From d06959dc06641176d3d0aa1d2d20d16b2f1346e8 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 8 Sep 2021 18:05:01 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Implement=20Notebook=20app=20(#65)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ✨ Start notebooks app * 🔧 Fix nullable fields for notebooks * 🔧 Display user-friendly name for `Notebook`s * 🔧 Allow filtering in the notebook admin page * 🗒 Improve README * 🗒 Improve README again * ⬆ Add bluelib to the dependencies of the frontend * 🧹 Prepare a good frontend base for development * ✨ Port and improve useStorageState Original: https://github.com/pds-nest/nest/blob/main/nest_frontend/hooks/useLocalStorageState.js * 🧹 Remove React logo * ⬆ Add `docker` to the dependencies * ⬆ Add `axios` to the dependencies * 🔨 Mark `src` as sources root * ✨ Add API routes to view Notebooks * 🔧 Use a router for the `by-project` route * 🐛 Fix deletion failing on `SophonViewSet` * 🔧 Abstract notebook methods * ✨ Create a base docker client * 🚧 Proof of concept for notebook starter * 📔 Document the contents of the Django apps * 🚧 Incomplete container implementation * 🚧 Working container implementation * 💥 Leftovers from an experiment * ✨ Correct implementation of the proxy configuration (Apache config file is still missing) * 💥 Improve code * 💥 Improve more things * 🔧 Remove duplicated `/project` in project app urls * ✨ Add basic Apache proxy config file * 🔧 User should have sudo access on the notebook * ✨ Implement the Internet access field (currently ignored) * 🧹 Cleanup code --- .gitignore | 1 + .idea/inspectionProfiles/Project_Default.xml | 1 + .idea/misc.xml | 2 +- .../Start_sophon_backend.xml | 2 + README.md | 4 +- backend/poetry.lock | 61 +- backend/pyproject.toml | 1 + backend/sophon/core/__init__.py | 3 + backend/sophon/core/views.py | 2 +- backend/sophon/notebooks/__init__.py | 21 + backend/sophon/notebooks/admin.py | 61 ++ backend/sophon/notebooks/apache.conf | 20 + backend/sophon/notebooks/apache.py | 69 +++ backend/sophon/notebooks/apps.py | 6 + backend/sophon/notebooks/docker.py | 68 +++ backend/sophon/notebooks/jupyter.py | 8 + .../notebooks/migrations/0001_initial.py | 50 ++ .../migrations/0002_auto_20210901_1527.py | 43 ++ .../migrations/0003_auto_20210905_0348.py | 50 ++ .../migrations/0004_auto_20210908_1108.py | 33 ++ .../migrations/0005_alter_notebook_port.py | 19 + .../migrations/0006_auto_20210908_1554.py | 26 + .../0007_alter_notebook_internet_access.py | 19 + .../sophon/notebooks/migrations/__init__.py | 0 backend/sophon/notebooks/models.py | 545 ++++++++++++++++++ backend/sophon/notebooks/tests.py | 1 + backend/sophon/notebooks/urls.py | 16 + backend/sophon/notebooks/views.py | 98 ++++ backend/sophon/projects/__init__.py | 7 + backend/sophon/projects/urls.py | 2 +- backend/sophon/settings.py | 8 + backend/sophon/urls.py | 1 + frontend/Frontend (React).iml | 4 +- frontend/README.md | 46 -- frontend/package.json | 2 + frontend/public/index.html | 61 +- frontend/public/manifest.json | 46 +- frontend/src/App.css | 38 -- frontend/src/App.test.tsx | 8 +- frontend/src/App.tsx | 37 +- frontend/src/hooks/useStorageState.ts | 72 +++ frontend/src/index.css | 18 +- frontend/src/index.tsx | 8 +- frontend/src/logo.svg | 1 - frontend/src/reportWebVitals.ts | 20 +- frontend/src/setupTests.ts | 2 +- frontend/tsconfig.json | 48 +- frontend/yarn.lock | 46 +- 48 files changed, 1474 insertions(+), 231 deletions(-) create mode 100644 .gitignore create mode 100644 backend/sophon/notebooks/__init__.py create mode 100644 backend/sophon/notebooks/admin.py create mode 100644 backend/sophon/notebooks/apache.conf create mode 100644 backend/sophon/notebooks/apache.py create mode 100644 backend/sophon/notebooks/apps.py create mode 100644 backend/sophon/notebooks/docker.py create mode 100644 backend/sophon/notebooks/jupyter.py create mode 100644 backend/sophon/notebooks/migrations/0001_initial.py create mode 100644 backend/sophon/notebooks/migrations/0002_auto_20210901_1527.py create mode 100644 backend/sophon/notebooks/migrations/0003_auto_20210905_0348.py create mode 100644 backend/sophon/notebooks/migrations/0004_auto_20210908_1108.py create mode 100644 backend/sophon/notebooks/migrations/0005_alter_notebook_port.py create mode 100644 backend/sophon/notebooks/migrations/0006_auto_20210908_1554.py create mode 100644 backend/sophon/notebooks/migrations/0007_alter_notebook_internet_access.py create mode 100644 backend/sophon/notebooks/migrations/__init__.py create mode 100644 backend/sophon/notebooks/models.py create mode 100644 backend/sophon/notebooks/tests.py create mode 100644 backend/sophon/notebooks/urls.py create mode 100644 backend/sophon/notebooks/views.py delete mode 100644 frontend/README.md delete mode 100644 frontend/src/App.css create mode 100644 frontend/src/hooks/useStorageState.ts delete mode 100644 frontend/src/logo.svg diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..726a419 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +proxy.dbm diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 68cfe01..4ce8214 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -1,6 +1,7 @@