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

Support for arranging "primary" views in the initial layout #445

Closed
danielwiehl opened this issue Jun 8, 2023 · 0 comments
Closed

Support for arranging "primary" views in the initial layout #445

danielwiehl opened this issue Jun 8, 2023 · 0 comments

Comments

@danielwiehl
Copy link
Collaborator

Is your feature request related to a problem? Please describe.

The initial layout allows the arrangement of only "auxiliary/secondary" views that have an empty path, but not "primary" views that have a path.

Describe the solution you'd like

The initial layout allows for arranging any "primary" view that has a path.

@danielwiehl danielwiehl added this to the 2023-09 milestone Jun 8, 2023
@danielwiehl danielwiehl changed the title Support for arranging any "primary" view in the initial layout Support for arranging "primary" views in the initial layout Jun 8, 2023
@k-genov k-genov modified the milestones: 2023-09, 2023-11 Sep 7, 2023
danielwiehl added a commit that referenced this issue May 6, 2024
…r perspective)

Previously, views in the initial layout (or perspective) were limited to only supporting empty-path routes and could not be navigated or opened multiple times.

closes #445

BREAKING CHANGE: Views in the initial layout (or perspective) must be navigated.

Previously, no explicit navigation was required as the view and route were coupled via the route's outlet and the view's id.

**Migrate the layout as follows:**
- Navigate views added to the layout;
- Pass an empty commands array to match routes with an empty path;
- Pass a navigation hint to differentiate between routes with empty paths; you can use the same value as before for the view id;

> See line (1) in the migration example below.

**Migrate the routes as follows:**
- Remove the outlet property;
- Add `canMatchWorkbenchView` guard and initialize it with the hint passed to the navigation; you can use the same value as before for the outlet name;

> See line (2) in the migration example below.

**Example of what a migration could look like:**

**Before migration:**
```ts
// Workbench Layout
provideWorkbench({
  layout: (factory: WorkbenchLayoutFactory) => factory
    .addPart(MAIN_AREA)
    .addPart('left', {relativeTo: MAIN_AREA, align: 'left'})
    .addView('navigator', {partId: 'left', activateView: true}),
});
// Routes
provideRouter([
  {
    path: '',
    outlet: 'navigator',
    loadComponent: () => ...,
  },
]);
```

**After migration:**
```ts
// Workbench Layout
provideWorkbench({
  layout: (factory: WorkbenchLayoutFactory) => factory
    .addPart(MAIN_AREA)
    .addPart('left', {relativeTo: MAIN_AREA, align: 'left'})
    .addView('navigator', {partId: 'left', activateView: true})
    .navigateView('navigator', [], {hint: 'navigator'}), // See (1)
});
// Routes
provideRouter([
  {
    path: '',
    canMatch: [canMatchWorkbenchView('navigator')], // See (2)
    loadComponent: () => ...,
  },
]);
```
danielwiehl added a commit that referenced this issue May 6, 2024
…r perspective)

Previously, views in the initial layout (or perspective) were limited to only supporting empty-path routes and could not be navigated or opened multiple times.

BREAKING CHANGE: Views in the initial layout (or perspective) must now be navigated.

Previously, no explicit navigation was required because view and route were coupled via route outlet and view id.

closes #445

BREAKING CHANGE: Views in the initial layout (or perspective) must be navigated.

Previously, no explicit navigation was required as the view and route were coupled via the route's outlet and the view's id.

**Migrate the layout as follows:**
- Navigate views added to the layout;
- Pass an empty commands array to match routes with an empty path;
- Pass a navigation hint to differentiate between routes with empty paths; you can use the same value as before for the view id;

```ts
// Before Migration
provideWorkbench({
  layout: (factory: WorkbenchLayoutFactory) => factory
    .addPart(MAIN_AREA)
    .addPart('left', {relativeTo: MAIN_AREA, align: 'left'})
    .addView('navigator', {partId: 'left', activateView: true}),
});

// After Migration
provideWorkbench({
  layout: (factory: WorkbenchLayoutFactory) => factory
    .addPart(MAIN_AREA)
    .addPart('left', {relativeTo: MAIN_AREA, align: 'left'})
    .addView('navigator', {partId: 'left', activateView: true})
	// Navigate view, passing hint to match route.
    .navigateView('navigator', [], {hint: 'navigator'}),
});
```

**Migrate the routes as follows:**
- Remove the outlet property;
- Add `canMatchWorkbenchView` guard and initialize it with the hint passed to the navigation; you can use the same value as before for the outlet name;

