@dovetail-v2/refine 0.1.4 → 0.1.5-alpha.0

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 (222) hide show
  1. package/dist/{MonacoYamlDiffEditor-4060eeb6.js → MonacoYamlDiffEditor-c27ab21c.js} +1 -1
  2. package/dist/{index-9767c246.js → index-984f2ec7.js} +16296 -2217
  3. package/dist/refine.js +163 -158
  4. package/dist/refine.umd.cjs +16049 -1970
  5. package/dist/style.css +231 -3
  6. package/lib/App.d.ts +2 -0
  7. package/lib/Dovetail.d.ts +18 -0
  8. package/lib/components/Breadcrumb/index.d.ts +5 -0
  9. package/lib/components/ConditionsTable/ConditionsTable.d.ts +7 -0
  10. package/lib/components/ConditionsTable/index.d.ts +1 -0
  11. package/lib/components/CreateButton/index.d.ts +1 -0
  12. package/lib/components/CronJobDropdown/index.d.ts +8 -0
  13. package/lib/components/CronjobJobsTable/index.d.ts +8 -0
  14. package/lib/components/DeleteButton/index.d.ts +2 -0
  15. package/lib/components/DeleteManyButton/index.d.ts +4 -0
  16. package/lib/components/DrawerShow/DrawerShow.d.ts +8 -0
  17. package/lib/components/DrawerShow/index.d.ts +1 -0
  18. package/lib/components/DurationTime/index.d.ts +5 -0
  19. package/lib/components/EditButton/index.d.ts +2 -0
  20. package/lib/components/EditField/index.d.ts +15 -0
  21. package/lib/components/ErrorContent/index.d.ts +17 -0
  22. package/lib/components/EventsTable/EventsTable.d.ts +6 -0
  23. package/lib/components/EventsTable/index.d.ts +1 -0
  24. package/lib/components/Form/FormModal.d.ts +10 -0
  25. package/lib/components/Form/RefineFormContent.d.ts +11 -0
  26. package/lib/components/Form/RefineFormPage.d.ts +6 -0
  27. package/lib/components/Form/YamlForm.d.ts +28 -0
  28. package/lib/components/Form/index.d.ts +7 -0
  29. package/lib/components/Form/type.d.ts +17 -0
  30. package/lib/components/Form/useReactHookForm.d.ts +29 -0
  31. package/lib/components/Form/useRefineForm.d.ts +13 -0
  32. package/lib/components/Form/useYamlForm.d.ts +51 -0
  33. package/lib/components/FormErrorAlert/index.d.ts +9 -0
  34. package/lib/components/FormLayout/index.d.ts +7 -0
  35. package/lib/components/FormWidgets/KeyValueListWidget.d.ts +5 -0
  36. package/lib/components/FormWidgets/MetadataForm.d.ts +1 -0
  37. package/lib/components/FormWidgets/NameInputWidget.d.ts +50 -0
  38. package/lib/components/FormWidgets/NamespaceSelectWidget.d.ts +8 -0
  39. package/lib/components/FormWidgets/index.d.ts +4 -0
  40. package/lib/components/FormWidgets/widget.d.ts +5 -0
  41. package/lib/components/ImageNames/index.d.ts +5 -0
  42. package/lib/components/IngressRulesComponent/index.d.ts +5 -0
  43. package/lib/components/IngressRulesTable/IngressRulesTable.d.ts +7 -0
  44. package/lib/components/IngressRulesTable/index.d.ts +1 -0
  45. package/lib/components/K8sDropdown/index.d.ts +9 -0
  46. package/lib/components/KeyValue/KeyValue.d.ts +7 -0
  47. package/lib/components/KeyValue/KeyValueAnnotation.d.ts +5 -0
  48. package/lib/components/KeyValue/KeyValueSecret.d.ts +4 -0
  49. package/lib/components/KeyValue/index.d.ts +3 -0
  50. package/lib/components/Layout/index.d.ts +3 -0
  51. package/lib/components/LinkFallback/index.d.ts +3 -0
  52. package/lib/components/ListPage/index.d.ts +9 -0
  53. package/lib/components/Menu/index.d.ts +1 -0
  54. package/lib/components/NamespacesFilter/index.d.ts +11 -0
  55. package/lib/components/NetworkPolicyRulesViewer/NetworkPolicyRulesViewer.d.ts +8 -0
  56. package/lib/components/NetworkPolicyRulesViewer/index.d.ts +1 -0
  57. package/lib/components/PageShow/PageShow.d.ts +12 -0
  58. package/lib/components/PageShow/index.d.ts +1 -0
  59. package/lib/components/PodContainersTable/PodContainersTable.d.ts +8 -0
  60. package/lib/components/PodContainersTable/index.d.ts +1 -0
  61. package/lib/components/PodDropdown/index.d.ts +9 -0
  62. package/lib/components/PodLog/index.d.ts +6 -0
  63. package/lib/components/PodSelectorTable/index.d.ts +6 -0
  64. package/lib/components/PodShellModal/PodShell.d.ts +18 -0
  65. package/lib/components/PodShellModal/index.d.ts +9 -0
  66. package/lib/components/PortsTable/index.d.ts +7 -0
  67. package/lib/components/ReferenceLink/index.d.ts +8 -0
  68. package/lib/components/ReplicasDropdown/index.d.ts +9 -0
  69. package/lib/components/ResourceCRUD/ResourceCRUD.d.ts +7 -0
  70. package/lib/components/ResourceCRUD/create/index.d.ts +7 -0
  71. package/lib/components/ResourceCRUD/index.d.ts +4 -0
  72. package/lib/components/ResourceCRUD/list/index.d.ts +8 -0
  73. package/lib/components/ResourceCRUD/show/index.d.ts +8 -0
  74. package/lib/components/ResourceFiledDisplays.d.ts +6 -0
  75. package/lib/components/ResourceLink/index.d.ts +8 -0
  76. package/lib/components/ResourceSelect/index.d.ts +11 -0
  77. package/lib/components/ResourceUsageBar/index.d.ts +8 -0
  78. package/lib/components/Separator/index.d.ts +2 -0
  79. package/lib/components/ServiceComponents/index.d.ts +10 -0
  80. package/lib/components/Shell/index.d.ts +54 -0
  81. package/lib/components/ShowContent/ShowContent.d.ts +18 -0
  82. package/lib/components/ShowContent/fields.d.ts +68 -0
  83. package/lib/components/ShowContent/groups.d.ts +23 -0
  84. package/lib/components/ShowContent/index.d.ts +4 -0
  85. package/lib/components/ShowContent/tabs.d.ts +5 -0
  86. package/lib/components/StateTag/StateTag.d.ts +10 -0
  87. package/lib/components/StateTag/index.d.ts +1 -0
  88. package/lib/components/Table/TableToolBar.d.ts +8 -0
  89. package/lib/components/Table/TableWidgets.d.ts +6 -0
  90. package/lib/components/Table/index.d.ts +43 -0
  91. package/lib/components/Tabs/index.d.ts +10 -0
  92. package/lib/components/Tags/index.d.ts +6 -0
  93. package/lib/components/TextTags/index.d.ts +6 -0
  94. package/lib/components/Time/index.d.ts +8 -0
  95. package/lib/components/ValueDisplay/index.d.ts +9 -0
  96. package/lib/components/WorkloadDropdown/index.d.ts +9 -0
  97. package/lib/components/WorkloadPodsTable/WorkloadPodsTable.d.ts +9 -0
  98. package/lib/components/WorkloadPodsTable/index.d.ts +1 -0
  99. package/lib/components/WorkloadReplicas/index.d.ts +17 -0
  100. package/lib/components/YamlEditor/MonacoYamlDiffEditor.d.ts +9 -0
  101. package/lib/components/YamlEditor/MonacoYamlEditor.d.ts +19 -0
  102. package/lib/components/YamlEditor/YamlEditorComponent.d.ts +27 -0
  103. package/lib/components/YamlEditor/index.d.ts +1 -0
  104. package/lib/components/YamlEditor/style.d.ts +11 -0
  105. package/lib/components/YamlEditor/yaml.worker.d.ts +1 -0
  106. package/lib/components/index.d.ts +47 -0
  107. package/lib/constants/auth.d.ts +5 -0
  108. package/lib/constants/index.d.ts +3 -0
  109. package/lib/constants/k8s.d.ts +487 -0
  110. package/lib/constants/state.d.ts +15 -0
  111. package/lib/contexts/component.d.ts +7 -0
  112. package/lib/contexts/configs.d.ts +3 -0
  113. package/lib/contexts/global-store.d.ts +5 -0
  114. package/lib/contexts/index.d.ts +3 -0
  115. package/lib/hooks/index.d.ts +8 -0
  116. package/lib/hooks/useDeleteModal/index.d.ts +1 -0
  117. package/lib/hooks/useDeleteModal/useDeleteManyModal.d.ts +7 -0
  118. package/lib/hooks/useDeleteModal/useDeleteModal.d.ts +7 -0
  119. package/lib/hooks/useDownloadYAML.d.ts +7 -0
  120. package/lib/hooks/useEagleTable/columns.d.ts +41 -0
  121. package/lib/hooks/useEagleTable/index.d.ts +2 -0
  122. package/lib/hooks/useEagleTable/useEagleTable.d.ts +55 -0
  123. package/lib/hooks/useEdit.d.ts +4 -0
  124. package/lib/hooks/useGlobalStore.d.ts +3 -0
  125. package/lib/hooks/useK8sYamlEditor.d.ts +5 -0
  126. package/lib/hooks/useNamespaceRefineFilter.d.ts +5 -0
  127. package/lib/hooks/useOpenForm.d.ts +7 -0
  128. package/lib/hooks/useSchema.d.ts +14 -0
  129. package/lib/hooks/useSubmitForm.d.ts +14 -0
  130. package/lib/hooks/useTableData.d.ts +19 -0
  131. package/lib/i18n.d.ts +353 -0
  132. package/lib/index.d.ts +11 -0
  133. package/lib/locales/en-US/index.d.ts +175 -0
  134. package/lib/locales/index.d.ts +2 -0
  135. package/lib/locales/zh-CN/index.d.ts +175 -0
  136. package/lib/main.d.ts +3 -0
  137. package/lib/models/cronjob-model.d.ts +15 -0
  138. package/lib/models/daemonset-model.d.ts +15 -0
  139. package/lib/models/deployment-model.d.ts +13 -0
  140. package/lib/models/event-model.d.ts +7 -0
  141. package/lib/models/index.d.ts +19 -0
  142. package/lib/models/ingress-model.d.ts +20 -0
  143. package/lib/models/job-model.d.ts +20 -0
  144. package/lib/models/network-policy-model.d.ts +9 -0
  145. package/lib/models/node-model.d.ts +17 -0
  146. package/lib/models/persistent-volume-claim.d.ts +9 -0
  147. package/lib/models/persistent-volume.d.ts +9 -0
  148. package/lib/models/pod-metrics-model.d.ts +8 -0
  149. package/lib/models/pod-model.d.ts +20 -0
  150. package/lib/models/resource-model.d.ts +21 -0
  151. package/lib/models/service-model.d.ts +24 -0
  152. package/lib/models/statefulset-model.d.ts +13 -0
  153. package/lib/models/storage-class.d.ts +12 -0
  154. package/lib/models/types/index.d.ts +1 -0
  155. package/lib/models/types/metric.d.ts +25 -0
  156. package/lib/models/workload-base-model.d.ts +12 -0
  157. package/lib/models/workload-model.d.ts +18 -0
  158. package/lib/pages/configmaps/index.d.ts +4 -0
  159. package/lib/pages/cronjobs/create/index.d.ts +3 -0
  160. package/lib/pages/cronjobs/index.d.ts +3 -0
  161. package/lib/pages/cronjobs/list/index.d.ts +3 -0
  162. package/lib/pages/cronjobs/show/index.d.ts +3 -0
  163. package/lib/pages/daemonsets/create/index.d.ts +3 -0
  164. package/lib/pages/daemonsets/index.d.ts +3 -0
  165. package/lib/pages/daemonsets/list/index.d.ts +3 -0
  166. package/lib/pages/daemonsets/show/index.d.ts +3 -0
  167. package/lib/pages/deployments/index.d.ts +2 -0
  168. package/lib/pages/deployments/list/index.d.ts +3 -0
  169. package/lib/pages/deployments/show/index.d.ts +3 -0
  170. package/lib/pages/ingresses/index.d.ts +4 -0
  171. package/lib/pages/jobs/index.d.ts +4 -0
  172. package/lib/pages/networkPolicies/index.d.ts +4 -0
  173. package/lib/pages/nodes/index.d.ts +2 -0
  174. package/lib/pages/nodes/list/index.d.ts +3 -0
  175. package/lib/pages/nodes/show/index.d.ts +3 -0
  176. package/lib/pages/persistentvolumeclaims/index.d.ts +4 -0
  177. package/lib/pages/persistentvolumes/index.d.ts +4 -0
  178. package/lib/pages/pods/create/index.d.ts +3 -0
  179. package/lib/pages/pods/index.d.ts +3 -0
  180. package/lib/pages/pods/list/index.d.ts +3 -0
  181. package/lib/pages/pods/show/index.d.ts +3 -0
  182. package/lib/pages/secrets/index.d.ts +4 -0
  183. package/lib/pages/services/index.d.ts +4 -0
  184. package/lib/pages/statefulsets/index.d.ts +4 -0
  185. package/lib/pages/storageclasses/form/index.d.ts +9 -0
  186. package/lib/pages/storageclasses/index.d.ts +44 -0
  187. package/lib/plugins/index.d.ts +4 -0
  188. package/lib/plugins/model-plugin.d.ts +13 -0
  189. package/lib/plugins/relation-plugin.d.ts +26 -0
  190. package/lib/plugins/type.d.ts +8 -0
  191. package/lib/providers/index.d.ts +1 -0
  192. package/lib/providers/router-provider/index.d.ts +21 -0
  193. package/lib/src/components/PodDropdown/index.d.ts +9 -0
  194. package/lib/src/components/PodShellModal/PodShell.d.ts +18 -0
  195. package/lib/src/components/PodShellModal/index.d.ts +10 -0
  196. package/lib/src/components/Shell/ShellToolbar.d.ts +16 -0
  197. package/lib/src/components/Shell/index.d.ts +74 -0
  198. package/lib/src/components/index.d.ts +3 -0
  199. package/lib/src/i18n.d.ts +8 -0
  200. package/lib/src/locales/en-US/index.d.ts +1 -0
  201. package/lib/src/locales/zh-CN/index.d.ts +7 -0
  202. package/lib/src/styles/modal.d.ts +1 -0
  203. package/lib/src/utils/index.d.ts +1 -0
  204. package/lib/src/utils/shell.d.ts +16 -0
  205. package/lib/types/index.d.ts +1 -0
  206. package/lib/types/resource.d.ts +62 -0
  207. package/lib/utils/addId.d.ts +3 -0
  208. package/lib/utils/download.d.ts +1 -0
  209. package/lib/utils/error.d.ts +20 -0
  210. package/lib/utils/form.d.ts +3 -0
  211. package/lib/utils/k8s.d.ts +3 -0
  212. package/lib/utils/labels.d.ts +9 -0
  213. package/lib/utils/match-selector.d.ts +3 -0
  214. package/lib/utils/openapi.d.ts +45 -0
  215. package/lib/utils/schema.d.ts +17 -0
  216. package/lib/utils/selector.d.ts +3 -0
  217. package/lib/utils/shell.d.ts +15 -0
  218. package/lib/utils/string.d.ts +1 -0
  219. package/lib/utils/time.d.ts +13 -0
  220. package/lib/utils/unit.d.ts +12 -0
  221. package/lib/utils/yaml.d.ts +2 -0
  222. package/package.json +14 -5
