Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add admin for node and compute sensors #33

Merged
merged 1 commit into from
Nov 17, 2023
Merged

Conversation

seanshahkarami
Copy link
Member

This PR adds admin interfaces for node and compute sensors in order to allow a global view and search across all sensors on all nodes and computes.

@seanshahkarami seanshahkarami merged commit a880063 into main Nov 17, 2023
5 checks passed
seanshahkarami added a commit that referenced this pull request Dec 12, 2023
* added node permissions

* Add lorawan sensors (#27)

* added phase, notes and address to node data

* added pandas to make data loading scripts more convinient

* allow blank node id and phase in node admin

* added migrations

* added registered_at field

* added registered_at to admin site

* added registered_at migration

* added node build model and admin

* refactors manifests and sensors views into viewset. added node build models, admin and api.

* added field for agent in node builds

* added agent to node build serializer

* added node type

* added computes api

* added admin action to add default sensors based on zone and hardware

* added migration

* added project field to node builds

* added migration files

* added ipython and sage-data-client for data loading scripts

* added migration

* added extra_rpi field for node builds. added autopopulate action to node admin.

* added extra_rpi field to serializer

* fixed rpi zone detection

* added lorawandevice model

* added lorawandevice serializer

* added create api view for lorawandevices

* added more fields to lorawandevices model

* had wrong name for model

* added lorawan serializer to import

* registered lorawandevice in admin site

* removed line of code that was not needed

* added verbose names for lorawan devices

* made view for lorawan devices only for post request

* changed name for last seen at

* added url for post request

* the create logic was changed to a method for the class

* added decorators library

* forgot to change name in admin.py for last seen at

* api view is not needed for class based views

* added new field and changed deveui to be a UUID field

* added more flags for lorawan device columns

* forgot to change device_id to deveui in admin.py

* added DEVEUI column

* use vsn field for node field instead of pk

* added lorawandevice to ManifestSerializer

* create api now works when fields aren't in the dict

* changed naming convention for lorawandevices classes,methods, and functions

* finished 1st version of update api

* moved node logic into for loop for create api

* filter by node only in admin page

* datasheet comment

* lorawandeviceview does not work with .views

* change textfield to charfield

* changed column name to deveui

* changed lorawandevice model name

* added lorawanconnections model

* renamed model

* typo

* added unique_together validation

* added admin instances for lorawanconnections

* added serializer for lorawanconnections

* added lorawanconnection view

* added url paths for create and update lorawan connections

* added get_object method for lorawanconnectionsview

* added source for lorawan device field

* forgot to import serializer

* moved battery_level column to lorawandevice

* forgot to add lorawanconnections to manifest fiels

* forgot to move battery level in serializer

* implement retrieve api to both lorawan devices and connections

* added lorawan keys model

* added permissions to lorawan views

* removed 0012_lorawandevice.py so we can fix migration history

* added lorawan related migrations

* reformat with black

---------

Co-authored-by: Sean Shahkarami <[email protected]>

* Added code to replace capabilities IDs by their names for /sensors endpoint (#29)

Co-authored-by: sergeygurvich <[email protected]>

* Bump django from 4.2.5 to 4.2.7 in /requirements (#28)

Bumps [django](https://github.com/django/django) from 4.2.5 to 4.2.7.
- [Commits](django/django@4.2.5...4.2.7)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* added node permissions

* added NodeAuthMixin

* changed permission from admin to node auth for lorawan devices

* added ability to change vsn field to filter by in mix in

* added node authentication for lorawanconnections retrieve api

* added node auth to creating objects associated to self

* moved retrieve object permission logic to permission instead of mix in

* moved mixins to file in node_auth

* change documentation for mix in

* update documentation for mix in

* added node auth for lorawan connections update

* added create api for lorawan keys

* added validation for lc field in lorawan keys

* added api for create and retrieve lorawan keys

* added a method to custimize retrieving vsn from POST

* changed foreign_key_name code for node_auth

* added ability in object level permission to traverse through models to find node relationship

* added node-auth object level to lorawan keys

* added object check in update api for lorawan connection

* added node auth token test

* removed line of code that was not needed

* added more tests for testing node_auth

* Update login / logout auth flows (#31)

* add globus logout flow. use globus login for admin login.

* updated logout test to include globus logout flow

* fix tests and behavior to support globus logout flow

* fixed admin logout

* Add project to node manifests (#32)

* added project to node model, admin, api.

* added clarifying comments about two distinct Project models.

* added project filter to manifests viewset

* add admin for node and compute sensors (#33)

* forgot to add serial no and uri to node sensors. (important for camera config!)

* added node permissions

* added NodeAuthMixin

* changed permission from admin to node auth for lorawan devices

* added node authentication for lorawanconnections retrieve api

* removed mixin from manifest

* Added code to replace capabilities IDs by their names for /sensors endpoint (#29)

Co-authored-by: sergeygurvich <[email protected]>

* Add project to node manifests (#32)

* added project to node model, admin, api.

* added clarifying comments about two distinct Project models.

* added project filter to manifests viewset

* add admin for node and compute sensors (#33)

* forgot to add serial no and uri to node sensors. (important for camera config!)

* added node authentication for lorawanconnections and lorawan devices views

* fixed wrong model name in response

* added better test reporting

* added ability to run multiple processes for running test faster

* updated readme with pytest suite

* added function to run collectstatic on first migrate

* add expected error markers

* removed handler

* added additional content to expected error

* added additional marker

* added flags to pytest

* added comments about pytest flags used

* removed comments

* added tests for TokenModel

* made IsAuthenticated_ObjectLevel child of IsAuthenticated

* added tests for permissions.py

* split node_auth tests into different files

* views not needed for node_auth

* added tests for node_auth serializers

* renamed test files for node_auth

* don't need this for node_auth right now

* added more tests for node_auth

* moved manifest test

* added test for lc retrieve api

* changed token keyword on test file to be retrived from file that sets it

* removed unneeded code since it duplicates parent class retrieve api

* added test for create lorawan connection view

* added test cases for update lorawanconnection view

* edited some tests to check the db if records were created or updated

* removed loop in lc view

* removed replicated retrieved function

* since device name is used to retrieve a lorawan connection it cannot be blank

* added test for lorawan key view

* removed loop in key view

* views only in this test file

* added test for lorawan device view

* removed unneeded code for lorawandeviceview

* created an abstract node class

* migration for lorawan device name switched to null=False

* got warnings for assertNotEquals

* added node_auth settings and functions to retrieve those settings

* added middleware to authenticate node and set request.node

* authentication for CRUD calls uses the new functions to retrieve node_auth models

* reconfigures base node and abstract node

* permission test use request.node now

* permission file uses request.node now

* init for contrib.auth

* added comments

* changed tests to use get_model functions

* used get functions for token and node

* changed tests to use requestfactory

* updated field name

* removed uneccesary code

* return model instance instead of succesful message

* updated lorawan urls

* switch lorawan device to use modelviewset and router for its url

* comment on node mock

* removed isadminuser not being used

* added AnonymousNode class to be returned when node can't be retrieved

* re structured middleware code

* removed unneeded code

* changed import of auth.get_node

* added new test for inactive node

* added tests for middleware

* added main

* added test for get functions

* removed last updated field

* removed unneeded code

* removed function

* added test cases for models

* moved custom get lookup record logic to lorawan connection serializer

* changed lorawan connection view to modelviewset

* moved get lookup field logic to lorawan key serializer

* changed lorawan key view to modelviewset

* changed NodeData model to use AbstractNode so that fields that need to be consistent stay like that with app.node model

* changed names of node settings get functions

* added get function for user token keyword

* removed libs not being used

* restructrured lorawan view test

* autofmt. added a few explicit test cases for /lorawanconnections/

* updated ci to use pytest

* autofmt. added default queryset to lorawan connections view so drf can infer name.

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Sean Shahkarami <[email protected]>
Co-authored-by: sgurvich83 <[email protected]>
Co-authored-by: sergeygurvich <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
FranciscoLozCoding added a commit that referenced this pull request Feb 6, 2024
* added node permissions

* Add lorawan sensors (#27)

* added phase, notes and address to node data

* added pandas to make data loading scripts more convinient

* allow blank node id and phase in node admin

* added migrations

* added registered_at field

* added registered_at to admin site

* added registered_at migration

* added node build model and admin

* refactors manifests and sensors views into viewset. added node build models, admin and api.

* added field for agent in node builds

* added agent to node build serializer

* added node type

* added computes api

* added admin action to add default sensors based on zone and hardware

* added migration

* added project field to node builds

* added migration files

* added ipython and sage-data-client for data loading scripts

* added migration

* added extra_rpi field for node builds. added autopopulate action to node admin.

* added extra_rpi field to serializer

* fixed rpi zone detection

* added lorawandevice model

* added lorawandevice serializer

* added create api view for lorawandevices

* added more fields to lorawandevices model

* had wrong name for model

* added lorawan serializer to import

* registered lorawandevice in admin site

* removed line of code that was not needed

* added verbose names for lorawan devices

* made view for lorawan devices only for post request

* changed name for last seen at

* added url for post request

* the create logic was changed to a method for the class

* added decorators library

* forgot to change name in admin.py for last seen at

* api view is not needed for class based views

* added new field and changed deveui to be a UUID field

* added more flags for lorawan device columns

* forgot to change device_id to deveui in admin.py

* added DEVEUI column

* use vsn field for node field instead of pk

* added lorawandevice to ManifestSerializer

* create api now works when fields aren't in the dict

* changed naming convention for lorawandevices classes,methods, and functions

* finished 1st version of update api

* moved node logic into for loop for create api

* filter by node only in admin page

* datasheet comment

* lorawandeviceview does not work with .views

* change textfield to charfield

* changed column name to deveui

* changed lorawandevice model name

* added lorawanconnections model

* renamed model

* typo

* added unique_together validation

* added admin instances for lorawanconnections

* added serializer for lorawanconnections

* added lorawanconnection view

* added url paths for create and update lorawan connections

* added get_object method for lorawanconnectionsview

* added source for lorawan device field

* forgot to import serializer

* moved battery_level column to lorawandevice

* forgot to add lorawanconnections to manifest fiels

* forgot to move battery level in serializer

* implement retrieve api to both lorawan devices and connections

* added lorawan keys model

* added permissions to lorawan views

* removed 0012_lorawandevice.py so we can fix migration history

* added lorawan related migrations

* reformat with black

---------

Co-authored-by: Sean Shahkarami <[email protected]>

* Added code to replace capabilities IDs by their names for /sensors endpoint (#29)

Co-authored-by: sergeygurvich <[email protected]>

* Bump django from 4.2.5 to 4.2.7 in /requirements (#28)

Bumps [django](https://github.com/django/django) from 4.2.5 to 4.2.7.
- [Commits](django/django@4.2.5...4.2.7)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* added node permissions

* added NodeAuthMixin

* changed permission from admin to node auth for lorawan devices

* added ability to change vsn field to filter by in mix in

* added node authentication for lorawanconnections retrieve api

* added node auth to creating objects associated to self

* moved retrieve object permission logic to permission instead of mix in

* moved mixins to file in node_auth

* change documentation for mix in

* update documentation for mix in

* added node auth for lorawan connections update

* added create api for lorawan keys

* added validation for lc field in lorawan keys

* added api for create and retrieve lorawan keys

* added a method to custimize retrieving vsn from POST

* changed foreign_key_name code for node_auth

* added ability in object level permission to traverse through models to find node relationship

* added node-auth object level to lorawan keys

* added object check in update api for lorawan connection

* added node auth token test

* removed line of code that was not needed

* added more tests for testing node_auth

* Update login / logout auth flows (#31)

* add globus logout flow. use globus login for admin login.

* updated logout test to include globus logout flow

* fix tests and behavior to support globus logout flow

* fixed admin logout

* Add project to node manifests (#32)

* added project to node model, admin, api.

* added clarifying comments about two distinct Project models.

* added project filter to manifests viewset

* add admin for node and compute sensors (#33)

* forgot to add serial no and uri to node sensors. (important for camera config!)

* added node permissions

* added NodeAuthMixin

* changed permission from admin to node auth for lorawan devices

* added node authentication for lorawanconnections retrieve api

* removed mixin from manifest

* Added code to replace capabilities IDs by their names for /sensors endpoint (#29)

Co-authored-by: sergeygurvich <[email protected]>

* Add project to node manifests (#32)

* added project to node model, admin, api.

* added clarifying comments about two distinct Project models.

* added project filter to manifests viewset

* add admin for node and compute sensors (#33)

* forgot to add serial no and uri to node sensors. (important for camera config!)

* added node authentication for lorawanconnections and lorawan devices views

* fixed wrong model name in response

* added better test reporting

* added ability to run multiple processes for running test faster

* updated readme with pytest suite

* added function to run collectstatic on first migrate

* add expected error markers

* removed handler

* added additional content to expected error

* added additional marker

* added flags to pytest

* added comments about pytest flags used

* removed comments

* added tests for TokenModel

* made IsAuthenticated_ObjectLevel child of IsAuthenticated

* added tests for permissions.py

* split node_auth tests into different files

* views not needed for node_auth

* added tests for node_auth serializers

* renamed test files for node_auth

* don't need this for node_auth right now

* added more tests for node_auth

* moved manifest test

* added test for lc retrieve api

* changed token keyword on test file to be retrived from file that sets it

* removed unneeded code since it duplicates parent class retrieve api

* added test for create lorawan connection view

* added test cases for update lorawanconnection view

* edited some tests to check the db if records were created or updated

* removed loop in lc view

* removed replicated retrieved function

* since device name is used to retrieve a lorawan connection it cannot be blank

* added test for lorawan key view

* removed loop in key view

* views only in this test file

* added test for lorawan device view

* removed unneeded code for lorawandeviceview

* created an abstract node class

* migration for lorawan device name switched to null=False

* got warnings for assertNotEquals

* added node_auth settings and functions to retrieve those settings

* added middleware to authenticate node and set request.node

* authentication for CRUD calls uses the new functions to retrieve node_auth models

* reconfigures base node and abstract node

* permission test use request.node now

* permission file uses request.node now

* init for contrib.auth

* added comments

* changed tests to use get_model functions

* used get functions for token and node

* changed tests to use requestfactory

* updated field name

* removed uneccesary code

* return model instance instead of succesful message

* updated lorawan urls

* switch lorawan device to use modelviewset and router for its url

* comment on node mock

* removed isadminuser not being used

* added AnonymousNode class to be returned when node can't be retrieved

* re structured middleware code

* removed unneeded code

* changed import of auth.get_node

* added new test for inactive node

* added tests for middleware

* added main

* added test for get functions

* removed last updated field

* removed unneeded code

* removed function

* added test cases for models

* moved custom get lookup record logic to lorawan connection serializer

* changed lorawan connection view to modelviewset

* moved get lookup field logic to lorawan key serializer

* changed lorawan key view to modelviewset

* changed NodeData model to use AbstractNode so that fields that need to be consistent stay like that with app.node model

* changed names of node settings get functions

* added get function for user token keyword

* removed libs not being used

* restructrured lorawan view test

* autofmt. added a few explicit test cases for /lorawanconnections/

* updated ci to use pytest

* autofmt. added default queryset to lorawan connections view so drf can infer name.

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Sean Shahkarami <[email protected]>
Co-authored-by: sgurvich83 <[email protected]>
Co-authored-by: sergeygurvich <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
FranciscoLozCoding added a commit that referenced this pull request Feb 6, 2024
* added node permissions

* Add lorawan sensors (#27)

* added phase, notes and address to node data

* added pandas to make data loading scripts more convinient

* allow blank node id and phase in node admin

* added migrations

* added registered_at field

* added registered_at to admin site

* added registered_at migration

* added node build model and admin

* refactors manifests and sensors views into viewset. added node build models, admin and api.

* added field for agent in node builds

* added agent to node build serializer

* added node type

* added computes api

* added admin action to add default sensors based on zone and hardware

* added migration

* added project field to node builds

* added migration files

* added ipython and sage-data-client for data loading scripts

* added migration

* added extra_rpi field for node builds. added autopopulate action to node admin.

* added extra_rpi field to serializer

* fixed rpi zone detection

* added lorawandevice model

* added lorawandevice serializer

* added create api view for lorawandevices

* added more fields to lorawandevices model

* had wrong name for model

* added lorawan serializer to import

* registered lorawandevice in admin site

* removed line of code that was not needed

* added verbose names for lorawan devices

* made view for lorawan devices only for post request

* changed name for last seen at

* added url for post request

* the create logic was changed to a method for the class

* added decorators library

* forgot to change name in admin.py for last seen at

* api view is not needed for class based views

* added new field and changed deveui to be a UUID field

* added more flags for lorawan device columns

* forgot to change device_id to deveui in admin.py

* added DEVEUI column

* use vsn field for node field instead of pk

* added lorawandevice to ManifestSerializer

* create api now works when fields aren't in the dict

* changed naming convention for lorawandevices classes,methods, and functions

* finished 1st version of update api

* moved node logic into for loop for create api

* filter by node only in admin page

* datasheet comment

* lorawandeviceview does not work with .views

* change textfield to charfield

* changed column name to deveui

* changed lorawandevice model name

* added lorawanconnections model

* renamed model

* typo

* added unique_together validation

* added admin instances for lorawanconnections

* added serializer for lorawanconnections

* added lorawanconnection view

* added url paths for create and update lorawan connections

* added get_object method for lorawanconnectionsview

* added source for lorawan device field

* forgot to import serializer

* moved battery_level column to lorawandevice

* forgot to add lorawanconnections to manifest fiels

* forgot to move battery level in serializer

* implement retrieve api to both lorawan devices and connections

* added lorawan keys model

* added permissions to lorawan views

* removed 0012_lorawandevice.py so we can fix migration history

* added lorawan related migrations

* reformat with black

---------

Co-authored-by: Sean Shahkarami <[email protected]>

* Added code to replace capabilities IDs by their names for /sensors endpoint (#29)

Co-authored-by: sergeygurvich <[email protected]>

* Bump django from 4.2.5 to 4.2.7 in /requirements (#28)

Bumps [django](https://github.com/django/django) from 4.2.5 to 4.2.7.
- [Commits](django/django@4.2.5...4.2.7)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* added node permissions

* added NodeAuthMixin

* changed permission from admin to node auth for lorawan devices

* added ability to change vsn field to filter by in mix in

* added node authentication for lorawanconnections retrieve api

* added node auth to creating objects associated to self

* moved retrieve object permission logic to permission instead of mix in

* moved mixins to file in node_auth

* change documentation for mix in

* update documentation for mix in

* added node auth for lorawan connections update

* added create api for lorawan keys

* added validation for lc field in lorawan keys

* added api for create and retrieve lorawan keys

* added a method to custimize retrieving vsn from POST

* changed foreign_key_name code for node_auth

* added ability in object level permission to traverse through models to find node relationship

* added node-auth object level to lorawan keys

* added object check in update api for lorawan connection

* added node auth token test

* removed line of code that was not needed

* added more tests for testing node_auth

* Update login / logout auth flows (#31)

* add globus logout flow. use globus login for admin login.

* updated logout test to include globus logout flow

* fix tests and behavior to support globus logout flow

* fixed admin logout

* Add project to node manifests (#32)

* added project to node model, admin, api.

* added clarifying comments about two distinct Project models.

* added project filter to manifests viewset

* add admin for node and compute sensors (#33)

* forgot to add serial no and uri to node sensors. (important for camera config!)

* added node permissions

* added NodeAuthMixin

* changed permission from admin to node auth for lorawan devices

* added node authentication for lorawanconnections retrieve api

* removed mixin from manifest

* Added code to replace capabilities IDs by their names for /sensors endpoint (#29)

Co-authored-by: sergeygurvich <[email protected]>

* Add project to node manifests (#32)

* added project to node model, admin, api.

* added clarifying comments about two distinct Project models.

* added project filter to manifests viewset

* add admin for node and compute sensors (#33)

* forgot to add serial no and uri to node sensors. (important for camera config!)

* added node authentication for lorawanconnections and lorawan devices views

* fixed wrong model name in response

* added better test reporting

* added ability to run multiple processes for running test faster

* updated readme with pytest suite

* added function to run collectstatic on first migrate

* add expected error markers

* removed handler

* added additional content to expected error

* added additional marker

* added flags to pytest

* added comments about pytest flags used

* removed comments

* added tests for TokenModel

* made IsAuthenticated_ObjectLevel child of IsAuthenticated

* added tests for permissions.py

* split node_auth tests into different files

* views not needed for node_auth

* added tests for node_auth serializers

* renamed test files for node_auth

* don't need this for node_auth right now

* added more tests for node_auth

* moved manifest test

* added test for lc retrieve api

* changed token keyword on test file to be retrived from file that sets it

* removed unneeded code since it duplicates parent class retrieve api

* added test for create lorawan connection view

* added test cases for update lorawanconnection view

* edited some tests to check the db if records were created or updated

* removed loop in lc view

* removed replicated retrieved function

* since device name is used to retrieve a lorawan connection it cannot be blank

* added test for lorawan key view

* removed loop in key view

* views only in this test file

* added test for lorawan device view

* removed unneeded code for lorawandeviceview

* created an abstract node class

* migration for lorawan device name switched to null=False

* got warnings for assertNotEquals

* added node_auth settings and functions to retrieve those settings

* added middleware to authenticate node and set request.node

* authentication for CRUD calls uses the new functions to retrieve node_auth models

* reconfigures base node and abstract node

* permission test use request.node now

* permission file uses request.node now

* init for contrib.auth

* added comments

* changed tests to use get_model functions

* used get functions for token and node

* changed tests to use requestfactory

* updated field name

* removed uneccesary code

* return model instance instead of succesful message

* updated lorawan urls

* switch lorawan device to use modelviewset and router for its url

* comment on node mock

* removed isadminuser not being used

* added AnonymousNode class to be returned when node can't be retrieved

* re structured middleware code

* removed unneeded code

* changed import of auth.get_node

* added new test for inactive node

* added tests for middleware

* added main

* added test for get functions

* removed last updated field

* removed unneeded code

* removed function

* added test cases for models

* moved custom get lookup record logic to lorawan connection serializer

* changed lorawan connection view to modelviewset

* moved get lookup field logic to lorawan key serializer

* changed lorawan key view to modelviewset

* changed NodeData model to use AbstractNode so that fields that need to be consistent stay like that with app.node model

* changed names of node settings get functions

* added get function for user token keyword

* removed libs not being used

* restructrured lorawan view test

* autofmt. added a few explicit test cases for /lorawanconnections/

* updated ci to use pytest

* autofmt. added default queryset to lorawan connections view so drf can infer name.

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Sean Shahkarami <[email protected]>
Co-authored-by: sgurvich83 <[email protected]>
Co-authored-by: sergeygurvich <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant