@heswell/vuu-portal 2.2.4 → 2.3.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.
- package/195.js +5 -1
- package/README.md +83 -0
- package/config/default-modules.yaml +2 -1
- package/package.json +3 -3
package/195.js
CHANGED
|
@@ -410,6 +410,10 @@ const managedModuleKeys = [
|
|
|
410
410
|
"navIconUrl",
|
|
411
411
|
"accessRole"
|
|
412
412
|
];
|
|
413
|
+
const navEntryKeys = [
|
|
414
|
+
"location",
|
|
415
|
+
"path"
|
|
416
|
+
];
|
|
413
417
|
const optionalModuleKeys = [
|
|
414
418
|
"navOrder",
|
|
415
419
|
"navBadge",
|
|
@@ -426,7 +430,7 @@ function parseManagedModule(value, index) {
|
|
|
426
430
|
for (const key of Object.keys(value))if (!managedModuleKeys.includes(key) && !optionalModuleKeys.includes(key) && !retiredModuleKeys.includes(key)) throw new Error(`Modules file entry ${index} contains unknown field '${key}'`);
|
|
427
431
|
const module = {};
|
|
428
432
|
for (const key of managedModuleKeys){
|
|
429
|
-
const fieldValue = value[key];
|
|
433
|
+
const fieldValue = void 0 === value[key] && navEntryKeys.includes(key) ? "" : value[key];
|
|
430
434
|
if (void 0 === fieldValue) throw new Error(`Modules file entry ${index} is missing '${key}'`);
|
|
431
435
|
const expected = [
|
|
432
436
|
"id",
|
package/README.md
CHANGED
|
@@ -138,3 +138,86 @@ absolute paths and `~/` paths are also accepted.
|
|
|
138
138
|
start.
|
|
139
139
|
- `vuu.portal.defaultModulesFile` is the seed catalogue. See
|
|
140
140
|
[`default-modules.yaml`](./default-modules.yaml) for the format.
|
|
141
|
+
|
|
142
|
+
## Workspaces and the Panels palette
|
|
143
|
+
|
|
144
|
+
`@vuu-ui/*` 4.0.0-alpha.26 adds named workspaces to the portal UI: a
|
|
145
|
+
**Workspaces** section in the nav with **+ New workspace**, the
|
|
146
|
+
`/workspaces/:id` route, **Reset to default**, and an **Add panel** button that
|
|
147
|
+
opens the **Panels** palette (tabs Modules, Tables and Recent) inline beside
|
|
148
|
+
the workspace grid. Tables › Browse lists the Vuu servers; each server page is
|
|
149
|
+
an unsaved workspace with the Tables palette pinned, which **Save as
|
|
150
|
+
workspace** keeps.
|
|
151
|
+
|
|
152
|
+
This package is the portal *server*. It doesn't render the UI; it supplies the
|
|
153
|
+
module records the palette is built from.
|
|
154
|
+
|
|
155
|
+
### What the server provides
|
|
156
|
+
|
|
157
|
+
A module record with a `workspace` descriptor is listed in the palette's
|
|
158
|
+
Modules tab, grouped by `workspace.paletteGroup`. A module without one isn't.
|
|
159
|
+
See [Workspace metadata](../../docs/requirements/vuu-portal-module-discovery.md#workspace-metadata)
|
|
160
|
+
for the field. In [`default-modules.yaml`](./default-modules.yaml):
|
|
161
|
+
|
|
162
|
+
| Module | `workspace` | Why |
|
|
163
|
+
| --- | --- | --- |
|
|
164
|
+
| `moduleAdmin`, `userAdmin` | `{ paletteGroup: "Admin", defaultSize: { cols: 12, rows: 6 } }` | Standalone pages |
|
|
165
|
+
| `basket-trading` | `{ paletteGroup: "Trading", defaultSize: { cols: 12, rows: 8 } }` | Standalone page |
|
|
166
|
+
| `vuu-table-browser` | none | It is itself a workspace page; its tables are in the palette's Tables tab |
|
|
167
|
+
| `vuu-table-viewer` | none | Nested module; it only works inside the table browser |
|
|
168
|
+
|
|
169
|
+
A top-level module with a `workspace` descriptor may leave `location` and
|
|
170
|
+
`path` empty (or omit them from the YAML) to be offered only in the palette,
|
|
171
|
+
with no nav entry or route. It is still sent in `LOGIN_SUCCESS`, with an empty
|
|
172
|
+
`navLocation` and `path`. Top-level modules without `workspace` still need
|
|
173
|
+
both.
|
|
174
|
+
|
|
175
|
+
The seed only applies when `modules.yaml` is first created. To change an
|
|
176
|
+
existing deployment, edit `modules.yaml` or use the module admin
|
|
177
|
+
(`updateModule` with `workspace`, or `workspace: null` to remove a module from
|
|
178
|
+
the palette).
|
|
179
|
+
|
|
180
|
+
### Portal host requirements
|
|
181
|
+
|
|
182
|
+
The host is the `PortalShell` application, for example finos/vuu
|
|
183
|
+
`vuu-ui/portal-examples/portal-host`. See its
|
|
184
|
+
`docs/module-federation-architecture.md`. Workspaces are opt in:
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
import {
|
|
188
|
+
AddPanelButton,
|
|
189
|
+
createPortalComponentRegistries,
|
|
190
|
+
PortalShell,
|
|
191
|
+
type PortalWorkspacesOptions,
|
|
192
|
+
} from "@vuu-ui/core/portal";
|
|
193
|
+
|
|
194
|
+
const { renderers, settingsCodecs } = createPortalComponentRegistries();
|
|
195
|
+
|
|
196
|
+
const workspaces: PortalWorkspacesOptions = {
|
|
197
|
+
componentRenderers: renderers,
|
|
198
|
+
headerActions: <AddPanelButton />,
|
|
199
|
+
settingsCodecs,
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
<PortalShell contextPanel={{ placement: "inline" }} workspaces={workspaces} ...>
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
- `PortalShell` renders the single `GridLayoutProvider` above both the palette
|
|
206
|
+
and the workspace. Don't add another one in the host or in a remote.
|
|
207
|
+
- `contextPanel={{ placement: "inline" }}` shows the palette beside the grid
|
|
208
|
+
instead of over it.
|
|
209
|
+
- Module Federation must share these as strict singletons
|
|
210
|
+
(`singleton: true, strictVersion: true`) in the host *and* every remote:
|
|
211
|
+
`react`, `react-dom`, `react-router-dom`, `@vuu-ui/core`,
|
|
212
|
+
`@vuu-ui/core/portal`, `@vuu-ui/grid-layout` and
|
|
213
|
+
`@vuu-ui/vuu-notifications`. A second copy of grid-layout breaks dragging
|
|
214
|
+
from the palette into the workspace; a second React or router breaks
|
|
215
|
+
rendering.
|
|
216
|
+
- Workspaces are saved by `workspaces.persistenceService`. By default that is
|
|
217
|
+
browser local storage, scoped to the `PortalShell` id and the signed-in
|
|
218
|
+
user. Servers added under Tables › Browse are kept in the per-user portal
|
|
219
|
+
state (`servers/manual`). This server doesn't store either.
|
|
220
|
+
|
|
221
|
+
To turn workspaces off, leave the `workspaces` prop off `PortalShell`. To
|
|
222
|
+
keep workspaces but hide a module from the palette, remove its `workspace`
|
|
223
|
+
descriptor.
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
# navOrder: 1
|
|
24
24
|
# navBadge: "modules.pending"
|
|
25
25
|
# notificationTopics: ["modules"]
|
|
26
|
-
# # Optional: list the module in the workspace Panels palette.
|
|
26
|
+
# # Optional: list the module in the workspace Panels palette. With it,
|
|
27
|
+
# # location and path may be "" (or omitted) for a palette-only module.
|
|
27
28
|
# workspace:
|
|
28
29
|
# paletteGroup: "Admin"
|
|
29
30
|
# iconUrl: "" # optional; data:image/... or http(s) URL
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heswell/vuu-portal",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "VUU portal server with remote module discovery",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"author": "heswell",
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@heswell/module-admin": "^2.
|
|
29
|
+
"@heswell/module-admin": "^2.3.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@heswell/vuu-server": "^3.1.0 || ^4.0.0",
|
|
33
33
|
"@heswell/vuu-table": "^1.0.1",
|
|
34
|
-
"@vuu-ui/vuu-protocol-types": "^4.0.0-alpha.
|
|
34
|
+
"@vuu-ui/vuu-protocol-types": "^4.0.0-alpha.26"
|
|
35
35
|
},
|
|
36
36
|
"repository": {
|
|
37
37
|
"type": "git",
|