@abi-software/simulationvuer 2.0.7 → 2.0.8
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.js +3646 -3637
- package/dist/simulationvuer.umd.cjs +30 -30
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/App.vue +110 -16
- package/src/components/SimulationVuer.vue +46 -29
- package/vuese-generator.js +0 -1
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
<p class="default note" v-if="uuid">Additional parameters are available on oSPARC</p>
|
|
34
34
|
</div>
|
|
35
35
|
<div class="main-right" ref="output" v-show="isSimulationValid">
|
|
36
|
-
<PlotVuer v-for="(
|
|
36
|
+
<PlotVuer v-for="(_outputPlot, index) in simulationUiInfo.output.plots"
|
|
37
37
|
:key="`output-${index}`"
|
|
38
38
|
:metadata="plotMetadata(index)"
|
|
39
39
|
:data-source="{data: simulationResults[index]}"
|
|
@@ -82,7 +82,7 @@ export default {
|
|
|
82
82
|
},
|
|
83
83
|
props: {
|
|
84
84
|
/**
|
|
85
|
-
* The
|
|
85
|
+
* The URL to the API location.
|
|
86
86
|
*/
|
|
87
87
|
apiLocation: {
|
|
88
88
|
required: true,
|
|
@@ -93,7 +93,16 @@ export default {
|
|
|
93
93
|
* to a PMR file, if it is a string.
|
|
94
94
|
*/
|
|
95
95
|
id: {
|
|
96
|
-
required:
|
|
96
|
+
required: false,
|
|
97
|
+
default: 0,
|
|
98
|
+
},
|
|
99
|
+
/**
|
|
100
|
+
* A COMBINE archive that was passed directly.
|
|
101
|
+
*/
|
|
102
|
+
combineArchive: {
|
|
103
|
+
required: false,
|
|
104
|
+
type: Uint8Array,
|
|
105
|
+
default: undefined,
|
|
97
106
|
},
|
|
98
107
|
},
|
|
99
108
|
data: function() {
|
|
@@ -159,29 +168,6 @@ export default {
|
|
|
159
168
|
},
|
|
160
169
|
};
|
|
161
170
|
},
|
|
162
|
-
/**
|
|
163
|
-
* @public
|
|
164
|
-
* Download the PMR file associated with the given `url`.
|
|
165
|
-
* @arg `url`
|
|
166
|
-
*/
|
|
167
|
-
downloadPmrFile(url) {
|
|
168
|
-
return new Promise((resolve, reject) => {
|
|
169
|
-
const xmlhttp = new XMLHttpRequest();
|
|
170
|
-
|
|
171
|
-
xmlhttp.open("POST", this.apiLocation + "/pmr_file");
|
|
172
|
-
xmlhttp.setRequestHeader("Content-type", "application/json");
|
|
173
|
-
xmlhttp.onreadystatechange = () => {
|
|
174
|
-
if (xmlhttp.readyState === 4) {
|
|
175
|
-
if (xmlhttp.status === 200) {
|
|
176
|
-
resolve(Uint8Array.from(atob(xmlhttp.response), (c) => c.charCodeAt(0)));
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
reject();
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
xmlhttp.send(JSON.stringify({path: url.replace(PMR_URL, "")}));
|
|
183
|
-
});
|
|
184
|
-
},
|
|
185
171
|
/**
|
|
186
172
|
* @public
|
|
187
173
|
* Manage the file associated with the given `url` and `fileContents`.
|
|
@@ -303,7 +289,8 @@ export default {
|
|
|
303
289
|
this.opencorBasedSimulation = this.solver.name === OPENCOR_SOLVER_NAME;
|
|
304
290
|
}
|
|
305
291
|
|
|
306
|
-
// Run the model if we are dealing with a PMR-based COMBINE archive
|
|
292
|
+
// Run the model if we are dealing with a PMR-based COMBINE archive or a
|
|
293
|
+
// COMBINE archive that was passed directly.
|
|
307
294
|
|
|
308
295
|
if (this.libopencor !== undefined) {
|
|
309
296
|
this.userMessage = "Running the model...";
|
|
@@ -650,8 +637,8 @@ export default {
|
|
|
650
637
|
this.userMessage = "Retrieving COMBINE archive from PMR...";
|
|
651
638
|
this.showUserMessage = true;
|
|
652
639
|
|
|
653
|
-
// Retrieve the
|
|
654
|
-
// then build the simulation UI.
|
|
640
|
+
// Retrieve the COMBINE archive, extract the simulation UI JSON file from
|
|
641
|
+
// it and then build the simulation UI.
|
|
655
642
|
|
|
656
643
|
this.$nextTick(() => {
|
|
657
644
|
const xmlhttp = new XMLHttpRequest();
|
|
@@ -685,6 +672,36 @@ export default {
|
|
|
685
672
|
};
|
|
686
673
|
xmlhttp.send(JSON.stringify({path: this.id}));
|
|
687
674
|
});
|
|
675
|
+
} else if (this.combineArchive !== undefined) {
|
|
676
|
+
// Extract the simulation UI JSON file from the COMBINE archive and build
|
|
677
|
+
// the simulation UI.
|
|
678
|
+
|
|
679
|
+
this.userMessage = "Retrieving COMBINE archive...";
|
|
680
|
+
this.showUserMessage = true;
|
|
681
|
+
|
|
682
|
+
this.$nextTick(() => {
|
|
683
|
+
libOpenCOR().then((libopencor) => {
|
|
684
|
+
this.libopencor = markRaw(libopencor);
|
|
685
|
+
this.libopencorSet = true;
|
|
686
|
+
this.fileManager = markRaw(this.libopencor.FileManager.instance());
|
|
687
|
+
|
|
688
|
+
const fileContents = this.combineArchive;
|
|
689
|
+
const file = this.manageFile(PMR_URL + this.id, fileContents);
|
|
690
|
+
|
|
691
|
+
if (file.type().value !== libopencor.File.Type.COMBINE_ARCHIVE.value) {
|
|
692
|
+
this.showUserMessage = false;
|
|
693
|
+
} else {
|
|
694
|
+
const decoder = new TextDecoder();
|
|
695
|
+
const simulationUiInfo = JSON.parse(decoder.decode(file.childFile("simulation.json").contents()));
|
|
696
|
+
|
|
697
|
+
this.showUserMessage = false;
|
|
698
|
+
|
|
699
|
+
this.$nextTick(() => {
|
|
700
|
+
this.buildSimulationUi(simulationUiInfo);
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
});
|
|
704
|
+
});
|
|
688
705
|
}
|
|
689
706
|
},
|
|
690
707
|
mounted: function() {
|