Skip to content

Commit

Permalink
Merge branch 'series-4.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
dyakhnov committed Nov 13, 2020
2 parents 87b9650 + f93d291 commit 608ef01
Show file tree
Hide file tree
Showing 34 changed files with 3,822 additions and 2,915 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ tardis/apps/*
!tardis/apps/sftp
!tardis/apps/social_auth
!tardis/apps/search

!tardis/apps/eventlog
2 changes: 2 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ disable=C0103,
C1001,
E0012,
E1101,
E5142,
I0011,
R0201,
R0205,
Expand Down Expand Up @@ -120,6 +121,7 @@ disable=C0103,
W0622,
W0702,
W0703,
W0707,
W0710,
W1201,
W1202,
Expand Down
8 changes: 8 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Releases
========

4.4.0
-----
* User activity logging app
* Updated various Python and JS libraries
* Fix to Google Chrome installation
* Bugfixes
- add SSH key

4.3.0
-----
* Updated various Python and JS libraries
Expand Down
6,201 changes: 3,387 additions & 2,814 deletions package-lock.json

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
"url": "git+https://github.com/mytardis/mytardis.git"
},
"dependencies": {
"@babel/core": "^7.10.3",
"@babel/plugin-proposal-class-properties": "^7.10.1",
"@babel/preset-env": "^7.10.3",
"@babel/preset-react": "^7.10.1",
"@babel/core": "^7.11.6",
"@babel/plugin-proposal-class-properties": "^7.10.4",
"@babel/preset-env": "^7.11.0",
"@babel/preset-react": "^7.10.4",
"@emotion/core": "^10.0.27",
"@testing-library/react": "latest",
"@testing-library/react": "11.0.4",
"angular": "1.8.0",
"angular-resource": "1.8.0",
"babel-loader": "^8.0.6",
"blueimp-file-upload": "^9.31.0",
"bootstrap": "^4.5.0",
"bootstrap": "^4.5.2",
"bootstrap-3-typeahead": "^4.0.2",
"clean-webpack-plugin": "^1.0.1",
"clipboard": "^2.0.4",
Expand All @@ -29,23 +29,23 @@
"filesize": "^6.0.1",
"font-awesome": "^4.7.0",
"glob": "^7.1.4",
"html-webpack-plugin": "^4.3.0",
"html-webpack-plugin": "^4.4.1",
"imports-loader": "^0.8.0",
"jquery": "^3.5.1",
"jquery-ui": "^1.12.1",
"jquery-ui-dist": "^1.12.1",
"js-cookie": "^2.2.1",
"less": "^3.11.3",
"less-loader": "^6.2.0",
"mini-css-extract-plugin": "^0.9.0",
"less": "^3.12.2",
"less-loader": "^7.0.1",
"mini-css-extract-plugin": "^0.11.2",
"minimatch": "^3.0.2",
"moment": "^2.27.0",
"moment": "^2.29.0",
"pluralize": "^8.0.0",
"prop-types": "^15.7.2",
"query-string": "^6.13.1",
"react": "^16.13.0",
"react-beautiful-dnd": "^13.0.0",
"react-bootstrap": "^1.0.0-beta.16",
"react-bootstrap": "^1.3.0",
"react-bootstrap-typeahead": "^4.0.0-alpha.10",
"react-datetime": "^2.16.3",
"react-dom": "^16.13.0",
Expand All @@ -55,37 +55,37 @@
"regenerator-runtime": "^0.13.3",
"sprintf-js": "^1.1.2",
"style-loader": "^1.2.1",
"terser-webpack-plugin": "^3.0.6",
"underscore": "^1.10.2",
"terser-webpack-plugin": "^3.1.0",
"underscore": "^1.11.0",
"underscore.string": "^3.3.5",
"url-loader": "^4.1.0",
"webpack": "^4.43.0",
"webpack": "^4.44.2",
"webpack-bundle-tracker": "^0.4.3",
"webpack-cli": "^3.3.12"
},
"devDependencies": {
"babel-eslint": "^10.0.3",
"bootlint": "^1.1.0",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.14.0",
"enzyme-adapter-react-16": "^1.15.5",
"eslint": "^5.16.0",
"eslint-config-airbnb": "^17.1.1",
"eslint-config-angular": "^0.5.0",
"eslint-plugin-angular": "^4.0.1",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-react": "^7.20.3",
"eslint-plugin-react": "^7.20.6",
"grunt": "^1.0.4",
"grunt-cli": "^1.3.2",
"grunt-contrib-qunit": "^4.0.0",
"grunt-webpack": "^3.1.3",
"identity-obj-proxy": "^3.0.0",
"jest": "^26.1.0",
"jest": "^26.4.2",
"jest-fetch-mock": "^3.0.3",
"jquery-mockjax": "^2.5.1",
"jquery-mockjax": "^2.6.0",
"js-yaml": "^3.14.0",
"jscpd": "^3.2.1",
"qunit": "^2.10.0",
"jscpd": "^3.3.19",
"qunit": "^2.11.3",
"react-test-renderer": "^16.10.2"
},
"scripts": {
Expand Down
23 changes: 11 additions & 12 deletions requirements-base.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
Django==2.2.14 # pyup: >=2.2,<3
Wand==0.6.2
amqp==2.6.0
bleach==3.1.5
boto3==1.14.46
celery==4.4.6
django-extensions==3.0.3
Django==2.2.17 # pyup: >=2.2,<3
Wand==0.6.3
bleach==3.2.1
celery==4.4.7
boto3==1.16.10
django-extensions==3.0.9
django-elasticsearch-dsl==7.1.1
git+https://github.com/mytardis/django-form-utils.git@django-1.11-upgrade#egg=django-form-utils
django-jstemplate==1.3.8
Expand All @@ -14,23 +13,23 @@ git+https://github.com/mytardis/django-tastypie-swagger.git@mytardis-dj2.0#egg=d
django-user-agents==0.4.0
django-webpack-loader==0.7.0
django-widget-tweaks==1.4.8
django-storages==1.9.1
django-storages==1.10.1
gunicorn==20.0.4
gevent==20.6.2
gevent==20.9.0
html2text==2020.1.16
html5lib==1.1
isodate==0.6.0
pyjwt==1.7.1
kombu==4.6.11
lxml==4.5.2
paramiko==2.7.1
lxml==4.6.1
paramiko==2.7.2
pillow==7.2.0
pyoai==2.5.0
pystache==0.5.4
python-dateutil==2.8.1
# python-magic
git+https://github.com/mytardis/python-magic.git#egg=python-magic
pytz==2020.1
pytz==2020.4
requests==2.24.0
uritemplate==3.0.1
django-graphql-jwt==0.3.1
2 changes: 1 addition & 1 deletion requirements-docs.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Sphinx==3.2.1
Sphinx==3.3.0
sphinx-rtd-theme==0.5.0
2 changes: 1 addition & 1 deletion requirements-postgres.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
psycopg2-binary==2.8.5
psycopg2-binary==2.8.6
8 changes: 4 additions & 4 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
behave_django==1.4.0
coverage==5.2
coverage==5.3
django-coverage-plugin==1.8.0
django-nose==1.4.6
django-nose==1.4.7
flexmock==0.10.4
nose==1.3.7
pylint==2.5.3
pylint-django==2.1.0
pylint==2.6.0
pylint-django==2.3.0
selenium==3.141.0
Empty file.
13 changes: 13 additions & 0 deletions tardis/apps/eventlog/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from django.contrib import admin

from .models import Log


class LogAdmin(admin.ModelAdmin):
raw_id_fields = ["user"]
list_filter = ["action__name", "timestamp"]
list_display = ["timestamp", "user", "action", "extra"]
search_fields = ["user__username", "user__email", "extra"]


admin.site.register(Log, LogAdmin)
2 changes: 2 additions & 0 deletions tardis/apps/eventlog/default_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ENABLE_EVENTLOG = False
EVENTLOG_ACTIONS = []
33 changes: 33 additions & 0 deletions tardis/apps/eventlog/fields.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import json

from django.db.models import Field


class JSONField(Field):
"""
Simple class to make `JSONField` available to sqlite backends.
"""

def db_type(self, connection):
return "text"

def from_db_value(self, value, expression, connection):
if value is not None:
return self.to_python(value)
return value

def to_python(self, value):
if value is not None:
try:
return json.loads(value)
except (TypeError, ValueError):
return value
return value

def get_prep_value(self, value):
if value is not None:
return str(json.dumps(value))
return value

def value_to_string(self, obj):
return self.value_from_object(obj)
48 changes: 48 additions & 0 deletions tardis/apps/eventlog/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Generated by Django 2.2.14 on 2020-07-18 06:27

from django.conf import settings
from django.db import migrations, models
import django.utils.timezone

from django.core.serializers.json import DjangoJSONEncoder

# pylint: disable=C0412
if "sqlite" in settings.DATABASES["default"]["ENGINE"]:
from ..fields import JSONField
elif "mysql" in settings.DATABASES["default"]["ENGINE"]:
# pylint: disable=E0401
from django_mysql.models import JSONField
else:
from django.contrib.postgres.fields import JSONField


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('contenttypes', '0002_remove_content_type_name'),
]

operations = [
migrations.CreateModel(
name='Action',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=64)),
],
),
migrations.CreateModel(
name='Log',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('timestamp', models.DateTimeField(db_index=True, default=django.utils.timezone.now)),
('action', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='eventlog.Action')),
('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
('content_type', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='contenttypes.ContentType')),
('object_id', models.PositiveIntegerField(null=True)),
('extra', JSONField(verbose_name=DjangoJSONEncoder)),
],
),
]
Empty file.
36 changes: 36 additions & 0 deletions tardis/apps/eventlog/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from django.conf import settings
from django.db import models
from django.utils import timezone
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User
from django.core.serializers.json import DjangoJSONEncoder

# pylint: disable=C0412
if "sqlite" in settings.DATABASES["default"]["ENGINE"]:
from .fields import JSONField
elif "mysql" in settings.DATABASES["default"]["ENGINE"]:
# pylint: disable=E0401
from django_mysql.models import JSONField
else:
from django.contrib.postgres.fields import JSONField


class Action(models.Model):
name = models.CharField(max_length=64)

def __str__(self):
return self.name


class Log(models.Model):
class Meta:
ordering = ["-timestamp"]

timestamp = models.DateTimeField(null=False, default=timezone.now, db_index=True)
action = models.ForeignKey(Action, on_delete=models.CASCADE)
user = models.ForeignKey(User, null=True, on_delete=models.SET_NULL)
content_type = models.ForeignKey(ContentType, null=True, on_delete=models.SET_NULL)
object_id = models.PositiveIntegerField(null=True)
obj = GenericForeignKey("content_type", "object_id")
extra = JSONField(DjangoJSONEncoder)
4 changes: 4 additions & 0 deletions tardis/apps/eventlog/signals.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import django.dispatch


event_logged = django.dispatch.Signal(providing_args=["event"])
1 change: 1 addition & 0 deletions tardis/apps/eventlog/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
urlpatterns = []

0 comments on commit 608ef01

Please sign in to comment.