@nsshunt/stsvueutils 1.2.19 → 1.2.21

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.
@@ -2468,6 +2468,118 @@ var __privateMethod = (obj, member, method) => {
2468
2468
  _SetMessagePort = new WeakMap();
2469
2469
  _AddAsyncRunner = new WeakMap();
2470
2470
  _StopRunners = new WeakMap();
2471
+ const ModelStore = pinia.defineStore("__sts__ModelStore", {
2472
+ // State
2473
+ // https://pinia.vuejs.org/core-concepts/state.html
2474
+ state: () => {
2475
+ return {
2476
+ _models: {}
2477
+ };
2478
+ },
2479
+ // Getters
2480
+ // https://pinia.vuejs.org/core-concepts/getters.html
2481
+ // Actions
2482
+ // https://pinia.vuejs.org/core-concepts/actions.html
2483
+ actions: {
2484
+ /*
2485
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2486
+ UpdateModel(model: MasterModel): void {
2487
+ //this.masterModel.serviceModel = _cloneDeep(model.serviceModel.model);
2488
+ //this.masterModel.agentModel = _cloneDeep(model.agentModel.model);
2489
+ },
2490
+ UpdateLogDataDirect(modeNode: any, logData: string[]): void {
2491
+ if (modeNode.instruments) {
2492
+ modeNode.instruments[Gauge.LOGGER] = {
2493
+ '_': 'd',
2494
+ val: _cloneDeep(logData)
2495
+ } as any
2496
+ modeNode.instruments[Gauge.LOGGER_COPY] = {
2497
+ '_': 'd',
2498
+ val: _cloneDeep(logData)
2499
+ } as any
2500
+ }
2501
+ },
2502
+ UpdateLogData(modeNode: any, logData: string[]): void {
2503
+ this.UpdateLogDataDirect(modeNode, [ ]);
2504
+ if (modeNode.instruments && modeNode.children) {
2505
+ for (const [k, v] of Object.entries(modeNode.children) as any) {
2506
+ this.UpdateLogDataDirect(v, [ ]);
2507
+ }
2508
+ }
2509
+ },
2510
+ UpdateModelEx(model: ModelNode): void {
2511
+ try {
2512
+ this.model = _cloneDeep((model as any).data);
2513
+ if (!this.model.context?.serviceInstanceId) {
2514
+ // Remove aggregated logs (legacy instruments when logs part of payload) for non serviceInstanceId 'levels'
2515
+ this.UpdateLogData(this.model, [ ]);
2516
+ }
2517
+ } catch (error) {
2518
+ console.error(chalk.red(`${error}`));
2519
+ //console.error(chalk.red(`${JSON.stringify(this.model)}`));
2520
+ }
2521
+ },
2522
+ UpdateModelLogs(nodeId: string, logMessages: string[]): void {
2523
+ const topicSplit = nodeId.split('_');
2524
+ const serviceInstanceId = `${topicSplit[0]}@${topicSplit[1]}`;
2525
+ const serviceInstanceProcessId = `${topicSplit[2]}@${topicSplit[3]}`;
2526
+
2527
+ //topic = (serviceInstanceId + '_' + serviceInstanceProcessId).replace(/@/g, '_');
2528
+ if (this.model.children) {
2529
+ for (const [k, v] of Object.entries(this.model.children) as any) {
2530
+ if (v.context.serviceInstanceId.localeCompare(serviceInstanceId) === 0) {
2531
+ if (v.context.serviceInstanceProcessId.localeCompare(serviceInstanceProcessId) === 0) {
2532
+ this.UpdateLogDataDirect(v, logMessages);
2533
+ }
2534
+ }
2535
+ }
2536
+ }
2537
+ },
2538
+ */
2539
+ SetupNewModelId(modelId) {
2540
+ this._models[modelId] = {
2541
+ serviceModel: {},
2542
+ agentModel: {},
2543
+ modelMeta: {},
2544
+ serviceModelSubscriptionKey: null,
2545
+ agentModelSubscriptionKey: null,
2546
+ friendlyName: {},
2547
+ friendNameIndex: 1
2548
+ };
2549
+ },
2550
+ UpdateServiceModel(modelId, model, subscriptionKey) {
2551
+ try {
2552
+ if (!this._models[modelId]) {
2553
+ this.SetupNewModelId(modelId);
2554
+ }
2555
+ this._models[modelId].serviceModel = _cloneDeep(model);
2556
+ this._models[modelId].serviceModelSubscriptionKey = subscriptionKey;
2557
+ } catch (error) {
2558
+ console.error(error);
2559
+ }
2560
+ },
2561
+ UpdateAgentModel(modelId, model, subscriptionKey) {
2562
+ if (!this._models[modelId]) {
2563
+ this.SetupNewModelId(modelId);
2564
+ }
2565
+ this._models[modelId].agentModel = _cloneDeep(model);
2566
+ this._models[modelId].agentModelSubscriptionKey = subscriptionKey;
2567
+ },
2568
+ GetFriendName(modelId, id) {
2569
+ try {
2570
+ if (!this._models[modelId]) {
2571
+ this.SetupNewModelId(modelId);
2572
+ }
2573
+ if (!this._models[modelId].friendlyName[id]) {
2574
+ this._models[modelId].friendlyName[id] = `FN${this._models[modelId].friendNameIndex++}@${id.split("@")[1]}`;
2575
+ }
2576
+ return this._models[modelId].friendlyName[id];
2577
+ } catch (error) {
2578
+ return `Error: ${error}`;
2579
+ }
2580
+ }
2581
+ }
2582
+ });
2471
2583
  const _hoisted_1$3 = /* @__PURE__ */ vue.createElementVNode("div", null, " UXTestForm ", -1);
2472
2584
  const _hoisted_2$3 = { class: "text-wrap" };
2473
2585
  const _hoisted_3$2 = { class: "ml-0 text-caption" };
@@ -8300,101 +8412,6 @@ var __privateMethod = (obj, member, method) => {
8300
8412
  }();
8301
8413
  var ansi_to_html = Filter;
8302
8414
  const Convert = /* @__PURE__ */ getDefaultExportFromCjs(ansi_to_html);
8303
- const ModelStore = pinia.defineStore("__sts__ModelStore", {
8304
- // State
8305
- // https://pinia.vuejs.org/core-concepts/state.html
8306
- state: () => {
8307
- return {
8308
- serviceModel: {},
8309
- agentModel: {},
8310
- modelMeta: {},
8311
- serviceModelSubscriptionKey: null,
8312
- agentModelSubscriptionKey: null,
8313
- friendlyName: {},
8314
- friendNameIndex: 1
8315
- };
8316
- },
8317
- // Getters
8318
- // https://pinia.vuejs.org/core-concepts/getters.html
8319
- // Actions
8320
- // https://pinia.vuejs.org/core-concepts/actions.html
8321
- actions: {
8322
- /*
8323
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
8324
- UpdateModel(model: MasterModel): void {
8325
- //this.masterModel.serviceModel = _cloneDeep(model.serviceModel.model);
8326
- //this.masterModel.agentModel = _cloneDeep(model.agentModel.model);
8327
- },
8328
- UpdateLogDataDirect(modeNode: any, logData: string[]): void {
8329
- if (modeNode.instruments) {
8330
- modeNode.instruments[Gauge.LOGGER] = {
8331
- '_': 'd',
8332
- val: _cloneDeep(logData)
8333
- } as any
8334
- modeNode.instruments[Gauge.LOGGER_COPY] = {
8335
- '_': 'd',
8336
- val: _cloneDeep(logData)
8337
- } as any
8338
- }
8339
- },
8340
- UpdateLogData(modeNode: any, logData: string[]): void {
8341
- this.UpdateLogDataDirect(modeNode, [ ]);
8342
- if (modeNode.instruments && modeNode.children) {
8343
- for (const [k, v] of Object.entries(modeNode.children) as any) {
8344
- this.UpdateLogDataDirect(v, [ ]);
8345
- }
8346
- }
8347
- },
8348
- UpdateModelEx(model: ModelNode): void {
8349
- try {
8350
- this.model = _cloneDeep((model as any).data);
8351
- if (!this.model.context?.serviceInstanceId) {
8352
- // Remove aggregated logs (legacy instruments when logs part of payload) for non serviceInstanceId 'levels'
8353
- this.UpdateLogData(this.model, [ ]);
8354
- }
8355
- } catch (error) {
8356
- console.error(chalk.red(`${error}`));
8357
- //console.error(chalk.red(`${JSON.stringify(this.model)}`));
8358
- }
8359
- },
8360
- UpdateModelLogs(nodeId: string, logMessages: string[]): void {
8361
- const topicSplit = nodeId.split('_');
8362
- const serviceInstanceId = `${topicSplit[0]}@${topicSplit[1]}`;
8363
- const serviceInstanceProcessId = `${topicSplit[2]}@${topicSplit[3]}`;
8364
-
8365
- //topic = (serviceInstanceId + '_' + serviceInstanceProcessId).replace(/@/g, '_');
8366
- if (this.model.children) {
8367
- for (const [k, v] of Object.entries(this.model.children) as any) {
8368
- if (v.context.serviceInstanceId.localeCompare(serviceInstanceId) === 0) {
8369
- if (v.context.serviceInstanceProcessId.localeCompare(serviceInstanceProcessId) === 0) {
8370
- this.UpdateLogDataDirect(v, logMessages);
8371
- }
8372
- }
8373
- }
8374
- }
8375
- },
8376
- */
8377
- UpdateServiceModel(model, subscriptionKey) {
8378
- this.serviceModel = _cloneDeep(model);
8379
- this.serviceModelSubscriptionKey = subscriptionKey;
8380
- },
8381
- UpdateAgentModel(model, subscriptionKey) {
8382
- this.agentModel = _cloneDeep(model);
8383
- this.agentModelSubscriptionKey = subscriptionKey;
8384
- },
8385
- GetFriendName(id) {
8386
- if (!this.friendlyName[id]) {
8387
- this.friendlyName[id] = `FN${this.friendNameIndex++}@${id.split("@")[1]}`;
8388
- }
8389
- return this.friendlyName[id];
8390
- }
8391
- /*
8392
- UpdateSubscriptions(subscriptions: ISubscriptions): void {
8393
- this.currentsubscriptions = subscriptions;
8394
- }
8395
- */
8396
- }
8397
- });
8398
8415
  /*! @license DOMPurify 3.0.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.11/LICENSE */
8399
8416
  const {
8400
8417
  entries,
@@ -9403,6 +9420,7 @@ var __privateMethod = (obj, member, method) => {
9403
9420
  const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
9404
9421
  __name: "UXModelInstrumentServiceCommon",
9405
9422
  props: {
9423
+ modelId: {},
9406
9424
  instrumentdata: {},
9407
9425
  contextdata: {},
9408
9426
  isleafnode: { type: Boolean },
@@ -9414,7 +9432,7 @@ var __privateMethod = (obj, member, method) => {
9414
9432
  chalk$1.level = 3;
9415
9433
  const friendlyTitle = (id) => {
9416
9434
  if (id.length > 30) {
9417
- return store.GetFriendName(id);
9435
+ return store.GetFriendName(props.modelId, id);
9418
9436
  } else {
9419
9437
  return id;
9420
9438
  }
@@ -9499,18 +9517,22 @@ var __privateMethod = (obj, member, method) => {
9499
9517
  };
9500
9518
  vue.computed({
9501
9519
  get: () => {
9502
- if (store.modelMeta[props.nodeid] && store.modelMeta[props.nodeid].detailView) {
9503
- return store.modelMeta[props.nodeid].detailView;
9520
+ if (store._models[props.modelId]) {
9521
+ if (store._models[props.modelId].modelMeta[props.nodeid] && store._models[props.modelId].modelMeta[props.nodeid].detailView) {
9522
+ return store._models[props.modelId].modelMeta[props.nodeid].detailView;
9523
+ }
9504
9524
  }
9505
9525
  return false;
9506
9526
  },
9507
9527
  set: (val) => {
9508
- if (store.modelMeta[props.nodeid]) {
9509
- store.modelMeta[props.nodeid].detailView = val;
9510
- } else {
9511
- store.modelMeta[props.nodeid] = {
9512
- detailView: val
9513
- };
9528
+ if (store._models[props.modelId]) {
9529
+ if (store._models[props.modelId].modelMeta[props.nodeid]) {
9530
+ store._models[props.modelId].modelMeta[props.nodeid].detailView = val;
9531
+ } else {
9532
+ store._models[props.modelId].modelMeta[props.nodeid] = {
9533
+ detailView: val
9534
+ };
9535
+ }
9514
9536
  }
9515
9537
  }
9516
9538
  });
@@ -9998,8 +10020,8 @@ var __privateMethod = (obj, member, method) => {
9998
10020
  }
9999
10021
  return target2;
10000
10022
  };
10001
- const UXModelInstrumentServiceCommon = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-98746b22"]]);
10002
- const _withScopeId = (n) => (vue.pushScopeId("data-v-ad136411"), n = n(), vue.popScopeId(), n);
10023
+ const UXModelInstrumentServiceCommon = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-02af10f2"]]);
10024
+ const _withScopeId = (n) => (vue.pushScopeId("data-v-3eab32be"), n = n(), vue.popScopeId(), n);
10003
10025
  const _hoisted_1$1 = { class: "ststitle" };
10004
10026
  const _hoisted_2$1 = {
10005
10027
  key: 0,
@@ -10061,6 +10083,7 @@ var __privateMethod = (obj, member, method) => {
10061
10083
  const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
10062
10084
  __name: "UXModelInstrumentServiceSmall",
10063
10085
  props: {
10086
+ modelId: {},
10064
10087
  instrumentdata: {},
10065
10088
  contextdata: {},
10066
10089
  isleafnode: { type: Boolean },
@@ -10087,7 +10110,7 @@ var __privateMethod = (obj, member, method) => {
10087
10110
  let barUpdate = 0;
10088
10111
  const friendlyTitle = (id) => {
10089
10112
  if (id.length > 30) {
10090
- return store.GetFriendName(id);
10113
+ return store.GetFriendName(props.modelId, id);
10091
10114
  } else {
10092
10115
  return id;
10093
10116
  }
@@ -10570,12 +10593,13 @@ var __privateMethod = (obj, member, method) => {
10570
10593
  };
10571
10594
  }
10572
10595
  });
10573
- const UXModelInstrumentServiceSmall = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-ad136411"]]);
10596
+ const UXModelInstrumentServiceSmall = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-3eab32be"]]);
10574
10597
  const _hoisted_1 = ["value"];
10575
10598
  const _hoisted_2 = { key: 0 };
10576
10599
  const _sfc_main = /* @__PURE__ */ vue.defineComponent({
10577
10600
  __name: "UXModelNode",
10578
10601
  props: {
10602
+ modelId: {},
10579
10603
  nodeid: {},
10580
10604
  smallMode: { type: Boolean }
10581
10605
  },
@@ -10583,12 +10607,21 @@ var __privateMethod = (obj, member, method) => {
10583
10607
  setup(__props, { emit: __emit }) {
10584
10608
  chalk$1.level = 3;
10585
10609
  const store = ModelStore();
10610
+ const props = __props;
10586
10611
  const emit = __emit;
10587
10612
  vue.computed(() => {
10588
- return store.agentModel;
10613
+ if (store._models[props.modelId]) {
10614
+ return store._models[props.modelId].agentModel;
10615
+ } else {
10616
+ return {};
10617
+ }
10589
10618
  });
10590
10619
  const serviceModel = vue.computed(() => {
10591
- return store.serviceModel;
10620
+ if (store._models[props.modelId]) {
10621
+ return store._models[props.modelId].serviceModel;
10622
+ } else {
10623
+ return {};
10624
+ }
10592
10625
  });
10593
10626
  const cpu = (model) => {
10594
10627
  try {
@@ -10611,12 +10644,13 @@ var __privateMethod = (obj, member, method) => {
10611
10644
  cpu(svc) > 0 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, [
10612
10645
  (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.smallMode ? UXModelInstrumentServiceSmall : UXModelInstrumentServiceCommon), {
10613
10646
  isleafnode: false,
10647
+ "model-id": props.modelId,
10614
10648
  nodeid: svc.id,
10615
10649
  contextdata: svc.context,
10616
10650
  instrumentdata: svc.instruments,
10617
10651
  title: svc.id,
10618
10652
  onMyclick: navigate
10619
- }, null, 40, ["nodeid", "contextdata", "instrumentdata", "title"]))
10653
+ }, null, 40, ["model-id", "nodeid", "contextdata", "instrumentdata", "title"]))
10620
10654
  ])) : vue.createCommentVNode("", true)
10621
10655
  ], 8, _hoisted_1);
10622
10656
  }), 128);
@@ -10630,6 +10664,7 @@ var __privateMethod = (obj, member, method) => {
10630
10664
  exports2.GetSTSInstrumentControllerPluginKeyWM = GetSTSInstrumentControllerPluginKeyWM;
10631
10665
  exports2.IRunnerState = IRunnerState;
10632
10666
  exports2.IWorkerState = IWorkerState;
10667
+ exports2.ModelStore = ModelStore;
10633
10668
  exports2.RequestResponseHelper = RequestResponseHelper;
10634
10669
  exports2.STSEmitterPlugin = STSEmitterPlugin;
10635
10670
  exports2.STSEmitterPluginKey = STSEmitterPluginKey;