From 48a2d5463bc929eeafbdecfc476a0d871ca52f47 Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Fri, 20 Mar 2020 12:00:37 +0100 Subject: [PATCH 1/6] collect static files at the first run --- development.sh | 1 + run.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/development.sh b/development.sh index 8977e12..7dc52f5 100755 --- a/development.sh +++ b/development.sh @@ -5,6 +5,7 @@ if [ -f ./.second_run ]; then python manage.py makemigrations python manage.py migrate else + python manage.py collectstatic --noinput python manage.py makemigrations backups python manage.py makemigrations computers python manage.py makemigrations core diff --git a/run.sh b/run.sh index 80e923c..56a20ca 100755 --- a/run.sh +++ b/run.sh @@ -5,6 +5,7 @@ if [ -f ./.second_run ]; then python manage.py makemigrations python manage.py migrate else + python manage.py collectstatic --noinput python manage.py makemigrations backups python manage.py makemigrations computers python manage.py makemigrations core From 7ad09c6977785309b574d57be7e110d6bc70b46d Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Wed, 25 Mar 2020 09:33:05 +0100 Subject: [PATCH 2/6] extend the tasks --- docs/notes.org | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/notes.org b/docs/notes.org index 9b93f61..8ea3d4b 100644 --- a/docs/notes.org +++ b/docs/notes.org @@ -10,7 +10,7 @@ - Customer :: A customer which owns some of the devices in the inventory tool and might have access to only the information related to the devices he owns. -* TODO Must Have [0/3] +* TODO Must Have [0/5] ** TODO Views [0/4] *** TODO ComputerDetailView [0/1] **** TODO add links to add a relation if it is none @@ -108,6 +108,18 @@ reason why I need this. If so it increases the used licenses counter. Maybe with this: - https://stackoverflow.com/questions/23059088/manytomany-field-check-if-relation-exists +** TODO Computer [0/1] +*** NEXT the computer is missing a GPU + +CAD computers often have sppecial graphics cards which we should be able to +track. + +** TODO NETs [0/1] +*** NEXT the IP needs to be able to be null + +Currently it's always required however when a device is in DHCP mode we can't +know the IP for sure. + * TODO Nice to Have [0/9] *** TODO allow technicians to add custom fields From 8310a1569a02dbb6664dbbe3c2e4a21aa8906d5f Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Mon, 20 Apr 2020 15:22:48 +0200 Subject: [PATCH 3/6] correct the static files setup --- .gitignore | 3 +-- {network_inventory => core}/static/core/.versions | 0 {network_inventory => core}/static/core/css/bootstrap-grid.css | 0 .../static/core/css/bootstrap-grid.css.map | 0 .../static/core/css/bootstrap-grid.min.css | 0 .../static/core/css/bootstrap-grid.min.css.map | 0 .../static/core/css/bootstrap-reboot.css | 0 .../static/core/css/bootstrap-reboot.css.map | 0 .../static/core/css/bootstrap-reboot.min.css | 0 .../static/core/css/bootstrap-reboot.min.css.map | 0 {network_inventory => core}/static/core/css/bootstrap.css | 0 {network_inventory => core}/static/core/css/bootstrap.css.map | 0 {network_inventory => core}/static/core/css/bootstrap.min.css | 0 .../static/core/css/bootstrap.min.css.map | 0 {network_inventory => core}/static/core/js/bootstrap.bundle.js | 0 .../static/core/js/bootstrap.bundle.js.map | 0 .../static/core/js/bootstrap.bundle.min.js | 0 .../static/core/js/bootstrap.bundle.min.js.map | 0 {network_inventory => core}/static/core/js/bootstrap.js | 0 {network_inventory => core}/static/core/js/bootstrap.js.map | 0 {network_inventory => core}/static/core/js/bootstrap.min.js | 0 .../static/core/js/bootstrap.min.js.map | 0 {network_inventory => core}/static/core/js/jquery.slim.min.js | 0 {network_inventory => core}/static/core/js/popper.min.js | 0 network_inventory/settings/base.py | 2 +- 25 files changed, 2 insertions(+), 3 deletions(-) rename {network_inventory => core}/static/core/.versions (100%) rename {network_inventory => core}/static/core/css/bootstrap-grid.css (100%) rename {network_inventory => core}/static/core/css/bootstrap-grid.css.map (100%) rename {network_inventory => core}/static/core/css/bootstrap-grid.min.css (100%) rename {network_inventory => core}/static/core/css/bootstrap-grid.min.css.map (100%) rename {network_inventory => core}/static/core/css/bootstrap-reboot.css (100%) rename {network_inventory => core}/static/core/css/bootstrap-reboot.css.map (100%) rename {network_inventory => core}/static/core/css/bootstrap-reboot.min.css (100%) rename {network_inventory => core}/static/core/css/bootstrap-reboot.min.css.map (100%) rename {network_inventory => core}/static/core/css/bootstrap.css (100%) rename {network_inventory => core}/static/core/css/bootstrap.css.map (100%) rename {network_inventory => core}/static/core/css/bootstrap.min.css (100%) rename {network_inventory => core}/static/core/css/bootstrap.min.css.map (100%) rename {network_inventory => core}/static/core/js/bootstrap.bundle.js (100%) rename {network_inventory => core}/static/core/js/bootstrap.bundle.js.map (100%) rename {network_inventory => core}/static/core/js/bootstrap.bundle.min.js (100%) rename {network_inventory => core}/static/core/js/bootstrap.bundle.min.js.map (100%) rename {network_inventory => core}/static/core/js/bootstrap.js (100%) rename {network_inventory => core}/static/core/js/bootstrap.js.map (100%) rename {network_inventory => core}/static/core/js/bootstrap.min.js (100%) rename {network_inventory => core}/static/core/js/bootstrap.min.js.map (100%) rename {network_inventory => core}/static/core/js/jquery.slim.min.js (100%) rename {network_inventory => core}/static/core/js/popper.min.js (100%) diff --git a/.gitignore b/.gitignore index 2321bf3..c344294 100644 --- a/.gitignore +++ b/.gitignore @@ -174,5 +174,4 @@ migrations/ htmlcov/ .second_run -network_inventory/static/ -!network_inventory/static/core +/static diff --git a/network_inventory/static/core/.versions b/core/static/core/.versions similarity index 100% rename from network_inventory/static/core/.versions rename to core/static/core/.versions diff --git a/network_inventory/static/core/css/bootstrap-grid.css b/core/static/core/css/bootstrap-grid.css similarity index 100% rename from network_inventory/static/core/css/bootstrap-grid.css rename to core/static/core/css/bootstrap-grid.css diff --git a/network_inventory/static/core/css/bootstrap-grid.css.map b/core/static/core/css/bootstrap-grid.css.map similarity index 100% rename from network_inventory/static/core/css/bootstrap-grid.css.map rename to core/static/core/css/bootstrap-grid.css.map diff --git a/network_inventory/static/core/css/bootstrap-grid.min.css b/core/static/core/css/bootstrap-grid.min.css similarity index 100% rename from network_inventory/static/core/css/bootstrap-grid.min.css rename to core/static/core/css/bootstrap-grid.min.css diff --git a/network_inventory/static/core/css/bootstrap-grid.min.css.map b/core/static/core/css/bootstrap-grid.min.css.map similarity index 100% rename from network_inventory/static/core/css/bootstrap-grid.min.css.map rename to core/static/core/css/bootstrap-grid.min.css.map diff --git a/network_inventory/static/core/css/bootstrap-reboot.css b/core/static/core/css/bootstrap-reboot.css similarity index 100% rename from network_inventory/static/core/css/bootstrap-reboot.css rename to core/static/core/css/bootstrap-reboot.css diff --git a/network_inventory/static/core/css/bootstrap-reboot.css.map b/core/static/core/css/bootstrap-reboot.css.map similarity index 100% rename from network_inventory/static/core/css/bootstrap-reboot.css.map rename to core/static/core/css/bootstrap-reboot.css.map diff --git a/network_inventory/static/core/css/bootstrap-reboot.min.css b/core/static/core/css/bootstrap-reboot.min.css similarity index 100% rename from network_inventory/static/core/css/bootstrap-reboot.min.css rename to core/static/core/css/bootstrap-reboot.min.css diff --git a/network_inventory/static/core/css/bootstrap-reboot.min.css.map b/core/static/core/css/bootstrap-reboot.min.css.map similarity index 100% rename from network_inventory/static/core/css/bootstrap-reboot.min.css.map rename to core/static/core/css/bootstrap-reboot.min.css.map diff --git a/network_inventory/static/core/css/bootstrap.css b/core/static/core/css/bootstrap.css similarity index 100% rename from network_inventory/static/core/css/bootstrap.css rename to core/static/core/css/bootstrap.css diff --git a/network_inventory/static/core/css/bootstrap.css.map b/core/static/core/css/bootstrap.css.map similarity index 100% rename from network_inventory/static/core/css/bootstrap.css.map rename to core/static/core/css/bootstrap.css.map diff --git a/network_inventory/static/core/css/bootstrap.min.css b/core/static/core/css/bootstrap.min.css similarity index 100% rename from network_inventory/static/core/css/bootstrap.min.css rename to core/static/core/css/bootstrap.min.css diff --git a/network_inventory/static/core/css/bootstrap.min.css.map b/core/static/core/css/bootstrap.min.css.map similarity index 100% rename from network_inventory/static/core/css/bootstrap.min.css.map rename to core/static/core/css/bootstrap.min.css.map diff --git a/network_inventory/static/core/js/bootstrap.bundle.js b/core/static/core/js/bootstrap.bundle.js similarity index 100% rename from network_inventory/static/core/js/bootstrap.bundle.js rename to core/static/core/js/bootstrap.bundle.js diff --git a/network_inventory/static/core/js/bootstrap.bundle.js.map b/core/static/core/js/bootstrap.bundle.js.map similarity index 100% rename from network_inventory/static/core/js/bootstrap.bundle.js.map rename to core/static/core/js/bootstrap.bundle.js.map diff --git a/network_inventory/static/core/js/bootstrap.bundle.min.js b/core/static/core/js/bootstrap.bundle.min.js similarity index 100% rename from network_inventory/static/core/js/bootstrap.bundle.min.js rename to core/static/core/js/bootstrap.bundle.min.js diff --git a/network_inventory/static/core/js/bootstrap.bundle.min.js.map b/core/static/core/js/bootstrap.bundle.min.js.map similarity index 100% rename from network_inventory/static/core/js/bootstrap.bundle.min.js.map rename to core/static/core/js/bootstrap.bundle.min.js.map diff --git a/network_inventory/static/core/js/bootstrap.js b/core/static/core/js/bootstrap.js similarity index 100% rename from network_inventory/static/core/js/bootstrap.js rename to core/static/core/js/bootstrap.js diff --git a/network_inventory/static/core/js/bootstrap.js.map b/core/static/core/js/bootstrap.js.map similarity index 100% rename from network_inventory/static/core/js/bootstrap.js.map rename to core/static/core/js/bootstrap.js.map diff --git a/network_inventory/static/core/js/bootstrap.min.js b/core/static/core/js/bootstrap.min.js similarity index 100% rename from network_inventory/static/core/js/bootstrap.min.js rename to core/static/core/js/bootstrap.min.js diff --git a/network_inventory/static/core/js/bootstrap.min.js.map b/core/static/core/js/bootstrap.min.js.map similarity index 100% rename from network_inventory/static/core/js/bootstrap.min.js.map rename to core/static/core/js/bootstrap.min.js.map diff --git a/network_inventory/static/core/js/jquery.slim.min.js b/core/static/core/js/jquery.slim.min.js similarity index 100% rename from network_inventory/static/core/js/jquery.slim.min.js rename to core/static/core/js/jquery.slim.min.js diff --git a/network_inventory/static/core/js/popper.min.js b/core/static/core/js/popper.min.js similarity index 100% rename from network_inventory/static/core/js/popper.min.js rename to core/static/core/js/popper.min.js diff --git a/network_inventory/settings/base.py b/network_inventory/settings/base.py index 6c9cdb6..bb0f596 100644 --- a/network_inventory/settings/base.py +++ b/network_inventory/settings/base.py @@ -125,7 +125,7 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.0/howto/static-files/ STATIC_URL = '/static/' -STATIC_ROOT = os.path.join(BASE_DIR, "static") +STATIC_ROOT = os.path.join(BASE_DIR, "..", "static") DJANGO_TABLES2_TEMPLATE = "django_tables2/bootstrap4.html" CRISPY_TEMPLATE_PACK = 'bootstrap4' From 86230256a859c516e0e20707a9ab21ff1e81fba0 Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Mon, 20 Apr 2020 15:53:17 +0200 Subject: [PATCH 4/6] add `make testlocal` to the Makefile This command allows to quickly run all tests without generating a coverage report. Just the quickest way to run all tests. --- Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Makefile b/Makefile index 422962d..a393969 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,13 @@ local: pip3 install -r requirements/local.txt; \ ) +testlocal: + ( \ + source venv/bin/activate; \ + pytest -n 6 --ds=network_inventory.settings.local --nomigrations; \ + ) + + clean: sudo find . \( -name __pycache__ -o -name "*.pyc" \) -delete sudo rm -f */migrations/0*.py From 466630232a9c41dcf44b3d706cf6c786b785ca65 Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Mon, 20 Apr 2020 15:55:50 +0200 Subject: [PATCH 5/6] use 4 cpu core when running tests with vscode --- .vscode/settings.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.vscode/settings.json b/.vscode/settings.json index deba5d2..7140780 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,6 +8,7 @@ "python.linting.enabled": true, "python.testing.pytestArgs": [ ".", + "-n 4", "--ds=network_inventory.settings.local" ] } From 3e8512a2dd357d5b0874fb5ff6be86fb282859a8 Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Mon, 20 Apr 2020 15:55:58 +0200 Subject: [PATCH 6/6] remove the pytest.ini file --- pytest.ini | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 pytest.ini diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 5496d46..0000000 --- a/pytest.ini +++ /dev/null @@ -1,2 +0,0 @@ -[pytest] -junit_family=legacy