@abi-software/simulationvuer 0.5.2 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/simulationvuer",
3
- "version": "0.5.2",
3
+ "version": "0.5.5",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve --mode static",
package/src/.DS_Store CHANGED
Binary file
package/src/App.vue CHANGED
@@ -37,14 +37,12 @@ export default {
37
37
  },
38
38
  normalEntry: {
39
39
  dataset: "https://sparc.science/datasets/135?type=dataset",
40
- datasetId: 135,
41
40
  description: "CellML version of the Fabbri et al. 2017 mathematical model of the spontaneous electrical activity of a human sinoatrial node (SAN) pacemaker cell",
42
41
  name: "Computational analysis of the human sinus node action potential - Model development and effects of mutations",
43
42
  resource: "https://models.physiomeproject.org/workspace/486/rawfile/55879cbc485e2d4c41f3dc6d60424b849f94c4ee/HumanSAN_Fabbri_Fantini_Wilders_Severi_2017.cellml",
44
43
  },
45
44
  compositeEntry: {
46
45
  dataset: "https://sparc.science/datasets/157?type=dataset",
47
- datasetId: 157,
48
46
  description: "CellML version of the Fabbri et al. 2017 human sinoatrial node (SAN) cell model and an ODE-based version of the Gerstner & Kistler 2002 brain stem model combined to demonstrate the effect of brain stem activity on heart rate",
49
47
  name: "Fabbri-based composite SAN model",
50
48
  resource: "https://models.physiomeproject.org/workspace/698/rawfile/f3fc911063ac72ed44e84c0c5af28df41c25d452/fabbri_et_al_based_composite_SAN_model.sedml",
@@ -178,48 +178,58 @@ export default {
178
178
  },
179
179
  },
180
180
  created: function() {
181
- this.userMessage = "Retrieving UI information...";
182
- this.showUserMessage = true;
181
+ let url = document.createElement("a");
183
182
 
184
- // Retrieve the simulation UI file for the given dataset.
183
+ url.href = this.entry.dataset;
185
184
 
186
- let xmlhttp = new XMLHttpRequest();
185
+ let datasetId = url.pathname.replace("/datasets/", "");
187
186
 
188
- xmlhttp.open("GET", this.apiLocation + "/simulation_ui_file/" + this.entry.datasetId, true);
189
- xmlhttp.setRequestHeader("Content-type", "application/json");
190
- xmlhttp.onreadystatechange = () => {
191
- if (xmlhttp.readyState === 4) {
192
- // Keep track of the simulation UI information.
187
+ if (datasetId !== "/undefined") {
188
+ // Let people know that we are retrieving our UI information.
193
189
 
194
- this.simulationUiInformation = JSON.parse(xmlhttp.responseText);
190
+ this.userMessage = "Retrieving UI information...";
191
+ this.showUserMessage = true;
195
192
 
196
- // Make sure that the simulation UI information is valid.
193
+ // Retrieve the simulation UI file for the given dataset.
197
194
 
198
- this.hasValidSimulationUiInformation = validJson(this.simulationUiInformation);
195
+ let xmlhttp = new XMLHttpRequest();
199
196
 
200
- if (!this.hasValidSimulationUiInformation) {
201
- this.showUserMessage = false;
197
+ xmlhttp.open("GET", this.apiLocation + "/simulation_ui_file/" + datasetId, true);
198
+ xmlhttp.setRequestHeader("Content-type", "application/json");
199
+ xmlhttp.onreadystatechange = () => {
200
+ if (xmlhttp.readyState === 4) {
201
+ // Keep track of the simulation UI information.
202
202
 
203
- return;
204
- }
203
+ this.simulationUiInformation = JSON.parse(xmlhttp.responseText);
205
204
 
206
- // Initialise our UI.
205
+ // Make sure that the simulation UI information is valid.
207
206
 
208
- initialiseUi(this);
207
+ this.hasValidSimulationUiInformation = validJson(this.simulationUiInformation);
209
208
 
210
- // Finalise our UI.
211
- // Note: we try both here and in the mounded() function since we have no
212
- // idea how long it's going to take to retrieve the simulation UI
213
- // information.
209
+ if (!this.hasValidSimulationUiInformation) {
210
+ this.showUserMessage = false;
214
211
 
215
- this.$nextTick(() => {
216
- finaliseUi(this);
212
+ return;
213
+ }
217
214
 
218
- this.showUserMessage = false;
219
- });
220
- }
221
- };
222
- xmlhttp.send();
215
+ // Initialise our UI.
216
+
217
+ initialiseUi(this);
218
+
219
+ // Finalise our UI.
220
+ // Note: we try both here and in the mounded() function since we have no
221
+ // idea how long it's going to take to retrieve the simulation UI
222
+ // information.
223
+
224
+ this.$nextTick(() => {
225
+ finaliseUi(this);
226
+
227
+ this.showUserMessage = false;
228
+ });
229
+ }
230
+ };
231
+ xmlhttp.send();
232
+ }
223
233
  },
224
234
  mounted: function() {
225
235
  // Finalise our UI.
@@ -79,16 +79,19 @@ export function validJson(json) {
79
79
  type: "object",
80
80
  },
81
81
  minItems: 1,
82
+ required: true,
82
83
  type: "array",
83
84
  },
84
85
  output: {
85
86
  additionalProperties: false,
87
+ minItems: 1,
86
88
  properties: {
87
89
  data: {
88
90
  items: {
89
91
  additionalProperties: false,
90
92
  properties: {
91
93
  id: {
94
+ required: true,
92
95
  type: "string",
93
96
  },
94
97
  name: {
@@ -98,6 +101,8 @@ export function validJson(json) {
98
101
  },
99
102
  type: "object",
100
103
  },
104
+ minItems: 1,
105
+ required: true,
101
106
  type: "array",
102
107
  },
103
108
  plots: {