Skip to content

Commit

Permalink
nit fixes eslinting warnings in workflows #1104
Browse files Browse the repository at this point in the history
nit eslinting fixes in workflows #1104
  • Loading branch information
aj-he committed Apr 17, 2024
1 parent 79325e5 commit 79f6daa
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand Down Expand Up @@ -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(){
Expand Down Expand Up @@ -183,7 +183,7 @@ define([
params.form.savedData(self.updatedValue());
});
};
};
}

return ko.components.register('app-area-address-step', {
viewModel: viewModel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 = [];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand All @@ -36,7 +36,7 @@ define([
resourceXresourceId: ""
}]);
}
})
});

this.resourceid(getValue('resourceid'));
if (this.resourceid()){
Expand All @@ -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) {
Expand Down Expand Up @@ -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;
})
});
}
});
};
Expand All @@ -119,7 +119,7 @@ define([
resourceid: self.resourceid(), ...self.updatedValue()
});
}
})
});
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ define([
params.form.complete(true);
params.form.saving(false);
}
)
);
};
this.sources = {
"related-application-area": {
Expand Down Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
}
Expand All @@ -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';
Expand Down Expand Up @@ -105,8 +105,8 @@ define([
self.relatedResourceLoading(false);
if (!self.resourceLoading()) {
self.loading(false);
};
})
}
});
}

ko.components.register('consultations-final-step', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
17 changes: 9 additions & 8 deletions arches_her/media/js/views/components/workflows/file-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand All @@ -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) {
Expand Down Expand Up @@ -77,11 +78,11 @@ define([
}
self.loading(false);
};
};
}

return ko.components.register('file-template', {
viewModel: viewModel,
template: NewTileStepTemplate
});
return viewModel;

});
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,4 @@ define([
viewModel: viewModel,
template: PhotoGalleryStepTemplate
});

return viewModel;
});
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -41,7 +41,7 @@ define([
params.form.complete(true);
params.form.saving(false);
}
)
);
};
this.initilize();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ 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){
return {
attendee: {'name': 'Attendee', 'value': self.getResourceValue(attendee, ['Attendee', '@value'])},
attendeeType: {'name': 'Type', 'value': self.getResourceValue(attendee, ['Attendee Type', '@value'])},
};
})
});
} catch(e) {
this.reportVals.attendees = [];
}
Expand All @@ -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 = [];
}
Expand All @@ -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 = [];
}
Expand All @@ -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 = [];
}
Expand Down
18 changes: 9 additions & 9 deletions arches_her/media/js/views/components/workflows/summary-step.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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
Expand Down

0 comments on commit 79f6daa

Please sign in to comment.