@@ -0,0 +1,4 @@
1
+ import { i18n } from 'i18next';
2
+ import { ResourceModel } from '../../models';
3
+ import { ResourceConfig } from '../../types';
4
+ export declare const SecretsConfig: (i18n: i18n) => ResourceConfig<ResourceModel>;
@@ -0,0 +1,4 @@
1
+ import { i18n } from 'i18next';
2
+ import { ServiceModel } from '../../models/service-model';
3
+ import { ResourceConfig } from '../../types';
4
+ export declare const ServicesConfig: (i18n: i18n) => ResourceConfig<ServiceModel>;
@@ -0,0 +1,4 @@
1
+ import { i18n } from 'i18next';
2
+ import { StatefulSetModel } from 'src/models/statefulset-model';
3
+ import { ResourceConfig } from 'src/types';
4
+ export declare const StatefulSetConfig: (i18n: i18n) => ResourceConfig<StatefulSetModel>;
@@ -0,0 +1,9 @@
1
+ import { ResourceModel } from 'src/models';
2
+ import { ResourceConfig } from 'src/types';
3
+ type GenerateStorageClassFormConfig = {
4
+ isEnabledZbs?: boolean;
5
+ isEnabledElf?: boolean;
6
+ isVmKsc?: boolean;
7
+ };
8
+ export declare function generateStorageClassFormConfig(options: GenerateStorageClassFormConfig): ResourceConfig<ResourceModel>['formConfig'];
9
+ export {};
@@ -0,0 +1,44 @@
1
+ import { i18n as I18n } from 'i18next';
2
+ import { RESOURCE_GROUP } from 'src/types';
3
+ export declare const StorageClassConfig: (i18n: I18n) => {
4
+ name: string;
5
+ basePath: string;
6
+ kind: string;
7
+ parent: RESOURCE_GROUP;
8
+ label: string;
9
+ initValue: {
10
+ apiVersion: string;
11
+ kind: string;
12
+ metadata: {
13
+ name: string;
14
+ namespace: string;
15
+ };
16
+ spec: {};
17
+ };
18
+ formConfig: {
19
+ fields?: ((props: {
20
+ record?: import("../..").ResourceModel<import("k8s-api-provider").Unstructured> | undefined;
21
+ records: import("../..").ResourceModel<import("k8s-api-provider").Unstructured>[];
22
+ action: "create" | "edit";
23
+ }) => import("../../components").RefineFormField[]) | undefined;
24
+ saveButtonText?: string;
25
+ renderForm?: (props: import("../../components").YamlFormProps) => React.ReactNode;
26
+ formType?: import("src/types").FormType;
27
+ transformInitValues?: (values: import("k8s-api-provider").Unstructured) => import("k8s-api-provider").Unstructured;
28
+ transformApplyValues?: (values: import("k8s-api-provider").Unstructured) => import("k8s-api-provider").Unstructured;
29
+ formTitle?: string | ((action: "create" | "edit") => string);
30
+ formDesc?: string | ((action: "create" | "edit") => string);
31
+ formatError?: (errorBody: any) => string;
32
+ refineCoreProps?: import("@refinedev/react-hook-form").UseFormProps["refineCoreProps"];
33
+ useFormProps?: import("@refinedev/react-hook-form").UseFormProps;
34
+ } | undefined;
35
+ columns: () => (import("../../components").Column<import("../..").ResourceModel<import("k8s-api-provider").Unstructured>> | import("../../components").Column<import("../..").StorageClassModel>)[];
36
+ showConfig: () => {
37
+ tabs: {
38
+ title: string;
39
+ key: string;
40
+ groups: import("../../components").ShowGroup<import("../..").StorageClassModel>[];
41
+ }[];
42
+ };
43
+ };
44
+ export * from './form';
@@ -0,0 +1,4 @@
1
+ import { IProviderPlugin } from 'k8s-api-provider';
2
+ export * from './model-plugin';
3
+ export * from './relation-plugin';
4
+ export declare const ProviderPlugins: IProviderPlugin[];
@@ -0,0 +1,13 @@
1
+ import { GlobalStore, Unstructured, UnstructuredList, IProviderPlugin, DataList } from 'k8s-api-provider';
2
+ import { ResourceModel } from '../models';
3
+ export declare class ModelPlugin implements IProviderPlugin<ResourceModel> {
4
+ _globalStore?: GlobalStore;
5
+ private ModelMap;
6
+ init(globalStore: GlobalStore): void;
7
+ processData(res: UnstructuredList): Promise<DataList<ResourceModel<Unstructured>>>;
8
+ processItem(item: Unstructured): Promise<ResourceModel>;
9
+ restoreData(res: DataList<ResourceModel>): UnstructuredList;
10
+ restoreItem(item: ResourceModel): Unstructured;
11
+ setModelMap(key: string, model: ResourceModel): void;
12
+ }
13
+ export declare const modelPlugin: ModelPlugin;
@@ -0,0 +1,26 @@
1
+ import { GlobalStore, Unstructured, UnstructuredList } from 'k8s-api-provider';
2
+ import { LabelSelector, ObjectMeta } from 'kubernetes-types/meta/v1';
3
+ import { ResourceModel } from '../models';
4
+ export type Relation = {
5
+ kind: string;
6
+ apiVersion: string;
7
+ type: 'creates' | 'uses' | 'applies' | 'owner' | 'selects';
8
+ inbound: boolean;
9
+ name?: string;
10
+ namespace?: string;
11
+ selector?: LabelSelector;
12
+ };
13
+ export type ExtendObjectMeta = ObjectMeta & {
14
+ relations?: Relation[];
15
+ };
16
+ export declare class RelationPlugin {
17
+ private globalStore?;
18
+ init(globalStore: GlobalStore): void;
19
+ processData(res: UnstructuredList): Promise<UnstructuredList>;
20
+ processItem(item: Unstructured): Promise<ResourceModel>;
21
+ restoreData(res: UnstructuredList): UnstructuredList;
22
+ restoreItem(item: Unstructured): Unstructured;
23
+ private processPodSelector;
24
+ private appendRelation;
25
+ }
26
+ export declare const relationPlugin: RelationPlugin;
@@ -0,0 +1,8 @@
1
+ import { Unstructured } from 'k8s-api-provider';
2
+ import { ListMeta } from 'kubernetes-types/meta/v1';
3
+ export type DataList<Output extends Unstructured = Unstructured> = {
4
+ apiVersion: string;
5
+ kind: string;
6
+ metadata: ListMeta;
7
+ items: Array<Unstructured & Output>;
8
+ };
@@ -0,0 +1 @@
1
+ export { routerProvider } from './router-provider';
@@ -0,0 +1,21 @@
1
+ import { GoConfig, ParseResponse } from '@refinedev/core';
2
+ import React from 'react';
3
+ export declare const stringifyConfig: {
4
+ addQueryPrefix: boolean;
5
+ skipNulls: boolean;
6
+ arrayFormat: "indices";
7
+ encode: boolean;
8
+ encodeValuesOnly: boolean;
9
+ };
10
+ export declare const convertToNumberIfPossible: (value: string | undefined) => string | number | undefined;
11
+ export declare const routerProvider: {
12
+ go: () => ({ to, type, query, hash, options: { keepQuery, keepHash } }: GoConfig) => string | void;
13
+ back: () => () => void;
14
+ parse: () => () => ParseResponse;
15
+ Link: React.ForwardRefExoticComponent<Pick<{
16
+ [prop: string]: any;
17
+ to: string;
18
+ } & {
19
+ children?: React.ReactNode | undefined;
20
+ }, string | number> & React.RefAttributes<HTMLAnchorElement>>;
21
+ };
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { PodModel } from '../../models';
3
+ import { DropdownSize } from '../K8sDropdown';
4
+ type Props<Model extends PodModel> = {
5
+ record: Model;
6
+ size?: DropdownSize;
7
+ };
8
+ export declare function PodDropdown<Model extends PodModel>(props: React.PropsWithChildren<Props<Model>>): JSX.Element;
9
+ export {};
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { SocketStatus } from 'src/components/Shell';
3
+ import '@xterm/xterm/css/xterm.css';
4
+ import { PodModel } from 'src/models/pod-model';
5
+ export declare enum OS {
6
+ Linux = "linux",
7
+ Windows = "windows"
8
+ }
9
+ interface PodShellProps {
10
+ pod: PodModel;
11
+ basePath: string;
12
+ onSocketStatusChange?: (socketStatus: SocketStatus) => void;
13
+ }
14
+ interface PodShellHandler {
15
+ getAllTerminalContents: () => string[];
16
+ }
17
+ export declare const PodShell: React.ForwardRefExoticComponent<PodShellProps & React.RefAttributes<PodShellHandler>>;
18
+ export {};
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { SocketStatus } from 'src/components/Shell';
3
+ import { PodModel } from 'src/models';
4
+ import { PodShell } from './PodShell';
5
+ interface PodShellModalProps {
6
+ pod: PodModel;
7
+ onSocketStatusChange?: (socketStatus: SocketStatus) => void;
8
+ }
9
+ export declare function PodShellModal(props: PodShellModalProps): JSX.Element;
10
+ export { PodShell };
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ type OperationType = ('fontSize' | 'downloadLog' | 'clear');
3
+ export interface ShellToolbarProps {
4
+ className?: string;
5
+ leftSlot?: React.ReactNode;
6
+ operations?: (OperationType | React.ReactNode)[];
7
+ searchMatchedTotal: number;
8
+ onSearchNext: (search: string) => void;
9
+ onSearchPre: (search: string) => void;
10
+ onSetFontSize?: (size: number) => void;
11
+ onDownFontSize?: () => void;
12
+ onDownloadLog?: () => void;
13
+ onClear?: () => void;
14
+ }
15
+ declare function ShellToolbar(props: ShellToolbarProps): JSX.Element;
16
+ export default ShellToolbar;
@@ -0,0 +1,74 @@
1
+ import { Terminal } from '@xterm/xterm';
2
+ import React from 'react';
3
+ import { ShellToolbarProps } from './ShellToolbar';
4
+ import '@xterm/xterm/css/xterm.css';
5
+ export declare enum SocketStatus {
6
+ Opening = "Opening",
7
+ Open = "Open",
8
+ Disconnected = "Disconnected"
9
+ }
10
+ export type ShellProps = React.PropsWithChildren<{
11
+ url: string;
12
+ protocols?: string;
13
+ timeout?: number;
14
+ className?: string;
15
+ logFileName?: string;
16
+ isHideToolbar?: boolean;
17
+ toolbarLeftSlot?: React.ReactNode;
18
+ operations?: ShellToolbarProps['operations'];
19
+ shellOptions?: Record<string, unknown>;
20
+ loadingElement?: React.ReactNode;
21
+ encode: (input: string) => string | ArrayBufferLike | Blob | ArrayBufferView;
22
+ decode?: (output: string | ArrayBufferLike | Blob | ArrayBufferView) => string | ArrayBuffer;
23
+ fit?: (layout: {
24
+ rows: number;
25
+ cols: number;
26
+ }) => void;
27
+ onReconnect?: () => void;
28
+ onSocketInit?: (socket: WebSocket) => void;
29
+ onTermInit?: (term: Terminal) => void;
30
+ onSocketMessage?: (e: MessageEvent, socket: WebSocket, term: Terminal | null) => void;
31
+ onSocketOpen?: (socket: WebSocket) => void;
32
+ onSocketClose?: (socket: WebSocket, term: Terminal | null) => void;
33
+ onSocketStatusChange?: (socketStatus: SocketStatus) => void;
34
+ }>;
35
+ export interface ShellHandler {
36
+ clear: () => void;
37
+ send: (data: string | ArrayBufferLike | Blob | ArrayBufferView, callback?: () => void) => void;
38
+ connect: () => void;
39
+ fit: () => void;
40
+ getAllTerminalContents: () => string[];
41
+ setSocketStatus: React.Dispatch<React.SetStateAction<SocketStatus>>;
42
+ searchNext: (search: string) => void;
43
+ searchPrevious: (search: string) => void;
44
+ setOptions: (options: Record<string, unknown>) => void;
45
+ setLoading: (loading: boolean) => void;
46
+ setError: (error: unknown) => void;
47
+ }
48
+ export declare const Shell: React.ForwardRefExoticComponent<{
49
+ url: string;
50
+ protocols?: string | undefined;
51
+ timeout?: number | undefined;
52
+ className?: string | undefined;
53
+ logFileName?: string | undefined;
54
+ isHideToolbar?: boolean | undefined;
55
+ toolbarLeftSlot?: React.ReactNode;
56
+ operations?: ShellToolbarProps['operations'];
57
+ shellOptions?: Record<string, unknown> | undefined;
58
+ loadingElement?: React.ReactNode;
59
+ encode: (input: string) => string | ArrayBufferLike | Blob | ArrayBufferView;
60
+ decode?: ((output: string | ArrayBufferLike | Blob | ArrayBufferView) => string | ArrayBuffer) | undefined;
61
+ fit?: ((layout: {
62
+ rows: number;
63
+ cols: number;
64
+ }) => void) | undefined;
65
+ onReconnect?: (() => void) | undefined;
66
+ onSocketInit?: ((socket: WebSocket) => void) | undefined;
67
+ onTermInit?: ((term: Terminal) => void) | undefined;
68
+ onSocketMessage?: ((e: MessageEvent, socket: WebSocket, term: Terminal | null) => void) | undefined;
69
+ onSocketOpen?: ((socket: WebSocket) => void) | undefined;
70
+ onSocketClose?: ((socket: WebSocket, term: Terminal | null) => void) | undefined;
71
+ onSocketStatusChange?: ((socketStatus: SocketStatus) => void) | undefined;
72
+ } & {
73
+ children?: React.ReactNode;
74
+ } & React.RefAttributes<ShellHandler>>;
@@ -7,6 +7,7 @@ export * from './FormLayout';
7
7
  export * from './PodContainersTable';
