@abi-software/simulationvuer 0.5.3 → 0.5.6

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.3",
3
+ "version": "0.5.6",
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
@@ -7,17 +7,17 @@
7
7
  <p>
8
8
  Instance for an unknown or invalid model:
9
9
  </p>
10
- <SimulationVuer :apiLocation="apiLocation" :entry="noEntry" />
10
+ <SimulationVuer :id=0 />
11
11
  <hr />
12
12
  <p>
13
13
  Instance showing the simulation of the <a href="https://models.physiomeproject.org/e/611/HumanSAN_Fabbri_Fantini_Wilders_Severi_2017.cellml/view">Fabbri <em>et al.</em> (2017)</a> model:
14
14
  </p>
15
- <SimulationVuer :apiLocation="apiLocation" :entry="normalEntry" />
15
+ <SimulationVuer :id=135 />
16
16
  <hr />
17
17
  <p>
18
18
  Instance showing the simulation of the <a href="https://models.physiomeproject.org/e/611/HumanSAN_Fabbri_Fantini_Wilders_Severi_2017.cellml/view">Fabbri <em>et al.</em> (2017)</a> + <a href="https://models.physiomeproject.org/workspace/694">Gerstner & Kistler (2002)</a> composite model:
19
19
  </p>
20
- <SimulationVuer :apiLocation="apiLocation" :entry="compositeEntry" style="height: 500px;" />
20
+ <SimulationVuer :id=157 />
21
21
  <hr />
22
22
  </div>
23
23
  </template>
@@ -30,27 +30,6 @@ export default {
30
30
  components: {
31
31
  SimulationVuer,
32
32
  },
33
- data: function () {
34
- return {
35
- apiLocation: process.env.VUE_APP_API_LOCATION,
36
- noEntry: {
37
- },
38
- normalEntry: {
39
- dataset: "https://sparc.science/datasets/135?type=dataset",
40
- datasetId: 135,
41
- 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
- name: "Computational analysis of the human sinus node action potential - Model development and effects of mutations",
43
- resource: "https://models.physiomeproject.org/workspace/486/rawfile/55879cbc485e2d4c41f3dc6d60424b849f94c4ee/HumanSAN_Fabbri_Fantini_Wilders_Severi_2017.cellml",
44
- },
45
- compositeEntry: {
46
- dataset: "https://sparc.science/datasets/157?type=dataset",
47
- datasetId: 157,
48
- 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
- name: "Fabbri-based composite SAN model",
50
- resource: "https://models.physiomeproject.org/workspace/698/rawfile/f3fc911063ac72ed44e84c0c5af28df41c25d452/fabbri_et_al_based_composite_SAN_model.sedml",
51
- },
52
- };
53
- },
54
33
  };
55
34
  </script>
56
35
 
@@ -3,7 +3,7 @@
3
3
  <p v-if="!hasValidSimulationUiInformation && !showUserMessage" class="default error"><span class="error">Error:</span> an unknown or invalid model was provided.</p>
4
4
  <div class="main" v-if="hasValidSimulationUiInformation">
5
5
  <div class="main-left">
6
- <p class="default title">{{title}}</p>
6
+ <p class="default name">{{name}}</p>
7
7
  <el-divider></el-divider>
8
8
  <p class="default input-parameters">Input parameters</p>
9
9
  <div>
@@ -52,16 +52,39 @@ export default {
52
52
  SimulationVuerInput,
53
53
  },
