Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent closing a view if it displays a message box with view modality #344

Closed
mofogasy opened this issue Aug 12, 2022 · 1 comment
Closed

Comments

@mofogasy
Copy link
Contributor

Describe the bug

When a message box with view modality is open in a view, it should not be possible to close the view.
Right now, the view cannot be closed through the keystroke Ctrl+k or the close button (x) of the tab (since it is hidden), which is the correct behavior.
However, the view can still be closed through the context menu of its tab (Close tab and Close all tabs), which is wrong.

To Reproduce

Steps to reproduce the behavior:

  1. Go to the Testing App
  2. Click on 'Workbench Messagebox'
  3. Click on 'Open message box' button
  4. Right-click on the tab
  5. The context menu entries Close tab and Close all tabs are active and can be used to close the tab.

Expected behavior

The context menu entries Close tab and Close all tabs should be inactive.

Environment

Please complete the following information:

  • SCION Workbench version: [13.0.0-beta.2]
  • SCION Workbench Client version: [1.0.0-beta.10]
  • Angular version: [13.3.4]
  • Browser: [Chrome 104]
  • OS: [Windows 10]
  • Device: [Desktop]
@mofogasy mofogasy changed the title Prevent closing a tab if its contained view displays a message box with view modality Prevent closing a view if it displays a message box with view modality Aug 12, 2022
@danielwiehl
Copy link
Collaborator

If fixed we can enable the test message-box.e2e-spec.ts: should prevent closing a view if it displays a message box with view modality

danielwiehl added a commit that referenced this issue May 2, 2024
To fix issues related to preventing views from closing, the guard is no longer implemented as an Angular "CanDeactivate" guard but runs before the Angular navigation.

This commit fixes the following issues:
- guard now also runs on child routes
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed.
- the guard can perform an Angular navigation, e.g., display a message box with route content.

closes #27, closes #344

BREAKING CHANGE: Interface and method for intercepting (or preventing) closing of a view has changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippets illustrate how a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 3, 2024
The guard now runs before the Angular navigation. Previously, it was implemented as an Angular `CanDeactivate` guard.

The following issues have been fixed:
- guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 3, 2024
The guard now runs before the Angular navigation. Previously, it was implemented as an Angular `CanDeactivate` guard.

The following issues have been fixed:
- guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 3, 2024
The guard now runs before the Angular navigation. Previously, it was implemented as an Angular `CanDeactivate` guard.

The following issues have been fixed:
- guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 3, 2024
The guard now runs before the Angular navigation. Previously, it was implemented as an Angular `CanDeactivate` guard.

The following issues have been fixed:
- guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 3, 2024
The guard now runs before the Angular navigation. Previously, it was implemented as an Angular `CanDeactivate` guard.

The following issues have been fixed:
- guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 3, 2024
The guard now runs before the Angular navigation. Previously, it was implemented as an Angular `CanDeactivate` guard.

The following issues have been fixed:
- guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 3, 2024
The guard now runs before the Angular navigation. Previously, it was implemented as an Angular `CanDeactivate` guard.

The following issues have been fixed:
- guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 3, 2024
The guard now runs before the Angular navigation. Previously, it was implemented as an Angular `CanDeactivate` guard.

The following issues have been fixed:
- guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 3, 2024
The guard now runs before the Angular navigation. Previously, it was implemented as an Angular `CanDeactivate` guard.

The following issues have been fixed:
- guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 3, 2024
The guard now runs before the Angular navigation. Previously, it was implemented as an Angular `CanDeactivate` guard.

The following issues have been fixed:
- guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 3, 2024
The guard now runs before the Angular navigation. Previously, it was implemented as an Angular `CanDeactivate` guard.

The following issues have been fixed:
- guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 4, 2024
The guard now runs before the Angular navigation. Previously, it was implemented as an Angular `CanDeactivate` guard.

The following issues have been fixed:
- guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 6, 2024
The following issues have been fixed:
- `CanClose` guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- `CanClose` guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 6, 2024
The following issues have been fixed:
- `CanClose` guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- `CanClose` guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 6, 2024
The following issues have been fixed:
- `CanClose` guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- `CanClose` guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
``ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
danielwiehl added a commit that referenced this issue May 6, 2024
The following issues have been fixed:
- `CanClose` guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- `CanClose` guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
```ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```
danielwiehl added a commit that referenced this issue May 6, 2024
The following issues have been fixed:
- `CanClose` guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- `CanClose` guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
```ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```
danielwiehl added a commit that referenced this issue May 6, 2024
The following issues have been fixed:
- `CanClose` guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- `CanClose` guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
```ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```
danielwiehl added a commit that referenced this issue May 6, 2024
The following issues have been fixed:
- `CanClose` guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- `CanClose` guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
```ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```
danielwiehl added a commit that referenced this issue May 6, 2024
The following issues have been fixed:
- `CanClose` guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- `CanClose` guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
```ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```
danielwiehl added a commit that referenced this issue May 6, 2024
The following issues have been fixed:
- `CanClose` guard now also runs on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- `CanClose` guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

The following snippet illustrates what a migration could look like:

**Before migration:**
```ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```
danielwiehl added a commit that referenced this issue May 6, 2024
The following issues have been fixed:
- `CanClose` guard now also works on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- `CanClose` guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

**Before migration:**
```ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```
danielwiehl added a commit that referenced this issue May 6, 2024
The following issues have been fixed:
- `CanClose` guard now also works on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- `CanClose` guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

**Before migration:**
```ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```
danielwiehl added a commit that referenced this issue May 7, 2024
The following issues have been fixed:
- `CanClose` guard now also works on child routes;
- multiple views can be closed simultaneously, even if some views prevent closing; previously, Angular navigation was canceled, causing no views to be closed;
- `CanClose` guard can now perform an Angular navigation, e.g., to display a dialog with routed content;

closes #27, closes #344

BREAKING CHANGE: Interface and method for preventing closing of a view have changed.

To migrate, implement the `CanClose` instead of the `WorkbenchViewPreDestroy` interface.

**Before migration:**
```ts
class YourComponent implements WorkbenchViewPreDestroy {
  public async onWorkbenchViewPreDestroy(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```

**After migration:**

```ts
class YourComponent implements CanClose {
  public async canClose(): Promise<boolean> {
    // return `true` to close the view, otherwise `false`.
  }
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

2 participants