@abi-software/simulationvuer 0.5.5 → 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/dist/simulationvuer.common.js +137 -119
- package/dist/simulationvuer.common.js.map +1 -1
- package/dist/simulationvuer.css +1 -1
- package/dist/simulationvuer.umd.js +137 -119
- package/dist/simulationvuer.umd.js.map +1 -1
- package/dist/simulationvuer.umd.min.js +1 -1
- package/dist/simulationvuer.umd.min.js.map +1 -1
- package/package-lock.json +1 -1
- package/package.json +1 -1
- package/src/.DS_Store +0 -0
- package/src/App.vue +3 -22
- package/src/components/SimulationVuer.vue +63 -45
|
@@ -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
|
|
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
|
-
|
|
55
|
+
id: {
|
|
56
56
|
required: true,
|
|
57
|
-
type:
|
|
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.
|
|
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.
|
|
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",
|
|
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,15 +202,9 @@ export default {
|
|
|
178
202
|
},
|
|
179
203
|
},
|
|
180
204
|
created: function() {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
url.href = this.entry.dataset;
|
|
184
|
-
|
|
185
|
-
let datasetId = url.pathname.replace("/datasets/", "");
|
|
186
|
-
|
|
187
|
-
if (datasetId !== "/undefined") {
|
|
188
|
-
// Let people know that we are retrieving our UI information.
|
|
205
|
+
// Try to retrieve the UI information, but only if we have a resource.
|
|
189
206
|
|
|
207
|
+
if (this.resource !== undefined) {
|
|
190
208
|
this.userMessage = "Retrieving UI information...";
|
|
191
209
|
this.showUserMessage = true;
|
|
192
210
|
|
|
@@ -194,38 +212,38 @@ export default {
|
|
|
194
212
|
|
|
195
213
|
let xmlhttp = new XMLHttpRequest();
|
|
196
214
|
|
|
197
|
-
xmlhttp.open("GET",
|
|
215
|
+
xmlhttp.open("GET", process.env.VUE_APP_API_LOCATION + "simulation_ui_file/" + this.id, true);
|
|
198
216
|
xmlhttp.setRequestHeader("Content-type", "application/json");
|
|
199
217
|
xmlhttp.onreadystatechange = () => {
|
|
200
218
|
if (xmlhttp.readyState === 4) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
this.simulationUiInformation = JSON.parse(xmlhttp.responseText);
|
|
219
|
+
this.showUserMessage = false;
|
|
204
220
|
|
|
205
|
-
|
|
221
|
+
if (xmlhttp.status === 200) {
|
|
222
|
+
// Keep track of the simulation UI information.
|
|
206
223
|
|
|
207
|
-
|
|
224
|
+
this.simulationUiInformation = JSON.parse(xmlhttp.responseText);
|
|
208
225
|
|
|
209
|
-
|
|
210
|
-
this.showUserMessage = false;
|
|
226
|
+
// Make sure that the simulation UI information is valid.
|
|
211
227
|
|
|
212
|
-
|
|
213
|
-
}
|
|
228
|
+
this.hasValidSimulationUiInformation = validJson(this.simulationUiInformation);
|
|
214
229
|
|
|
215
|
-
|
|
230
|
+
if (!this.hasValidSimulationUiInformation) {
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
216
233
|
|
|
217
|
-
|
|
234
|
+
// Initialise our UI.
|
|
218
235
|
|
|
219
|
-
|
|
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.
|
|
236
|
+
initialiseUi(this);
|
|
223
237
|
|
|
224
|
-
|
|
225
|
-
|
|
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.
|
|
226
242
|
|
|
227
|
-
this
|
|
228
|
-
|
|
243
|
+
this.$nextTick(() => {
|
|
244
|
+
finaliseUi(this);
|
|
245
|
+
});
|
|
246
|
+
}
|
|
229
247
|
}
|
|
230
248
|
};
|
|
231
249
|
xmlhttp.send();
|
|
@@ -336,18 +354,18 @@ p.default {
|
|
|
336
354
|
p.error {
|
|
337
355
|
margin-left: 16px;
|
|
338
356
|
}
|
|
339
|
-
p.
|
|
340
|
-
font-size: 12px;
|
|
341
|
-
line-height: 16px;
|
|
342
|
-
}
|
|
343
|
-
p.title,
|
|
357
|
+
p.name,
|
|
344
358
|
p.input-parameters {
|
|
345
359
|
margin-top: 0;
|
|
346
360
|
font-weight: 500 /* Medium */;
|
|
347
361
|
}
|
|
348
|
-
p.
|
|
362
|
+
p.name {
|
|
349
363
|
line-height: 20px;
|
|
350
364
|
}
|
|
365
|
+
p.note {
|
|
366
|
+
font-size: 12px;
|
|
367
|
+
line-height: 16px;
|
|
368
|
+
}
|
|
351
369
|
span.error {
|
|
352
370
|
font-weight: 500 /* Medium */;
|
|
353
371
|
}
|