```ts
// Before Migration
provideRouter([
  {
    path: '',
    outlet: 'navigator',
    loadComponent: () => ...,
  },
]);

// After Migration
provideRouter([
  {
    path: '',
	// Match route only if navigated with specified hint.
    canMatch: [canMatchWorkbenchView('navigator')],
    loadComponent: () => ...,
  },
]);
```
danielwiehl added a commit that referenced this issue May 6, 2024
…r perspective)

Previously, views in the initial layout (or perspective) were limited to only supporting empty-path routes and could not be navigated or opened multiple times.

BREAKING CHANGE: Views in the initial layout (or perspective) must now be navigated.

Previously, no explicit navigation was required because view and route were coupled via route outlet and view id.

closes #445

BREAKING CHANGE: Views in the initial layout (or perspective) must be navigated.

Previously, no explicit navigation was required as the view and route were coupled via the route's outlet and the view's id.

**Migrate the layout as follows:**
- Navigate views added to the layout;
- Pass an empty commands array to match routes with an empty path;
- Pass a navigation hint to differentiate between routes with empty paths; you can use the same value as before for the view id;

```ts
// Before Migration
provideWorkbench({
  layout: (factory: WorkbenchLayoutFactory) => factory
    .addPart(MAIN_AREA)
    .addPart('left', {relativeTo: MAIN_AREA, align: 'left'})
    .addView('navigator', {partId: 'left', activateView: true}),
});

// After Migration
provideWorkbench({
  layout: (factory: WorkbenchLayoutFactory) => factory
    .addPart(MAIN_AREA)
    .addPart('left', {relativeTo: MAIN_AREA, align: 'left'})
    .addView('navigator', {partId: 'left', activateView: true})
	// Navigate view, passing hint to match route.
    .navigateView('navigator', [], {hint: 'navigator'}),
});
```

**Migrate the routes as follows:**
- Remove the outlet property;
- Add `canMatchWorkbenchView` guard and initialize it with the hint passed to the navigation; you can use the same value as before for the outlet name;

```ts
// Before Migration
provideRouter([
  {
    path: '',
    outlet: 'navigator',
    loadComponent: () => ...,
  },
]);

// After Migration
provideRouter([
  {
    path: '',
	// Match route only if navigated with specified hint.
    canMatch: [canMatchWorkbenchView('navigator')],
    loadComponent: () => ...,
  },
]);
```
danielwiehl added a commit that referenced this issue May 6, 2024
…r perspective)

Previously, views in the initial layout (or perspective) were limited to only supporting empty-path routes and could not be navigated or opened multiple times.

closes #445

BREAKING CHANGE: Views in the initial layout (or perspective) must now be navigated.

Previously, no explicit navigation was required because view and route were coupled via route outlet and view id.

**Migrate the layout as follows:**
- Navigate views added to the layout;
- Pass an empty commands array to match routes with an empty path;
- Pass a navigation hint to differentiate between routes with empty paths; you can use the same value as before for the view id;

```ts
// Before Migration
provideWorkbench({
  layout: (factory: WorkbenchLayoutFactory) => factory
    .addPart(MAIN_AREA)
    .addPart('left', {relativeTo: MAIN_AREA, align: 'left'})
    .addView('navigator', {partId: 'left', activateView: true}),
});

// After Migration
provideWorkbench({
  layout: (factory: WorkbenchLayoutFactory) => factory
    .addPart(MAIN_AREA)
    .addPart('left', {relativeTo: MAIN_AREA, align: 'left'})
    .addView('navigator', {partId: 'left', activateView: true})
	// Navigate view, passing hint to match route.
    .navigateView('navigator', [], {hint: 'navigator'}),
});
```

**Migrate the routes as follows:**
- Remove the outlet property;
- Add `canMatchWorkbenchView` guard and initialize it with the hint passed to the navigation; you can use the same value as before for the outlet name;

```ts
// Before Migration
provideRouter([
  {
    path: '',
    outlet: 'navigator',
    loadComponent: () => ...,
  },
]);

// After Migration
provideRouter([
  {
    path: '',
	// Match route only if navigated with specified hint.
    canMatch: [canMatchWorkbenchView('navigator')],
    loadComponent: () => ...,
  },
]);
```

BREAKING CHANGE: Changed type of view id from `string` to `ViewId`

```ts
import {inject} from '@angular/core';
import {ViewId, WorkbenchService} from '@scion/workbench';

// Before Migration
const viewId: string = 'view.1';
inject(WorkbenchService).getView(viewId);

// After Migration
const viewId: ViewId = 'view.1';
inject(WorkbenchService).getView(viewId);
```
danielwiehl added a commit that referenced this issue May 6, 2024
…r perspective)

Previously, views in the initial layout (or perspective) were limited to only supporting empty-path routes and could not be navigated or opened multiple times.

