@dovetail-v2/refine 0.4.2-beta.0 → 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.
- package/dist/{PodShell-43c7028e.cjs → PodShell-a335b2b2.cjs} +4 -2
- package/dist/{PodShell-76331418.js → PodShell-a6ed3498.js} +4 -2
- package/dist/components/CopyButton/index.d.ts +7 -0
- package/dist/components/EditMetadataForm/LabelFormatPopover.d.ts +0 -1
- package/dist/components/Form/ExtraSubmitFooter.d.ts +23 -0
- package/dist/components/Form/FormModal.d.ts +1 -1
- package/dist/components/Form/RawYamlFormModal.d.ts +1 -1
- package/dist/components/Form/RefineFormContainer.d.ts +1 -1
- package/dist/components/Form/useReactHookForm.d.ts +1 -2
- package/dist/components/Form/useRefineForm.d.ts +1 -1
- package/dist/components/FormWidgets/NameInputWidget.d.ts +0 -48
- package/dist/components/KeyValueTableForm/FormatRulePopover.d.ts +7 -0
- package/dist/components/KeyValueTableForm/index.d.ts +3 -1
- package/dist/components/ServiceComponents/index.d.ts +10 -0
- package/dist/components/Shell/ShellToolbar.d.ts +1 -1
- package/dist/components/ShowContent/fields.d.ts +4 -0
- package/dist/components/index.d.ts +2 -3
- package/dist/contexts/component.d.ts +14 -5
- package/dist/contexts/index.d.ts +1 -0
- package/dist/hooks/use409Retry.d.ts +68 -0
- package/dist/hooks/useDeleteModal/index.d.ts +1 -0
- package/dist/hooks/useEagleTable/columns.d.ts +5 -4
- package/dist/hooks/useOpenForm.d.ts +1 -1
- package/dist/hooks/useSubmitForm.d.ts +1 -1
- package/dist/hooks/useTableData.d.ts +1 -1
- package/dist/i18n.d.ts +31 -0
- package/dist/{index-31874f77.cjs → index-053ee180.cjs} +1 -1
- package/dist/{index-ab97826a.js → index-d7bc2ee6.js} +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/locales/en-US/index.d.ts +15 -0
- package/dist/locales/zh-CN/index.d.ts +16 -0
- package/dist/models/daemonset-model.d.ts +0 -3
- package/dist/models/statefulset-model.d.ts +0 -3
- package/dist/models/workload-base-model.d.ts +3 -0
- package/dist/models/workload-model.d.ts +3 -0
- package/dist/pages/deployments/form/index.d.ts +2 -1
- package/dist/plugins/model-plugin.d.ts +1 -1
- package/dist/refine.cjs +1607 -1333
- package/dist/refine.js +1611 -1337
- package/dist/shell.cjs +1 -1
- package/dist/shell.js +1 -1
- package/dist/style.css +268 -121
- package/dist/types/resource.d.ts +33 -9
- package/package.json +18 -7
|
@@ -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-
|
|
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(
|
|
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-
|
|
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(
|
|
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,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RefineFormConfig } from 'src/types';
|
|
3
|
+
import { type SaveButtonProps } from './FormModal';
|
|
4
|
+
interface UseExtraSubmitFooterOptions {
|
|
5
|
+
action: 'create' | 'edit';
|
|
6
|
+
cancelText: React.ReactNode;
|
|
7
|
+
defaultSubmitText: React.ReactNode;
|
|
8
|
+
errorText: React.ReactNode;
|
|
9
|
+
extraSubmitButton?: RefineFormConfig['extraSubmitButton'];
|
|
10
|
+
fallbackFooter?: React.ReactNode;
|
|
11
|
+
isYamlMode: boolean;
|
|
12
|
+
nextStepText: React.ReactNode;
|
|
13
|
+
prevStepText: React.ReactNode;
|
|
14
|
+
saveButtonProps: SaveButtonProps;
|
|
15
|
+
step: number;
|
|
16
|
+
stepCount: number;
|
|
17
|
+
onCancel: () => void;
|
|
18
|
+
onNextStep: () => void;
|
|
19
|
+
onPrevStep: () => void;
|
|
20
|
+
onSubmit: (e: React.BaseSyntheticEvent) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare function useExtraSubmitFooter({ action, cancelText, defaultSubmitText, errorText, extraSubmitButton, fallbackFooter, isYamlMode, nextStepText, prevStepText, saveButtonProps, step, stepCount, onCancel, onNextStep, onPrevStep, onSubmit, }: UseExtraSubmitFooterOptions): React.ReactNode;
|
|
23
|
+
export {};
|
|
@@ -17,7 +17,7 @@ export interface ConfirmModalProps {
|
|
|
17
17
|
}
|
|
18
18
|
export type FormModalProps = {
|
|
19
19
|
id?: string;
|
|
20
|
-
resourceConfig: Pick<ResourceConfig, 'name' | 'displayName' | 'kind' | 'initValue' | 'apiVersion' | 'basePath' | 'formConfig'>;
|
|
20
|
+
resourceConfig: Pick<ResourceConfig, 'name' | 'displayName' | 'kind' | 'initValue' | 'apiVersion' | 'basePath' | 'formConfig' | 'dataProviderName'>;
|
|
21
21
|
yamlFormProps?: YamlFormProps;
|
|
22
22
|
options?: {
|
|
23
23
|
initialValues?: Record<string, unknown>;
|
|
@@ -4,7 +4,7 @@ import { ResourceConfig } from 'src/types';
|
|
|
4
4
|
import { YamlFormProps } from './YamlForm';
|
|
5
5
|
type RawYamlFormModalProps = {
|
|
6
6
|
id?: string;
|
|
7
|
-
resourceConfig: Pick<ResourceConfig, 'name' | 'displayName' | 'kind' | 'initValue' | 'apiVersion' | 'basePath' | 'formConfig'>;
|
|
7
|
+
resourceConfig: Pick<ResourceConfig, 'name' | 'displayName' | 'kind' | 'initValue' | 'apiVersion' | 'basePath' | 'formConfig' | 'dataProviderName'>;
|
|
8
8
|
yamlFormProps?: YamlFormProps;
|
|
9
9
|
onSuccess?: (data: UpdateResponse<BaseRecord> | CreateResponse<BaseRecord>) => void;
|
|
10
10
|
};
|
|
@@ -7,7 +7,7 @@ import { YamlFormProps } from './YamlForm';
|
|
|
7
7
|
interface RefineFormContainerProps {
|
|
8
8
|
id: string;
|
|
9
9
|
isYamlMode: boolean;
|
|
10
|
-
resourceConfig: Pick<ResourceConfig, 'name' | 'displayName' | 'kind' | 'initValue' | 'basePath' | 'formConfig'>;
|
|
10
|
+
resourceConfig: Pick<ResourceConfig, 'name' | 'displayName' | 'kind' | 'initValue' | 'basePath' | 'formConfig' | 'dataProviderName'>;
|
|
11
11
|
step: number;
|
|
12
12
|
formConfig: (RefineFormConfig & CommonFormConfig) | undefined;
|
|
13
13
|
customYamlFormProps?: YamlFormProps;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BaseRecord, HttpError, UseFormProps as UseFormCoreProps, UseFormReturnType as UseFormReturnTypeCore } from '@refinedev/core';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { DefaultValues } from 'react-hook-form';
|
|
4
|
-
import { UseFormProps as UseHookFormProps, UseFormReturn, FieldValues } from 'react-hook-form';
|
|
3
|
+
import { DefaultValues, UseFormProps as UseHookFormProps, UseFormReturn, FieldValues } from 'react-hook-form';
|
|
5
4
|
export type UseFormReturnType<TQueryFnData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables extends FieldValues = FieldValues, TContext extends object = object, TData extends BaseRecord = TQueryFnData, TResponse extends BaseRecord = TData, TResponseError extends HttpError = TError> = UseFormReturn<TVariables, TContext> & {
|
|
6
5
|
transformedInitValues: TVariables | undefined;
|
|
7
6
|
refineCore: UseFormReturnTypeCore<TQueryFnData, TError, TVariables, TData, TResponse, TResponseError>;
|
|
@@ -9,7 +9,7 @@ interface UseRefineFormOptions {
|
|
|
9
9
|
export declare const useRefineForm: (props: {
|
|
10
10
|
formConfig?: RefineFormConfig & CommonFormConfig;
|
|
11
11
|
id?: string;
|
|
12
|
-
resourceConfig: Pick<ResourceConfig, 'name' | 'displayName' | 'kind' | 'initValue' | 'formConfig'>;
|
|
12
|
+
resourceConfig: Pick<ResourceConfig, 'name' | 'displayName' | 'kind' | 'initValue' | 'formConfig' | 'dataProviderName'>;
|
|
13
13
|
refineProps?: UseFormProps['refineCoreProps'];
|
|
14
14
|
options?: UseRefineFormOptions;
|
|
15
15
|
}) => {
|
|
@@ -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
|
-
})[];
|
|
@@ -31,6 +31,7 @@ interface KeyValueTableFormProps<T extends KeyValuePair> {
|
|
|
31
31
|
};
|
|
32
32
|
onSubmit?: (value: T[]) => Promise<unknown> | undefined;
|
|
33
33
|
keyTitle?: string;
|
|
34
|
+
formatPopover?: React.ReactNode;
|
|
34
35
|
}
|
|
35
36
|
export type KeyValueTableFormHandle<T extends KeyValuePair = KeyValuePair> = {
|
|
36
37
|
validate: () => Promise<boolean>;
|
|
@@ -38,4 +39,5 @@ export type KeyValueTableFormHandle<T extends KeyValuePair = KeyValuePair> = {
|
|
|
38
39
|
setValue: (value: T[]) => void;
|
|
39
40
|
};
|
|
40
41
|
export declare const KeyValueTableForm: React.ForwardRefExoticComponent<KeyValueTableFormProps<KeyValuePair> & React.RefAttributes<KeyValueTableFormHandle<KeyValuePair>>>;
|
|
41
|
-
export {};
|
|
42
|
+
export { FormatRulePopover } from './FormatRulePopover';
|
|
43
|
+
export type { FormatRulePopoverProps } from './FormatRulePopover';
|
|
@@ -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 {};
|
|
@@ -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
|
|
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
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import Table from 'src/components/InternalBaseTable';
|
|
3
3
|
import { Tabs } from 'src/components/Tabs';
|
|
4
|
-
|
|
5
|
-
Table?: typeof Table
|
|
6
|
-
Tabs?: typeof Tabs
|
|
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;
|
package/dist/contexts/index.d.ts
CHANGED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Unstructured } from 'k8s-api-provider';
|
|
2
|
+
import { MutableRefObject, ReactNode } from 'react';
|
|
3
|
+
export type Retry409MetaOptions = {
|
|
4
|
+
/** 编辑表单打开时捕获的初始版本;通常由本 hook 自动捕获,外部一般不需要手动传入。 */
|
|
5
|
+
initialResource?: Unstructured;
|
|
6
|
+
/** provider 判断无法安全重试时抛出的本地化错误文案。 */
|
|
7
|
+
conflictMessage?: string;
|
|
8
|
+
};
|
|
9
|
+
type MutationMetaWith409Retry = Record<string, unknown> & {
|
|
10
|
+
/** 传给 k8s-api-provider 的 409 恢复内部参数。 */
|
|
11
|
+
resourceVersionConflictRetry?: Retry409MetaOptions;
|
|
12
|
+
};
|
|
13
|
+
type Use409RetryOptions = {
|
|
14
|
+
/** 当前表单动作;只有 edit 动作会启用 409 重试,create 会自动移除重试 meta。 */
|
|
15
|
+
action?: string;
|
|
16
|
+
/** 当前表单使用的数据源名称,用于找到对应 GlobalStore 并还原 raw YAML。 */
|
|
17
|
+
dataProviderName?: string;
|
|
18
|
+
/** 当前编辑资源的 id;部分调用链 action 不稳定时,用 id 作为 edit 场景的兜底判断。 */
|
|
19
|
+
id?: unknown;
|
|
20
|
+
/** 调用方原本要传给 refine useFormCore 的 mutationMeta,本 hook 会保留其它字段并覆盖内部 409 重试参数。 */
|
|
21
|
+
mutationMeta?: MutationMetaWith409Retry;
|
|
22
|
+
};
|
|
23
|
+
type Use409RetryResult = {
|
|
24
|
+
/** queryResult 拿到资源后调用,用来捕获打开编辑表单时的初始版本。 */
|
|
25
|
+
captureInitialResource: (resource?: Unstructured) => void;
|
|
26
|
+
/** 已合并 409 重试参数的 mutationMeta,应直接传给 refine useFormCore。 */
|
|
27
|
+
mutationMeta: Record<string, unknown>;
|
|
28
|
+
};
|
|
29
|
+
type InitialResourceRef = MutableRefObject<Unstructured | undefined>;
|
|
30
|
+
type Retry409ProviderProps = {
|
|
31
|
+
/** 需要共享同一份初始版本的表单内容,例如同一个编辑弹窗内的 FORM 和 YAML 模式。 */
|
|
32
|
+
children?: ReactNode;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* 为同一个编辑弹窗内的多个表单模式共享 409 重试初始版本。
|
|
36
|
+
*
|
|
37
|
+
* 背景:FORM 模式保存失败后,如果用户切换到 YAML 模式,YAML 表单会重新挂载。
|
|
38
|
+
* 如果每个模式都维护自己的初始版本,YAML 可能捕获到已经变化的服务端版本,
|
|
39
|
+
* 导致 provider 误以为初始版本和服务端版本一致,从而允许覆盖保存。
|
|
40
|
+
*
|
|
41
|
+
* 用法:在表单弹窗层包裹一次,内部所有 `use409Retry` 会共用同一个 ref。
|
|
42
|
+
*
|
|
43
|
+
* @param props - Provider 属性。
|
|
44
|
+
* @param props.children - 需要共享初始版本的子节点。
|
|
45
|
+
* @returns 包裹后的 React 节点。
|
|
46
|
+
*/
|
|
47
|
+
export declare function Retry409Provider({ children, }: Retry409ProviderProps): import("react").FunctionComponentElement<import("react").ProviderProps<InitialResourceRef | null>>;
|
|
48
|
+
/**
|
|
49
|
+
* 为 D2 编辑表单接入 Kubernetes PUT 409 自动恢复能力。
|
|
50
|
+
*
|
|
51
|
+
* 背景:Kubernetes PUT 保存要求用户保存版本里的 `metadata.resourceVersion`
|
|
52
|
+
* 与服务端版本一致。如果用户编辑期间只有 status、managedFields 等运行时字段发生变化,
|
|
53
|
+
* D2 可以把打开表单时的初始版本交给 k8s-api-provider,由 provider 拉取服务端版本、
|
|
54
|
+
* 判断是否安全,并在安全时替换用户保存版本的 resourceVersion 后重试一次。
|
|
55
|
+
*
|
|
56
|
+
* 用法:FORM/YAML 表单在创建 refine useFormCore 前调用本 hook,把返回的 `mutationMeta`
|
|
57
|
+
* 传给 useFormCore;queryResult 首次拿到资源后调用 `captureInitialResource(data)`。
|
|
58
|
+
* D2 只负责捕获初始版本和传递本地化错误文案,比较、拉取服务端版本和重试都内聚在 provider。
|
|
59
|
+
*
|
|
60
|
+
* @param options - 409 重试接入配置。
|
|
61
|
+
* @param options.action - 当前表单动作;只有 edit 动作会启用 409 重试。
|
|
62
|
+
* @param options.dataProviderName - 当前表单使用的数据源名称,用于选择对应 GlobalStore。
|
|
63
|
+
* @param options.id - 当前编辑资源的 id,用作 edit 场景的兜底判断。
|
|
64
|
+
* @param options.mutationMeta - 调用方原本的 mutationMeta,本 hook 会保留其它字段并覆盖内部 409 重试参数。
|
|
65
|
+
* @returns 用于捕获初始版本的方法,以及应传给 useFormCore 的 mutationMeta。
|
|
66
|
+
*/
|
|
67
|
+
export declare function use409Retry({ action, dataProviderName, id, mutationMeta, }: Use409RetryOptions): Use409RetryResult;
|
|
68
|
+
export {};
|
|
@@ -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>(
|
|
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>(
|
|
31
|
-
|
|
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>;
|
|
@@ -2,7 +2,7 @@ import { CreateResponse, UpdateResponse, BaseRecord } from '@refinedev/core';
|
|
|
2
2
|
import { ResourceConfig } from 'src/types';
|
|
3
3
|
interface OpenFormOptions {
|
|
4
4
|
id?: string;
|
|
5
|
-
resourceConfig?: Pick<ResourceConfig, 'name' | 'displayName' | 'kind' | 'initValue' | 'apiVersion' | 'basePath' | 'formConfig'>;
|
|
5
|
+
resourceConfig?: Pick<ResourceConfig, 'name' | 'displayName' | 'kind' | 'initValue' | 'apiVersion' | 'basePath' | 'formConfig' | 'dataProviderName'>;
|
|
6
6
|
resourceName?: string;
|
|
7
7
|
initialValues?: Record<string, unknown>;
|
|
8
8
|
customOptions?: Record<string, unknown>;
|
|
@@ -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;
|
|
@@ -22,6 +29,8 @@ export declare const resources: {
|
|
|
22
29
|
name: string;
|
|
23
30
|
pod: string;
|
|
24
31
|
cancel: string;
|
|
32
|
+
prev_step: string;
|
|
33
|
+
next_step: string;
|
|
25
34
|
delete: string;
|
|
26
35
|
create: string;
|
|
27
36
|
confirm_delete_text: string;
|
|
@@ -187,6 +196,7 @@ export declare const resources: {
|
|
|
187
196
|
data_expired: string;
|
|
188
197
|
data_expired_body: string;
|
|
189
198
|
data_expired_note: string;
|
|
199
|
+
resource_version_conflict: string;
|
|
190
200
|
abandon_edit: string;
|
|
191
201
|
exit_yaml_tip: string;
|
|
192
202
|
value_optional: string;
|
|
@@ -283,9 +293,21 @@ export declare const resources: {
|
|
|
283
293
|
port_name: string;
|
|
284
294
|
target_port_range_limit: string;
|
|
285
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;
|
|
286
301
|
};
|
|
287
302
|
};
|
|
288
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
|
+
};
|
|
289
311
|
dovetail: {
|
|
290
312
|
copy: string;
|
|
291
313
|
reset_arguments: string;
|
|
@@ -298,6 +320,8 @@ export declare const resources: {
|
|
|
298
320
|
copied: string;
|
|
299
321
|
already_reset: string;
|
|
300
322
|
cancel: string;
|
|
323
|
+
prev_step: string;
|
|
324
|
+
next_step: string;
|
|
301
325
|
delete: string;
|
|
302
326
|
create: string;
|
|
303
327
|
delete_resource: string;
|
|
@@ -473,6 +497,7 @@ export declare const resources: {
|
|
|
473
497
|
data_expired: string;
|
|
474
498
|
data_expired_body: string;
|
|
475
499
|
data_expired_note: string;
|
|
500
|
+
resource_version_conflict: string;
|
|
476
501
|
abandon_edit: string;
|
|
477
502
|
exit_yaml_tip: string;
|
|
478
503
|
form: string;
|
|
@@ -566,6 +591,12 @@ export declare const resources: {
|
|
|
566
591
|
no_annotations: string;
|
|
567
592
|
pause_scheduling: string;
|
|
568
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;
|
|
569
600
|
};
|
|
570
601
|
};
|
|
571
602
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -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;
|
|
@@ -19,6 +26,8 @@ declare const _default: {
|
|
|
19
26
|
name: string;
|
|
20
27
|
pod: string;
|
|
21
28
|
cancel: string;
|
|
29
|
+
prev_step: string;
|
|
30
|
+
next_step: string;
|
|
22
31
|
delete: string;
|
|
23
32
|
create: string;
|
|
24
33
|
confirm_delete_text: string;
|
|
@@ -184,6 +193,7 @@ declare const _default: {
|
|
|
184
193
|
data_expired: string;
|
|
185
194
|
data_expired_body: string;
|
|
186
195
|
data_expired_note: string;
|
|
196
|
+
resource_version_conflict: string;
|
|
187
197
|
abandon_edit: string;
|
|
188
198
|
exit_yaml_tip: string;
|
|
189
199
|
value_optional: string;
|
|
@@ -280,6 +290,11 @@ declare const _default: {
|
|
|
280
290
|
port_name: string;
|
|
281
291
|
target_port_range_limit: string;
|
|
282
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;
|
|
283
298
|
};
|
|
284
299
|
};
|
|
285
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;
|
|
@@ -11,6 +18,8 @@ declare const _default: {
|
|
|
11
18
|
copied: string;
|
|
12
19
|
already_reset: string;
|
|
13
20
|
cancel: string;
|
|
21
|
+
prev_step: string;
|
|
22
|
+
next_step: string;
|
|
14
23
|
delete: string;
|
|
15
24
|
create: string;
|
|
16
25
|
delete_resource: string;
|
|
@@ -186,6 +195,7 @@ declare const _default: {
|
|
|
186
195
|
data_expired: string;
|
|
187
196
|
data_expired_body: string;
|
|
188
197
|
data_expired_note: string;
|
|
198
|
+
resource_version_conflict: string;
|
|
189
199
|
abandon_edit: string;
|
|
190
200
|
exit_yaml_tip: string;
|
|
191
201
|
form: string;
|
|
@@ -279,6 +289,12 @@ declare const _default: {
|
|
|
279
289
|
no_annotations: string;
|
|
280
290
|
pause_scheduling: string;
|
|
281
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;
|
|
282
298
|
};
|
|
283
299
|
};
|
|
284
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;
|