@dovetail-v2/refine 0.4.3 → 0.4.4

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.
Files changed (33) hide show
  1. package/dist/{PodShell-43c7028e.cjs → PodShell-a335b2b2.cjs} +4 -2
  2. package/dist/{PodShell-76331418.js → PodShell-a6ed3498.js} +4 -2
  3. package/dist/components/CopyButton/index.d.ts +7 -0
  4. package/dist/components/FormWidgets/NameInputWidget.d.ts +0 -48
  5. package/dist/components/ServiceComponents/index.d.ts +10 -0
  6. package/dist/components/Shell/ShellToolbar.d.ts +1 -1
  7. package/dist/components/ShowContent/fields.d.ts +4 -0
  8. package/dist/components/index.d.ts +2 -3
  9. package/dist/contexts/component.d.ts +14 -5
  10. package/dist/contexts/index.d.ts +1 -0
  11. package/dist/hooks/useDeleteModal/index.d.ts +1 -0
  12. package/dist/hooks/useEagleTable/columns.d.ts +5 -4
  13. package/dist/hooks/useSubmitForm.d.ts +1 -1
  14. package/dist/hooks/useTableData.d.ts +1 -1
  15. package/dist/i18n.d.ts +25 -0
  16. package/dist/{index-31874f77.cjs → index-053ee180.cjs} +1 -1
  17. package/dist/{index-ab97826a.js → index-d7bc2ee6.js} +1 -1
  18. package/dist/index.d.ts +0 -1
  19. package/dist/locales/en-US/index.d.ts +12 -0
  20. package/dist/locales/zh-CN/index.d.ts +13 -0
  21. package/dist/models/daemonset-model.d.ts +0 -3
  22. package/dist/models/statefulset-model.d.ts +0 -3
  23. package/dist/models/workload-base-model.d.ts +3 -0
  24. package/dist/models/workload-model.d.ts +3 -0
  25. package/dist/pages/deployments/form/index.d.ts +2 -1
  26. package/dist/plugins/model-plugin.d.ts +1 -1
  27. package/dist/refine.cjs +1220 -1083
  28. package/dist/refine.js +1223 -1086
  29. package/dist/shell.cjs +1 -1
  30. package/dist/shell.js +1 -1
  31. package/dist/style.css +133 -4
  32. package/dist/types/resource.d.ts +9 -9
  33. package/package.json +17 -6
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const common = require("./common-1eb43414.cjs");
4
4
  const eagle = require("@cloudtower/eagle");
5
5
  const React = require("react");
6
- const index = require("./index-31874f77.cjs");
6
+ const index = require("./index-053ee180.cjs");
7
7
  const buffer = require("buffer");
8
8
  require("@xterm/addon-canvas");
9
9
  require("@xterm/addon-fit");
@@ -66,7 +66,9 @@ function base64DecodeToBuffer(str) {
66
66
  }
67
67
  }
68
68
  function base64Decode(str) {
69
- return !str ? str : base64DecodeToBuffer(str.replace(/[-_]/g, (char) => char === "-" ? "+" : "/")).toString();
69
+ return !str ? str : base64DecodeToBuffer(
70
+ str.replace(/[-_]/g, (char) => char === "-" ? "+" : "/")
71
+ ).toString();
70
72
  }
