Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions public/app/services/simulation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,10 @@ module App {
this.$log.info('visualizing ' + name + ' at: ' + url);

// Make sure the layer group exists
let groupId = task.input.ensemble + '_' + task.input.simulation;
let ensamble = task.input.ensamble || 'dynamic';
let simulation = task.input.simulation || 'simulation';
let groupId = ensamble + '_' + simulation;

let group = this.layerService.findGroupById(groupId);
if (group === null) {
let title = task.input.ensemble + ': ' + task.input.simulation;
Expand Down Expand Up @@ -358,7 +361,10 @@ module App {
let key = formItem.key;
let layerId = 'input-' + task._id + '-' + key;

let groupId = task.input.ensemble + '_' + task.input.simulation;
let ensamble = task.input.ensamble || 'dynamic';
let simulation = task.input.simulation || 'simulation';
let groupId = ensamble + '_' + simulation;

let group = this.layerService.findGroupById(groupId);
if (group === null) {
let title = task.input.ensemble + ': ' + task.input.simulation;
Expand Down
21 changes: 13 additions & 8 deletions public/app/simform/simform.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,8 @@ module App {
}

// Initialize the simulation form
this.schema = {};
this.form = [];
this.model = {};
this.featureSubscriptions = [];
this.resetForm();
this.formLayers = [];
this.legend = "";

// Initialize custom type mapping BEFORE getting
// the simulation form
Expand Down Expand Up @@ -187,9 +183,11 @@ module App {
* Reset the simulation form
*/
private resetForm(): void {
this.featureSubscriptions.forEach(handle => {
this.messageBusService.unsubscribe(handle);
});
try {
this.featureSubscriptions.forEach(handle => {
this.messageBusService.unsubscribe(handle);
});
} catch(e) { }
this.featureSubscriptions = [];
this.form = [];
this.schema = {};
Expand All @@ -208,6 +206,13 @@ module App {
this.form = data.form;
this.legend = data.schema.title;

this.form.unshift('name'); // Push at the beginning
this.schema.properties['name'] = {
"type": "string",
"default": this.SimAdminService.simulationName,
"title": "Identifier"
};

this.$scope.$broadcast('schemaFormValidate');
} else {
this.resetForm();
Expand Down
2 changes: 1 addition & 1 deletion public/app/simlist/simlist.directive.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</div>

<button class="layer-action" ng-click="vm.toggleSimulationForm()">
<span class="fa fa-plus layer-action-icon"></span>{{show ? 'Show' : 'Hide'}} Simulation Form
<span class="fa fa-plus layer-action-icon"></span>{{show ? 'Show' : 'Hide'}} Dynamic Layer Input Form
</button>
</div>

Expand Down
7 changes: 4 additions & 3 deletions public/app/simlist/simlist.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,11 @@ module App {
this.tasks = response.data.rows.map(el => el.value);
var start: TaskEnsemble = {};
this.tasksByEnsemble = response.data.rows.reduce(function (ensembles, cur, index): TaskEnsemble {
if (!ensembles.hasOwnProperty(cur.value['input']['ensemble'])) {
ensembles[cur.value['input']['ensemble']] = [];
var taskName = cur.value.input.ensemble || cur.value.input.name;
if (!ensembles.hasOwnProperty(taskName)) {
ensembles[taskName] = [];
}
ensembles[cur.value['input']['ensemble']].push(cur.value);
ensembles[taskName].push(cur.value);
return ensembles;
}, start);
if (this.status) {
Expand Down