closes #445

BREAKING CHANGE: Views in the initial layout (or perspective) must now be navigated.

Previously, no explicit navigation was required because view and route were coupled via route outlet and view id.

**Migrate the layout as follows:**

Explicitly navigate views, passing an empty array of commands and the view id as navigation hint.

```ts
// Before Migration
provideWorkbench({
  layout: (factory: WorkbenchLayoutFactory) => factory
    .addPart(MAIN_AREA)
    .addPart('left', {relativeTo: MAIN_AREA, align: 'left'})
    .addView('navigator', {partId: 'left', activateView: true}),
});

// After Migration
provideWorkbench({
  layout: (factory: WorkbenchLayoutFactory) => factory
    .addPart(MAIN_AREA)
    .addPart('left', {relativeTo: MAIN_AREA, align: 'left'})
    .addView('navigator', {partId: 'left', activateView: true})
	// Navigate view, passing hint to match route.
    .navigateView('navigator', [], {hint: 'navigator'}),
});
```

**Migrate the routes as follows:**
- Remove the outlet property;
- Add `canMatchWorkbenchView` guard and initialize it with the hint passed to the navigation;

```ts
// Before Migration
provideRouter([
  {
    path: '',
    outlet: 'navigator',
    loadComponent: () => ...,
  },
]);

// After Migration
provideRouter([
  {
    path: '',
	// Match route only if navigated with specified hint.
    canMatch: [canMatchWorkbenchView('navigator')],
    loadComponent: () => ...,
  },
]);
```

BREAKING CHANGE: Changed type of view id from `string` to `ViewId`

If storing the view id in a variable, change its type from `string` to `ViewId`.
danielwiehl added a commit that referenced this issue May 6, 2024
…r perspective)

Previously, views in the initial layout (or perspective) were limited to only supporting empty-path routes and could not be navigated or opened multiple times.

closes #445

BREAKING CHANGE: Views in the initial layout (or perspective) must now be navigated.

Previously, no explicit navigation was required because view and route were coupled via route outlet and view id.

**Migrate the layout as follows:**

Explicitly navigate views, passing an empty array of commands and the view id as navigation hint.

```ts
// Before Migration
provideWorkbench({
  layout: (factory: WorkbenchLayoutFactory) => factory
    .addPart(MAIN_AREA)
    .addPart('left', {relativeTo: MAIN_AREA, align: 'left'})
    .addView('navigator', {partId: 'left', activateView: true}),
});

// After Migration
provideWorkbench({
  layout: (factory: WorkbenchLayoutFactory) => factory
    .addPart(MAIN_AREA)
    .addPart('left', {relativeTo: MAIN_AREA, align: 'left'})
    .addView('navigator', {partId: 'left', activateView: true})
    // Navigate view, passing hint to match route.
    .navigateView('navigator', [], {hint: 'navigator'}),
});
```

**Migrate the routes as follows:**
- Remove the outlet property;
- Add `canMatchWorkbenchView` guard and initialize it with the hint passed to the navigation;

```ts
// Before Migration
provideRouter([
  {
    path: '',
    outlet: 'navigator',
    loadComponent: () => ...,
  },
]);

// After Migration
provideRouter([
  {
    path: '',
    // Match route only if navigated with specified hint.
    canMatch: [canMatchWorkbenchView('navigator')],
    loadComponent: () => ...,
  },
]);
```

BREAKING CHANGE: Changed type of view id from `string` to `ViewId`

If storing the view id in a variable, change its type from `string` to `ViewId`.
danielwiehl added a commit that referenced this issue May 6, 2024
…r perspective)

Previously, views in the initial layout (or perspective) were limited to only supporting empty-path routes and could not be navigated or opened multiple times.

closes #445

BREAKING CHANGE: Views in the initial layout (or perspective) must now be navigated.

Previously, no explicit navigation was required because view and route were coupled via route outlet and view id.

**Migrate the layout as follows:**

Explicitly navigate views, passing an empty array of commands and the view id as navigation hint.

```ts
// Before Migration
provideWorkbench({
  layout: (factory: WorkbenchLayoutFactory) => factory
    .addPart(MAIN_AREA)
    .addPart('left', {relativeTo: MAIN_AREA, align: 'left'})
    .addView('navigator', {partId: 'left', activateView: true}),
});

// After Migration
provideWorkbench({
  layout: (factory: WorkbenchLayoutFactory) => factory
    .addPart(MAIN_AREA)
    .addPart('left', {relativeTo: MAIN_AREA, align: 'left'})
    .addView('navigator', {partId: 'left', activateView: true})
    // Navigate view, passing hint to match route.
    .navigateView('navigator', [], {hint: 'navigator'}),
});
```

