Skip to content

Commit

Permalink
Observations api (#263)
Browse files Browse the repository at this point in the history
* feat: add observations view

* feat: create observation serializer

* feat: add observations urls

* patch: clean up code

* patch: import value

* patch: change observations locaton

* patch: clean up code

* patch: use gis openlayers templates in django admin

* patch: update fetch observations uri

* patch: pass the observation pk to url on navigate

* patch: update sidebar to take observation id

* patch: pass observation id to observation details

* patch: set observation details data to be dynamic

* feat: define global variables to use in any component

* patch: update all fields

* feat: define and implement CRUD operations for observations

* patch: clean up models

* patch: define global variables to use in any component

* patch: trigger a built

* patch: disable contrib.gis

* Delete django_project/monitor/views directory

* patch: observation views

* patch: update paths

* patch: update settings

* patch: add a default value

* patch: update migration

* patch: update migration

* patch: update table

* patch: ignore user profile does not exist

* patch: set null on observations date

* update migration

* patch: update migration

* patch: update user field

* patch: update model

* patch: update migration file

* patch:  update view

* patch: test recent observations

* patch: test recent observations

* patch: add the encoder

* test observation

* patch: add missing import

* patch: update recent observations url

* patch: update view functions and paths

* patch: update urls

* patch: update observation details url

* patch: update observation details view

* patch: update observation details form

* patch: remove restriction on observation detail view

* patch: fix login failing

* patch: update retrieve observation

* patch: update url for fetch observation detial

* patch: set loading to false

* patch: remove lookup link

* patch: update migration

* patch: revert changes

* patch: revert changes

* patch: update component

* patch: use serializers

* patch: update serializer

* feat: add observations test

* patch: trigger test on entry

* patch: update score variable

* patch: update env vars

* Update django_project/monitor/urls.py

---------

Co-authored-by: Dimas Ciputra <dimas@kartoza.com>
  • Loading branch information
tinashechiraya and dimasciput authored Nov 28, 2023
1 parent 72bc144 commit f092ec7
Show file tree
Hide file tree
Showing 19 changed files with 529 additions and 491 deletions.
8 changes: 4 additions & 4 deletions .example.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ DATABASE_PORT=5432
SERVER_MODE=production
RECAPTCHA_PUBLIC_KEY=
RECAPTCHA_PRIVATE_KEY=
SMTP_HOST=
SMTP_PORT=587
SMTP_EMAIL=
SMTP_HOST_USER=
SMTP_EMAIL_TLS=
SMTP_HOST=
SMTP_HOST_PASSWORD=
SMTP_EMAIL_TLS=True
SMTP_HOST_USER=
SMTP_PORT=
ADMIN_EMAIL=
RESOLVER=127.0.0.11
HTTPS_HOST=${COMPUTER_HOSTNAME}
Expand Down
4 changes: 4 additions & 0 deletions deployment/docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ echo 'Initialize project.'
python manage.py collectstatic --clear --noinput
python manage.py migrate

# Run tests
echo 'Running tests.'
python manage.py test

echo "-----------------------------------------------------"
echo "FINISHED DJANGO ENTRYPOINT --------------------------"
echo "-----------------------------------------------------"
Expand Down
5 changes: 1 addition & 4 deletions django_project/minisass/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from django.views.static import serve
from django.views.generic import TemplateView
from django.views.i18n import JavaScriptCatalog
from minisass_frontend.views import ObservationsView

admin.autodiscover()

Expand All @@ -24,8 +23,6 @@
# Indlude monitor URLs
path('monitor/', include('monitor.urls')),

# get observations
path('api/observations/', ObservationsView.as_view(), name='observations-api'),

# map frontend urls to backend
path("map/", TemplateView.as_view(template_name="react_base.html"), name="map"),
Expand All @@ -37,4 +34,4 @@
urlpatterns += [
re_path(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
re_path(r'^static/(?P<path>.*)$', serve, {'document_root': settings.STATIC_ROOT}),
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ function AuthenticationButtons() {
const [isRegisterModalOpen, setRegisterModalOpen] = useState(false);

const { dispatch, state } = useAuth();

const [isAuthenticated, setIsAuthenticated] = useState(state.isAuthenticated);

useEffect(() => {
Expand Down Expand Up @@ -69,9 +68,11 @@ function AuthenticationButtons() {
setIsAuthenticated(true)
} else {
setError('Invalid credentials. Please try again.');
setIsAuthenticated(false)
}
} catch (error) {
setError('Invalid credentials. Please try again.');
setIsAuthenticated(false)
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ const inputDirectionUnitsList = [

const DataInputForm: React.FC<DataInputFormProps> = (props) => {

// TODO still need to save data to db

// State to store form values
const [formValues, setFormValues] = useState({
riverName: '',
Expand Down
Loading

0 comments on commit f092ec7

Please sign in to comment.