@dovetail-v2/refine 0.2.0-alpha.1 → 0.2.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/dist/style.css CHANGED
@@ -45,92 +45,6 @@
45
45
  /* box shadow */
46
46
  /* fisheye */
47
47
  /* z-index */
48
- .fq4465w.ant-modal.fullscreen .ant-modal-header {
49
- padding: 60px 0 32px 0;
50
- max-width: var(--max-modal-width, 1024px);
51
- width: 100%;
52
- margin: auto;
53
- }
54
- .fq4465w.ant-modal.fullscreen .ant-modal-body {
55
- padding: 0 4px;
56
- max-width: var(--max-modal-width, 1024px);
57
- width: 100%;
58
- margin: auto;
59
- }
60
- .fq4465w.ant-modal.fullscreen .ant-modal-footer .footer-content {
61
- padding: 0;
62
- max-width: var(--max-modal-width, 1024px);
63
- width: 100%;
64
- margin: auto;
65
- }
66
-
67
- .s1nc293e.ant-modal.normal-modal .ant-modal-content {
68
- width: 492px;
69
- border-radius: 16px;
70
- }
71
- .s1nc293e.ant-modal.normal-modal .ant-modal-body {
72
- padding: 32px 40px;
73
- min-height: 160px;
74
- overflow-x: hidden;
75
- }
76
- .s1nc293e.ant-modal.normal-modal .ant-modal-header {
77
- border-radius: 16px 16px 0 0;
78
- padding: 32px 40px;
79
- padding-bottom: 0;
80
- }
81
- .s1nc293e.ant-modal.normal-modal .ant-modal-footer {
82
- padding: 24px 40px;
83
- }
84
- .s1nc293e.ant-modal.normal-modal .ant-modal-close-x {
85
- top: 35px;
86
- right: 40px;
87
- }/* // basic */
88
- /* FishEye Color Variables and Functions */
89
- /*
90
- --------------------------- Primary Color ---------------------------
91
- */
92
- /*
93
- ---------------------------When necessary to add at any time---------------------------
94
- */
95
- /* computed */
96
- /* blue */
97
- /* green */
98
- /* yellow */
99
- /* red */
100
- /* purple */
101
- /* palette global token*/
102
- /* color opaque */
103
- /* color transparent */
104
- /* blue transparent */
105
- /* green transparent */
106
- /* yellow transparent */
107
- /* red transparent */
108
- /* gray transparent */
109
- /* white transparent */
110
- /* gradient opaque */
111
- /* blue radial gradient */
112
- /* blue linear gradient */
113
- /* green radial gradient */
114
- /* yellow radial gradient */
115
- /* red radial gradient */
116
- /* gray radial gradient */
117
- /* white to gray radial gradient */
118
- /* white to gray linear gradient */
119
- /* gradient transparent */
120
- /* secondary palette */
121
- /* purple radial gradient */
122
- /* refine alias color */
123
- /* text */
124
- /* link */
125
- /* fill */
126
- /* fill element */
127
- /* fill interaction */
128
- /* stroke */
129
- /* background */
130
- /* dim */
131
- /* box shadow */
132
- /* fisheye */
133
- /* z-index */
134
48
  .s82411.ant-tag {
135
49
  padding: 3px 16px;
136
50
  height: 24px;
@@ -195,169 +109,6 @@
195
109
  /* box shadow */
196
110
  /* fisheye */
197
111
  /* z-index */
198
- .t1vq0ett {
199
- margin-bottom: 4px;
200
- }
201
-
202
- .t139onst {
203
- color: rgba(44, 56, 82, 0.6);
204
- }/* // basic */
205
- /* FishEye Color Variables and Functions */
206
- /*
207
- --------------------------- Primary Color ---------------------------
208
- */
209
- /*
210
- ---------------------------When necessary to add at any time---------------------------
211
- */
212
- /* computed */
213
- /* blue */
214
- /* green */
215
- /* yellow */
216
- /* red */
217
- /* purple */
218
- /* palette global token*/
219
- /* color opaque */
220
- /* color transparent */
221
- /* blue transparent */
222
- /* green transparent */
223
- /* yellow transparent */
224
- /* red transparent */
225
- /* gray transparent */
226
- /* white transparent */
227
- /* gradient opaque */
228
- /* blue radial gradient */
229
- /* blue linear gradient */
230
- /* green radial gradient */
231
- /* yellow radial gradient */
232
- /* red radial gradient */
233
- /* gray radial gradient */
234
- /* white to gray radial gradient */
235
- /* white to gray linear gradient */
236
- /* gradient transparent */
237
- /* secondary palette */
238
- /* purple radial gradient */
239
- /* refine alias color */
240
- /* text */
241
- /* link */
242
- /* fill */
243
- /* fill element */
244
- /* fill interaction */
245
- /* stroke */
246
- /* background */
247
- /* dim */
248
- /* box shadow */
249
- /* fisheye */
250
- /* z-index */
251
- .wwyz7ti.ant-btn.ant-btn.ant-btn-primary {
252
- background-color: #fea008;
253
- }
254
- .wwyz7ti.ant-btn.ant-btn.ant-btn-primary:hover {
255
- background-color: #feba33;
256
- }
257
-
258
- .c1xsou5f.ant-btn {
259
- border-radius: 6px;
260
- border: 1px solid rgba(172, 186, 211, 0.6) !important;
261
- }/* // basic */
262
- /* FishEye Color Variables and Functions */
263
- /*
264
- --------------------------- Primary Color ---------------------------
265
- */
266
- /*
267
- ---------------------------When necessary to add at any time---------------------------
268
- */
269
- /* computed */
270
- /* blue */
271
- /* green */
272
- /* yellow */
273
- /* red */
274
- /* purple */
275
- /* palette global token*/
276
- /* color opaque */
277
- /* color transparent */
278
- /* blue transparent */
279
- /* green transparent */
280
- /* yellow transparent */
281
- /* red transparent */
282
- /* gray transparent */
283
- /* white transparent */
284
- /* gradient opaque */
285
- /* blue radial gradient */
286
- /* blue linear gradient */
287
- /* green radial gradient */
288
- /* yellow radial gradient */
289
- /* red radial gradient */
290
- /* gray radial gradient */
291
- /* white to gray radial gradient */
292
- /* white to gray linear gradient */
293
- /* gradient transparent */
294
- /* secondary palette */
295
- /* purple radial gradient */
296
- /* refine alias color */
297
- /* text */
298
- /* link */
299
- /* fill */
300
- /* fill element */
301
- /* fill interaction */
302
- /* stroke */
303
- /* background */
304
- /* dim */
305
- /* box shadow */
306
- /* fisheye */
307
- /* z-index */
308
- .t56wb76 {
309
- margin-bottom: 4px;
310
- }
311
-
312
- .tnei7dl {
313
- color: rgba(44, 56, 82, 0.6);
314
- }/* // basic */
315
- /* FishEye Color Variables and Functions */
316
- /*
317
- --------------------------- Primary Color ---------------------------
318
- */
319
- /*
320
- ---------------------------When necessary to add at any time---------------------------
321
- */
322
- /* computed */
323
- /* blue */
324
- /* green */
325
- /* yellow */
326
- /* red */
327
- /* purple */
328
- /* palette global token*/
329
- /* color opaque */
330
- /* color transparent */
331
- /* blue transparent */
332
- /* green transparent */
333
- /* yellow transparent */
334
- /* red transparent */
335
- /* gray transparent */
336
- /* white transparent */
337
- /* gradient opaque */
338
- /* blue radial gradient */
339
- /* blue linear gradient */
340
- /* green radial gradient */
341
- /* yellow radial gradient */
342
- /* red radial gradient */
343
- /* gray radial gradient */
344
- /* white to gray radial gradient */
345
- /* white to gray linear gradient */
346
- /* gradient transparent */
347
- /* secondary palette */
348
- /* purple radial gradient */
349
- /* refine alias color */
350
- /* text */
351
- /* link */
352
- /* fill */
353
- /* fill element */
354
- /* fill interaction */
355
- /* stroke */
356
- /* background */
357
- /* dim */
358
- /* box shadow */
359
- /* fisheye */
360
- /* z-index */
361
112
  .e5223w8.empty-text {
362
113
  color: rgba(0, 21, 64, 0.3);
363
114
  }
@@ -673,6 +424,92 @@
673
424
  /* box shadow */
674
425
  /* fisheye */
675
426
  /* z-index */
427
+ .fq4465w.ant-modal.fullscreen .ant-modal-header {
428
+ padding: 60px 0 32px 0;
429
+ max-width: var(--max-modal-width, 1024px);
430
+ width: 100%;
431
+ margin: auto;
432
+ }
433
+ .fq4465w.ant-modal.fullscreen .ant-modal-body {
434
+ padding: 0 4px;
435
+ max-width: var(--max-modal-width, 1024px);
436
+ width: 100%;
437
+ margin: auto;
438
+ }
439
+ .fq4465w.ant-modal.fullscreen .ant-modal-footer .footer-content {
440
+ padding: 0;
441
+ max-width: var(--max-modal-width, 1024px);
442
+ width: 100%;
443
+ margin: auto;
444
+ }
445
+
446
+ .s1nc293e.ant-modal.normal-modal .ant-modal-content {
447
+ width: 492px;
448
+ border-radius: 16px;
449
+ }
450
+ .s1nc293e.ant-modal.normal-modal .ant-modal-body {
451
+ padding: 32px 40px;
452
+ min-height: 160px;
453
+ overflow-x: hidden;
454
+ }
455
+ .s1nc293e.ant-modal.normal-modal .ant-modal-header {
456
+ border-radius: 16px 16px 0 0;
457
+ padding: 32px 40px;
458
+ padding-bottom: 0;
459
+ }
460
+ .s1nc293e.ant-modal.normal-modal .ant-modal-footer {
461
+ padding: 24px 40px;
462
+ }
463
+ .s1nc293e.ant-modal.normal-modal .ant-modal-close-x {
464
+ top: 35px;
465
+ right: 40px;
466
+ }/* // basic */
467
+ /* FishEye Color Variables and Functions */
468
+ /*
469
+ --------------------------- Primary Color ---------------------------
470
+ */
471
+ /*
472
+ ---------------------------When necessary to add at any time---------------------------
473
+ */
474
+ /* computed */
475
+ /* blue */
476
+ /* green */
477
+ /* yellow */
478
+ /* red */
479
+ /* purple */
480
+ /* palette global token*/
481
+ /* color opaque */
482
+ /* color transparent */
483
+ /* blue transparent */
484
+ /* green transparent */
485
+ /* yellow transparent */
486
+ /* red transparent */
487
+ /* gray transparent */
488
+ /* white transparent */
489
+ /* gradient opaque */
490
+ /* blue radial gradient */
491
+ /* blue linear gradient */
492
+ /* green radial gradient */
493
+ /* yellow radial gradient */
494
+ /* red radial gradient */
495
+ /* gray radial gradient */
496
+ /* white to gray radial gradient */
497
+ /* white to gray linear gradient */
498
+ /* gradient transparent */
499
+ /* secondary palette */
500
+ /* purple radial gradient */
501
+ /* refine alias color */
502
+ /* text */
503
+ /* link */
504
+ /* fill */
505
+ /* fill element */
506
+ /* fill interaction */
507
+ /* stroke */
508
+ /* background */
509
+ /* dim */
510
+ /* box shadow */
511
+ /* fisheye */
512
+ /* z-index */
676
513
  .esoz3jw.ant-btn.ant-btn-link {
677
514
  font-size: 13px;
678
515
  height: 18px;
@@ -4225,6 +4062,63 @@
4225
4062
  /* box shadow */
4226
4063
  /* fisheye */
4227
4064
  /* z-index */
4065
+ .wwyz7ti.ant-btn.ant-btn.ant-btn-primary {
4066
+ background-color: #fea008;
4067
+ }
4068
+ .wwyz7ti.ant-btn.ant-btn.ant-btn-primary:hover {
4069
+ background-color: #feba33;
4070
+ }
4071
+
4072
+ .c1xsou5f.ant-btn {
4073
+ border-radius: 6px;
4074
+ border: 1px solid rgba(172, 186, 211, 0.6) !important;
4075
+ }/* // basic */
4076
+ /* FishEye Color Variables and Functions */
4077
+ /*
4078
+ --------------------------- Primary Color ---------------------------
4079
+ */
4080
+ /*
4081
+ ---------------------------When necessary to add at any time---------------------------
4082
+ */
4083
+ /* computed */
4084
+ /* blue */
4085
+ /* green */
4086
+ /* yellow */
4087
+ /* red */
4088
+ /* purple */
4089
+ /* palette global token*/
4090
+ /* color opaque */
4091
+ /* color transparent */
4092
+ /* blue transparent */
4093
+ /* green transparent */
4094
+ /* yellow transparent */
4095
+ /* red transparent */
4096
+ /* gray transparent */
4097
+ /* white transparent */
4098
+ /* gradient opaque */
4099
+ /* blue radial gradient */
4100
+ /* blue linear gradient */
4101
+ /* green radial gradient */
4102
+ /* yellow radial gradient */
4103
+ /* red radial gradient */
4104
+ /* gray radial gradient */
4105
+ /* white to gray radial gradient */
4106
+ /* white to gray linear gradient */
4107
+ /* gradient transparent */
4108
+ /* secondary palette */
4109
+ /* purple radial gradient */
4110
+ /* refine alias color */
4111
+ /* text */
4112
+ /* link */
4113
+ /* fill */
4114
+ /* fill element */
4115
+ /* fill interaction */
4116
+ /* stroke */
4117
+ /* background */
4118
+ /* dim */
4119
+ /* box shadow */
4120
+ /* fisheye */
4121
+ /* z-index */
4228
4122
  .c154n7ie {
4229
4123
  max-width: 144px;
4230
4124
  }
package/lib/Dovetail.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { AccessControlProvider, DataProvider, LiveProvider } from '@refinedev/core';
1
+ import { RefineProps } from '@refinedev/core';
2
2
  import { History } from 'history';
3
- import { GlobalStore } from 'k8s-api-provider';
4
3
  import React from 'react';
5
4
  import { ResourceConfig } from './types';
6
5
  import './styles.css';
6
+ import { IGlobalStore } from './types/globalStore';
7
7
  type Props = {
8
8
  resourcesConfig: ResourceConfig[];
9
9
  schemaUrlPrefix: string;
@@ -11,12 +11,8 @@ type Props = {
11
11
  urlPrefix?: string;
12
12
  Layout?: React.FC<unknown>;
13
13
  history: History;
14
- globalStore: GlobalStore;
15
- accessControlProvider?: AccessControlProvider;
16
- routerProvider?: any;
17
- dataProvider?: DataProvider;
18
- liveProvider?: LiveProvider;
14
+ globalStoreMap: Record<string, IGlobalStore<unknown>>;
19
15
  antdGetPopupContainer?: (triggerNode?: HTMLElement) => HTMLElement;
20
- };
16
+ } & Partial<RefineProps>;
21
17
  export declare const Dovetail: React.FC<Props>;
22
18
  export {};
@@ -37,6 +37,7 @@ export type InternalTableProps<Data extends {
37
37
  empty?: string;
38
38
  showMenuColumn?: boolean;
39
39
  hideNamespacesFilter?: boolean;
40
+ customNamespaceFilter?: React.ReactNode;
40
41
  };
41
42
  declare function Table<Data extends {
42
43
  id: string;
@@ -3,6 +3,7 @@ type Props = {
3
3
  resourceKind: string;
4
4
  namespace: string;
5
5
  name: string;
6
+ displayName?: string;
6
7
  uid?: string;
7
8
  };
8
9
  export declare const ResourceLink: React.FC<Props>;
@@ -1,6 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { GlobalStore } from 'k8s-api-provider';
3
- declare const GlobalStoreContext: import("react").Context<{
4
- globalStore?: GlobalStore | undefined;
5
- }>;
2
+ import { WatchEvent } from 'k8s-api-provider';
3
+ import { IGlobalStore } from 'src/types/globalStore';
4
+ declare const GlobalStoreContext: import("react").Context<Record<string, IGlobalStore<WatchEvent>>>;
6
5
  export default GlobalStoreContext;
@@ -1,6 +1,6 @@
1
1
  export * from './useSchema';
2
2
  export * from './useDeleteModal';
3
- export * from './useFailedModal';
3
+ export * from './useDeleteModal/useFailedModal';
4
4
  export * from './useEagleTable';
5
5
  export * from './useDownloadYAML';
6
6
  export * from './useEdit';
@@ -1 +1,3 @@
1
1
  export * from './useDeleteModal';
2
+ export * from './useDeleteModalOnly';
3
+ export * from './useFailedModal';
@@ -1,11 +1,13 @@
1
- import { ModalProps } from '@cloudtower/eagle';
2
- import React from 'react';
3
- export declare const useDeleteModal: (resource: string, { deleteTip, onError }?: {
4
- deleteTip?: React.ReactNode;
5
- onError?: ((error: any) => void) | undefined;
6
- }) => {
7
- modalProps: ModalProps;
8
- visible: boolean;
9
- setVisible: React.Dispatch<React.SetStateAction<boolean>>;
1
+ import { DeleteDialogProps } from '@cloudtower/eagle';
2
+ type useDeleteDialogProps = {
3
+ resourceName: string;
4
+ deleteDialogProps?: Partial<DeleteDialogProps>;
5
+ };
6
+ /**
7
+ * 打开确认删除弹窗,如果失败会自动弹出回绝弹窗
8
+ */
9
+ export declare const useDeleteModal: ({ resourceName, deleteDialogProps, }: useDeleteDialogProps) => {
10
10
  openDeleteConfirmModal: (id: string) => void;
11
+ closeDeleteConfirmModal: () => void;
11
12
  };
13
+ export {};
@@ -0,0 +1,12 @@
1
+ import { DeleteDialogProps } from '@cloudtower/eagle';
2
+ import { HttpError } from '@refinedev/core';
3
+ type useDeleteModalOnlyProps = {
4
+ resource: string;
5
+ onError?: (resourceId: string, error?: HttpError) => void;
6
+ deleteDialogProps?: Partial<DeleteDialogProps>;
7
+ };
8
+ export declare const useDeleteModalOnly: ({ resource, deleteDialogProps, onError, }: useDeleteModalOnlyProps) => {
9
+ openDeleteConfirmModal: (id: string) => void;
10
+ closeDeleteConfirmModal: () => void;
11
+ };
12
+ export {};
@@ -1,6 +1,4 @@
1
- import { ModalProps } from '@cloudtower/eagle';
2
1
  export declare const useFailedModal: (resource: string) => {
3
- modalProps: ModalProps;
4
- visible: boolean;
5
2
  openFailedModal: (id: string, errorMsgs: string[]) => void;
3
+ closeFailedModal: () => void;
6
4
  };
@@ -1,3 +1 @@
1
- export declare const useGlobalStore: () => {
2
- globalStore?: import("k8s-api-provider").GlobalStore | undefined;
3
- };
1
+ export declare const useGlobalStore: (name?: string) => import("..").IGlobalStore<import("k8s-api-provider").WatchEvent>;
@@ -0,0 +1,25 @@
1
+ import { MetaQuery } from '@refinedev/core';
2
+ import { CancelQueriesParams, IProviderPlugin, Unstructured, UnstructuredList } from 'k8s-api-provider';
3
+ interface GlobalStoreInitParams {
4
+ apiUrl: string;
5
+ fieldManager?: string;
6
+ kubeApiTimeout?: false | number;
7
+ }
8
+ export interface IGlobalStore<TWatchEvent> {
9
+ plugins: IProviderPlugin[];
10
+ prefix?: string;
11
+ fieldManager?: string;
12
+ apiUrl: string;
13
+ kubeApiTimeout: number | false | undefined;
14
+ get<T = UnstructuredList>(resource: string, meta?: MetaQuery): Promise<T>;
15
+ subscribe(resource: string, onEvent: (event: TWatchEvent) => void): () => void;
16
+ publish(resource: string, event: TWatchEvent): void;
17
+ init(params: GlobalStoreInitParams): void;
18
+ loadPlugins(plugins?: IProviderPlugin[]): void;
19
+ restoreItem(item: Unstructured): Unstructured;
20
+ restoreData(list: UnstructuredList): UnstructuredList;
21
+ destroy(): void;
22
+ cancelQueries(params?: CancelQueriesParams): void;
23
+ refreshList?(resource: string): void;
24
+ }
25
+ export {};
@@ -1 +1,2 @@
1
1
  export * from './resource';
2
+ export * from './globalStore';
@@ -151,12 +151,16 @@ export type ResourceConfig<Model extends ResourceModel = ResourceModel> = {
151
151
  * 实际效果为:{apiUrl}{basePath}{apiVersion}{name}
152
152
  */
153
153
  apiVersion: string;
154
+ /** 资源使用的 DataProvider 的名称 */
155
+ dataProviderName?: string;
154
156
  /** 资源在界面上显示的名称 */
155
157
  displayName?: string;
156
158
  /** 是否隐藏列表页的工具栏。会连标题和描述一起去掉 */
157
159
  hideListToolBar?: boolean;
158
160
  /** 是否隐藏命名空间过滤器 */
159
161
  hideNamespacesFilter?: boolean;
162
+ /** 自定义命名空间过滤器 */
163
+ customNamespaceFilter?: React.ReactNode;
160
164
  /** 是否隐藏编辑功能。会隐藏 Dropdown 和详情中的编辑按钮 */
161
165
  hideEdit?: boolean;
162
166
  /** 是否隐藏创建功能 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dovetail-v2/refine",
3
- "version": "0.2.0-alpha.1",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -10,8 +10,8 @@
10
10
  "module": "./dist/refine.js",
11
11
  "types": "./lib/index.d.ts",
12
12
  "dependencies": {
13
- "@cloudtower/eagle": "^0.31.19",
14
- "@cloudtower/icons-react": "^0.31.19",
13
+ "@cloudtower/eagle": "^0.32.50",
14
+ "@cloudtower/icons-react": "^0.32.50",
15
15
  "@patternfly/react-core": "^5.1.1",
16
16
  "@patternfly/react-log-viewer": "^5.0.0",
17
17
  "@refinedev/core": "^4.47.2",
@@ -83,8 +83,8 @@
83
83
  "vite-plugin-commonjs": "^0.10.0"
84
84
  },
85
85
  "peerDependencies": {
86
- "@cloudtower/eagle": "^0.31.18",
87
- "@cloudtower/icons-react": "^0.31.18",
86
+ "@cloudtower/eagle": "^0.32.50",
87
+ "@cloudtower/icons-react": "^0.32.50",
88
88
  "@refinedev/core": "^4.47.2",
89
89
  "antd": "4.5.0",
90
90
  "i18next": "^23.2.3",