71
73
  var OS = /* @__PURE__ */ ((OS2) => {
72
74
  OS2["Linux"] = "linux";
@@ -1,7 +1,7 @@
1
1
  import { S as SocketStatus, j as jsxRuntimeExports } from "./common-241b21f8.js";
2
2
  import { Select, AntdOption } from "@cloudtower/eagle";
3
3
  import React, { useMemo, useRef, useState, useCallback, useEffect, useImperativeHandle } from "react";
4
- import { S as Shell } from "./index-ab97826a.js";
4
+ import { S as Shell } from "./index-d7bc2ee6.js";
5
5
  import { Buffer } from "buffer";
6
6
  import "@xterm/addon-canvas";
7
7
  import "@xterm/addon-fit";
@@ -64,7 +64,9 @@ function base64DecodeToBuffer(str) {
64
64
  }
65
65
  }
66
66
  function base64Decode(str) {
67
- return !str ? str : base64DecodeToBuffer(str.replace(/[-_]/g, (char) => char === "-" ? "+" : "/")).toString();
67
+ return !str ? str : base64DecodeToBuffer(
68
+ str.replace(/[-_]/g, (char) => char === "-" ? "+" : "/")
69
+ ).toString();
68
70
  }
69
71
  var OS = /* @__PURE__ */ ((OS2) => {
70
72
  OS2["Linux"] = "linux";
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export type CopyButtonProps = {
3
+ /** 需要复制到剪贴板的内容。 */
4
+ value: string;
5
+ className?: string;
6
+ };
7
+ export declare const CopyButton: React.FC<CopyButtonProps>;
@@ -1,51 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { AntdInputProps } from '@cloudtower/eagle';
3
3
  export declare function NameInputWidget(props: AntdInputProps): JSX.Element;
4
- export declare const dnsSubDomainRules: ({
5
- required: boolean;
6
- message: string;
7
- pattern?: undefined;
8
- max?: undefined;
9
- } | {
10
- pattern: RegExp;
11
- message: string;
12
- required?: undefined;
13
- max?: undefined;
14
- } | {
15
- max: number;
16
- message: string;
17
- required?: undefined;
18
- pattern?: undefined;
19
- })[];
20
- export declare const rfc1123LabelRules: ({
21
- required: boolean;
22
- message: string;
23
- pattern?: undefined;
24
- max?: undefined;
25
- } | {
26
- pattern: RegExp;
27
- message: string;
28
- required?: undefined;
29
- max?: undefined;
30
- } | {
31
- max: number;
32
- message: string;
33
- required?: undefined;
34
- pattern?: undefined;
35
- })[];
36
- export declare const rfc1035LabelRules: ({
37
- required: boolean;
38
- message: string;
39
- pattern?: undefined;
40
- max?: undefined;
41
- } | {
42
- pattern: RegExp;
43
- message: string;
44
- required?: undefined;
45
- max?: undefined;
46
- } | {
47
- max: number;
48
- message: string;
49
- required?: undefined;
50
- pattern?: undefined;
51
- })[];
@@ -4,9 +4,19 @@ type Props = {
4
4
  service: ServiceModel;
5
5
  };
6
6
  export declare const ServiceInClusterAccessComponent: React.FC<Props>;
7
+ /**
8
+ * 渲染 Service 集群外访问方式,详情页可通过 showCopyButton 为每个地址添加复制按钮。
9
+ *
10
+ * @param service 当前 Service 资源模型。
11
+ * @param breakLine 是否按换行展示多个访问地址。
12
+ * @param clusterVip NodePort 类型拼接访问地址时使用的集群 VIP。
13
+ * @param showDashedUnderline 是否展示协议提示的虚线下划线。
14
+ * @param showCopyButton 是否在每个访问地址后展示复制按钮。
15
+ */
7
16
  export declare const ServiceOutClusterAccessComponent: React.FC<Props & {
8
17
  breakLine?: boolean;
9
18
  clusterVip: string;
10
19
  showDashedUnderline?: boolean;
20
+ showCopyButton?: boolean;
11
21
  }>;
12
22
  export {};
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- type OperationType = ('fontSize' | 'downloadLog' | 'clear');
2
+ type OperationType = 'fontSize' | 'downloadLog' | 'clear';
3
3
  export interface ShellToolbarProps {
4
4
  className?: string;
5
5
  leftSlot?: React.ReactNode;
@@ -6,6 +6,10 @@ import { ConfigMap, Secret } from 'kubernetes-types/core/v1';
6
6
  import { NetworkPolicy } from 'kubernetes-types/networking/v1';
7
7
  import React from 'react';
8
8
  import { JobModel, ResourceModel, WorkloadModel, WorkloadBaseModel, CronJobModel, IngressModel, ServiceModel, StorageClassModel, PersistentVolumeModel, PersistentVolumeClaimModel, PodModel } from '../../models';
9
+ /**
10
+ * @property render - 替换整个字段行(包括标签和值的外层布局),用于需要完全自定义布局的场景
11
+ * @property renderContent - 仅替换字段的值区域,保留标准的标签-值布局结构
12
+ */
9
13
  export type ShowField<Model extends ResourceModel> = {
10
14
  key: string;
11
15
  title?: React.ReactNode;
@@ -3,6 +3,7 @@ export * from './FormWidgets';
3
3
  export * from './PageShow';
4
4
  export * from './Time';
5
5
  export * from './ConditionsTable';
6
+ export * from './CopyButton';
6
7
  export * from './FormLayout';
7
8
  export * from './FormErrorAlert';
8
9
  export * from './PodContainersTable';
@@ -51,12 +52,10 @@ export * from './ResourceSelect';
51
52
  export * from './PodShellModal';
52
53
  export * from './ResourceTable';
53
54
  export * from './ErrorContent';
54
- export { default as ErrorContent } from './ErrorContent';
55
+ export { default as WidgetErrorContent } from './ErrorContent';
55
56
  export * from './KeyValueTableForm';
56
57
  export * from './MatchLabelSelector';
57
58
  export * from './PortsConfigForm';
58
59
  export * from './SectionTitle';
59
60
  export * from './EditMetadataForm';
60
61
  export * from './LabelsAndAnnotationsShow';
61
- export * from './FormErrorAlert';
62
- export * from './EditField';
@@ -1,8 +1,17 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import Table from 'src/components/InternalBaseTable';
3
3
  import { Tabs } from 'src/components/Tabs';
4
- declare const ComponentContext: import("react").Context<{
5
- Table?: typeof Table | undefined;
6
- Tabs?: typeof Tabs | undefined;
7
- }>;
4
+ export interface ComponentContextValue {
5
+ Table?: typeof Table;
6
+ Tabs?: typeof Tabs;
7
+ }
8
+ /**
9
+ * 允许消费者替换框架内部使用的 Table 和 Tabs 组件。
10
+ * 通过 ComponentContextProvider 注入自定义实现。
11
+ */
12
+ declare const ComponentContext: React.Context<ComponentContextValue>;
13
+ export declare function ComponentContextProvider({ value, children, }: {
14
+ value: ComponentContextValue;
15
+ children: React.ReactNode;
16
+ }): React.FunctionComponentElement<React.ProviderProps<ComponentContextValue>>;
8
17
  export default ComponentContext;
@@ -1,3 +1,4 @@
1
1
  export { default as ComponentContext } from './component';
2
+ export { ComponentContextProvider, type ComponentContextValue } from './component';
2
3
  export { default as GlobalStoreContext } from './global-store';
3
4
  export { default as ConfigsContext } from './configs';
@@ -1,3 +1,4 @@
1
+ export * from './useDeleteManyModal';
1
2
  export * from './useDeleteModal';
2
3
  export * from './useDeleteModalOnly';
3
4
  export * from './useFailedModal';
@@ -25,11 +25,12 @@ export declare const ServiceTypeColumnRenderer: <Model extends ResourceModel<Uns
25
25
  export declare function ServiceInClusterAccessTitle(): JSX.Element;
26
26
  export declare const ServiceInClusterAccessColumnRenderer: <Model extends ServiceModel>() => Column<Model>;
27
27
  export declare function ServiceOutClusterAccessTitle(): JSX.Element;
28
- export declare const ServiceOutClusterAccessColumnRenderer: <Model extends ServiceModel>(clusterVip: string) => Column<Model>;
28
+ export declare const ServiceOutClusterAccessColumnRenderer: <Model extends ServiceModel>(_i18n: I18nType, options: {
29
+ clusterVip: string;
30
+ }) => Column<Model>;
29
31
  export declare const PodWorkloadColumnRenderer: <Model extends PodModel>(i18n: I18nType) => Column<Model>;
30
- export declare const IngressRulesColumnRenderer: <Model extends IngressModel>({ i18n, noLink, }: {
31
- i18n: I18nType;
32
- noLink?: boolean | undefined;
32
+ export declare const IngressRulesColumnRenderer: <Model extends IngressModel>(i18n: I18nType, options?: {
33
+ noLink?: boolean;
33
34
  }) => Column<Model>;
34
35
  export declare const IngressDefaultBackendColumnRenderer: <Model extends IngressModel>(i18n: I18nType) => Column<Model>;
35
36
  export declare const IngressClassColumnRenderer: <Model extends IngressModel>(i18n: I18nType) => Column<Model>;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  interface UseSubmitFormOptions {
3
3
  formRef: React.MutableRefObject<{
4
- submit: () => (Promise<unknown> | boolean | undefined);
4
+ submit: () => Promise<unknown> | boolean | undefined;
5
5
  } | null>;
6
6
  onSubmitSuccess?: () => void;
7
7
  }
@@ -11,7 +11,7 @@ type UseTableDataProps<Data extends {
11
11
  };
12
12
  declare function useTableData<Data extends {
13
13
  id: string;
14
- }>({ data, columns, pageSize, defaultSorters }: UseTableDataProps<Data>): {
14
+ }>({ data, columns, pageSize, defaultSorters, }: UseTableDataProps<Data>): {
15
15
  data: Data[];
16
16
  currentPage: number;
17
17
  onPageChange: import("react").Dispatch<import("react").SetStateAction<number>>;
package/dist/i18n.d.ts CHANGED
@@ -2,6 +2,13 @@ import 'dayjs/locale/zh';
2
2
  import i18n from 'i18next';
3
3
  export declare const resources: {
4
4
  'en-US': {
5
+ app: {
6
+ add_container: string;
7
+ container_index: string;
8
+ container_name: string;
9
+ container_image: string;
10
+ advanced_settings: string;
11
+ };
5
12
  dovetail: {
6
13
  copy: string;
7
14
  reset_arguments: string;
@@ -286,9 +293,21 @@ export declare const resources: {
286
293
  port_name: string;
287
294
  target_port_range_limit: string;
288
295
  service_port_name_tip: string;
296
+ network_error: string;
297
+ retry_when_access_data_failed: string;
298
+ service: string;
299
+ ingress: string;
300
+ fstype: string;
289
301
  };
290
302
  };
291
303
  'zh-CN': {
304
+ app: {
305
+ add_container: string;
306
+ container_index: string;
307
+ container_name: string;
308
+ container_image: string;
309
+ advanced_settings: string;
310
+ };
292
311
  dovetail: {
293
312
  copy: string;
294
313
  reset_arguments: string;
@@ -572,6 +591,12 @@ export declare const resources: {
572
591
  no_annotations: string;
573
592
  pause_scheduling: string;
574
593
  service_port_name_tip: string;
594
+ exec_pod: string;
595
+ network_error: string;
596
+ retry_when_access_data_failed: string;
597
+ service: string;
598
+ ingress: string;
599
+ fstype: string;
575
600
  };
576
601
  };
577
602
  };
@@ -30,7 +30,7 @@ const Connecting = () => {
30
30
  })]
31
31
  });
32
32
  };
33
- const ShellToolbar_ihg418 = "";
33
+ const ShellToolbar_rburfa = "";
34
34
  const ToolbarStyle$1 = "tzxa6d";
35
35
  const ToolbarAreaStyle = "t1sxu3rr";
36
36
  const IconWrapperStyle = "ix8ych8";
@@ -29,7 +29,7 @@ const Connecting = () => {
29
29
  })]
30
30
  });
31
31
  };
