@openmfp/webcomponents 0.6.1 → 0.6.7
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/mfp-wc-dashboard.js +153 -0
- package/mfp-webcomponents.js +573 -0
- package/package.json +14 -68
- package/.github/workflows/pipeline.yaml +0 -41
- package/.storybook/main.ts +0 -34
- package/.storybook/preview.ts +0 -29
- package/.storybook/tsconfig.json +0 -11
- package/AGENTS.md +0 -153
- package/CODEOWNERS +0 -6
- package/CONTRIBUTING.md +0 -95
- package/LICENSE +0 -201
- package/LICENSES/Apache-2.0.txt +0 -73
- package/README.md +0 -91
- package/REUSE.toml +0 -9
- package/angular.json +0 -157
- package/docs/dashboard.md +0 -358
- package/docs/declarative-form.md +0 -178
- package/docs/declarative-table-card.md +0 -235
- package/docs/declarative-table.md +0 -315
- package/eslint.config.js +0 -41
- package/projects/ngx/cards/favorites/favorites.component.html +0 -12
- package/projects/ngx/cards/favorites/favorites.component.scss +0 -50
- package/projects/ngx/cards/favorites/favorites.component.ts +0 -19
- package/projects/ngx/cards/public-api.ts +0 -4
- package/projects/ngx/cards/service-status/service-status-card.component.html +0 -15
- package/projects/ngx/cards/service-status/service-status-card.component.scss +0 -87
- package/projects/ngx/cards/service-status/service-status-card.component.ts +0 -36
- package/projects/ngx/cards/stories/visited-service-card.stories.ts +0 -149
- package/projects/ngx/cards/visited-service-card/visited-service-card.component.html +0 -17
- package/projects/ngx/cards/visited-service-card/visited-service-card.component.scss +0 -34
- package/projects/ngx/cards/visited-service-card/visited-service-card.component.ts +0 -22
- package/projects/ngx/cards/whats-new/whats-new.component.html +0 -10
- package/projects/ngx/cards/whats-new/whats-new.component.scss +0 -25
- package/projects/ngx/cards/whats-new/whats-new.component.ts +0 -46
- package/projects/ngx/declarative-ui/dashboard/add-card-dialog/add-card-dialog.component.html +0 -28
- package/projects/ngx/declarative-ui/dashboard/add-card-dialog/add-card-dialog.component.scss +0 -44
- package/projects/ngx/declarative-ui/dashboard/add-card-dialog/add-card-dialog.component.spec.ts +0 -85
- package/projects/ngx/declarative-ui/dashboard/add-card-dialog/add-card-dialog.component.ts +0 -58
- package/projects/ngx/declarative-ui/dashboard/card/dashboard-card.component.html +0 -29
- package/projects/ngx/declarative-ui/dashboard/card/dashboard-card.component.scss +0 -63
- package/projects/ngx/declarative-ui/dashboard/card/dashboard-card.component.spec.ts +0 -255
- package/projects/ngx/declarative-ui/dashboard/card/dashboard-card.component.ts +0 -75
- package/projects/ngx/declarative-ui/dashboard/card/utils/dashboard-card-registry.spec.ts +0 -76
- package/projects/ngx/declarative-ui/dashboard/card/utils/dashboard-card-registry.ts +0 -109
- package/projects/ngx/declarative-ui/dashboard/card/utils/index.ts +0 -4
- package/projects/ngx/declarative-ui/dashboard/card/utils/mount-angular-card.spec.ts +0 -141
- package/projects/ngx/declarative-ui/dashboard/card/utils/mount-angular-card.ts +0 -44
- package/projects/ngx/declarative-ui/dashboard/card/utils/mount-sap-card.spec.ts +0 -142
- package/projects/ngx/declarative-ui/dashboard/card/utils/mount-sap-card.ts +0 -52
- package/projects/ngx/declarative-ui/dashboard/card/utils/mount-wc-card.spec.ts +0 -107
- package/projects/ngx/declarative-ui/dashboard/card/utils/mount-wc-card.ts +0 -22
- package/projects/ngx/declarative-ui/dashboard/dashboard/dashboard.component.html +0 -134
- package/projects/ngx/declarative-ui/dashboard/dashboard/dashboard.component.scss +0 -88
- package/projects/ngx/declarative-ui/dashboard/dashboard/dashboard.component.spec.ts +0 -354
- package/projects/ngx/declarative-ui/dashboard/dashboard/dashboard.component.ts +0 -238
- package/projects/ngx/declarative-ui/dashboard/dashboard/index.ts +0 -1
- package/projects/ngx/declarative-ui/dashboard/index.ts +0 -5
- package/projects/ngx/declarative-ui/dashboard/models/constants.ts +0 -2
- package/projects/ngx/declarative-ui/dashboard/models/dashboard.model.ts +0 -50
- package/projects/ngx/declarative-ui/dashboard/models/index.ts +0 -1
- package/projects/ngx/declarative-ui/dashboard/section/dashboard-section.component.html +0 -28
- package/projects/ngx/declarative-ui/dashboard/section/dashboard-section.component.scss +0 -85
- package/projects/ngx/declarative-ui/dashboard/section/dashboard-section.component.spec.ts +0 -104
- package/projects/ngx/declarative-ui/dashboard/section/dashboard-section.component.ts +0 -23
- package/projects/ngx/declarative-ui/form/declarative-form/declarative-form.component.html +0 -62
- package/projects/ngx/declarative-ui/form/declarative-form/declarative-form.component.scss +0 -12
- package/projects/ngx/declarative-ui/form/declarative-form/declarative-form.component.spec.ts +0 -301
- package/projects/ngx/declarative-ui/form/declarative-form/declarative-form.component.ts +0 -166
- package/projects/ngx/declarative-ui/form/declarative-form/index.ts +0 -1
- package/projects/ngx/declarative-ui/form/index.ts +0 -2
- package/projects/ngx/declarative-ui/form/models/form-field-definition.ts +0 -15
- package/projects/ngx/declarative-ui/form/models/index.ts +0 -1
- package/projects/ngx/declarative-ui/form/utils/set-property-by-path.ts +0 -30
- package/projects/ngx/declarative-ui/models/index.ts +0 -2
- package/projects/ngx/declarative-ui/models/resource.ts +0 -5
- package/projects/ngx/declarative-ui/models/ui-definition.ts +0 -95
- package/projects/ngx/declarative-ui/public-api.ts +0 -4
- package/projects/ngx/declarative-ui/stories/add-card-dialog.stories.ts +0 -91
- package/projects/ngx/declarative-ui/stories/background-lightblue.png +0 -0
- package/projects/ngx/declarative-ui/stories/dashboard.cards.ts +0 -107
- package/projects/ngx/declarative-ui/stories/dashboard.stories.ts +0 -296
- package/projects/ngx/declarative-ui/stories/declarative-form.stories.ts +0 -149
- package/projects/ngx/declarative-ui/stories/declarative-table-card.stories.ts +0 -358
- package/projects/ngx/declarative-ui/stories/declarative-table.stories.ts +0 -363
- package/projects/ngx/declarative-ui/stories/pods-table.config.ts +0 -188
- package/projects/ngx/declarative-ui/table/declarative-table/declarative-table.component.html +0 -138
- package/projects/ngx/declarative-ui/table/declarative-table/declarative-table.component.scss +0 -21
- package/projects/ngx/declarative-ui/table/declarative-table/declarative-table.component.spec.ts +0 -345
- package/projects/ngx/declarative-ui/table/declarative-table/declarative-table.component.ts +0 -61
- package/projects/ngx/declarative-ui/table/declarative-table/index.ts +0 -1
- package/projects/ngx/declarative-ui/table/index.ts +0 -2
- package/projects/ngx/declarative-ui/table/models/index.ts +0 -14
- package/projects/ngx/declarative-ui/table/models/table.model.ts +0 -17
- package/projects/ngx/declarative-ui/table/utils/cssRules.engine.spec.ts +0 -146
- package/projects/ngx/declarative-ui/table/utils/cssRules.engine.ts +0 -69
- package/projects/ngx/declarative-ui/table/utils/field-definition.utils.spec.ts +0 -70
- package/projects/ngx/declarative-ui/table/utils/field-definition.utils.ts +0 -13
- package/projects/ngx/declarative-ui/table/utils/proccess-fields.spec.ts +0 -511
- package/projects/ngx/declarative-ui/table/utils/proccess-fields.ts +0 -71
- package/projects/ngx/declarative-ui/table/utils/resource-field-by-path.spec.ts +0 -372
- package/projects/ngx/declarative-ui/table/utils/resource-field-by-path.ts +0 -98
- package/projects/ngx/declarative-ui/table/value-cell/boolean-value/boolean-cell.constants.ts +0 -5
- package/projects/ngx/declarative-ui/table/value-cell/boolean-value/boolean-value.component.html +0 -1
- package/projects/ngx/declarative-ui/table/value-cell/boolean-value/boolean-value.component.scss +0 -0
- package/projects/ngx/declarative-ui/table/value-cell/boolean-value/boolean-value.component.spec.ts +0 -119
- package/projects/ngx/declarative-ui/table/value-cell/boolean-value/boolean-value.component.ts +0 -35
- package/projects/ngx/declarative-ui/table/value-cell/link-value/link-value.component.html +0 -7
- package/projects/ngx/declarative-ui/table/value-cell/link-value/link-value.component.scss +0 -0
- package/projects/ngx/declarative-ui/table/value-cell/link-value/link-value.component.spec.ts +0 -114
- package/projects/ngx/declarative-ui/table/value-cell/link-value/link-value.component.ts +0 -19
- package/projects/ngx/declarative-ui/table/value-cell/secret-value/secret-value.component.html +0 -7
- package/projects/ngx/declarative-ui/table/value-cell/secret-value/secret-value.component.scss +0 -10
- package/projects/ngx/declarative-ui/table/value-cell/secret-value/secret-value.component.spec.ts +0 -188
- package/projects/ngx/declarative-ui/table/value-cell/secret-value/secret-value.component.ts +0 -16
- package/projects/ngx/declarative-ui/table/value-cell/value-cell.component.html +0 -59
- package/projects/ngx/declarative-ui/table/value-cell/value-cell.component.scss +0 -33
- package/projects/ngx/declarative-ui/table/value-cell/value-cell.component.spec.ts +0 -316
- package/projects/ngx/declarative-ui/table/value-cell/value-cell.component.ts +0 -115
- package/projects/ngx/declarative-ui/table-card/declarative-table-card.component.html +0 -156
- package/projects/ngx/declarative-ui/table-card/declarative-table-card.component.scss +0 -123
- package/projects/ngx/declarative-ui/table-card/declarative-table-card.component.spec.ts +0 -786
- package/projects/ngx/declarative-ui/table-card/declarative-table-card.component.ts +0 -286
- package/projects/ngx/declarative-ui/table-card/index.ts +0 -2
- package/projects/ngx/declarative-ui/table-card/models/configs.ts +0 -46
- package/projects/ngx/declarative-ui/tsconfig.lib.json +0 -11
- package/projects/ngx/declarative-ui/tsconfig.lib.prod.json +0 -9
- package/projects/ngx/declarative-ui/tsconfig.spec.json +0 -9
- package/projects/ngx/ng-package.json +0 -8
- package/projects/ngx/package.json +0 -22
- package/projects/ngx/public-api.ts +0 -2
- package/projects/ngx/tsconfig.lib.json +0 -11
- package/projects/ngx/tsconfig.lib.prod.json +0 -9
- package/projects/webcomponents/main.ts +0 -92
- package/projects/webcomponents/tsconfig.app.json +0 -9
- package/projects/webcomponents-dashboard/main.ts +0 -15
- package/projects/webcomponents-dashboard/tsconfig.app.json +0 -9
- package/renovate.json +0 -6
- package/scripts/bundle-wc.mjs +0 -79
- package/tsconfig.json +0 -37
- package/tsconfig.spec.json +0 -8
- package/tsconfig.storybook.json +0 -16
- package/vitest.config.ts +0 -26
|
@@ -1,358 +0,0 @@
|
|
|
1
|
-
import type { FormFieldChangeEvent, FormFieldDefinition } from '../form/models';
|
|
2
|
-
import type { GenericResource } from '../models/resource';
|
|
3
|
-
import { DeclarativeTableCard } from '../table-card/declarative-table-card.component';
|
|
4
|
-
import type {
|
|
5
|
-
DeleteResourceConfirmationConfig,
|
|
6
|
-
ResourceFormConfig,
|
|
7
|
-
TableCardConfig,
|
|
8
|
-
TableCardFormState,
|
|
9
|
-
TableConfig,
|
|
10
|
-
} from '../table-card/models/configs';
|
|
11
|
-
import type { TableFieldDefinition } from '../table/models';
|
|
12
|
-
import { Component, Input } from '@angular/core';
|
|
13
|
-
import type { Meta, StoryObj } from '@storybook/angular';
|
|
14
|
-
|
|
15
|
-
// ---------------------------------------------------------------------------
|
|
16
|
-
// Sample data
|
|
17
|
-
// ---------------------------------------------------------------------------
|
|
18
|
-
|
|
19
|
-
interface Pod extends GenericResource {
|
|
20
|
-
id: string;
|
|
21
|
-
metadata: { name: string; namespace: string; uid: string };
|
|
22
|
-
status: { phase: string; ready: boolean; restarts: number; message?: string };
|
|
23
|
-
spec: { nodeName: string; image: string };
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const PODS: Pod[] = [
|
|
27
|
-
{
|
|
28
|
-
id: 'abc-001',
|
|
29
|
-
metadata: { name: 'api-server-7d9f', namespace: 'default', uid: 'abc-001' },
|
|
30
|
-
status: { phase: 'Running', ready: true, restarts: 0 },
|
|
31
|
-
spec: { nodeName: 'node-1', image: 'nginx:1.25' },
|
|
32
|
-
isAvailable: true,
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
id: 'abc-002',
|
|
36
|
-
metadata: { name: 'worker-5bc8', namespace: 'default', uid: 'abc-002' },
|
|
37
|
-
status: {
|
|
38
|
-
phase: 'Pending',
|
|
39
|
-
ready: false,
|
|
40
|
-
restarts: 3,
|
|
41
|
-
message: 'ImagePullBackOff',
|
|
42
|
-
},
|
|
43
|
-
spec: { nodeName: 'node-2', image: 'myapp:latest' },
|
|
44
|
-
isAvailable: false,
|
|
45
|
-
accessibleName: 'Pod unavailable: ImagePullBackOff',
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
id: 'abc-003',
|
|
49
|
-
metadata: {
|
|
50
|
-
name: 'cache-redis-0',
|
|
51
|
-
namespace: 'kube-system',
|
|
52
|
-
uid: 'abc-003',
|
|
53
|
-
},
|
|
54
|
-
status: { phase: 'Running', ready: true, restarts: 1 },
|
|
55
|
-
spec: { nodeName: 'node-1', image: 'redis:7' },
|
|
56
|
-
isAvailable: true,
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
id: 'abc-004',
|
|
60
|
-
metadata: {
|
|
61
|
-
name: 'db-postgres-0',
|
|
62
|
-
namespace: 'production',
|
|
63
|
-
uid: 'abc-004',
|
|
64
|
-
},
|
|
65
|
-
status: {
|
|
66
|
-
phase: 'Failed',
|
|
67
|
-
ready: false,
|
|
68
|
-
restarts: 5,
|
|
69
|
-
message: 'CrashLoopBackOff',
|
|
70
|
-
},
|
|
71
|
-
spec: { nodeName: 'node-3', image: 'postgres:16' },
|
|
72
|
-
isAvailable: false,
|
|
73
|
-
accessibleName: 'Pod unavailable: CrashLoopBackOff',
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
id: 'abc-005',
|
|
77
|
-
metadata: {
|
|
78
|
-
name: 'ingress-ctrl-xkp',
|
|
79
|
-
namespace: 'default',
|
|
80
|
-
uid: 'abc-005',
|
|
81
|
-
},
|
|
82
|
-
status: { phase: 'Running', ready: true, restarts: 0 },
|
|
83
|
-
spec: { nodeName: 'node-2', image: 'nginx-ingress:1.9' },
|
|
84
|
-
isAvailable: true,
|
|
85
|
-
},
|
|
86
|
-
];
|
|
87
|
-
|
|
88
|
-
// ---------------------------------------------------------------------------
|
|
89
|
-
// Shared definitions
|
|
90
|
-
// ---------------------------------------------------------------------------
|
|
91
|
-
|
|
92
|
-
const BASE_COLUMNS: TableFieldDefinition[] = [
|
|
93
|
-
{ label: 'Name', property: 'metadata.name' },
|
|
94
|
-
{ label: 'Namespace', property: 'metadata.namespace' },
|
|
95
|
-
{ label: 'Phase', property: 'status.phase' },
|
|
96
|
-
{ label: 'Node', property: 'spec.nodeName' },
|
|
97
|
-
];
|
|
98
|
-
|
|
99
|
-
const POD_FORM_FIELDS: FormFieldDefinition[] = [
|
|
100
|
-
{ name: 'metadata.name', label: 'Name', required: true },
|
|
101
|
-
{
|
|
102
|
-
name: 'metadata.namespace',
|
|
103
|
-
label: 'Namespace',
|
|
104
|
-
required: true,
|
|
105
|
-
values: ['default', 'kube-system', 'production'],
|
|
106
|
-
},
|
|
107
|
-
];
|
|
108
|
-
|
|
109
|
-
const CREATE_FORM_STATE_FIELDS: FormFieldDefinition[] = [
|
|
110
|
-
{
|
|
111
|
-
name: 'metadata.name',
|
|
112
|
-
label: 'Name',
|
|
113
|
-
required: true,
|
|
114
|
-
validation: 'onChange',
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
name: 'metadata.namespace',
|
|
118
|
-
label: 'Namespace',
|
|
119
|
-
required: true,
|
|
120
|
-
validation: 'onBlur',
|
|
121
|
-
},
|
|
122
|
-
];
|
|
123
|
-
|
|
124
|
-
const POD_EDIT_FORM_FIELDS: FormFieldDefinition[] = [
|
|
125
|
-
{ name: 'metadata.name', label: 'Name', required: true, disabled: true },
|
|
126
|
-
{
|
|
127
|
-
name: 'metadata.namespace',
|
|
128
|
-
label: 'Namespace',
|
|
129
|
-
required: true,
|
|
130
|
-
values: ['default', 'kube-system', 'production'],
|
|
131
|
-
},
|
|
132
|
-
];
|
|
133
|
-
|
|
134
|
-
const BASE_TABLE_CONFIG: TableConfig = {
|
|
135
|
-
fields: BASE_COLUMNS,
|
|
136
|
-
paginationLimit: 5,
|
|
137
|
-
hasMore: false,
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
const BASE_CONFIG: TableCardConfig = {
|
|
141
|
-
header: 'Pods',
|
|
142
|
-
resourcesSearchable: true,
|
|
143
|
-
tableConfig: BASE_TABLE_CONFIG,
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
// ---------------------------------------------------------------------------
|
|
147
|
-
// Wrapper component for stories that need host-owned state
|
|
148
|
-
// ---------------------------------------------------------------------------
|
|
149
|
-
|
|
150
|
-
@Component({
|
|
151
|
-
selector: 'mfp-declarative-table-card-create-story',
|
|
152
|
-
imports: [DeclarativeTableCard],
|
|
153
|
-
template: `
|
|
154
|
-
<mfp-declarative-table-card
|
|
155
|
-
#tableCard
|
|
156
|
-
[config]="config"
|
|
157
|
-
[createFormState]="createFormState"
|
|
158
|
-
[resources]="resources"
|
|
159
|
-
(createFieldChange)="onCreateFieldChange($event)"
|
|
160
|
-
(createSubmit)="onCreateSubmit($event, tableCard)"
|
|
161
|
-
/>
|
|
162
|
-
`,
|
|
163
|
-
})
|
|
164
|
-
class DeclarativeTableCardCreateStory {
|
|
165
|
-
@Input() config!: TableCardConfig;
|
|
166
|
-
@Input() resources: GenericResource[] = [];
|
|
167
|
-
createFormState: TableCardFormState = {};
|
|
168
|
-
|
|
169
|
-
onCreateFieldChange(event: FormFieldChangeEvent): void {
|
|
170
|
-
const fieldErrors: Record<string, string | null> = {
|
|
171
|
-
...this.createFormState.fieldErrors,
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
switch (event.fieldProperty) {
|
|
175
|
-
case 'metadata.name':
|
|
176
|
-
fieldErrors[event.fieldProperty] = event.value
|
|
177
|
-
? null
|
|
178
|
-
: 'Name is required';
|
|
179
|
-
break;
|
|
180
|
-
case 'metadata.namespace':
|
|
181
|
-
fieldErrors[event.fieldProperty] = event.value
|
|
182
|
-
? null
|
|
183
|
-
: 'Namespace is required';
|
|
184
|
-
break;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
this.createFormState = { fieldErrors };
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
onCreateSubmit(
|
|
191
|
-
_value: Record<string, unknown>,
|
|
192
|
-
tableCard: DeclarativeTableCard<GenericResource>,
|
|
193
|
-
): void {
|
|
194
|
-
setTimeout(() => {
|
|
195
|
-
alert(JSON.stringify(_value));
|
|
196
|
-
tableCard.closeCreateDialog();
|
|
197
|
-
}, 1000);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// ---------------------------------------------------------------------------
|
|
202
|
-
// Meta
|
|
203
|
-
// ---------------------------------------------------------------------------
|
|
204
|
-
|
|
205
|
-
const meta: Meta<DeclarativeTableCard<GenericResource>> = {
|
|
206
|
-
title: 'Declarative UI / DeclarativeTableCard',
|
|
207
|
-
component: DeclarativeTableCardCreateStory,
|
|
208
|
-
tags: ['autodocs'],
|
|
209
|
-
parameters: {
|
|
210
|
-
layout: 'fullscreen',
|
|
211
|
-
},
|
|
212
|
-
argTypes: {
|
|
213
|
-
config: { control: 'object' },
|
|
214
|
-
createFormState: { control: 'object' },
|
|
215
|
-
editFormState: { control: 'object' },
|
|
216
|
-
},
|
|
217
|
-
args: {
|
|
218
|
-
config: BASE_CONFIG,
|
|
219
|
-
editFormState: {} satisfies TableCardFormState,
|
|
220
|
-
resources: PODS,
|
|
221
|
-
},
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
export default meta;
|
|
225
|
-
type Story = StoryObj<DeclarativeTableCard<GenericResource>>;
|
|
226
|
-
|
|
227
|
-
// ---------------------------------------------------------------------------
|
|
228
|
-
// Stories
|
|
229
|
-
// ---------------------------------------------------------------------------
|
|
230
|
-
|
|
231
|
-
/** Minimal card: header, columns, and resources. No dialogs or action buttons. */
|
|
232
|
-
export const Basic: Story = {};
|
|
233
|
-
|
|
234
|
-
/** Header with an info icon that shows a tooltip on hover. */
|
|
235
|
-
export const WithHeaderTooltip: Story = {
|
|
236
|
-
args: {
|
|
237
|
-
config: {
|
|
238
|
-
...BASE_CONFIG,
|
|
239
|
-
headerTooltip: 'This table lists all pods running in the cluster.',
|
|
240
|
-
},
|
|
241
|
-
},
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
/** Adds a Create button that opens a dialog with name + namespace fields. */
|
|
245
|
-
export const WithCreate: Story = {
|
|
246
|
-
args: {
|
|
247
|
-
config: {
|
|
248
|
-
...BASE_CONFIG,
|
|
249
|
-
createResourceFormConfig: {
|
|
250
|
-
fields: POD_FORM_FIELDS,
|
|
251
|
-
title: 'Create Pod',
|
|
252
|
-
confirmLabel: 'Create',
|
|
253
|
-
cancelLabel: 'Cancel',
|
|
254
|
-
} satisfies ResourceFormConfig,
|
|
255
|
-
},
|
|
256
|
-
},
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
/** Create dialog with host-owned validation and submit state. */
|
|
260
|
-
export const WithCreateFormState: StoryObj<DeclarativeTableCardCreateStory> = {
|
|
261
|
-
render: (args) => ({
|
|
262
|
-
props: args,
|
|
263
|
-
component: DeclarativeTableCardCreateStory,
|
|
264
|
-
}),
|
|
265
|
-
args: {
|
|
266
|
-
config: {
|
|
267
|
-
...BASE_CONFIG,
|
|
268
|
-
createResourceFormConfig: {
|
|
269
|
-
fields: CREATE_FORM_STATE_FIELDS,
|
|
270
|
-
title: 'Create Pod',
|
|
271
|
-
confirmLabel: 'Create',
|
|
272
|
-
cancelLabel: 'Cancel',
|
|
273
|
-
} satisfies ResourceFormConfig,
|
|
274
|
-
},
|
|
275
|
-
resources: PODS,
|
|
276
|
-
},
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
/** Adds Edit row-action button. Clicking it opens a pre-filled dialog. */
|
|
280
|
-
export const WithEdit: Story = {
|
|
281
|
-
args: {
|
|
282
|
-
config: {
|
|
283
|
-
...BASE_CONFIG,
|
|
284
|
-
editResourceFormConfig: {
|
|
285
|
-
fields: POD_EDIT_FORM_FIELDS,
|
|
286
|
-
title: 'Edit Pod',
|
|
287
|
-
confirmLabel: 'Save',
|
|
288
|
-
cancelLabel: 'Cancel',
|
|
289
|
-
} satisfies ResourceFormConfig,
|
|
290
|
-
},
|
|
291
|
-
},
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
/** Adds Delete row-action button with a confirmation dialog. */
|
|
295
|
-
export const WithDelete: Story = {
|
|
296
|
-
args: {
|
|
297
|
-
config: {
|
|
298
|
-
...BASE_CONFIG,
|
|
299
|
-
deleteResourceConfirmationConfig: {
|
|
300
|
-
title: 'Delete Pod?',
|
|
301
|
-
message:
|
|
302
|
-
'This action cannot be undone. The pod will be permanently removed.',
|
|
303
|
-
confirmLabel: 'Delete',
|
|
304
|
-
cancelLabel: 'Cancel',
|
|
305
|
-
} satisfies DeleteResourceConfirmationConfig,
|
|
306
|
-
},
|
|
307
|
-
},
|
|
308
|
-
};
|
|
309
|
-
|
|
310
|
-
/** Full action suite: Create button, Edit row button, Delete row button. */
|
|
311
|
-
export const WithAllActions: Story = {
|
|
312
|
-
args: {
|
|
313
|
-
config: {
|
|
314
|
-
...BASE_CONFIG,
|
|
315
|
-
createResourceFormConfig: {
|
|
316
|
-
fields: POD_FORM_FIELDS,
|
|
317
|
-
title: 'Create Pod',
|
|
318
|
-
confirmLabel: 'Create',
|
|
319
|
-
cancelLabel: 'Cancel',
|
|
320
|
-
} satisfies ResourceFormConfig,
|
|
321
|
-
editResourceFormConfig: {
|
|
322
|
-
fields: POD_EDIT_FORM_FIELDS,
|
|
323
|
-
title: 'Edit Pod',
|
|
324
|
-
confirmLabel: 'Save',
|
|
325
|
-
cancelLabel: 'Cancel',
|
|
326
|
-
} satisfies ResourceFormConfig,
|
|
327
|
-
deleteResourceConfirmationConfig: {
|
|
328
|
-
title: 'Delete Pod?',
|
|
329
|
-
message:
|
|
330
|
-
'This action cannot be undone. The pod will be permanently removed.',
|
|
331
|
-
confirmLabel: 'Delete',
|
|
332
|
-
cancelLabel: 'Cancel',
|
|
333
|
-
} satisfies DeleteResourceConfirmationConfig,
|
|
334
|
-
},
|
|
335
|
-
},
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
/** Empty resources array triggers the illustrated empty-state message inside the table. */
|
|
339
|
-
export const EmptyState: Story = {
|
|
340
|
-
args: {
|
|
341
|
-
resources: [],
|
|
342
|
-
},
|
|
343
|
-
};
|
|
344
|
-
|
|
345
|
-
/** Shows pagination controls when hasMore is true. */
|
|
346
|
-
export const WithPagination: Story = {
|
|
347
|
-
args: {
|
|
348
|
-
config: {
|
|
349
|
-
...BASE_CONFIG,
|
|
350
|
-
tableConfig: {
|
|
351
|
-
...BASE_TABLE_CONFIG,
|
|
352
|
-
totalItemsCount: 42,
|
|
353
|
-
paginationLimit: 5,
|
|
354
|
-
hasMore: true,
|
|
355
|
-
},
|
|
356
|
-
},
|
|
357
|
-
},
|
|
358
|
-
};
|