diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 00000000..14112662 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,7 @@ +[run] +plugins = + django_coverage_plugin +omit = + venv/* + static/* + */migrations/* diff --git a/.dockerignore b/.dockerignore index e69de29b..4a59239f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -0,0 +1,6 @@ +venv +tmp +**/*/node_modules +pygeppetto-django +static/org.geppetto.frontend +service/docker diff --git a/.env b/.env index 31a14221..71043943 100644 --- a/.env +++ b/.env @@ -1,11 +1,29 @@ DEVELOPMENT=1 PRODUCTION=0 -DB_HOST='localhost' +DB_HOST=scidash-postgres DB_PORT=5432 -DB_NAME='scidash' +DB_NAME=scidash +DB_USER=scidash_admin +DB_PASSWORD=scidash_local_password -REDIS_URL='redis://' +STATIC_URL=/static/ +STATIC_DIR=static -STATIC_URL='/static/' -STATIC_DIR='static' +REDIS_URL=redis://scidash-redis:6379 + +# for localhost +# GEPPETTO_HOST=localhost +# for docker +GEPPETTO_HOST=scidash-virgo +GEPPETTO_PORT=8080 +GEPPETTO_SERVLET_URL=ws://${GEPPETTO_HOST}:${GEPPETTO_PORT}/org.geppetto.frontend/GeppettoServlet +GEPPETTO_BASE_URL=http://${GEPPETTO_HOST}:${GEPPETTO_PORT}/org.geppetto.frontend/geppetto + +BASE_PROJECT_FILES_HOST='http://172.21.0.1:8000/static/projects/' + +DEBUG=True +# ToDo: change in development sentry dsn +SENTRY_DSN="https://ccf48f7877bc4fb5a4cca74bdd193feb@sentry.io/1955654" # base of all errors +SENTRY_SYS_DSN="https://ccf48f7877bc4fb5a4cca74bdd193feb@sentry.io/1955654" # system/infra errors +SENTRY_APP_DSN="https://81d007aa741d46ada0741f1a4f1cfd1c@sentry.io/2069800" # application errors diff --git a/.flake8 b/.flake8 index 8d74efc7..1495397e 100644 --- a/.flake8 +++ b/.flake8 @@ -1,3 +1,3 @@ [flake8] max-line-length = 79 -exclude = .git,__pycache__,build,dist,.tox,*/migrations/*,env,__init__.py,settings.py,*/node_modules/*,routing.py +exclude = .git,__pycache__,build,dist,.tox,*/migrations/*,env,venv,__init__.py,settings.py,*/node_modules/*,routing.py diff --git a/.gitignore b/.gitignore index 8cca934a..e7e3462a 100644 --- a/.gitignore +++ b/.gitignore @@ -39,9 +39,8 @@ MANIFEST pip-log.txt pip-delete-this-directory.txt -# Unit test / coverage reports +# Unit tests / coverage reports htmlcov/ -.tox/ .coverage .coverage.* .cache @@ -120,3 +119,6 @@ static/models/* virgo-tomcat-server/* virgo-tomcat-server/work/* celerybeat.pid + +.devcontainer +tmp diff --git a/.project b/.project new file mode 100644 index 00000000..cdc3313c --- /dev/null +++ b/.project @@ -0,0 +1,11 @@ + + + scidash + + + + + + + + diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..0cf3ee88 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,20 @@ +language: node_js +sudo: required +node_js: + - "9" +install: + - npm install jest@24.8.0 puppeteer@1.17.0 jest-puppeteer@4.3.0 @babel/preset-env@7.4.5 url-join@4.0.0 @babel/core@7.4.5 +script: + - echo -e "python unit/integration testing running in geppetto-scidash travis" || true +after_success: + - echo $TRAVIS_BRANCH + - echo $TRAVIS_PULL_REQUEST + - echo $TRAVIS_PULL_REQUEST_BRANCH + - if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then + bash $TRAVIS_BUILD_DIR/service/scripts/trigger-travis.sh --branch $TRAVIS_PULL_REQUEST_BRANCH Metacell geppetto-scidash $TRAVIS_ACCESS_TOKEN ; + echo "I am in the first condition, so I am evaluating"; + else + bash $TRAVIS_BUILD_DIR/service/scripts/trigger-travis.sh --branch $TRAVIS_BRANCH Metacell geppetto-scidash $TRAVIS_ACCESS_TOKEN ; + echo "I am in the second condition"; + fi + - cat /tmp/travis-request-output* diff --git a/Makefile b/Makefile index 406b7bc2..4bffd9b7 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,10 @@ + +VENV:=$(shell if [ -d "venv" ]; then echo "venv/bin/"; else echo ""; fi) +PYTHON:=$(VENV)python3 +PIP:=$(VENV)/bin/pip +MANAGE:="manage.py" +MANAGECMD=$(PYTHON) $(MANAGE) + install: create-db install-sciunit-neuronunit install-frontend install-backend @echo "===========================" @echo "= Finished =" @@ -19,7 +26,7 @@ install-frontend: @echo "===========================" @echo "= Install frontend =" @echo "===========================" - @./service/scripts/install-frontend.sh + @./service/scripts/install-frontend.sh $(ARGS) codefresh-install-frontend: @echo "===========================" @@ -37,7 +44,7 @@ install-backend-with-env: @echo "===========================" @echo "= Install backend =" @echo "===========================" - @./service/scripts/install-backend.sh -v + @./service/scripts/install-backend.sh -v $(ARGS) create-db: @echo "===========================" @@ -63,19 +70,20 @@ run-staging: migrate django-migrate: migrations migrate migrations: - ./manage.py makemigrations + $(MANAGECMD) makemigrations migrate: - ./manage.py migrate + $(MANAGECMD) migrate superuser: - ./manage.py createsuperuser + $(MANAGECMD) createsuperuser run-django: - ./manage.py runserver + cp ./service/dotenv/dev_env .env + $(MANAGECMD) runserver --insecure 0.0.0.0:8000 run-django-staging: - python3.6 manage.py runserver --insecure 0.0.0.0:8000 + $(MANAGECMD) runserver --insecure 0.0.0.0:8000 run-frontend: cd static/org.geppetto.frontend/src/main/webapp/; npm run build-dev-noTest:watch; @@ -89,6 +97,23 @@ run-celery-beat: run-virgo-staging: /bin/bash /opt/virgo/bin/startup.sh +manage/%: + $(MANAGECMD) $* + +run-tests: run-django-tests + +run-django-tests: + $(MANAGECMD) test + +run-coverage: + coverage run $(MANAGE) test + +coverage-badge: run-coverage + coverage-badge -o coverage.svg -f + +coverage: run-coverage + coverage report -m + lint: flake8-lint isort-lint yapf-lint format: yapf-format isort-format @@ -140,3 +165,5 @@ push-scidash-db: @echo "= Push scidash db image =" @echo "===========================" @./service/scripts/push-image-scidash-db.sh +%: + @: diff --git a/README.md b/README.md index bffc5230..6be332e2 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +[![Build Status](https://img.shields.io/travis/MetaCell/scidash/master.svg?style=flat-square&label=master)](https://travis-ci.org/MetaCell/scidash) +[![Build Status](https://img.shields.io/travis/MetaCell/scidash/development.svg?style=flat-square&label=develop)](https://travis-ci.org/MetaCell/scidash) +[![Coverage Status](coverage.svg)](https://travis-ci.org/MetaCell/scidash)