54
54
  props: {
55
- apiLocation: {
55
+ id: {
56
56
  required: true,
57
- type: String,
58
- },
59
- entry: {
60
- required: true,
61
- type: Object,
57
+ type: Number,
62
58
  },
63
59
  },
64
60
  data: function() {
61
+ let xmlhttp = new XMLHttpRequest();
62
+ let name = undefined;
63
+ let resource = undefined;
64
+
65
+ xmlhttp.open("GET", process.env.VUE_APP_API_LOCATION + "dataset_info/using_pennsieve_identifier?identifier=" + this.id, false);
66
+ xmlhttp.setRequestHeader("Content-type", "application/json");
67
+ xmlhttp.send();
68
+
69
+ if (xmlhttp.status === 200) {
70
+ let datasetInfo = JSON.parse(xmlhttp.responseText).result[0];
71
+
72
+ if (datasetInfo !== undefined) {
73
+ name = datasetInfo.name;
74
+
75
+ let isSedmlResource = false;
76
+
77
+ datasetInfo.additionalLinks.forEach(function(el) {
78
+ if (el.description == "SED-ML file") {
79
+ isSedmlResource = true;
80
+ resource = el.uri;
81
+ } else if (!isSedmlResource && (el.description == "CellML file")) {
82
+ resource = el.uri;
83
+ }
84
+ });
85
+ }
86
+ }
87
+
65
88
  return {
66
89
  errorMessage: "",
67
90
  firstScalarInput: [],
@@ -70,12 +93,13 @@ export default {
70
93
  isMounted: false,
71
94
  isSimulationValid: true,
72
95
  layout: [],
96
+ name: name,
97
+ resource: resource,
73
98
  showUserMessage: false,
74
99
  simulationData: [],
75
100
  simulationDataId: {},
76
101
  simulationUiInformation: {},
77
102
  userMessage: "",
78
- title: (this.entry !== undefined)?this.entry.name:"",
79
103
  ui: null,
80
104
  };
81
105
  },
@@ -84,14 +108,14 @@ export default {
84
108
  window.open("https://osparc.io/", "_blank");
85
109
  },
86
110
  viewDataset() {
87
- window.open(this.entry.dataset, "_blank");
111
+ window.open(`https://sparc.science/datasets/${this.id}?type=dataset`, "_blank");
88
112
  },
89
113
  runSimulation() {
90
114
  this.userMessage = "Loading simulation results...";
91
115
  this.showUserMessage = true;
92
116
 
93
117
  let request = {
94
- model_url: this.entry.resource,
118
+ model_url: this.resource,
95
119
  json_config: {},
96
120
  };
97
121
 
@@ -131,7 +155,7 @@ export default {
131
155
 
132
156
  let xmlhttp = new XMLHttpRequest();
133
157
 
134
- xmlhttp.open("POST", this.apiLocation + "/simulation", true);
158
+ xmlhttp.open("POST", process.env.VUE_APP_API_LOCATION + "simulation", true);
135
159
  xmlhttp.setRequestHeader("Content-type", "application/json");
136
160
  xmlhttp.onreadystatechange = () => {
137
161
  if (xmlhttp.readyState === 4) {
@@ -178,48 +202,52 @@ export default {
178
202
  },
179
203
  },
180
204
  created: function() {
181
- this.userMessage = "Retrieving UI information...";
182
- this.showUserMessage = true;
205
+ // Try to retrieve the UI information, but only if we have a resource.
183
206
 
184
- // Retrieve the simulation UI file for the given dataset.
207
+ if (this.resource !== undefined) {
208
+ this.userMessage = "Retrieving UI information...";
209
+ this.showUserMessage = true;
185
210
 
186
- let xmlhttp = new XMLHttpRequest();
211
+ // Retrieve the simulation UI file for the given dataset.
187
212
 
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.
213
+ let xmlhttp = new XMLHttpRequest();
193
214
 
194
- this.simulationUiInformation = JSON.parse(xmlhttp.responseText);
215
+ xmlhttp.open("GET", process.env.VUE_APP_API_LOCATION + "simulation_ui_file/" + this.id, true);
216
+ xmlhttp.setRequestHeader("Content-type", "application/json");
217
+ xmlhttp.onreadystatechange = () => {
218
+ if (xmlhttp.readyState === 4) {
219
+ this.showUserMessage = false;
195
220
 
196
- // Make sure that the simulation UI information is valid.
221
+ if (xmlhttp.status === 200) {
222
+ // Keep track of the simulation UI information.
197
223
 
198
- this.hasValidSimulationUiInformation = validJson(this.simulationUiInformation);
224
+ this.simulationUiInformation = JSON.parse(xmlhttp.responseText);
199
225
 
200
- if (!this.hasValidSimulationUiInformation) {
201
- this.showUserMessage = false;
226
+ // Make sure that the simulation UI information is valid.
202
227
 
203
- return;
204
- }
228
+ this.hasValidSimulationUiInformation = validJson(this.simulationUiInformation);
205
229
 
206
- // Initialise our UI.
230
+ if (!this.hasValidSimulationUiInformation) {
231
+ return;
232
+ }
207
233
 
208
- initialiseUi(this);
234
+ // Initialise our UI.
209
235
 
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.
236
+ initialiseUi(this);
214
237
 
215
- this.$nextTick(() => {
216
- finaliseUi(this);
238
+ // Finalise our UI.
239
+ // Note: we try both here and in the mounded() function since we have no
240
+ // idea how long it's going to take to retrieve the simulation UI
241
+ // information.
217
242
 
218
- this.showUserMessage = false;
219
- });
220
- }
221
- };
222
- xmlhttp.send();
243
+ this.$nextTick(() => {
244
+ finaliseUi(this);
245
+ });
246
+ }
247
+ }
248
+ };
249
+ xmlhttp.send();
250
+ }
223
251
  },
224
252
  mounted: function() {
225
253
  // Finalise our UI.
@@ -326,18 +354,18 @@ p.default {
326
354
  p.error {
327
355
  margin-left: 16px;
328
356
  }
329
- p.note {
330
- font-size: 12px;
331
- line-height: 16px;
332
- }
333
- p.title,
357
+ p.name,
334
358
  p.input-parameters {
335
359
  margin-top: 0;
336
360
  font-weight: 500 /* Medium */;
337
361
  }
338
- p.title {
362
+ p.name {
339
363
  line-height: 20px;
340
364
  }
365
+ p.note {
366
+ font-size: 12px;
367
+ line-height: 16px;
368
+ }
341
369
  span.error {
342
370
  font-weight: 500 /* Medium */;
343
371
  }