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