8
8
  export * from './WorkloadDropdown';
9
9
  export * from './ReplicasDropdown';
10
+ export * from './PodDropdown';
10
11
  export * from './CreateButton';
11
12
  export * from './ImageNames';
12
13
  export * from './ResourceCRUD';
@@ -42,3 +43,5 @@ export * from './ResourceFiledDisplays';
42
43
  export * from './Tabs';
43
44
  export * as ValueDisplay from './ValueDisplay';
44
45
  export * from './ResourceSelect';
46
+ export * from './Shell';
47
+ export * from './PodShellModal';
package/lib/src/i18n.d.ts CHANGED
@@ -172,6 +172,7 @@ export declare const resources: {
172
172
  pv_phase_released: string;
173
173
  pv_phase_failed: string;
174
174
  pv_phase_pending: string;
175
+ exec_pod: string;
175
176
  };
176
177
  };
177
178
  'zh-CN': {
@@ -346,6 +347,13 @@ export declare const resources: {
346
347
  pv_phase_released: string;
347
348
  pv_phase_failed: string;
348
349
  pv_phase_pending: string;
350
+ font_size: string;
351
+ download_shell_content: string;
352
+ clear_shell: string;
353
+ disconnected: string;
354
+ connecting: string;
355
+ reconnect: string;
356
+ search: string;
349
357
  };
350
358
  };
