@smartbit4all/ng-client 3.0.35 → 3.1.0

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.
@@ -2711,6 +2711,9 @@ class SmartViewContextService {
2711
2711
  }
2712
2712
  }
2713
2713
  openView(view) {
2714
+ let alreadyOpened = this.openedViewUuids.some((uuid) => uuid === view.uuid);
2715
+ if (alreadyOpened)
2716
+ return;
2714
2717
  let viewHandler = this.viewHandlers.find((handler) => handler.name === view.viewName);
2715
2718
  if (!viewHandler) {
2716
2719
  throw new Error(`SmartViewHandlerModel was not found by view name: ${view.viewName}`);
@@ -2721,7 +2724,22 @@ class SmartViewContextService {
2721
2724
  }
2722
2725
  let refIsAlradyAdded = this.dialogRefs.some((ref) => ref.uuid === view.uuid);
2723
2726
  if (!refIsAlradyAdded) {
2724
- let dialogRef = this.dialog.openComponentAsDialog(viewHandler.component, viewHandler.name);
2727
+ let dialogRef;
2728
+ try {
2729
+ this.openedViewUuids.push(view.uuid);
2730
+ this.openedViewData.push(view);
2731
+ sessionStorage.setItem(view.viewName, view.uuid);
2732
+ dialogRef = this.dialog.openComponentAsDialog(viewHandler.component, viewHandler.name);
2733
+ }
2734
+ finally {
2735
+ const index = this.openedViewUuids.indexOf(view.uuid);
2736
+ if (index >= 0) {
2737
+ this.openedViewUuids.splice(index, 1);
2738
+ this.openedViewData.splice(index, 1);
2739
+ sessionStorage.removeItem(view.viewName);
2740
+ }
2741
+ sessionStorage.setItem(view.viewName, view.uuid);
2742
+ }
2725
2743
  let dialogDisableClose = true;
2726
2744
  try {
2727
2745
  dialogDisableClose = this.inject.get(DIALOG_DISABLE_CLOSE);