From 52ae24b85ab002ac790ad7420173fb6a61862bde Mon Sep 17 00:00:00 2001
From: William Newman <3382274+newmanw@users.noreply.github.com>
Date: Sun, 1 Sep 2024 12:37:13 -0600
Subject: [PATCH] Refactor navbar and map buttons
---
web-app/admin/src/ng1/app.js | 3 ++
web-app/admin/src/ng1/mage/index.js | 5 +--
web-app/src/app/event/event.service.ts | 8 ++--
web-app/src/app/home/home.component.html | 26 +++++++------
web-app/src/app/home/home.component.scss | 13 +++++--
web-app/src/app/home/home.module.ts | 4 ++
.../controls/add-observation.component.html | 2 +-
.../controls/add-observation.component.scss | 4 --
.../app/map/controls/export.component.html | 3 ++
.../app/map/controls/export.component.scss | 0
.../app/map/controls/export.component.spec.ts | 29 ++++++++++++++
.../src/app/map/controls/export.component.ts | 23 +++++++++++
.../app/map/controls/filter.component.html | 3 ++
.../app/map/controls/filter.component.scss | 0
.../app/map/controls/filter.component.spec.ts | 29 ++++++++++++++
.../src/app/map/controls/filter.component.ts | 23 +++++++++++
.../app/map/controls/search.component.scss | 1 -
.../src/app/map/controls/zoom.component.html | 7 ++--
.../src/app/map/controls/zoom.component.scss | 3 +-
web-app/src/app/map/map.component.html | 14 +++++--
web-app/src/app/map/map.component.scss | 38 ++++++++++++++-----
web-app/src/app/map/map.component.ts | 18 +++++++++
.../app/navigation/navigation.component.html | 23 ++++++-----
.../app/navigation/navigation.component.scss | 7 ++++
.../app/navigation/navigation.component.ts | 19 +---------
.../observation-edit.component.html | 2 +-
.../preferences/preferences.component.html | 19 ----------
.../app/preferences/preferences.component.ts | 29 +-------------
.../user-avatar/user-avatar.component.html | 2 +-
.../user-avatar/user-avatar.component.scss | 5 ++-
.../user/user-avatar/user-avatar.component.ts | 2 +-
.../user/user-avatar/user-avatar.module.ts | 4 +-
32 files changed, 243 insertions(+), 125 deletions(-)
create mode 100644 web-app/src/app/map/controls/export.component.html
create mode 100644 web-app/src/app/map/controls/export.component.scss
create mode 100644 web-app/src/app/map/controls/export.component.spec.ts
create mode 100644 web-app/src/app/map/controls/export.component.ts
create mode 100644 web-app/src/app/map/controls/filter.component.html
create mode 100644 web-app/src/app/map/controls/filter.component.scss
create mode 100644 web-app/src/app/map/controls/filter.component.spec.ts
create mode 100644 web-app/src/app/map/controls/filter.component.ts
diff --git a/web-app/admin/src/ng1/app.js b/web-app/admin/src/ng1/app.js
index 5db51a046..3ea2191f6 100644
--- a/web-app/admin/src/ng1/app.js
+++ b/web-app/admin/src/ng1/app.js
@@ -1,5 +1,6 @@
import _ from 'underscore';
import angular from 'angular';
+import mage from './mage/mage.component';
import fileUpload from './file-upload/file.upload.component';
import fileBrowser from './file-upload/file.browser.component';
import uiRouter from "@uirouter/angularjs";
@@ -77,6 +78,7 @@ app
.directive('adminEventFormPreview', downgradeComponent({ component: AdminEventFormPreviewComponent }));
app
+ .component('mage', mage)
.component('navbar', require('./navbar/navbar.component'))
.component('filterPanel', require('./filter/filter'))
.component('eventFilter', require('./filter/event.filter.component'))
@@ -99,6 +101,7 @@ app
.config(config)
.run(run);
+require('./mage');
require('./authentication') // for modal in admin pages if token expires
require('./factories');
require('./filters');
diff --git a/web-app/admin/src/ng1/mage/index.js b/web-app/admin/src/ng1/mage/index.js
index 22a738adf..f415ab88c 100644
--- a/web-app/admin/src/ng1/mage/index.js
+++ b/web-app/admin/src/ng1/mage/index.js
@@ -3,10 +3,7 @@ import banner from './banner.component';
import leaflet from './leaflet.component';
angular.module('mage')
- .component('mageInfo', require('./mage-info.component.js'))
.directive('colorPicker', require('./color.picker.directive'))
.directive('equals', require('./equals.directive'))
.component('banner', banner)
- .component('leaflet', leaflet);
-
-require('./navbar');
\ No newline at end of file
+ .component('leaflet', leaflet);
\ No newline at end of file
diff --git a/web-app/src/app/event/event.service.ts b/web-app/src/app/event/event.service.ts
index bedef58b8..03c9cc15e 100644
--- a/web-app/src/app/event/event.service.ts
+++ b/web-app/src/app/event/event.service.ts
@@ -97,10 +97,10 @@ export class EventService {
})
removed.forEach((removed: any) => {
- this.observationsChanged({ removed: Object.values(this.eventsById[removed.id].filteredObservationsById) });
- this.usersChanged({ removed: Object.values(this.eventsById[removed.id].filteredUsersById) });
- this.layersChanged({ removed: Object.values(this.eventsById[removed.id].layersById) }, removed);
- this.feedItemsChanged({ removed: Object.values(this.eventsById[removed.id].feedsById).map((feed: any) => ({ feed })) }, removed);
+ this.observationsChanged({ removed: Object.values(this.eventsById[removed.id]?.filteredObservationsById || {}) });
+ this.usersChanged({ removed: Object.values(this.eventsById[removed.id]?.filteredUsersById || {}) });
+ this.layersChanged({ removed: Object.values(this.eventsById[removed.id]?.layersById || {}) }, removed);
+ this.feedItemsChanged({ removed: Object.values(this.eventsById[removed.id]?.feedsById || {}).map((feed: any) => ({ feed })) }, removed);
delete this.eventsById[removed.id];
})
}
diff --git a/web-app/src/app/home/home.component.html b/web-app/src/app/home/home.component.html
index 64ce78bcb..80faf38fd 100644
--- a/web-app/src/app/home/home.component.html
+++ b/web-app/src/app/home/home.component.html
@@ -1,16 +1,18 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web-app/src/app/home/home.component.scss b/web-app/src/app/home/home.component.scss
index 9d86d6cee..8c943fc2d 100644
--- a/web-app/src/app/home/home.component.scss
+++ b/web-app/src/app/home/home.component.scss
@@ -3,20 +3,25 @@
}
.home {
+ height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
}
+.home-content {
+ flex: 1;
+}
+
+mat-sidenav-container {
+ height: 100%;
+}
+
.preferences-toolbar {
display: flex;
align-items: end;
}
-.main-container {
- height: 100vh;
-}
-
.feed {
background: #e1e2e1;
order: 1;
diff --git a/web-app/src/app/home/home.module.ts b/web-app/src/app/home/home.module.ts
index 696a71406..93b484786 100644
--- a/web-app/src/app/home/home.module.ts
+++ b/web-app/src/app/home/home.module.ts
@@ -139,6 +139,8 @@ import { RouterModule, Routes } from '@angular/router';
import { UserResolver } from '../ingress/user.resolver';
import { UserAvatarModule } from '../user/user-avatar/user-avatar.module';
import { IngressModule } from '../ingress/ingress.module';
+import { FilterControlComponent } from '../map/controls/filter.component';
+import { ExportControlComponent } from '../map/controls/export.component';
const routes: Routes = [{
path: '',
@@ -156,6 +158,8 @@ const routes: Routes = [{
AddObservationComponent,
LocationComponent,
SearchComponent,
+ FilterControlComponent,
+ ExportControlComponent,
MapComponent,
PasswordResetSuccessDialog,
PreferencesComponent,
diff --git a/web-app/src/app/map/controls/add-observation.component.html b/web-app/src/app/map/controls/add-observation.component.html
index a7366a2f4..8701d7ee0 100644
--- a/web-app/src/app/map/controls/add-observation.component.html
+++ b/web-app/src/app/map/controls/add-observation.component.html
@@ -1,3 +1,3 @@
-