diff --git a/plugins/arcgis/web-app/projects/main/src/lib/arc-admin/arc-admin.component.html b/plugins/arcgis/web-app/projects/main/src/lib/arc-admin/arc-admin.component.html index b0a5a6cba..be7f35181 100644 --- a/plugins/arcgis/web-app/projects/main/src/lib/arc-admin/arc-admin.component.html +++ b/plugins/arcgis/web-app/projects/main/src/lib/arc-admin/arc-admin.component.html @@ -1,196 +1,189 @@

ArcGIS Configuration

-
-
-

Processing

-

MAGE ArcGIS plugin processing settings.

-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Enabled - - {{config.enabled}}
Base URL - - {{config.baseUrl}}
Interval (s) - - {{config.intervalSeconds}}
Startup Interval (s) - - {{config.startupIntervalSeconds}}
Update Interval (s) - - {{config.updateIntervalSeconds}}
Batch Size - - {{config.batchSize}}
Attachment Tolerance (ms) - - {{config.attachmentModifiedTolerance}}
-
-
- - -
-
-

Attributes

-

MAGE Field to ArcGIS Attribute mappings.

-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Observation Id Field - - {{config.observationIdField}}
Id Separator - - {{config.idSeparator}}
Event Id Field - - {{config.eventIdField}}
Last Edited Date Field - - {{config.lastEditedDateField}}
Event Name Field - - {{config.eventNameField}}
User Id Field - - {{config.userIdField}}
Username Field - - {{config.usernameField}}
User Display Name Field - - {{config.userDisplayNameField}}
Device Id Field - - {{config.deviceIdField}}
Created At Field - - {{config.createdAtField}}
Last Modified Field - - {{config.lastModifiedField}}
Geometry Type Field - - {{config.geometryType}}
-
+ + + + Processing + + MAGE ArcGIS plugin processing settings. + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Enabled + + {{config.enabled}}
Base URL + + {{config.baseUrl}}
Interval (s) + + {{config.intervalSeconds}}
Startup Interval (s) + + {{config.startupIntervalSeconds}}
Update Interval (s) + + {{config.updateIntervalSeconds}}
Batch Size + + {{config.batchSize}}
Attachment Tolerance (ms) + + {{config.attachmentModifiedTolerance}}
+
+
+ + + +
+ + +
+ + + Attributes + MAGE Field to ArcGIS Attribute mappings. + + +
+
+
+ + Observation Id Field + + The ArcGIS layer text field attribute name to store the MAGE observation id + +
+
+ + Id Separator + + When event id field is not configured, the separator combining observation ids and event ids in the observation id field + +
+
+ + Event Id Field + + The ArcGIS layer integer field attribute name to store the MAGE event id + +
+
+ + Last Edited Date Field + + The last edited date field attribute name on the ArcGIS layer + +
+
+ + Event Name Field + + The ArcGIS layer text field attribute name to store the MAGE event name + +
+
+ + User Id Field + + The ArcGIS layer text field attribute name to store the MAGE user id + +
+
+ + Username Field + + The ArcGIS layer text field attribute name to store the MAGE username + +
+
+ + User Display Name Field + + The ArcGIS layer text field attribute name to store the MAGE user display name + +
+
+ + Device Id Field + + The ArcGIS layer text field attribute name to store the MAGE device id + +
+
+ + Created At Field + + The ArcGIS layer date time field attribute name to store the MAGE created at date + +
+
+ + Last Modified Field + + The ArcGIS layer date time field attribute name to store the MAGE last modified date (may be the + same as last edited date field if editable) + +
+
+ + Geometry Type Field + + The ArcGIS layer text field attribute name to store the Esri geometry type + +
+
+ + +
+
+
+
+
+
Field Mappings
+
+ + + + +
Interval diff --git a/plugins/arcgis/web-app/projects/main/src/lib/arc-admin/arc-admin.component.scss b/plugins/arcgis/web-app/projects/main/src/lib/arc-admin/arc-admin.component.scss index 316f415d0..d575a3078 100644 --- a/plugins/arcgis/web-app/projects/main/src/lib/arc-admin/arc-admin.component.scss +++ b/plugins/arcgis/web-app/projects/main/src/lib/arc-admin/arc-admin.component.scss @@ -9,7 +9,7 @@ section { >* { - margin-inline-start: 1em; + margin-inline-start: 0; } header { @@ -50,20 +50,6 @@ section { } } -.attributes-table { - tr { - th { - font-weight: normal; - } - - td { - padding-left: 20px; - opacity: 0.5; - font-size: 0.9em; - } - } -} - .fieldOverrides { margin-top: 20px; } @@ -193,3 +179,17 @@ section { line-height: inherit; width: inherit; } + +mat-form-field { + width: 100%; + margin-bottom: 16px; +} + +mat-card { + margin-bottom: 8px; +} + +.hint { + font-size: 75%; + padding: 0 1em; +} diff --git a/plugins/arcgis/web-app/projects/main/src/lib/arc-admin/arc-admin.component.ts b/plugins/arcgis/web-app/projects/main/src/lib/arc-admin/arc-admin.component.ts index 887a9e077..a2ef3ad26 100644 --- a/plugins/arcgis/web-app/projects/main/src/lib/arc-admin/arc-admin.component.ts +++ b/plugins/arcgis/web-app/projects/main/src/lib/arc-admin/arc-admin.component.ts @@ -4,6 +4,7 @@ import { AttributeConfig, AttributeConcatenationConfig, AttributeDefaultConfig, import { ArcGISPluginConfig, defaultArcGISPluginConfig } from '../ArcGISPluginConfig' import { ArcService, Form, MageEvent } from '../arc.service' import { Subject } from 'rxjs'; +import { FormGroup, FormBuilder } from '@angular/forms'; @Component({ selector: 'arc-admin', @@ -52,17 +53,12 @@ export class ArcAdminComponent implements OnInit { @ViewChild('editAttributeConfigDialog', { static: true }) private editAttributeConfigTemplate: TemplateRef - constructor(private arcService: ArcService, private dialog: MatDialog) { + attributesForm: FormGroup; + + constructor(private arcService: ArcService, private dialog: MatDialog, private fb: FormBuilder) { this.config = defaultArcGISPluginConfig; this.editConfig = defaultArcGISPluginConfig; this.editFieldMappings = false; - arcService.fetchArcConfig().subscribe(x => { - this.config = x; - if (!this.config.baseUrl) { - this.config.baseUrl = window.location.origin - } - arcService.fetchPopulatedEvents().subscribe(x => this.handleEventResults(x)); - }) } configChanged(config: ArcGISPluginConfig) { @@ -70,13 +66,63 @@ export class ArcAdminComponent implements OnInit { this.configChangedNotifier.next(); } + //map attribute form to fields ngOnInit(): void { - } + this.attributesForm = this.fb.group({ + observationIdField: [this.editConfig.observationIdField], + idSeparator: [this.editConfig.idSeparator], + eventIdField: [this.editConfig.eventIdField], + lastEditedDateField: [this.editConfig.lastEditedDateField], + eventNameField: [this.editConfig.eventNameField], + userIdField: [this.editConfig.userIdField], + usernameField: [this.editConfig.usernameField], + userDisplayNameField: [this.editConfig.userDisplayNameField], + deviceIdField: [this.editConfig.deviceIdField], + createdAtField: [this.editConfig.createdAtField], + lastModifiedField: [this.editConfig.lastModifiedField], + geometryType: [this.editConfig.geometryType] + }); + } + + //save attributes form + onSubmit(): void { + if (this.attributesForm.valid) { + const formValue = this.attributesForm.value; + + this.editConfig = { + ...this.editConfig, + observationIdField: formValue.observationIdField, + idSeparator: formValue.idSeparator, + eventIdField: formValue.eventIdField, + lastEditedDateField: formValue.lastEditedDateField, + eventNameField: formValue.eventNameField, + userIdField: formValue.userIdField, + usernameField: formValue.usernameField, + userDisplayNameField: formValue.userDisplayNameField, + deviceIdField: formValue.deviceIdField, + createdAtField: formValue.createdAtField, + lastModifiedField: formValue.lastModifiedField, + geometryType: formValue.geometryType + }; + + console.log('Form Submitted:', this.editConfig); + + this.editConfig = this.copyConfig(); + } + } + + //when edit attributes is canceled, preserve initial data + onCancel(): void { + this.attributesForm.reset({ + ...this.editConfig + }); + console.log('Canceled edit'); + + } handleEventResults(x: MageEvent[]) { this.events = x } - onDeleteLayer(layerUrl: string) { let index = 0; for (const featureServiceConfig of this.config.featureServices) { @@ -96,11 +142,6 @@ export class ArcAdminComponent implements OnInit { this.dialog.open(this.editProcessingTemplate) } - onEditAttributes() { - this.editConfig = this.copyConfig() - this.dialog.open(this.editAttributesTemplate) - } - setField(field: string, value: any) { if (value != undefined && value.length == 0) { value = undefined diff --git a/plugins/arcgis/web-app/projects/main/src/lib/arc-event/arc-event.component.html b/plugins/arcgis/web-app/projects/main/src/lib/arc-event/arc-event.component.html index 043fb18ab..61ae84c21 100644 --- a/plugins/arcgis/web-app/projects/main/src/lib/arc-event/arc-event.component.html +++ b/plugins/arcgis/web-app/projects/main/src/lib/arc-event/arc-event.component.html @@ -1,9 +1,13 @@
+ + + + Events + + Change the ArcGIS layers each MAGE event sends its observations to. + +
-
-

Events

-

Change the ArcGIS layers each MAGE event sends its observations to.

-
There are no events synchronizing to ArcGIS layers. @@ -32,7 +36,9 @@

Events

-
+ + +

ArcGIS layers that MAGE event named {{currentEditingEvent.name}} is synchronizing

@@ -48,4 +54,5 @@

ArcGIS layers that MAGE event named {{currentEditingEvent.nam - \ No newline at end of file + +

\ No newline at end of file diff --git a/plugins/arcgis/web-app/projects/main/src/lib/arc-layer/arc-layer.component.html b/plugins/arcgis/web-app/projects/main/src/lib/arc-layer/arc-layer.component.html index 931d1c6e6..a64820431 100644 --- a/plugins/arcgis/web-app/projects/main/src/lib/arc-layer/arc-layer.component.html +++ b/plugins/arcgis/web-app/projects/main/src/lib/arc-layer/arc-layer.component.html @@ -1,9 +1,13 @@
+ + + + Feature Layers + + Add ArcGIS feature service urls and layers to synchronize MAGE data to. + +
-
-

Feature Layers

-

Add ArcGIS feature service urls and layers to sychronize MAGE data to.

-
@@ -31,7 +35,56 @@

Feature Layers

{{layer.layer}}
-
+
- \ No newline at end of file + + +

Add ArcGIS Feature Service

+
+ +

Edit ArcGIS Feature Service

+
+ +
+ + URL + + + URL is required + + + + Token + + +
+

Layers

+ +
+
+ + {{arcLayer.name}} +
+
+
+ + + + +
+ +

Delete feature service?

+
+ {{currentUrl}} +
+
+ + + + +
+ + diff --git a/plugins/arcgis/web-app/projects/main/src/lib/arc-layer/arc-layer.component.scss b/plugins/arcgis/web-app/projects/main/src/lib/arc-layer/arc-layer.component.scss index 0336d7fab..b4b3333cb 100644 --- a/plugins/arcgis/web-app/projects/main/src/lib/arc-layer/arc-layer.component.scss +++ b/plugins/arcgis/web-app/projects/main/src/lib/arc-layer/arc-layer.component.scss @@ -83,4 +83,8 @@ section { height: inherit; line-height: inherit; width: inherit; -} \ No newline at end of file +} + +mat-card { + margin-bottom: 16px; + } \ No newline at end of file diff --git a/service/src/routes/authenticationconfigurations.js b/service/src/routes/authenticationconfigurations.js index cdf239035..8f119dc6d 100644 --- a/service/src/routes/authenticationconfigurations.js +++ b/service/src/routes/authenticationconfigurations.js @@ -101,7 +101,7 @@ module.exports = function (app, security) { const securityData = {}; - const settings = JSON.parse(req.body.settings); + const { settings } = req.body; Object.keys(settings).forEach(key => { if (blacklist && blacklist.indexOf(key.toLowerCase()) != -1) { @@ -184,7 +184,7 @@ module.exports = function (app, security) { const securityData = {}; - const settings = JSON.parse(req.body.settings); + const { settings } = req.body; Object.keys(settings).forEach(key => { if (blacklist && blacklist.indexOf(key.toLowerCase()) != -1) { diff --git a/web-app/admin/src/app/admin/admin-authentication/admin-authentication-create/admin-authentication-create.component.ts b/web-app/admin/src/app/admin/admin-authentication/admin-authentication-create/admin-authentication-create.component.ts index 60a2dd104..8393b7ca2 100644 --- a/web-app/admin/src/app/admin/admin-authentication/admin-authentication-create/admin-authentication-create.component.ts +++ b/web-app/admin/src/app/admin/admin-authentication/admin-authentication-create/admin-authentication-create.component.ts @@ -17,10 +17,10 @@ import { Strategy } from '../../admin-authentication/admin-settings.model'; }) export class AuthenticationCreateComponent implements OnInit { breadcrumbs: AdminBreadcrumb[] = [{ - title: 'Settings', - icon: 'build', + title: 'Security', + icon: 'shield', state: { - name: 'admin.settings' + name: 'admin.security' } }]; strategy: Strategy; @@ -124,13 +124,13 @@ export class AuthenticationCreateComponent implements OnInit { save(): void { this.authenticationConfigurationService.createConfiguration(this.strategy).then(() => { - this.stateService.go('admin.settings'); + this.stateService.go('admin.security'); }).catch((err: any) => { console.error(err); this.snackBar.open('An error occured while creating ' + this.strategy.title, null, { duration: 2000, }) - this.stateService.go('admin.settings'); + this.stateService.go('admin.security'); }); } diff --git a/web-app/admin/src/app/admin/admin-authentication/admin-authentication.component.html b/web-app/admin/src/app/admin/admin-authentication/admin-authentication.component.html index 0141543ff..bb48b8f7f 100644 --- a/web-app/admin/src/app/admin/admin-authentication/admin-authentication.component.html +++ b/web-app/admin/src/app/admin/admin-authentication/admin-authentication.component.html @@ -1,3 +1,6 @@ +
+ +