@platform-mesh/portal-ui-lib 0.55.2 → 0.56.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platform-mesh/portal-ui-lib",
3
- "version": "0.55.2",
3
+ "version": "0.56.1",
4
4
  "repository": {
5
5
  "url": "git+https://github.com/platform-mesh/portal-ui-lib.git"
6
6
  },
@@ -35,6 +35,62 @@ interface LogicalCluster {
35
35
  };
36
36
  }
37
37
 
38
+ /**
39
+ * Action performed inside a modal, reported back on close.
40
+ *
41
+ * Extend this union when new modal outcomes are introduced (e.g. `'update'`,
42
+ * `'delete'`). Consumers pass the action through `goBackContext` so the host
43
+ * (e.g. a table) can react accordingly.
44
+ */
45
+ type ModalResultAction = 'create' | 'navigate' | 'loadTableData';
46
+ /**
47
+ * How the modal was closed.
48
+ *
49
+ * - `'submit'` — the user completed the modal; `action`/`resource` are honored.
50
+ * - `'cancelled'` — the modal was dismissed; the host performs no action.
51
+ */
52
+ type ModalResultStatus = 'submit' | 'cancelled';
53
+ /**
54
+ * Context passed to `LuigiClient.linkManager().goBack(context)` when a modal
55
+ * opened via `openAsModal` (button action `'openInModal'`) is closed. The
56
+ * `openAsModal` promise resolves with this value.
57
+ *
58
+ * This is the documented contract consumers use to tell the host what happened
59
+ * inside the modal — for example, that a resource was created and a table
60
+ * should reload its data.
61
+ *
62
+ * When `status` is `'cancelled'` (or absent), the host performs no action,
63
+ * regardless of `action` or `resource`.
64
+ *
65
+ * The interface is intentionally extensible: new outcomes are added to
66
+ * `ModalResultAction`, and `resource` is generic so the affected resource can
67
+ * be typed by the consumer.
68
+ *
69
+ * @typeParam T - Type of the affected resource.
70
+ */
71
+ interface ModalResultContext<T = unknown> {
72
+ /** How the modal was closed. Treated as `'cancelled'` when omitted. */
73
+ status?: ModalResultStatus;
74
+ /** Action performed inside the modal (applied only when `status` is `'submit'`). */
75
+ action?: ModalResultAction;
76
+ /** Resource affected by the action (e.g. the created resource). May be undefined. */
77
+ resource?: T;
78
+ }
79
+ /**
80
+ * Value the `openAsModal` promise resolves with. Luigi wraps the
81
+ * `goBackContext` passed to `LuigiClient.linkManager().goBack(context)` in a
82
+ * `{ data }` envelope.
83
+ *
84
+ * The whole value may be `undefined` when the modal is closed without a
85
+ * `goBack` context (e.g. dismissed via the close button or ESC).
86
+ *
87
+ * @typeParam T - Type of the affected resource.
88
+ */
89
+ interface ModalResult<T = unknown> {
90
+ /** The `goBackContext` provided when closing the modal. */
91
+ data?: ModalResultContext<T>;
92
+ }
93
+
38
94
  interface Permission {
39
95
  actions: string[];
40
96
  resource: string;
@@ -161,4 +217,4 @@ interface ResourceListResult {
161
217
  type KubernetesScope = 'Cluster' | 'Namespaced';
162
218
 
163
219
  export { ALL_NAMESPACE, DOWNLOAD_KUBECONFIG_FROM_SECRET_REF_ACTION, ResourceOperationTypeMap, kcpRootOrgsPath };
164
- export type { AccountInfo, DetailView, DownloadKubeconfigFromSecretRefButtonSettings, InstancePermission, KubernetesScope, ListView, LogicalCluster, Permission, PermissionsDefinition, PlatformMeshFieldDefinition, Resource, ResourceDefinition, ResourceListResult, ResourceMeta, ResourceOperationType, ResourcePagination, ResourceSpec, ResourceStatus, ResourceSubscriptionResult, UIDefinition, UiView };
220
+ export type { AccountInfo, DetailView, DownloadKubeconfigFromSecretRefButtonSettings, InstancePermission, KubernetesScope, ListView, LogicalCluster, ModalResult, ModalResultAction, ModalResultContext, ModalResultStatus, Permission, PermissionsDefinition, PlatformMeshFieldDefinition, Resource, ResourceDefinition, ResourceListResult, ResourceMeta, ResourceOperationType, ResourcePagination, ResourceSpec, ResourceStatus, ResourceSubscriptionResult, UIDefinition, UiView };