**Migrate the routes as follows:**
- Remove the `outlet` property;
- Add `canMatchWorkbenchView` guard and initialize it with the hint passed to the navigation;

```ts
// Before Migration
provideRouter([
  {
    path: '',
    outlet: 'navigator',
    loadComponent: () => ...,
  },
]);

// After Migration
provideRouter([
  {
    path: '',
    // Match route only if navigated with specified hint.
    canMatch: [canMatchWorkbenchView('navigator')],
    loadComponent: () => ...,
  },
]);
```

BREAKING CHANGE: Changed type of view id from `string` to `ViewId`

If storing the view id in a variable, change its type from `string` to `ViewId`.
danielwiehl pushed a commit that referenced this issue May 6, 2024
…r perspective)

Previously, views in the initial layout (or perspective) were limited to only supporting empty-path routes and could not be navigated or opened multiple times.

Authors: marcarrian <[email protected]>, danielwiehl <[email protected]>

closes #445

BREAKING CHANGE: Views in the initial layout (or perspective) must now be navigated.

Previously, no explicit navigation was required because view and route were coupled via route outlet and view id.

**Migrate the layout as follows:**

Explicitly navigate views, passing an empty array of commands and the view id as navigation hint.

```ts
// Before Migration
provideWorkbench({
  layout: (factory: WorkbenchLayoutFactory) => factory
    .addPart(MAIN_AREA)
    .addPart('left', {relativeTo: MAIN_AREA, align: 'left'})
    .addView('navigator', {partId: 'left', activateView: true}),
});

// After Migration
provideWorkbench({
  layout: (factory: WorkbenchLayoutFactory) => factory
    .addPart(MAIN_AREA)
    .addPart('left', {relativeTo: MAIN_AREA, align: 'left'})
    .addView('navigator', {partId: 'left', activateView: true})
    // Navigate view, passing hint to match route.
    .navigateView('navigator', [], {hint: 'navigator'}),
});
```

**Migrate the routes as follows:**
- Remove the `outlet` property;
- Add `canMatchWorkbenchView` guard and initialize it with the hint passed to the navigation;

```ts
// Before Migration
provideRouter([
  {
    path: '',
    outlet: 'navigator',
    loadComponent: () => ...,
  },
]);

// After Migration
provideRouter([
  {
    path: '',
    // Match route only if navigated with specified hint.
    canMatch: [canMatchWorkbenchView('navigator')],
    loadComponent: () => ...,
  },
]);
```

BREAKING CHANGE: Changed type of view id from `string` to `ViewId`

If storing the view id in a variable, change its type from `string` to `ViewId`.
danielwiehl pushed a commit that referenced this issue May 7, 2024
…r perspective)

Previously, views in the initial layout (or perspective) were limited to only supporting empty-path routes and could not be navigated or opened multiple times.

Authors: marcarrian <[email protected]>, danielwiehl <[email protected]>

closes #445

BREAKING CHANGE: Views in the initial layout (or perspective) must now be navigated.

Previously, no explicit navigation was required because views and routes were coupled via route outlet and view id.

**Migrate the layout as follows:**

Explicitly navigate views, passing an empty array of commands and the view id as navigation hint.

```ts
// Before Migration
provideWorkbench({
  layout: (factory: WorkbenchLayoutFactory) => factory
    .addPart(MAIN_AREA)
    .addPart('left', {relativeTo: MAIN_AREA, align: 'left'})
    .addView('navigator', {partId: 'left', activateView: true}),
});

// After Migration
provideWorkbench({
  layout: (factory: WorkbenchLayoutFactory) => factory
    .addPart(MAIN_AREA)
    .addPart('left', {relativeTo: MAIN_AREA, align: 'left'})
    .addView('navigator', {partId: 'left', activateView: true})
    // Navigate view, passing hint to match route.
    .navigateView('navigator', [], {hint: 'navigator'}),
});
```

**Migrate the routes as follows:**
- Remove the `outlet` property;
- Add `canMatchWorkbenchView` guard and initialize it with the hint passed to the navigation;

```ts
// Before Migration
provideRouter([
  {
    path: '',
    outlet: 'navigator',
    loadComponent: () => ...,
  },
]);

// After Migration
provideRouter([
  {
    path: '',
    // Match route only if navigated with specified hint.
    canMatch: [canMatchWorkbenchView('navigator')],
    loadComponent: () => ...,
  },
]);
```

BREAKING CHANGE: Changed type of view id from `string` to `ViewId`

If storing the view id in a variable, change its type from `string` to `ViewId`.
@danielwiehl danielwiehl mentioned this issue May 7, 2024
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants