From 79f6daa87ff8ba75b15743bec734dfa2d6709a3a Mon Sep 17 00:00:00 2001 From: Andy Jones Date: Tue, 16 Apr 2024 16:53:01 +0100 Subject: [PATCH] nit fixes eslinting warnings in workflows #1104 nit eslinting fixes in workflows #1104 --- .../application-area/app-area-address-step.js | 6 +++--- .../application-area/app-area-final-step.js | 6 +++--- .../communication-select-resource.js | 12 ++++++------ .../consultation/consultation-map-step.js | 4 ++-- .../consultation/consultations-final-step.js | 10 +++++----- .../workflows/correspondence-letter-step.js | 2 +- .../components/workflows/file-template.js | 17 +++++++++-------- .../components/workflows/photo-gallery-step.js | 2 -- .../workflows/select-resource-step.js | 8 ++++---- .../site-visit/site-visit-final-step.js | 10 +++++----- .../views/components/workflows/summary-step.js | 18 +++++++++--------- 11 files changed, 47 insertions(+), 48 deletions(-) diff --git a/arches_her/media/js/views/components/workflows/application-area/app-area-address-step.js b/arches_her/media/js/views/components/workflows/application-area/app-area-address-step.js index af849a16d..29587065d 100644 --- a/arches_her/media/js/views/components/workflows/application-area/app-area-address-step.js +++ b/arches_her/media/js/views/components/workflows/application-area/app-area-address-step.js @@ -50,7 +50,7 @@ define([ "9c9f9dbe-83bf-11ea-aa43-f875a44e0e11": "2df285fa-9cf2-45e7-bc05-a67b7d7ddc2f", "9c9f9dbf-83bf-11ea-b1a9-f875a44e0e11": "e987fb72-6fa6-43ab-8812-867c4813a2a2", "9c9f9dc0-83bf-11ea-8d22-f875a44e0e11": self.applicationAreaName() - } + }; }); var addressTileDataObj = ko.pureComputed(function(){ @@ -89,7 +89,7 @@ define([ "7ee45beb-eeb5-11eb-8679-a87eeabdefba": self.county(), "7ee43307-eeb5-11eb-99c7-a87eeabdefba": self.postcode(), "7ee432ff-eeb5-11eb-8299-a87eeabdefba": self.fullAddress() - } + }; }); this.updatedValue = ko.pureComputed(function(){ @@ -183,7 +183,7 @@ define([ params.form.savedData(self.updatedValue()); }); }; - }; + } return ko.components.register('app-area-address-step', { viewModel: viewModel, diff --git a/arches_her/media/js/views/components/workflows/application-area/app-area-final-step.js b/arches_her/media/js/views/components/workflows/application-area/app-area-final-step.js index 91df8db1b..bafc29a2d 100644 --- a/arches_her/media/js/views/components/workflows/application-area/app-area-final-step.js +++ b/arches_her/media/js/views/components/workflows/application-area/app-area-final-step.js @@ -21,8 +21,8 @@ define([ try { this.reportVals.designations = val.resource['Designation and Protection Assignment'].map(function(designation){ - const reference = self.getResourceValue(designation,['Reference URL','@value']) - const referenceUrl = (reference !== 'none') ? JSON.parse(reference).url : undefined + const reference = self.getResourceValue(designation,['Reference URL','@value']); + const referenceUrl = (reference !== 'none') ? JSON.parse(reference).url : undefined; const referenceLabel = (reference !== 'none') && JSON.parse(reference).url_label !== '' ? JSON.parse(reference).url_label : referenceUrl ? referenceUrl: 'none'; return { @@ -34,7 +34,7 @@ define([ designationReference: {'name': 'Reference', 'value': referenceLabel, 'link': referenceUrl}, designationDigitalFiles: {'name': 'Digital File(s)', 'value': self.getResourceValue(designation,['Digital File(s)','@value'])}, }; - }) + }); } catch(e) { this.reportVals.designations = []; } diff --git a/arches_her/media/js/views/components/workflows/communication-workflow/communication-select-resource.js b/arches_her/media/js/views/components/workflows/communication-workflow/communication-select-resource.js index 5d12dfa2f..423ed3e75 100644 --- a/arches_her/media/js/views/components/workflows/communication-workflow/communication-select-resource.js +++ b/arches_her/media/js/views/components/workflows/communication-workflow/communication-select-resource.js @@ -16,7 +16,7 @@ define([ this.graphid = params.graphid; var getValue = function(key) { return ko.unwrap(params.value) ? params.value()[key] : null; - } + }; this.date = ko.observable(getValue('date')); this.subject = ko.observable(getValue('subject')); this.type = ko.observable(getValue('type')); @@ -36,7 +36,7 @@ define([ resourceXresourceId: "" }]); } - }) + }); this.resourceid(getValue('resourceid')); if (this.resourceid()){ @@ -57,14 +57,14 @@ define([ if (self.resourceid()) { params.value(val); } - }) + }); var communicationTileData = ko.pureComputed(function(){ return { "caf5bff5-a3d7-11e9-8c7e-00224800b26d": ko.unwrap(self.date), //data node "f4ea6a30-9378-11ea-a36d-f875a44e0e11": ko.unwrap(self.subject), //subject "caf5bff4-a3d7-11e9-99c5-00224800b26d": ko.unwrap(self.type), //type - } + }; }); this.buildTile = function(tileDataObj, nodeGroupId, resourceid, tileid) { @@ -102,7 +102,7 @@ define([ params.form.error(new Error("Missing Required Value")); params.pageVm.alert(new AlertViewModel('ep-alert-red', result.title, result.message)); return; - }) + }); } }); }; @@ -119,7 +119,7 @@ define([ resourceid: self.resourceid(), ...self.updatedValue() }); } - }) + }); }; } diff --git a/arches_her/media/js/views/components/workflows/consultation/consultation-map-step.js b/arches_her/media/js/views/components/workflows/consultation/consultation-map-step.js index 814bfbdb9..15dafdba7 100644 --- a/arches_her/media/js/views/components/workflows/consultation/consultation-map-step.js +++ b/arches_her/media/js/views/components/workflows/consultation/consultation-map-step.js @@ -28,7 +28,7 @@ define([ params.form.complete(true); params.form.saving(false); } - ) + ); }; this.sources = { "related-application-area": { @@ -139,7 +139,7 @@ define([ this.map = ko.observable(); self.tile().dirty.subscribe(function(dirty) { - params.dirty(dirty) + params.dirty(dirty); }); const GeoJsonNode = 'b949053a-184f-11eb-ac4a-f875a44e0e11'; diff --git a/arches_her/media/js/views/components/workflows/consultation/consultations-final-step.js b/arches_her/media/js/views/components/workflows/consultation/consultations-final-step.js index 4186e5989..d31d98641 100644 --- a/arches_her/media/js/views/components/workflows/consultation/consultations-final-step.js +++ b/arches_her/media/js/views/components/workflows/consultation/consultations-final-step.js @@ -42,7 +42,7 @@ define([ referenceType: {'name': 'Reference Type', 'value': self.getResourceValue(ref, ['Agency Identifier', 'Reference Type', '@value'])}, agency: {'name': 'Agency', 'value': self.getResourceValue(ref, ['Agency', '@value'])} }; - }) + }); } catch(e) { this.reportVals.references = []; } @@ -56,11 +56,11 @@ define([ } catch(e) { //pass } - }; + } this.resourceLoading(false); if (!self.relatedResourceLoading()) { self.loading(false); - }; + } if (!val.resource['Status']) { var statusNodegroupId = '6a773228-db20-11e9-b6dd-784f435179ea'; @@ -105,8 +105,8 @@ define([ self.relatedResourceLoading(false); if (!self.resourceLoading()) { self.loading(false); - }; - }) + } + }); } ko.components.register('consultations-final-step', { diff --git a/arches_her/media/js/views/components/workflows/correspondence-letter-step.js b/arches_her/media/js/views/components/workflows/correspondence-letter-step.js index 27cd49cb9..37e930889 100644 --- a/arches_her/media/js/views/components/workflows/correspondence-letter-step.js +++ b/arches_her/media/js/views/components/workflows/correspondence-letter-step.js @@ -6,7 +6,7 @@ define([ 'views/components/workflows/new-tile-step', 'viewmodels/alert', 'templates/views/components/workflows/correspondence-letter-step.htm' -], function($, arches, ko, koMapping, NewTileStep, AlertViewMode, CorrespondenceLetterStepTemplate) { +], function($, arches, ko, koMapping, NewTileStep, AlertViewModel, CorrespondenceLetterStepTemplate) { function viewModel(params) { NewTileStep.apply(this, [params]); diff --git a/arches_her/media/js/views/components/workflows/file-template.js b/arches_her/media/js/views/components/workflows/file-template.js index 60bcebeb0..0f433813a 100644 --- a/arches_her/media/js/views/components/workflows/file-template.js +++ b/arches_her/media/js/views/components/workflows/file-template.js @@ -4,9 +4,10 @@ define([ 'arches', 'knockout', 'knockout-mapping', + 'viewmodels/alert', 'views/components/workflows/new-tile-step', 'templates/views/components/workflows/new-tile-step.htm' -], function(_, $, arches, ko, koMapping, NewTileStep, NewTileStepTemplate) { +], function(_, $, arches, ko, koMapping, AlertViewModel, NewTileStep, NewTileStepTemplate) { function viewModel(params) { @@ -29,12 +30,12 @@ define([ params.defineStateProperties = function(){ - return { - resourceid: ko.unwrap(params.resourceid), - tile: !!(params.tile) ? koMapping.toJS(params.tile().data) : undefined, - tileid: !!(params.tile) ? ko.unwrap(params.tile().tileid): undefined - } + return { + resourceid: ko.unwrap(params.resourceid), + tile: !!(params.tile) ? koMapping.toJS(params.tile().data) : undefined, + tileid: !!(params.tile) ? ko.unwrap(params.tile().tileid): undefined }; + }; self.tile.subscribe(function(val) { if(val) { @@ -77,11 +78,11 @@ define([ } self.loading(false); }; - }; + } return ko.components.register('file-template', { viewModel: viewModel, template: NewTileStepTemplate }); - return viewModel; + }); diff --git a/arches_her/media/js/views/components/workflows/photo-gallery-step.js b/arches_her/media/js/views/components/workflows/photo-gallery-step.js index 8936d9bfb..d8ee82715 100644 --- a/arches_her/media/js/views/components/workflows/photo-gallery-step.js +++ b/arches_her/media/js/views/components/workflows/photo-gallery-step.js @@ -29,6 +29,4 @@ define([ viewModel: viewModel, template: PhotoGalleryStepTemplate }); - - return viewModel; }); diff --git a/arches_her/media/js/views/components/workflows/select-resource-step.js b/arches_her/media/js/views/components/workflows/select-resource-step.js index 4be8f2a45..30e02df22 100644 --- a/arches_her/media/js/views/components/workflows/select-resource-step.js +++ b/arches_her/media/js/views/components/workflows/select-resource-step.js @@ -16,17 +16,17 @@ define([ if (val){ self.tile().resourceinstance_id = val; } - }) + }); this.tile().transactionId = this.workflowId; this.tile().dirty.subscribe(function(dirty) { - self.dirty(dirty) + self.dirty(dirty); }); this.initilize = function(){ if (ko.unwrap(self.savedData)) { self.resourceValue(ko.unwrap(self.savedData).resourceInstanceId); } - } + }; params.form.save = function() { self.tile().save().then( @@ -41,7 +41,7 @@ define([ params.form.complete(true); params.form.saving(false); } - ) + ); }; this.initilize(); } diff --git a/arches_her/media/js/views/components/workflows/site-visit/site-visit-final-step.js b/arches_her/media/js/views/components/workflows/site-visit/site-visit-final-step.js index fae359330..2abf58425 100644 --- a/arches_her/media/js/views/components/workflows/site-visit/site-visit-final-step.js +++ b/arches_her/media/js/views/components/workflows/site-visit/site-visit-final-step.js @@ -29,7 +29,7 @@ define([ consultationName: {'name': 'Consultation', 'value': this.getResourceValue(val, ['displayname'])}, date: {'name': 'Date', 'value': this.getResourceValue(currentSiteVisit, ['Timespan of Visit', 'Date of Visit', '@value'])}, locatinDescription: {'name': 'Visit Location Description', 'value': this.getResourceValue(currentSiteVisit, ['Location', 'Location Descriptions', 'Location Description', '@value'])}, - } + }; try { this.reportVals.attendees = currentSiteVisit['Attendees'].map(function(attendee){ @@ -37,7 +37,7 @@ define([ attendee: {'name': 'Attendee', 'value': self.getResourceValue(attendee, ['Attendee', '@value'])}, attendeeType: {'name': 'Type', 'value': self.getResourceValue(attendee, ['Attendee Type', '@value'])}, }; - }) + }); } catch(e) { this.reportVals.attendees = []; } @@ -48,7 +48,7 @@ define([ observation: {'name': 'observation', 'value': self.getResourceValue(obs, ['Observation', 'Observation Notes', '@value'])}, observedBy: {'name': 'observedBy', 'value': self.getResourceValue(obs, ['Observed by', '@value'])}, }; - }) + }); } catch(e) { this.reportVals.observations = []; } @@ -59,7 +59,7 @@ define([ recommendation: {'name': 'recommendation', 'value': self.getResourceValue(rec, ['Recommendation', 'Recommendation Value', '@value'])}, recommendedBy: {'name': 'recommendedBy', 'value': self.getResourceValue(rec, ['Recommended by', '@value'])}, }; - }) + }); } catch(e) { this.reportVals.recommendations = []; } @@ -73,7 +73,7 @@ define([ copyrightHolder: {'name': 'Copyright Holder', 'value': self.getResourceValue(photograph, ['Copyright', 'Copyright Holder', '@value'])}, copyrightNotes: {'name': 'Copyright Notes', 'value': self.getResourceValue(photograph, ['Copyright', 'Copyright Note', 'Copyright Note Text', '@value'])}, }; - }) + }); } catch(e) { this.reportVals.photographs = []; } diff --git a/arches_her/media/js/views/components/workflows/summary-step.js b/arches_her/media/js/views/components/workflows/summary-step.js index 61afa8137..4f3e29a20 100644 --- a/arches_her/media/js/views/components/workflows/summary-step.js +++ b/arches_her/media/js/views/components/workflows/summary-step.js @@ -14,24 +14,24 @@ define([ this.getResourceData = function() { window.fetch(this.urls.api_resources(this.resourceid) + '?format=json&compact=false') - .then(response => response.json()) - .then(data => this.resourceData(data)) + .then(response => response.json()) + .then(data => this.resourceData(data)); }; this.getRelatedResources = function() { window.fetch(this.urls.related_resources + this.resourceid + "?paginate=false") - .then(response => response.json()) - .then(data => this.relatedResources(data)) + .then(response => response.json()) + .then(data => this.relatedResources(data)); }; this.init = function(){ this.getResourceData(); - this.getRelatedResources() + this.getRelatedResources(); }; this.getResourceValue = function(obj, attrs, missingValue='none') { try { - return attrs.reduce(function index(obj, i) {return obj[i]}, obj) || missingValue; + return attrs.reduce(function index(obj, i) {return obj[i];}, obj) || missingValue; } catch(e) { return missingValue; } @@ -45,9 +45,9 @@ define([ } var sourceConfig = {}; sourceConfig[source] = { - "type": "geojson", - "data": geojson - }; + "type": "geojson", + "data": geojson + }; mapParams.sources = Object.assign(sourceConfig, mapParams.sources); mapParams.layers = selectFeatureLayersFactory( '', //resourceid