@abi-software/simulationvuer 3.0.10 → 3.0.11

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": "3.0.10",
3
+ "version": "3.0.11",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vite serve --host --force",
@@ -274,7 +274,8 @@ export default {
274
274
 
275
275
  this.activeSubscriptions.push(payload);
276
276
 
277
- // Build the list of model parameters to be tracked for this subscription.
277
+ // Ask OpenCOR to track the simulation data associated with the subscription's component and variable (and the
278
+ // VOI, if requested).
278
279
 
279
280
  const modelParameters = [];
280
281
 
@@ -292,6 +293,48 @@ export default {
292
293
  * @arg `subscriptionId `
293
294
  */
294
295
  removeDataSubscription(subscriptionId) {
296
+ // Ask OpenCOR to stop tracking the simulation data associated with the subscription's component and variable (and
297
+ // the VOI, if requested and unless it's requested by another subscription).
298
+
299
+ const subscription = this.activeSubscriptions.find((activeSubscription) => {
300
+ return activeSubscription.windowId === subscriptionId;
301
+ });
302
+
303
+ if (!subscription) {
304
+ console.warn(`removeDataSubscription: no active subscription found for id ${subscriptionId}.`);
305
+
306
+ return;
307
+ }
308
+
309
+ const isVoiTrackedByAnotherSubscription = this.activeSubscriptions.some((activeSubscription) => {
310
+ return activeSubscription.windowId !== subscriptionId && activeSubscription.withVOI;
311
+ });
312
+ const isModelParameterTrackedByAnotherSubscription = this.activeSubscriptions.some((activeSubscription) => {
313
+ return (
314
+ activeSubscription.windowId !== subscriptionId &&
315
+ activeSubscription.component === subscription.component &&
316
+ activeSubscription.variable === subscription.variable
317
+ );
318
+ });
319
+
320
+ if (!isVoiTrackedByAnotherSubscription || !isModelParameterTrackedByAnotherSubscription) {
321
+ const modelParameters = [];
322
+
323
+ if (subscription.withVOI && !isVoiTrackedByAnotherSubscription) {
324
+ modelParameters.push('VOI');
325
+ }
326
+
327
+ if (!isModelParameterTrackedByAnotherSubscription) {
328
+ modelParameters.push(`${subscription.component}/${subscription.variable}`);
329
+ }
330
+
331
+ if (modelParameters.length) {
332
+ this.$refs.opencorRef?.untrackSimulationData(modelParameters);
333
+ }
334
+ }
335
+
336
+ // Remove the subscription from our list of active subscriptions.
337
+
295
338
  this.activeSubscriptions = this.activeSubscriptions.filter((activeSubscription) => {
296
339
  return activeSubscription.windowId !== subscriptionId;
297
340
  });