32
- const ShellToolbar_ihg418 = "";
32
+ const ShellToolbar_rburfa = "";
33
33
  const ToolbarStyle$1 = "tzxa6d";
34
34
  const ToolbarAreaStyle = "t1sxu3rr";
35
35
  const IconWrapperStyle = "ix8ych8";
package/dist/index.d.ts CHANGED
@@ -3,7 +3,6 @@ export * from './providers';
3
3
  export * from './hooks';
4
4
  export * from './components';
5
5
  export * from './constants';
6
- export * from './hooks';
7
6
  export * from './Dovetail';
8
7
  export * from './types';
9
8
  export * from './contexts';
@@ -1,4 +1,11 @@
1
1
  declare const _default: {
2
+ app: {
3
+ add_container: string;
4
+ container_index: string;
5
+ container_name: string;
6
+ container_image: string;
7
+ advanced_settings: string;
8
+ };
2
9
  dovetail: {
3
10
  copy: string;
4
11
  reset_arguments: string;
@@ -283,6 +290,11 @@ declare const _default: {
283
290
  port_name: string;
284
291
  target_port_range_limit: string;
285
292
  service_port_name_tip: string;
293
+ network_error: string;
294
+ retry_when_access_data_failed: string;
295
+ service: string;
296
+ ingress: string;
297
+ fstype: string;
286
298
  };
287
299
  };
288
300
  export default _default;
@@ -1,4 +1,11 @@
1
1
  declare const _default: {
2
+ app: {
3
+ add_container: string;
4
+ container_index: string;
5
+ container_name: string;
6
+ container_image: string;
7
+ advanced_settings: string;
8
+ };
2
9
  dovetail: {
3
10
  copy: string;
4
11
  reset_arguments: string;
@@ -282,6 +289,12 @@ declare const _default: {
282
289
  no_annotations: string;
283
290
  pause_scheduling: string;
284
291
  service_port_name_tip: string;
292
+ exec_pod: string;
293
+ network_error: string;
294
+ retry_when_access_data_failed: string;
295
+ service: string;
296
+ ingress: string;
297
+ fstype: string;
285
298
  };
286
299
  };
287
300
  export default _default;
@@ -1,7 +1,6 @@
1
1
  import { GlobalStore, Unstructured } from 'k8s-api-provider';
2
2
  import { DaemonSet } from 'kubernetes-types/apps/v1';
3
3
  import { ResourceState } from '../constants';
4
- import { ControllerRevisionModel } from './controller-revison-model';
5
4
  import { WorkloadModel } from './workload-model';
6
5
  type RequiredDaemonSet = Required<DaemonSet> & Unstructured;
7
6
  export declare class DaemonSetModel extends WorkloadModel {
@@ -9,8 +8,6 @@ export declare class DaemonSetModel extends WorkloadModel {
9
8
  spec?: RequiredDaemonSet['spec'];
10
9
  status?: RequiredDaemonSet['status'];
11
10
  constructor(_rawYaml: RequiredDaemonSet, _globalStore: GlobalStore);
12
- getControllerRevisions(controllerVisions: ControllerRevisionModel[]): ControllerRevisionModel[];
13
- getRevision(controllerVisions: ControllerRevisionModel[]): number;
14
11
  get stateDisplay(): ResourceState.UPDATING | ResourceState.READY;
15
12
  get replicas(): number;
16
13
  get readyReplicas(): number;
@@ -1,7 +1,6 @@
1
1
  import { GlobalStore, Unstructured } from 'k8s-api-provider';
2
2
  import { StatefulSet } from 'kubernetes-types/apps/v1';
3
3
  import { ResourceState } from '../constants';
4
- import { ControllerRevisionModel } from './controller-revison-model';
5
4
  import { WorkloadModel } from './workload-model';
6
5
  type RequiredStatefulSet = Required<StatefulSet> & Unstructured;
7
6
  export declare class StatefulSetModel extends WorkloadModel {
@@ -9,8 +8,6 @@ export declare class StatefulSetModel extends WorkloadModel {
9
8
  spec?: RequiredStatefulSet['spec'];
10
9
  status?: RequiredStatefulSet['status'];
11
10
  constructor(_rawYaml: RequiredStatefulSet, _globalStore: GlobalStore);
12
- getControllerRevisions(controllerVisions: ControllerRevisionModel[]): ControllerRevisionModel[];
13
- getRevision(controllerVisions: ControllerRevisionModel[]): number;
14
11
  get stateDisplay(): ResourceState.UPDATING | ResourceState.READY | ResourceState.STOPPED;
15
12
  }
16
13
  export {};
@@ -8,5 +8,8 @@ export declare class WorkloadBaseModel extends ResourceModel<WorkloadBaseTypes>
8
8
  _rawYaml: WorkloadBaseTypes;
9
9
  constructor(_rawYaml: WorkloadBaseTypes, _globalStore: GlobalStore);
10
10
  get imageNames(): string[];
11
+ protected fetchRestarts(selector: Record<string, string> | {
12
+ matchLabels?: Record<string, string>;
13
+ } | undefined, namespace?: string): Promise<number>;
11
14
  }
12
15
  export {};
@@ -1,5 +1,6 @@
1
1
  import { GlobalStore, Unstructured } from 'k8s-api-provider';
2
2
  import type { DaemonSet, Deployment, StatefulSet } from 'kubernetes-types/apps/v1';
3
+ import { ControllerRevisionModel } from './controller-revison-model';
3
4
  import { IngressModel } from './ingress-model';
4
5
  import { ServiceModel } from './service-model';
5
6
  import { WorkloadBaseModel } from './workload-base-model';
@@ -21,5 +22,7 @@ export declare class WorkloadModel extends WorkloadBaseModel {
21
22
  get appKey(): string;
22
23
  redeploy(): WorkloadTypes;
23
24
  scale(value: number): WorkloadTypes;
25
+ getControllerRevisions(controllerRevisions: ControllerRevisionModel[]): ControllerRevisionModel[];
26
+ getRevision(controllerRevisions: ControllerRevisionModel[]): number;
24
27
  }
25
28
  export {};
@@ -1,2 +1,3 @@
1
+ import { i18n as I18nType } from 'i18next';
1
2
  import { RefineFormConfig, CommonFormConfig } from 'src/types';
2
- export declare function generatedDeploymentsFormConfig(): RefineFormConfig & CommonFormConfig;
3
+ export declare function generatedDeploymentsFormConfig(i18n: I18nType): RefineFormConfig & CommonFormConfig;
@@ -8,6 +8,6 @@ export declare class ModelPlugin implements IProviderPlugin<ResourceModel> {
8
8
  processItem(item: Unstructured): Promise<ResourceModel>;
9
9
  restoreData(res: DataList<ResourceModel>): UnstructuredList;
10
10
  restoreItem(item: ResourceModel): Unstructured;
11
- setModelMap(key: string, model: ResourceModel): void;
11
+ setModelMap(key: string, ModelClass: new (...args: never[]) => ResourceModel): void;
12
12
  }
13
13
  export declare const modelPlugin: ModelPlugin;