SciDash logo

@@ -11,9 +14,57 @@ SciDash is a project that enables the reproducible execution and visualization o SciDash is a geppetto / django-based client-server web application. -## Installation +## Installation with Docker -We recommend you to use a Python 3 (*3.6 or newer at least*) virtual environment for the installation, so you can keep all the dependencies within that environment. +This installation procedure relies on the use of docker and docker-compose, if you don't have these already installed in your machine you can follow these [link 1](https://docs.docker.com/install/) and [link 2](https://docs.docker.com/compose/install/). + +In order to install scidash in your machine you will need to clone the scidash repository + +``` +git clone https://github.com/metacell/scidash.git +``` + +Then, we need to access the repository at the folder scidash/service/docker, for instance if you are using linux you can type in your terminal the below: + +``` +cd ./scidash/service/docker +``` + +Inside this folder you will find the 3 docker files needed to build and run scidash locally. +Running the 3 commands below we will build 3 docker images that we will re-use through our docker-compose.yml file in order to run scidash. You can now proceed with the 3 commands below to build the 3 images required (note, it might take roughly 1 hour to build all the 3 images and the time can vary depending on your internet connection speed since these steps will have to download other software from the web): + +``` +docker build -f Dockerfile-postgres -t metacell/scidash_db:my_local_tag . +docker build -f Dockerfile-virgo -t metacell/scidash_virgo:my_local_tag . +docker build -f Dockerfile-scidash -t metacell/scidash:my_local_tag . +``` + +Once the 3 images have been created we can now move to the deployment folder, on the same level of the current docker folder, for instance in linux we can run: + +``` +cd ../deployment +``` + +At this point we need to edit the docker-compose.yml with our favourite editor (vim obviously, unless you are one of those who use emacs, I am sorry for you) and replace the tag with the one used during the manual build. +If you did a copy paste of the commands, you will need to replace the tag latest with the my_local_tag string, for instance: + + image: metacell/scidash_db:latest + +will become: + + image: metacell/scidash_db:my_local_tag + +Once we finish to edit the file with the correct tag we are ready to run scidash, so sit down, relax and run: + +``` +docker-compose up -d +``` + +Wait 1-2 mins that docker compose will bring up all the service and enjoy Scidash! + +## Installation in my machine + +We recommend you to use a Python 3.6 virtual environment for the installation, so you can keep all the dependencies within that environment. **Dependencies** @@ -47,7 +98,25 @@ cp service/dotenv/env-docker .env source .env ``` -Just a reminder before going forward that this project requires at least a Python 3.6 version, if this requirement is not satisfied before proceeding further ensure you have Python 3.6 (or bigger) installed. +As a developer you may add the git pre-commit hook to you .git repo. Besides updating the coverage badge, this hook runs some more commands before committing your changes. To install the pre-commit hook copy the hook to your .git folder + +```shell script +cp service/hooks/pre-commit .git +chmod +x .git/hooks/pre-commit +``` + +You should install the requirements-dev.txt to use the coverage and more code testing tools + +```shell script +pip install -r requirements-dev.txt +``` + +To update the coverage badge manually run +```shell script +make coverage-badge +``` + +Just a reminder before going forward that this project requires a Python 3.6 version, if this requirement is not satisfied before proceeding further ensure you have Python 3.6 installed. #### ***Configure Database*** In order to configure the database you need the PostgreSQL server installed as per dependencies listed above, then you can proceed with the steps below that will need to be run as postgres user: @@ -63,7 +132,7 @@ sudo su postgres logout ``` -#### ***Backend and Fronend Installation*** +#### ***Backend and Frontend Installation*** Once done with the database configuration you can proceed with the backend (first) and the frontend (second) installation. First we start with the backend installation with the command below: ``` @@ -87,6 +156,7 @@ make run-dev Go to http://localhost:8000/ and enjoy! + ## Requirements to neuronunit test and model classes to work with scidash > Note: to save compatibility with uploaded results you'll be able to save classes which are not meet requirements, but there is no guarantee that they will work with application @@ -182,126 +252,8 @@ pq.UnitQuantity('megaohm', pq.ohm*1e6, symbol='Mohm') # custom unit {'v': pq.V, 'i': pq.pA} # mapping ``` -## Deployment - -For scidash test deployment there are configurations in deploy folder `$PROJECT_ROOT/service/kubernetes/scidash` - -What is what: +## Post install steps -`scidash-service.yaml` +For copying/cloning initial model instances and test instances please update the DEMO_USER_ID in the settings file +to point to the user (id) from where the models and test instances should be cloned. -This configuration describes kubernetes service ([what is service](https://kubernetes.io/docs/concepts/services-networking/service/)) for scidash deployment. - -Section with general information: - -```yaml -kind: Service -apiVersion: v1 -metadata: - name: scidash - namespace: scidash-testing - labels: - app: scidash -``` - -Section with port mappings and other important information: - -``` -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 8000 - selector: - app: scidash -``` - -This service in general is k8 resource with load balancer which provides access to the open ports from your pods ([what is pods](https://kubernetes.io/docs/concepts/workloads/pods/pod/)) - -`scidash-deployment.yaml` - -This file provides management for deploying (and updating) pod with containers (application container and redis container). - -To better understanding you can compare k8 pods with composition created by docker-compose. - -Section with general information: - -``` -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - labels: - app: scidash - name: scidash - namespace: scidash-testing -``` - -Start of actual specification for deployment: - -``` -spec: - replicas: 1 # Count of the similar pods that should by launched - selector: - matchLabels: - app: scidash - strategy: - rollingUpdate: - maxSurge: 50% - maxUnavailable: 50% - type: RollingUpdate -``` -Containers descriptions start here in template: - -``` - template: - metadata: - labels: - app: scidash - spec: - containers: - - - image: r.cfcr.io/tarelli/metacell/scidash:deployment - imagePullPolicy: Always - name: scidash - ports: - - containerPort: 8000 # Ports that should be exposed - protocol: TCP -``` - -Also example for environment description. And as you can see here it uses secrets ([what is secret](https://kubernetes.io/docs/concepts/configuration/secret/)) as a source for sensible data. - -``` - env: - - name: DB_USER - valueFrom: - secretKeyRef: - name: scidash-secret - key: DB_USER - - name: DB_PASSWORD - valueFrom: - secretKeyRef: - name: scidash-secret - key: DB_PASSWORD -``` -Every secret should be mounted as a volume - -``` - volumeMounts: - - name: scidash-secret - mountPath: /scidash-secret -``` - -And described in volumes section on the same level as containers: -``` - volumes: - - name: scidash-secret - secret: - secretName: scidash-secret -``` - -Also codefresh repository requires especial secret for pulling images: - -``` - imagePullSecrets: - - name: codefresh-generated-r.cfcr.io-cfcr-scidash-testing -``` diff --git a/coverage.svg b/coverage.svg new file mode 100644 index 00000000..d79e240d --- /dev/null +++ b/coverage.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + coverage + coverage + 65% + 65% + + diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 0a0203f5..00000000 --- a/docker-compose.yml +++ /dev/null @@ -1,16 +0,0 @@ -version: '2' - -services: - scidash-redis: - image: redis - scidash-postgres: - image: metacell/scidash-db - ports: - - 5432:5432 - scidash: - image: metacell/scidash:latest - ports: - - 80:8000 - depends_on: - - scidash-redis - - scidash-postgres diff --git a/requirements-dev.txt b/requirements-dev.txt index 1e835830..698c17b3 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,3 +1,7 @@ flake8 yapf isort +coverage +coverage-badge +django_coverage_plugin +pip-tools diff --git a/requirements.in b/requirements.in index 04185443..0f343887 100644 --- a/requirements.in +++ b/requirements.in @@ -1,16 +1,36 @@ -psycopg2 -django==1.11.7 -channels==2.1.2 +# Please upgrade pip to min v21, the default version v18 of py36 has package resolving issues +# e.g. when installing numba the py37 version of numpy will be installed and fails +django==1.11.29 +psycopg2-binary==2.8.6 +channels==2.3.1 djangorestframework==3.7.1 drf-writable-nested django-filter==1.1.0 -djangorestframework-jwt -django-extensions +django-timezone-field==3.1 +git+https://github.com/zsinnema/django-rest-framework-jwt@master +django-extensions==2.1.6 django-dotenv rest-framework-cache django-material -celery[redis] -django-celery-beat -django-celery-results +celery[redis]==4.2.2 +django-celery-beat==1.4.0 +django-celery-results==1.0.4 django-db-logger -git+git://github.com/ddelpiano/neuronunit@4.0.0#egg=neuronunit +neo==0.9.0 +elephant==0.10.0 +pynn==0.9.5 +Jinja2==2.11.3 +lmfit==1.0.2 +numpy==1.19.5 +numba==0.50.1 +git+https://github.com/scidash/neuronunit@metacell +git+https://github.com/scidash/sciunit@metacell +git+https://github.com/MetaCell/scidash-api.git@master +wheel +sentry-sdk +django-ckeditor==5.9.0 +django-admin-sortable2==0.7.5 +social-auth-app-django==4.0.0 # will be installed through install script install-backend +#git+git://github.com/scidash/python-quantities@master # waiting for this PR https://github.com/python-quantities/python-quantities/pull/186 to be merged +quantities==0.12.1 +llvmlite>=0.33.0.dev0,<0.34 diff --git a/requirements.txt b/requirements.txt index 813c6d41..5c7cc12b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,47 +1,170 @@ -# -# This file is autogenerated by pip-compile -# To update, run: -# -# pip-compile -# -amqp==2.4.2 # via kombu -asgiref==2.3.2 # via channels -async-timeout==3.0.1 # via asgiref -attrs==19.1.0 # via automat, twisted -autobahn==19.3.3 # via daphne -automat==0.7.0 # via twisted -billiard==3.5.0.5 # via celery -celery[redis]==4.2.2 -channels==2.1.2 -constantly==15.1.0 # via twisted -daphne==2.2.5 # via channels +airspeed==0.5.17 +amqp==2.6.1 +apipkg==1.5 +asgiref==3.3.4 +asteval==0.9.23 +async-generator==1.10 +attrs==21.2.0 +autobahn==21.2.1 +Automat==20.2.0 +backcall==0.2.0 +beautifulsoup4==4.9.3 +billiard==3.5.0.5 +bleach==3.3.0 +bokeh==2.3.2 +bs4==0.0.1 +cachetools==4.2.2 +celery==4.2.2 +Cerberus==1.3.4 +certifi==2021.5.30 +cffi==1.14.5 +channels==2.3.1 +chardet==4.0.0 +click==8.0.1 +cloudpickle==1.6.0 +constantly==15.1.0 +contextvars==2.4 +cryptography==3.4.7 +cycler==0.10.0 +daphne==2.5.0 +dask==2021.3.0 +deap==1.3.1 +decorator==5.0.9 +deepdiff==5.5.0 +defusedxml==0.7.1 +distributed==2021.3.0 +Django==1.11.29 +django-admin-sortable2==0.7.5 django-celery-beat==1.4.0 django-celery-results==1.0.4 -django-db-logger==0.1.7 +django-ckeditor==5.9.0 +django-db-logger==0.1.10 django-dotenv==1.4.2 django-extensions==2.1.6 django-filter==1.1.0 -django-material==1.5.2 -django-timezone-field==3.0 # via django-celery-beat -django==1.11.7 -djangorestframework-jwt==1.11.0 +django-js-asset==1.2.2 +django-material==1.9.0 +django-timezone-field==3.1 djangorestframework==3.7.1 -drf-writable-nested==0.5.1 -git+git://github.com/ddelpiano/neuronunit@4.0.0#egg=neuronunit -hyperlink==18.0.0 # via twisted -idna==2.8 # via hyperlink -incremental==17.5.0 # via twisted -kombu==4.3.0 # via celery -psycopg2==2.7.7 -pyhamcrest==1.9.0 # via twisted -pyjwt==1.7.1 # via djangorestframework-jwt -python-crontab==2.3.6 # via django-celery-beat -python-dateutil==2.8.0 # via python-crontab -pytz==2018.9 # via celery, django, django-timezone-field -redis==2.10.6 # via celery +git+https://github.com/zsinnema/django-rest-framework-jwt@master +dpath==2.0.1 +drf-writable-nested==0.6.3 +elephant==0.10.0 +enforce==0.3.4 +entrypoints==0.3 +execnet==1.8.1 +fsspec==2021.5.0 +future==0.18.2 +gitdb==4.0.7 +GitPython==3.1.17 +graphviz==0.16 +HeapDict==1.0.1 +hyperlink==21.0.0 +idna==2.10 +igor==0.3 +immutables==0.15 +importlib-metadata==3.10.1 +incremental==21.3.0 +ipykernel==5.5.5 +ipython==7.16.1 +ipython-genutils==0.2.0 +jedi==0.18.0 +Jinja2==2.11.3 +jsonpickle==2.0.0 +jsonschema==3.2.0 +jupyter-client==6.1.12 +jupyter-core==4.7.1 +jupyterlab-pygments==0.1.2 +kiwisolver==1.3.1 +kombu==4.3.0 +lazyarray==0.4.0 +libNeuroML==0.2.55 +llvmlite==0.36.0 +lmfit==1.0.2 +locket==0.2.1 +lxml==4.6.3 +MarkupSafe==2.0.1 +matplotlib==3.3.4 +mistune==0.8.4 +msgpack==1.0.2 +nbclient==0.5.3 +nbconvert==6.0.7 +nbformat==5.1.3 +neo==0.9.0 +nest-asyncio==1.5.1 +neuromllite==0.3.2 +#neuronunit==0.19 +git+https://github.com/scidash/neuronunit@master +#numba==0.53.1 +numba==0.50.1 +numpy==1.19.5 +oauthlib==3.1.1 +ordered-set==4.0.2 +packaging==20.9 +pandas==1.1.5 +pandocfilters==1.4.3 +parso==0.8.2 +partd==1.2.0 +pexpect==4.8.0 +pickleshare==0.7.5 +Pillow==8.2.0 +prompt-toolkit==3.0.18 +psutil==5.8.0 +psycopg2-binary==2.8.6 +ptyprocess==0.7.0 +pyasn1==0.4.8 +pyasn1-modules==0.2.8 +pycparser==2.20 +-e git+https://github.com/MetaCell/pygeppetto-django.git@c2fff0fad0c9b941b7eb7983038c0c5f1b2f83a9#egg=pygeppetto_django +Pygments==2.9.0 +PyJWT==2.1.0 +PyLEMS==0.5.2 +pylmeasure==0.2.0 +pyNeuroML==0.5.11 +PyNN==0.9.5 +pyOpenSSL==20.0.1 +pyparsing==2.4.7 +pyrsistent==0.17.3 +python-crontab==2.5.1 +python-dateutil==2.8.1 +python3-openid==3.2.0 +pytz==2021.1 +PyYAML==5.4.1 +pyzmq==22.1.0 +quantities==0.12.4 +quantities-scidash==0.12.4.3 +redis==2.10.6 +requests==2.25.1 +requests-oauthlib==1.3.0 rest-framework-cache==0.1 -six==1.12.0 # via autobahn, automat, django-extensions, pyhamcrest, python-dateutil, txaio -twisted==18.9.0 # via daphne -txaio==18.8.1 # via autobahn -vine==1.3.0 # via amqp -zope.interface==4.6.0 # via twisted +scidash-api==1.2.0 +scipy==1.5.4 +sciunit @ git+https://github.com/scidash/sciunit@42f7aa1dba657f0cfb7d2b96efd5dbb2a6493c72 +sentry-sdk==1.1.0 +service-identity==21.1.0 +six==1.16.0 +smmap==4.0.0 +social-auth-app-django==4.0.0 +social-auth-core==4.1.0 +sortedcontainers==2.4.0 +soupsieve==2.2.1 +tblib==1.7.0 +tqdm==4.64.1 +testpath==0.5.0 +toolz==0.11.1 +tornado==6.1 +traitlets==4.3.3 +Twisted==21.2.0 +txaio==21.2.1 +typing-extensions==3.10.0.0 +uncertainties==3.1.5 +urllib3==1.26.5 +validators==0.18.2 +vine==1.3.0 +wcwidth==0.2.5 +webencodings==0.5.1 +websocket-client==1.0.1 +wrapt==1.12.1 +zict==2.0.0 +zipp==3.4.1 +zope.interface==5.4.0 diff --git a/scidash/account/api/views.py b/scidash/account/api/views.py index 2a012c85..abc6fc74 100644 --- a/scidash/account/api/views.py +++ b/scidash/account/api/views.py @@ -22,7 +22,16 @@ def get_object(self): class CheckIsLoggedView(views.APIView): def get(self, request, format=None): - return response.Response( {'is_logged': self.request.user.is_authenticated()} ) + + +class SetShowInstructions(views.APIView): + def post(self, request, format=None): + show = request.data.get('show', None) + if show is not None: + user = ScidashUser.objects.get(id=request.user.id) + user.show_instructions = show + user.save() + return response.Response() diff --git a/scidash/account/static/css/main.css b/scidash/account/static/css/main.css index ab45a818..6e67671f 100644 --- a/scidash/account/static/css/main.css +++ b/scidash/account/static/css/main.css @@ -68,10 +68,9 @@ body { .login-container { position: fixed !important; - top: 50%; + top: 40%; left: 50%; transform: translate(-50%, -50%) !important; - width: 250px; } .password-reset-container { @@ -96,4 +95,15 @@ body { left: 50%; transform: translate(-50%, -50%) !important; width: 250px; +} + +.btn.icon-btn { + float: left; + letter-spacing: 0px; + margin-top: 16px; + margin-right: 16px; + width: 208px; + display: flex; + justify-content: center; + align-items: center; } \ No newline at end of file diff --git a/scidash/account/templates/registration/base-template.html b/scidash/account/templates/registration/base-template.html index 4b921a0c..3b10fef0 100644 --- a/scidash/account/templates/registration/base-template.html +++ b/scidash/account/templates/registration/base-template.html @@ -3,6 +3,17 @@ + + + + + +