351
359
  };
@@ -169,6 +169,7 @@ declare const _default: {
169
169
  pv_phase_released: string;
170
170
  pv_phase_failed: string;
171
171
  pv_phase_pending: string;
172
+ exec_pod: string;
172
173
  };
173
174
  };
174
175
  export default _default;
@@ -170,6 +170,13 @@ declare const _default: {
170
170
  pv_phase_released: string;
171
171
  pv_phase_failed: string;
172
172
  pv_phase_pending: string;
173
+ font_size: string;
174
+ download_shell_content: string;
175
+ clear_shell: string;
176
+ disconnected: string;
177
+ connecting: string;
178
+ reconnect: string;
179
+ search: string;
173
180
  };
174
181
  };
175
182
  export default _default;
@@ -0,0 +1 @@
1
+ export declare const FullscreenModalStyle: import("@linaria/core").LinariaClassName;
@@ -0,0 +1 @@
1
+ export * from './schema';
@@ -0,0 +1,16 @@
1
+ /// <reference types="node" />
2
+ import { Buffer } from 'buffer';
3
+ export type QueryParams = {
4
+ [key: string]: string | string[];
5
+ };
6
+ export declare const stdin: (characters: string) => Buffer;
7
+ export declare function addParam(url: string, key: string, val: string | string[]): string;
8
+ export declare function addParams(url: string, params: QueryParams): string;
9
+ declare enum Alphabet {
10
+ NORMAL = "normal",
11
+ URL = "url"
12
+ }
13
+ export declare function base64Encode(str: string, alphabet?: Alphabet): string;
14
+ export declare function base64DecodeToBuffer(str: string): Buffer;
15
+ export declare function base64Decode(str: string): string;
16
+ export {};
@@ -0,0 +1 @@
1
+ export * from './resource';
@@ -0,0 +1,62 @@
1
+ import { UseFormProps } from '@refinedev/react-hook-form';
2
+ import { Unstructured } from 'k8s-api-provider';
3
+ import { YamlFormProps } from '../components';
4
+ import { RefineFormField } from '../components/Form';
5
+ import { ShowConfig } from '../components/ShowContent';
6
+ import { Column, TableProps } from '../components/Table';
7
+ import { ResourceModel } from '../models';
8
+ export declare enum RESOURCE_GROUP {
9
+ WORKLOAD = "WORKLOAD",
10
+ STORAGE = "STORAGE",
11
+ NETWORK = "NETWORK",
12
+ CLUSTER = "CLUSTER",
13
+ SERVICE = "SERVICE",
14
+ SERVICE_AND_NETWORK = "SERVICE_AND_NETWORK",
15
+ CONFIG = "CONFIG",
16
+ NODE_MANAGEMENT = "NODE_MANAGEMENT"
17
+ }
18
+ export declare enum FormType {
19
+ PAGE = "PAGE",
20
+ MODAL = "MODAL"
21
+ }
22
+ export type WithId<T> = T & {
23
+ id: string;
24
+ };
25
+ export type ResourceConfig<Model extends ResourceModel = ResourceModel> = {
26
+ name: string;
27
+ kind: string;
28
+ basePath: string;
29
+ apiVersion: string;
30
+ label: string;
31
+ hideListToolBar?: boolean;
32
+ hideNamespacesFilter?: boolean;
33
+ description?: string;
34
+ parent?: RESOURCE_GROUP;
35
+ formatter?: (v: Model) => Model;
36
+ initValue?: Record<string, unknown>;
37
+ columns?: () => Column<Model>[];
38
+ noShow?: boolean;
39
+ showConfig?: () => ShowConfig<Model>;
40
+ Dropdown?: React.FC<{
41
+ record: Model;
42
+ }>;
43
+ tableProps?: Partial<TableProps<Model>>;
44
+ isCustom?: boolean;
45
+ formConfig?: {
46
+ fields?: (props: {
47
+ record?: Model;
48
+ records: Model[];
49
+ action: 'create' | 'edit';
50
+ }) => RefineFormField[];
51
+ saveButtonText?: string;
52
+ renderForm?: (props: YamlFormProps) => React.ReactNode;
53
+ formType?: FormType;
54
+ transformInitValues?: (values: Unstructured) => Unstructured;
55
+ transformApplyValues?: (values: Unstructured) => Unstructured;
56
+ formTitle?: string | ((action: 'create' | 'edit') => string);
57
+ formDesc?: string | ((action: 'create' | 'edit') => string);
58
+ formatError?: (errorBody: any) => string;
59
+ refineCoreProps?: UseFormProps['refineCoreProps'];
60
+ useFormProps?: UseFormProps;
61
+ };
62
+ };
@@ -0,0 +1,3 @@
1
+ export declare function addId<T extends object>(arr: T[], idKey: keyof T): ({
2
+ id: string;
3
+ } & T)[];
@@ -0,0 +1 @@
1
+ export declare function download(filename: string, content: string): void;
@@ -0,0 +1,20 @@
1
+ import { i18n as I18n } from 'i18next';
2
+ type Cause = {
3
+ code?: string;
4
+ reason?: string;
5
+ message: string;
6
+ field?: string;
7
+ };
8
+ export type ErrorResponseBody = {
9
+ message?: string;
10
+ code?: number;
11
+ reason?: string;
12
+ details?: {
13
+ causes?: Cause[];
14
+ };
15
+ graphQLErrors?: Cause[];
16
+ };
17
+ export declare function isNetworkError(errors?: Cause[]): boolean;
18
+ export declare function getSubmitError(errorResponse: ErrorResponseBody | undefined, text: string, i18n: I18n): string;
19
+ export declare function getCommonErrors(responseBody: ErrorResponseBody, i18n: I18n): string[];
20
+ export {};
@@ -0,0 +1,3 @@
1
+ import { ResourceModel } from 'src/models';
2
+ import { ResourceConfig } from 'src/types';
3
+ export declare function getInitialValues<Model extends ResourceModel = ResourceModel>(config: ResourceConfig<Model>): Record<string, unknown>;
@@ -0,0 +1,3 @@
1
+ import { BaseRecord } from '@refinedev/core';
2
+ export declare function getApiVersion(resourceBasePath: string): string;
3
+ export declare function pruneBeforeEdit(v: BaseRecord): void;
@@ -0,0 +1,9 @@
1
+ type Labels = Record<string, string>;
2
+ type LabelsArray = {
3
+ key: string;
4
+ value: string;
5
+ }[];
6
+ export declare function toLabelStrings(labels?: Labels): string[];
7
+ export declare function toLabelsArray(labels?: Labels): LabelsArray;
8
+ export declare function toLabelsRecord(labels: LabelsArray): Labels;
9
+ export {};
@@ -0,0 +1,3 @@
1
+ import { LabelSelector } from 'kubernetes-types/meta/v1';
2
+ import { PodModel } from '../models/pod-model';
3
+ export declare function matchSelector(pod: PodModel, selector?: LabelSelector, namespace?: string): boolean;
@@ -0,0 +1,45 @@
1
+ import { JSONSchema7 } from 'json-schema';
2
+ interface OpenAPIResponse {
3
+ openapi: string;
4
+ paths: {
5
+ [prop: string]: {
6
+ get: {
7
+ responses: {
8
+ 200: {
9
+ content: {
10
+ 'application/json': {
11
+ schema: JSONSchema7;
12
+ };
13
+ };
14
+ };
15
+ };
16
+ };
17
+ };
18
+ };
19
+ components: {
20
+ schemas: {
21
+ [prop: string]: JSONSchema7 & {
22
+ 'x-kubernetes-group-version-kind': {
23
+ group: string;
24
+ kind: string;
25
+ version: string;
26
+ }[];
27
+ };
28
+ };
29
+ };
30
+ }
31
+ declare class K8sOpenAPI {
32
+ resourceBasePath: string;
33
+ response: OpenAPIResponse | null;
34
+ apiVersion: string;
35
+ constructor(resourceBasePath: string);
36
+ fetch(): Promise<OpenAPIResponse>;
37
+ findSchema(kind: string): Promise<(JSONSchema7 & {
38
+ 'x-kubernetes-group-version-kind': {
39
+ group: string;
40
+ kind: string;
41
+ version: string;
42
+ }[];
43
+ }) | undefined>;
44
+ }
45
+ export default K8sOpenAPI;
@@ -0,0 +1,17 @@
1
+ import { JSONSchema7, JSONSchema7Type } from 'json-schema';
2
+ type TransformOptions = {
3
+ generateValue?: (schema: JSONSchema7) => JSONSchema7Type | undefined | null | Record<string, unknown>;
4
+ };
5
+ export declare function generateValueFromSchema(schema: JSONSchema7, options: TransformOptions): JSONSchema7Type | undefined | Record<string, unknown>;
6
+ export declare function generateSchemaTypeValue(schema: JSONSchema7): JSONSchema7Type | undefined | Record<string, unknown>;
7
+ type ResolveOptions = {
8
+ prune: {
9
+ description: boolean;
10
+ optional: boolean;
11
+ metadata: boolean;
12
+ fields: string[];
13
+ xProperty: boolean;
14
+ };
15
+ };
16
+ export declare function resolveRef(schema: JSONSchema7, schemas: Record<string, JSONSchema7>, options: ResolveOptions): JSONSchema7;
17
+ export {};
@@ -0,0 +1,3 @@
1
+ import { LabelSelector } from 'kubernetes-types/meta/v1';
2
+ import { PodModel } from '../models';
3
+ export declare function matchSelector(pod: PodModel, selector: LabelSelector): boolean;
@@ -0,0 +1,15 @@
1
+ import { Buffer } from 'buffer';
2
+ export type QueryParams = {
3
+ [key: string]: string | string[];
4
+ };
5
+ export declare const stdin: (characters: string) => Buffer;
6
+ export declare function addParam(url: string, key: string, val: string | string[]): string;
7
+ export declare function addParams(url: string, params: QueryParams): string;
8
+ declare enum Alphabet {
9
+ NORMAL = "normal",
10
+ URL = "url"
11
+ }
12
+ export declare function base64Encode(str: string, alphabet?: Alphabet): string;
13
+ export declare function base64DecodeToBuffer(str: string): Buffer;
14
+ export declare function base64Decode(str: string): string;
15
+ export {};
@@ -0,0 +1 @@
1
+ export declare function shortenedImage(image: string): string;
@@ -0,0 +1,13 @@
1
+ export declare function getSecondsDiff(startDate: string, endDate: string): number;
2
+ export declare function elapsedTime(seconds: number, i18nMap: {
3
+ min: string;
4
+ sec: string;
5
+ hr: string;
6
+ day: string;
7
+ }): {
8
+ diff?: undefined;
9
+ label?: undefined;
10
+ } | {
11
+ diff: number;
12
+ label: string;
13
+ };
@@ -0,0 +1,12 @@
1
+ type FormatOptions = {
2
+ increment: number;
3
+ suffix: string | null;
4
+ firstSuffix: string | null;
5
+ startingExponent: number;
6
+ minExponent: number;
7
+ maxPrecision: number;
8
+ atLeastOne: boolean;
9
+ };
10
+ export declare function formatSi(inValue: number, options?: Partial<FormatOptions>): string;
11
+ export declare function parseSi(inValue: string, increment?: number | null, allowFractional?: boolean): number;
12
+ export {};
@@ -0,0 +1,2 @@
1
+ import { JSONSchema7 } from 'json-schema';
2
+ export declare function generateYamlBySchema(defaultValue: Record<string, unknown>, schema: JSONSchema7): string;