@dovetail-v2/refine 0.0.43 → 0.0.45-bowen.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.
- package/dist/{MonacoYamlDiffEditor-b2da37e8.js → MonacoYamlDiffEditor-5ce46809.js} +1 -1
- package/dist/{index-64df5871.js → index-c644b7e1.js} +188 -114
- package/dist/refine.js +1 -1
- package/dist/refine.umd.cjs +187 -113
- package/dist/style.css +4 -4
- package/lib/src/App.js +91 -0
- package/lib/src/Dovetail.js +45 -0
- package/lib/src/components/Breadcrumb/index.js +20 -0
- package/lib/src/components/ConditionsTable/ConditionsTable.js +56 -0
- package/lib/src/components/ConditionsTable/index.js +1 -0
- package/lib/src/components/CreateButton/index.js +10 -0
- package/lib/src/components/CronJobDropdown/index.js +26 -0
- package/lib/src/components/CronjobJobsTable/index.js +49 -0
- package/lib/src/components/DeleteButton/index.js +13 -0
- package/lib/src/components/DeleteManyButton/index.js +16 -0
- package/lib/src/components/DrawerShow/DrawerShow.js +13 -0
- package/lib/src/components/DrawerShow/index.js +1 -0
- package/lib/src/components/EditButton/index.js +13 -0
- package/lib/src/components/EditField/index.js +47 -0
- package/lib/src/components/ErrorContent/index.js +36 -0
- package/lib/src/components/EventsTable/EventsTable.js +59 -0
- package/lib/src/components/EventsTable/index.js +1 -0
- package/lib/src/components/Form/KeyValueListWidget.js +56 -0
- package/lib/src/components/Form/MetadataForm.js +9 -0
- package/lib/src/components/Form/NameInputWidget.js +50 -0
- package/lib/src/components/Form/NamespaceSelectWidget.js +21 -0
- package/lib/src/components/Form/RefineFormContent.d.ts +1 -1
- package/lib/src/components/Form/index.js +4 -0
- package/lib/src/components/Form/type.d.ts +2 -1
- package/lib/src/components/Form/useRefineForm.d.ts +2 -2
- package/lib/src/components/Form/widget.js +1 -0
- package/lib/src/components/FormErrorAlert/index.js +8 -0
- package/lib/src/components/FormLayout/index.js +21 -0
- package/lib/src/components/FormModal/index.js +51 -0
- package/lib/src/components/ImageNames/index.js +14 -0
- package/lib/src/components/IngressRulesComponent/index.js +11 -0
- package/lib/src/components/IngressRulesTable/IngressRulesTable.js +51 -0
- package/lib/src/components/IngressRulesTable/index.js +1 -0
- package/lib/src/components/K8sDropdown/index.js +31 -0
- package/lib/src/components/KeyValue/KeyValue.js +27 -0
- package/lib/src/components/KeyValue/index.js +1 -0
- package/lib/src/components/KeyValueData/index.js +50 -0
- package/lib/src/components/Layout/index.js +39 -0
- package/lib/src/components/ListPage/index.js +25 -0
- package/lib/src/components/Menu/index.js +36 -0
- package/lib/src/components/NamespacesFilter/index.js +34 -0
- package/lib/src/components/NetworkPolicyRulesTable/NetworkPolicyRulesTable.d.ts +1 -2
- package/lib/src/components/NetworkPolicyRulesTable/NetworkPolicyRulesTable.js +77 -0
- package/lib/src/components/NetworkPolicyRulesTable/index.js +1 -0
- package/lib/src/components/PageShow/PageShow.js +11 -0
- package/lib/src/components/PageShow/index.js +1 -0
- package/lib/src/components/PodContainersTable/PodContainersTable.js +78 -0
- package/lib/src/components/PodContainersTable/index.js +1 -0
- package/lib/src/components/PodLog/index.js +136 -0
- package/lib/src/components/ReferenceLink/index.js +17 -0
- package/lib/src/components/RefineForm/RefineFormContent.d.ts +10 -0
- package/lib/src/components/RefineForm/RefineFormModal.d.ts +8 -0
- package/lib/src/components/RefineForm/RefineFormPage.d.ts +7 -0
- package/lib/src/components/RefineForm/index.d.ts +3 -0
- package/lib/src/components/RefineForm/type.d.ts +20 -0
- package/lib/src/components/RefineForm/useRefineForm.d.ts +10 -0
- package/lib/src/components/ResourceCRUD/ResourceCRUD.js +15 -0
- package/lib/src/components/ResourceCRUD/create/index.js +13 -0
- package/lib/src/components/ResourceCRUD/index.js +4 -0
- package/lib/src/components/ResourceCRUD/list/index.js +19 -0
- package/lib/src/components/ResourceCRUD/show/index.js +6 -0
- package/lib/src/components/ResourceLink/index.js +21 -0
- package/lib/src/components/ResourceUsageBar/index.js +81 -0
- package/lib/src/components/Separator/index.js +11 -0
- package/lib/src/components/ShowContent/ShowContent.js +157 -0
- package/lib/src/components/ShowContent/fields.js +157 -0
- package/lib/src/components/ShowContent/index.js +2 -0
- package/lib/src/components/StateTag/StateTag.js +22 -0
- package/lib/src/components/StateTag/index.js +1 -0
- package/lib/src/components/Table/ErrorContent.js +36 -0
- package/lib/src/components/Table/TableToolBar.js +14 -0
- package/lib/src/components/Table/TableWidgets.js +28 -0
- package/lib/src/components/Table/index.js +69 -0
- package/lib/src/components/Tags/index.js +22 -0
- package/lib/src/components/Time/index.js +14 -0
- package/lib/src/components/WorkloadDropdown/index.js +24 -0
- package/lib/src/components/WorkloadPodsTable/WorkloadPodsTable.js +39 -0
- package/lib/src/components/WorkloadPodsTable/index.js +1 -0
- package/lib/src/components/WorkloadReplicas/index.js +50 -0
- package/lib/src/components/YamlEditor/MonacoYamlDiffEditor.js +34 -0
- package/lib/src/components/YamlEditor/MonacoYamlEditor.js +149 -0
- package/lib/src/components/YamlEditor/YamlEditorComponent.js +90 -0
- package/lib/src/components/YamlEditor/index.js +1 -0
- package/lib/src/components/YamlEditor/style.js +102 -0
- package/lib/src/components/YamlEditor/yaml.worker.js +1 -0
- package/lib/src/components/YamlForm/index.d.ts +0 -4
- package/lib/src/components/YamlForm/index.js +61 -0
- package/lib/src/components/index.js +38 -0
- package/lib/src/constants/index.js +2 -0
- package/lib/src/constants/k8s.js +203 -0
- package/lib/src/constants/state.js +15 -0
- package/lib/src/contexts/component.js +3 -0
- package/lib/src/contexts/configs.js +3 -0
- package/lib/src/contexts/global-store.js +3 -0
- package/lib/src/contexts/index.js +3 -0
- package/lib/src/hooks/index.js +7 -0
- package/lib/src/hooks/useDeleteModal/index.js +1 -0
- package/lib/src/hooks/useDeleteModal/useDeleteManyModal.js +31 -0
- package/lib/src/hooks/useDeleteModal/useDeleteModal.js +38 -0
- package/lib/src/hooks/useDownloadYAML.js +10 -0
- package/lib/src/hooks/useEagleForm.d.ts +1 -2
- package/lib/src/hooks/useEagleForm.js +177 -0
- package/lib/src/hooks/useEagleTable/columns.js +246 -0
- package/lib/src/hooks/useEagleTable/index.js +2 -0
- package/lib/src/hooks/useEagleTable/useEagleTable.js +63 -0
- package/lib/src/hooks/useEdit.js +19 -0
- package/lib/src/hooks/useGlobalStore.js +5 -0
- package/lib/src/hooks/useK8sYamlEditor.js +37 -0
- package/lib/src/hooks/useOpenForm.js +43 -0
- package/lib/src/hooks/useSchema.js +37 -0
- package/lib/src/hooks/useSubmitForm.js +42 -0
- package/lib/src/i18n.js +19 -0
- package/lib/src/index.js +13 -0
- package/lib/src/locales/en-US/dovetail.json +18 -0
- package/lib/src/locales/en-US/index.js +4 -0
- package/lib/src/locales/index.js +6 -0
- package/lib/src/locales/zh-CN/dovetail.json +91 -0
- package/lib/src/locales/zh-CN/index.js +4 -0
- package/lib/src/main.js +12 -0
- package/lib/src/models/cronjob-model.js +32 -0
- package/lib/src/models/daemonset-model.js +17 -0
- package/lib/src/models/deployment-model.js +17 -0
- package/lib/src/models/event-model.js +11 -0
- package/lib/src/models/index.js +14 -0
- package/lib/src/models/ingress-model.js +24 -0
- package/lib/src/models/job-model.js +56 -0
- package/lib/src/models/network-policy-model.js +10 -0
- package/lib/src/models/pod-metrics-model.js +34 -0
- package/lib/src/models/pod-model.js +78 -0
- package/lib/src/models/resource-model.js +34 -0
- package/lib/src/models/server-instance-model.d.ts +10 -0
- package/lib/src/models/service-model.js +17 -0
- package/lib/src/models/statefulset-model.js +17 -0
- package/lib/src/models/types/index.js +1 -0
- package/lib/src/models/types/metric.js +1 -0
- package/lib/src/models/workload-base-model.js +22 -0
- package/lib/src/models/workload-model.js +51 -0
- package/lib/src/pages/configmaps/index.js +15 -0
- package/lib/src/pages/cronjobs/create/index.js +6 -0
- package/lib/src/pages/cronjobs/index.js +3 -0
- package/lib/src/pages/cronjobs/list/index.js +42 -0
- package/lib/src/pages/cronjobs/show/index.js +16 -0
- package/lib/src/pages/daemonsets/create/index.js +6 -0
- package/lib/src/pages/daemonsets/index.js +3 -0
- package/lib/src/pages/daemonsets/list/index.js +32 -0
- package/lib/src/pages/daemonsets/show/index.js +16 -0
- package/lib/src/pages/deployments/create/index.js +7 -0
- package/lib/src/pages/deployments/index.js +3 -0
- package/lib/src/pages/deployments/list/index.js +26 -0
- package/lib/src/pages/deployments/show/index.js +16 -0
- package/lib/src/pages/ingresses/index.js +26 -0
- package/lib/src/pages/jobs/index.js +34 -0
- package/lib/src/pages/networkPolicies/index.js +67 -0
- package/lib/src/pages/pods/create/index.js +6 -0
- package/lib/src/pages/pods/index.js +3 -0
- package/lib/src/pages/pods/list/index.js +81 -0
- package/lib/src/pages/pods/show/index.js +54 -0
- package/lib/src/pages/secrets/index.js +15 -0
- package/lib/src/pages/services/index.js +26 -0
- package/lib/src/pages/statefulsets/create/index.js +6 -0
- package/lib/src/pages/statefulsets/index.js +3 -0
- package/lib/src/pages/statefulsets/list/index.js +26 -0
- package/lib/src/pages/statefulsets/show/index.js +16 -0
- package/lib/src/plugins/index.js +3 -0
- package/lib/src/plugins/model-plugin.js +46 -0
- package/lib/src/plugins/relation-plugin.js +81 -0
- package/lib/src/plugins/type.js +1 -0
- package/lib/src/providers/index.js +1 -0
- package/lib/src/providers/router-provider/index.js +100 -0
- package/lib/src/types/index.js +1 -0
- package/lib/src/types/resource.d.ts +2 -1
- package/lib/src/types/resource.js +12 -0
- package/lib/src/utils/addId.js +8 -0
- package/lib/src/utils/download.js +9 -0
- package/lib/src/utils/error.js +53 -0
- package/lib/src/utils/form.js +9 -0
- package/lib/src/utils/k8s.js +6 -0
- package/lib/src/utils/labels.js +15 -0
- package/lib/src/utils/match-selector.js +12 -0
- package/lib/src/utils/openapi.js +33 -0
- package/lib/src/utils/schema.js +117 -0
- package/lib/src/utils/selector.js +12 -0
- package/lib/src/utils/string.js +6 -0
- package/lib/src/utils/time.js +46 -0
- package/lib/src/utils/unit.js +69 -0
- package/lib/src/utils/yaml.js +44 -0
- package/lib/vite.config.js +60 -0
- package/package.json +1 -1
- package/lib/src/components/ModalContextProvider/index.d.ts +0 -12
- package/lib/src/hooks/useModal.d.ts +0 -0
- package/lib/src/model/cronjob-model.d.ts +0 -9
- package/lib/src/model/index.d.ts +0 -6
- package/lib/src/model/job-model.d.ts +0 -10
- package/lib/src/model/pod-metrics-model.d.ts +0 -7
- package/lib/src/model/pod-model.d.ts +0 -15
- package/lib/src/model/resource-model.d.ts +0 -17
- package/lib/src/model/workload-model.d.ts +0 -17
- package/lib/src/types/metric.d.ts +0 -25
package/dist/refine.umd.cjs
CHANGED
|
@@ -9959,7 +9959,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9959
9959
|
children: content || "-"
|
|
9960
9960
|
});
|
|
9961
9961
|
};
|
|
9962
|
-
const
|
|
9962
|
+
const index_10ylmu3 = "";
|
|
9963
9963
|
const TagWrapper = "t13a6vox";
|
|
9964
9964
|
const TagStyle = "t12ikbmp";
|
|
9965
9965
|
const Tags = (props) => {
|
|
@@ -9998,23 +9998,24 @@ var __publicField = (obj, key, value) => {
|
|
|
9998
9998
|
const {
|
|
9999
9999
|
t: t2
|
|
10000
10000
|
} = useTranslation();
|
|
10001
|
-
const
|
|
10002
|
-
updating: "
|
|
10001
|
+
const statusMap = {
|
|
10002
|
+
updating: "loading",
|
|
10003
10003
|
ready: "green",
|
|
10004
10004
|
completed: "gray",
|
|
10005
10005
|
failed: "red",
|
|
10006
10006
|
suspended: "warning",
|
|
10007
|
-
running: "
|
|
10008
|
-
succeeded: "
|
|
10009
|
-
unknown: "
|
|
10010
|
-
terminating: "
|
|
10011
|
-
pending: "
|
|
10007
|
+
running: "green",
|
|
10008
|
+
succeeded: "blue",
|
|
10009
|
+
unknown: "gray",
|
|
10010
|
+
terminating: "loading",
|
|
10011
|
+
pending: "warning",
|
|
10012
10012
|
waiting: "warning",
|
|
10013
10013
|
terminated: "red"
|
|
10014
10014
|
};
|
|
10015
10015
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.statusCapsule, {
|
|
10016
10016
|
className: cx_default(className, StateTagStyle, hideBackground && "no-background"),
|
|
10017
|
-
color:
|
|
10017
|
+
color: statusMap[state2] !== "loading" ? statusMap[state2] : void 0,
|
|
10018
|
+
loading: statusMap[state2] === "loading",
|
|
10018
10019
|
children: t2(`dovetail.${state2 || "updating"}`)
|
|
10019
10020
|
});
|
|
10020
10021
|
};
|
|
@@ -10689,7 +10690,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10689
10690
|
}
|
|
10690
10691
|
);
|
|
10691
10692
|
};
|
|
10692
|
-
const
|
|
10693
|
+
const KeyValue_q4vd5r = "";
|
|
10693
10694
|
const ContentBlockStyle = "c8jy7dc";
|
|
10694
10695
|
const KeyStyle = "k2sddxl";
|
|
10695
10696
|
const ValueStyle$2 = "v16vicsr";
|
|
@@ -18320,7 +18321,7 @@ var __publicField = (obj, key, value) => {
|
|
|
18320
18321
|
}
|
|
18321
18322
|
}
|
|
18322
18323
|
const GlobalStoreContext = React.createContext({});
|
|
18323
|
-
const
|
|
18324
|
+
const index_1xad2h9 = "";
|
|
18324
18325
|
const SelectStyle = "sj0ggy";
|
|
18325
18326
|
const DropdownStyle = "d1eo8uqs";
|
|
18326
18327
|
const SearchInputStyle = "s64gojc";
|
|
@@ -18356,6 +18357,7 @@ var __publicField = (obj, key, value) => {
|
|
|
18356
18357
|
t: t2
|
|
18357
18358
|
} = useTranslation();
|
|
18358
18359
|
const [search, setSearch] = React.useState("");
|
|
18360
|
+
const [tagMaxWidth, setTagMaxWidth] = React.useState("");
|
|
18359
18361
|
const {
|
|
18360
18362
|
data: data2,
|
|
18361
18363
|
isLoading
|
|
@@ -18370,91 +18372,144 @@ var __publicField = (obj, key, value) => {
|
|
|
18370
18372
|
}
|
|
18371
18373
|
});
|
|
18372
18374
|
const [value2, setValue] = useLocalStorage(NS_STORE_KEY, [ALL_NS]);
|
|
18375
|
+
const [open, setOpen] = React.useState(false);
|
|
18373
18376
|
const debouncedSetSearch = lodashEs.debounce(setSearch, 100);
|
|
18374
|
-
|
|
18375
|
-
|
|
18376
|
-
|
|
18377
|
-
|
|
18378
|
-
|
|
18379
|
-
|
|
18380
|
-
|
|
18381
|
-
|
|
18382
|
-
|
|
18383
|
-
|
|
18384
|
-
|
|
18385
|
-
|
|
18386
|
-
|
|
18387
|
-
|
|
18388
|
-
|
|
18389
|
-
|
|
18377
|
+
const MAX_TAG_COUNT = 8;
|
|
18378
|
+
const COUNT_TAG_WIDTH = 22;
|
|
18379
|
+
const TAG_GAP = 4;
|
|
18380
|
+
const PADDING = 36;
|
|
18381
|
+
const hasCountTag = value2.length > MAX_TAG_COUNT;
|
|
18382
|
+
const WRAPPER_CLASS = "d2-namespace-select-wrapper";
|
|
18383
|
+
const SELECT_CLASS = "d2-namespace-select";
|
|
18384
|
+
const calcTagMaxWidth = React.useCallback(() => {
|
|
18385
|
+
const wrapper = document.querySelector(`.${WRAPPER_CLASS}`);
|
|
18386
|
+
const n2 = Math.min(value2.length, MAX_TAG_COUNT);
|
|
18387
|
+
const tagWidth = ((wrapper == null ? void 0 : wrapper.offsetWidth) || 0) / n2;
|
|
18388
|
+
const gapsWidth = (Math.min(value2.length, MAX_TAG_COUNT + 1) - 1) * TAG_GAP;
|
|
18389
|
+
const paddingAndCountTagWidth = PADDING + (hasCountTag ? COUNT_TAG_WIDTH : 0);
|
|
18390
|
+
const perTagMaxWidth = tagWidth - (paddingAndCountTagWidth + gapsWidth) / n2;
|
|
18391
|
+
setTagMaxWidth(`${perTagMaxWidth}px`);
|
|
18392
|
+
}, [value2, hasCountTag]);
|
|
18393
|
+
React.useEffect(() => {
|
|
18394
|
+
calcTagMaxWidth();
|
|
18395
|
+
}, [calcTagMaxWidth]);
|
|
18396
|
+
React.useEffect(() => {
|
|
18397
|
+
window.addEventListener("resize", calcTagMaxWidth);
|
|
18398
|
+
return () => {
|
|
18399
|
+
window.removeEventListener("resize", calcTagMaxWidth);
|
|
18400
|
+
};
|
|
18401
|
+
}, [calcTagMaxWidth]);
|
|
18402
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
18403
|
+
className: WRAPPER_CLASS,
|
|
18404
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.select, {
|
|
18405
|
+
loading: isLoading,
|
|
18406
|
+
className: cx_default(SelectStyle, SELECT_CLASS, className),
|
|
18407
|
+
style: {
|
|
18408
|
+
"--tag-max-width": tagMaxWidth
|
|
18409
|
+
},
|
|
18410
|
+
dropdownClassName: DropdownStyle,
|
|
18411
|
+
searchValue: search,
|
|
18412
|
+
virtual: false,
|
|
18413
|
+
input: {
|
|
18414
|
+
value: value2,
|
|
18415
|
+
onChange(value22) {
|
|
18416
|
+
if (lodashEs.last(value22) === ALL_NS || value22.length === 0) {
|
|
18417
|
+
setValue([ALL_NS]);
|
|
18418
|
+
} else {
|
|
18419
|
+
setValue(value22.filter((namespace2) => namespace2 !== ALL_NS));
|
|
18420
|
+
}
|
|
18390
18421
|
}
|
|
18391
|
-
}
|
|
18392
|
-
|
|
18393
|
-
|
|
18394
|
-
|
|
18395
|
-
|
|
18396
|
-
|
|
18397
|
-
|
|
18398
|
-
|
|
18399
|
-
|
|
18400
|
-
|
|
18401
|
-
|
|
18402
|
-
}),
|
|
18403
|
-
|
|
18404
|
-
|
|
18405
|
-
|
|
18406
|
-
value: value22,
|
|
18407
|
-
closable,
|
|
18408
|
-
onClose
|
|
18409
|
-
}) => {
|
|
18410
|
-
const isCountToken = label2 !== value22 && typeof label2 === "string";
|
|
18411
|
-
const isAll = value22 === ALL_NS;
|
|
18412
|
-
return isAll ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
|
|
18413
|
-
style: {
|
|
18414
|
-
marginLeft: 8
|
|
18415
|
-
},
|
|
18416
|
-
children: label2
|
|
18417
|
-
}) : /* @__PURE__ */ jsxRuntimeExports.jsx(kit.token, {
|
|
18418
|
-
className: cx_default(isCountToken ? CountTokenStyle : TokenStyle, isCountToken ? "" : "closable-token"),
|
|
18422
|
+
},
|
|
18423
|
+
dropdownRender: (menu) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
|
|
18424
|
+
className: SelectContentStyle,
|
|
18425
|
+
children: [/* @__PURE__ */ jsxRuntimeExports.jsx(kit.searchInput, {
|
|
18426
|
+
style: {
|
|
18427
|
+
width: "100%"
|
|
18428
|
+
},
|
|
18429
|
+
className: SearchInputStyle,
|
|
18430
|
+
onChange: debouncedSetSearch,
|
|
18431
|
+
placeholder: t2("dovetail.please_input")
|
|
18432
|
+
}), menu, isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.loading, {}) : null]
|
|
18433
|
+
}),
|
|
18434
|
+
tagRender: ({
|
|
18435
|
+
label: label2,
|
|
18436
|
+
value: namespaceValue,
|
|
18419
18437
|
closable,
|
|
18420
|
-
|
|
18421
|
-
|
|
18438
|
+
onClose
|
|
18439
|
+
}) => {
|
|
18440
|
+
const isCountToken = label2 !== namespaceValue && typeof label2 === "string";
|
|
18441
|
+
const isAll = namespaceValue === ALL_NS;
|
|
18442
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
|
|
18443
|
+
onClick: () => {
|
|
18444
|
+
setOpen(!open);
|
|
18445
|
+
},
|
|
18446
|
+
children: isAll ? /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
|
|
18447
|
+
style: {
|
|
18448
|
+
marginLeft: 8
|
|
18449
|
+
},
|
|
18450
|
+
children: [label2, "..."]
|
|
18451
|
+
}) : /* @__PURE__ */ jsxRuntimeExports.jsx(kit.token, {
|
|
18452
|
+
className: cx_default(isCountToken ? CountTokenStyle : TokenStyle, isCountToken ? "" : "closable-token"),
|
|
18453
|
+
closable,
|
|
18454
|
+
size: "medium",
|
|
18455
|
+
onClose,
|
|
18456
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
|
|
18457
|
+
content: isCountToken ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.tooltip, {
|
|
18458
|
+
title: isCountToken ? value2.slice(MAX_TAG_COUNT).map((namespace2, index) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
|
|
18459
|
+
children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
18460
|
+
children: namespace2
|
|
18461
|
+
}), index !== value2.length - 1 - MAX_TAG_COUNT ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.divider, {
|
|
18462
|
+
style: {
|
|
18463
|
+
margin: "6px 0",
|
|
18464
|
+
borderColor: "rgba(107, 128, 167, 0.60)"
|
|
18465
|
+
}
|
|
18466
|
+
}) : null]
|
|
18467
|
+
})) : null,
|
|
18468
|
+
trigger: ["hover"],
|
|
18469
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
|
|
18470
|
+
children: label2.replace(/[\s\.]/g, "")
|
|
18471
|
+
})
|
|
18472
|
+
}) : label2
|
|
18473
|
+
})
|
|
18474
|
+
})
|
|
18475
|
+
});
|
|
18476
|
+
},
|
|
18477
|
+
maxTagCount: MAX_TAG_COUNT,
|
|
18478
|
+
optionLabelProp: "label",
|
|
18479
|
+
showArrow: true,
|
|
18480
|
+
showSearch: false,
|
|
18481
|
+
open,
|
|
18482
|
+
onDropdownVisibleChange: (open2) => {
|
|
18483
|
+
setOpen(open2);
|
|
18484
|
+
},
|
|
18485
|
+
multiple: true,
|
|
18486
|
+
children: [/* @__PURE__ */ jsxRuntimeExports.jsx(kit.option, {
|
|
18487
|
+
value: "_all",
|
|
18488
|
+
label: t2("dovetail.all_namespaces"),
|
|
18489
|
+
className: AllNamespaceOptionStyle,
|
|
18422
18490
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
|
|
18423
|
-
content:
|
|
18491
|
+
content: t2("dovetail.all_namespaces"),
|
|
18492
|
+
className: LabelWrapperStyle
|
|
18424
18493
|
})
|
|
18425
|
-
})
|
|
18426
|
-
|
|
18427
|
-
|
|
18428
|
-
|
|
18429
|
-
|
|
18430
|
-
|
|
18431
|
-
|
|
18432
|
-
|
|
18433
|
-
|
|
18434
|
-
|
|
18435
|
-
|
|
18436
|
-
|
|
18437
|
-
|
|
18438
|
-
|
|
18439
|
-
|
|
18440
|
-
|
|
18441
|
-
|
|
18442
|
-
|
|
18443
|
-
|
|
18444
|
-
const {
|
|
18445
|
-
name: name2
|
|
18446
|
-
} = namespace2.metadata;
|
|
18447
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.option, {
|
|
18448
|
-
value: name2,
|
|
18449
|
-
label: name2,
|
|
18450
|
-
className: OptionStyle,
|
|
18451
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
|
|
18452
|
-
content: name2,
|
|
18453
|
-
className: LabelWrapperStyle
|
|
18454
|
-
})
|
|
18455
|
-
}, name2);
|
|
18456
|
-
})
|
|
18457
|
-
})]
|
|
18494
|
+
}, "_all"), /* @__PURE__ */ jsxRuntimeExports.jsx(kit.selectOptGroup, {
|
|
18495
|
+
label: "",
|
|
18496
|
+
className: SelectOptionGroupStyle,
|
|
18497
|
+
children: data2 == null ? void 0 : data2.data.map((namespace2) => {
|
|
18498
|
+
const {
|
|
18499
|
+
name: name2
|
|
18500
|
+
} = namespace2.metadata;
|
|
18501
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.option, {
|
|
18502
|
+
value: name2,
|
|
18503
|
+
label: name2,
|
|
18504
|
+
className: OptionStyle,
|
|
18505
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
|
|
18506
|
+
content: name2,
|
|
18507
|
+
className: LabelWrapperStyle
|
|
18508
|
+
})
|
|
18509
|
+
}, name2);
|
|
18510
|
+
})
|
|
18511
|
+
})]
|
|
18512
|
+
})
|
|
18458
18513
|
});
|
|
18459
18514
|
};
|
|
18460
18515
|
const index_hp158y = "";
|
|
@@ -21797,13 +21852,13 @@ var __publicField = (obj, key, value) => {
|
|
|
21797
21852
|
meta: {}
|
|
21798
21853
|
});
|
|
21799
21854
|
}
|
|
21800
|
-
if (action === "edit" && c2.
|
|
21855
|
+
if (action === "edit" && c2.disabledWhenEdit) {
|
|
21801
21856
|
ele = /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
21802
21857
|
children: value2
|
|
21803
21858
|
});
|
|
21804
21859
|
}
|
|
21805
21860
|
if (c2 == null ? void 0 : c2.render) {
|
|
21806
|
-
ele = c2.render(value2, onChange, formValue, onBlur);
|
|
21861
|
+
ele = c2.render(value2, onChange, formValue, onBlur, action);
|
|
21807
21862
|
}
|
|
21808
21863
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Form.Item, {
|
|
21809
21864
|
label: c2.label,
|
|
@@ -22459,7 +22514,6 @@ var __publicField = (obj, key, value) => {
|
|
|
22459
22514
|
};
|
|
22460
22515
|
};
|
|
22461
22516
|
const useRefineForm = (props) => {
|
|
22462
|
-
var _a;
|
|
22463
22517
|
const { config, id, refineProps } = props;
|
|
22464
22518
|
const [responseErrorMsg, setResponseErrorMsg] = React.useState("");
|
|
22465
22519
|
const i18n2 = useTranslation();
|
|
@@ -22492,14 +22546,15 @@ var __publicField = (obj, key, value) => {
|
|
|
22492
22546
|
defaultValues: config == null ? void 0 : config.initValue
|
|
22493
22547
|
});
|
|
22494
22548
|
React.useEffect(() => {
|
|
22495
|
-
var
|
|
22496
|
-
const response = (
|
|
22549
|
+
var _a, _b;
|
|
22550
|
+
const response = (_a = result.refineCore.mutationResult.error) == null ? void 0 : _a.response;
|
|
22497
22551
|
if (response && !(response == null ? void 0 : response.bodyUsed)) {
|
|
22498
22552
|
(_b = response.json) == null ? void 0 : _b.call(response).then((body) => {
|
|
22499
|
-
|
|
22553
|
+
var _a2, _b2;
|
|
22554
|
+
setResponseErrorMsg(((_b2 = (_a2 = config.formConfig) == null ? void 0 : _a2.formatError) == null ? void 0 : _b2.call(_a2, body)) || body.message);
|
|
22500
22555
|
});
|
|
22501
22556
|
}
|
|
22502
|
-
}, [
|
|
22557
|
+
}, [config.formConfig, result]);
|
|
22503
22558
|
return { formResult: result, responseErrorMsg };
|
|
22504
22559
|
};
|
|
22505
22560
|
const index_12sfrn = "";
|
|
@@ -23025,9 +23080,18 @@ var __publicField = (obj, key, value) => {
|
|
|
23025
23080
|
setEditorErrors(errors);
|
|
23026
23081
|
return;
|
|
23027
23082
|
}
|
|
23028
|
-
|
|
23029
|
-
|
|
23030
|
-
|
|
23083
|
+
try {
|
|
23084
|
+
const objectValues = editor.current ? yaml.load(((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue()) || "") : values;
|
|
23085
|
+
const finalValues = (transformApplyValues == null ? void 0 : transformApplyValues(objectValues)) || objectValues;
|
|
23086
|
+
return onFinish(finalValues);
|
|
23087
|
+
} catch (error) {
|
|
23088
|
+
if (error instanceof Error) {
|
|
23089
|
+
if (error.message === "expected a single document in the stream, but found more") {
|
|
23090
|
+
setEditorErrors([t2("dovetail.only_support_one_yaml")]);
|
|
23091
|
+
return;
|
|
23092
|
+
}
|
|
23093
|
+
}
|
|
23094
|
+
}
|
|
23031
23095
|
},
|
|
23032
23096
|
onKeyUp,
|
|
23033
23097
|
onValuesChange,
|
|
@@ -23187,7 +23251,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23187
23251
|
const FormDescStyle = "f1qgcca6";
|
|
23188
23252
|
const ErrorStyle = "e1tl3wq2";
|
|
23189
23253
|
function FormModal(props) {
|
|
23190
|
-
var _a, _b, _c, _d, _e;
|
|
23254
|
+
var _a, _b, _c, _d, _e, _f;
|
|
23191
23255
|
const {
|
|
23192
23256
|
resource: resourceFromProps,
|
|
23193
23257
|
id,
|
|
@@ -23203,10 +23267,8 @@ var __publicField = (obj, key, value) => {
|
|
|
23203
23267
|
const [yamlSaveButtonProps, setYamlSaveButtonProps] = React.useState({});
|
|
23204
23268
|
const [isError, setIsError] = React.useState(false);
|
|
23205
23269
|
const config = configs[resourceFromProps || (resource == null ? void 0 : resource.name) || ""];
|
|
23206
|
-
const title = i18n2.t(id ? "dovetail.edit_resource" : "dovetail.create_resource", {
|
|
23207
|
-
resource: config == null ? void 0 : config.kind
|
|
23208
|
-
});
|
|
23209
23270
|
const okText = i18n2.t(id ? "dovetail.save" : "dovetail.create");
|
|
23271
|
+
const action = id ? "edit" : "create";
|
|
23210
23272
|
const yamlFormProps = React.useMemo(() => {
|
|
23211
23273
|
var _a2, _b2, _c2;
|
|
23212
23274
|
return {
|
|
@@ -23215,7 +23277,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23215
23277
|
transformApplyValues: (_b2 = config.formConfig) == null ? void 0 : _b2.transformApplyValues,
|
|
23216
23278
|
initialValues: ((_c2 = props.formProps) == null ? void 0 : _c2.initialValues) || (config == null ? void 0 : config.initValue),
|
|
23217
23279
|
id,
|
|
23218
|
-
action
|
|
23280
|
+
action,
|
|
23219
23281
|
isShowLayout: false,
|
|
23220
23282
|
useFormProps: {
|
|
23221
23283
|
redirect: false
|
|
@@ -23226,7 +23288,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23226
23288
|
},
|
|
23227
23289
|
onFinish: eagle.popModal
|
|
23228
23290
|
};
|
|
23229
|
-
}, [props.formProps,
|
|
23291
|
+
}, [props.formProps, (_a = config.formConfig) == null ? void 0 : _a.transformInitValues, (_b = config.formConfig) == null ? void 0 : _b.transformApplyValues, config == null ? void 0 : config.initValue, id, action]);
|
|
23230
23292
|
const refineFormResult = useRefineForm({
|
|
23231
23293
|
config,
|
|
23232
23294
|
id,
|
|
@@ -23235,10 +23297,10 @@ var __publicField = (obj, key, value) => {
|
|
|
23235
23297
|
eagle.popModal();
|
|
23236
23298
|
},
|
|
23237
23299
|
redirect: false,
|
|
23238
|
-
...(
|
|
23300
|
+
...(_c = config.formConfig) == null ? void 0 : _c.refineCoreProps
|
|
23239
23301
|
}
|
|
23240
23302
|
});
|
|
23241
|
-
const isYamlForm = !((
|
|
23303
|
+
const isYamlForm = !((_d = config.formConfig) == null ? void 0 : _d.fields);
|
|
23242
23304
|
const formEle = (() => {
|
|
23243
23305
|
if (renderForm) {
|
|
23244
23306
|
return renderForm(yamlFormProps);
|
|
@@ -23267,10 +23329,21 @@ var __publicField = (obj, key, value) => {
|
|
|
23267
23329
|
return i18n2.t(id ? "dovetail.save_failed" : "dovetail.create_failed");
|
|
23268
23330
|
}
|
|
23269
23331
|
})();
|
|
23332
|
+
const title = React.useMemo(() => {
|
|
23333
|
+
var _a2, _b2, _c2, _d2;
|
|
23334
|
+
if (typeof ((_a2 = config.formConfig) == null ? void 0 : _a2.formTitle) === "string")
|
|
23335
|
+
return (_b2 = config.formConfig) == null ? void 0 : _b2.formTitle;
|
|
23336
|
+
if (typeof ((_c2 = config.formConfig) == null ? void 0 : _c2.formTitle) === "function") {
|
|
23337
|
+
return (_d2 = config.formConfig) == null ? void 0 : _d2.formTitle(action);
|
|
23338
|
+
}
|
|
23339
|
+
return i18n2.t(id ? "dovetail.edit_resource" : "dovetail.create_resource", {
|
|
23340
|
+
resource: config == null ? void 0 : config.kind
|
|
23341
|
+
});
|
|
23342
|
+
}, [action, config.formConfig, config == null ? void 0 : config.kind, i18n2, id]);
|
|
23270
23343
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(eagle.Modal, {
|
|
23271
23344
|
className: FullscreenModalStyle,
|
|
23272
23345
|
width: "calc(100vw - 16px)",
|
|
23273
|
-
title
|
|
23346
|
+
title,
|
|
23274
23347
|
error: errorText ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
|
|
23275
23348
|
className: ErrorStyle,
|
|
23276
23349
|
children: [/* @__PURE__ */ jsxRuntimeExports.jsx(iconsReact.ExclamationErrorCircleFill16RedIcon, {}), " ", errorText]
|
|
@@ -23282,9 +23355,9 @@ var __publicField = (obj, key, value) => {
|
|
|
23282
23355
|
onCancel,
|
|
23283
23356
|
destroyOnClose: true,
|
|
23284
23357
|
fullscreen: true,
|
|
23285
|
-
children: [((
|
|
23358
|
+
children: [((_e = config.formConfig) == null ? void 0 : _e.formDesc) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
23286
23359
|
className: FormDescStyle,
|
|
23287
|
-
children: (
|
|
23360
|
+
children: (_f = config.formConfig) == null ? void 0 : _f.formDesc
|
|
23288
23361
|
}) : void 0, formEle]
|
|
23289
23362
|
});
|
|
23290
23363
|
}
|
|
@@ -23322,7 +23395,8 @@ var __publicField = (obj, key, value) => {
|
|
|
23322
23395
|
className: "c1pvtlkp",
|
|
23323
23396
|
children: [/* @__PURE__ */ jsxRuntimeExports.jsx(RefineFormContent, {
|
|
23324
23397
|
config,
|
|
23325
|
-
formResult
|
|
23398
|
+
formResult,
|
|
23399
|
+
action
|
|
23326
23400
|
}), ";", /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Button, {
|
|
23327
23401
|
...saveButtonProps,
|
|
23328
23402
|
onClick,
|
package/dist/style.css
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
.b1vtjd4k.ant-btn.ant-btn-link{display:block;}
|
|
13
13
|
.luro4rx.ant-btn.ant-btn-link{line-height:18px;height:18px;}
|
|
14
14
|
.t13a6vox{-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;max-width:100%;gap:8px 8px;}
|
|
15
|
-
.t12ikbmp.ant-tag{overflow:hidden;text-overflow:ellipsis;color:#1D326C;}.t12ikbmp.ant-tag.outside-tag{background-color
|
|
15
|
+
.t12ikbmp.ant-tag{overflow:hidden;text-overflow:ellipsis;color:#1D326C;}.t12ikbmp.ant-tag.outside-tag{border:1px solid #A3B4CC;background-color:#E4E9F2;}.t12ikbmp.ant-tag .inside-tag{background-color:#CCD4E3;}
|
|
16
16
|
.s8qkbck.ant-tag{padding:3px 16px;height:24px;}.s8qkbck.no-background{background-color:transparent !important;padding:0;}
|
|
17
17
|
.t19ustft{display:inline-block;line-height:18px;height:18px;border-bottom:1px dashed rgba(107,128,167,0.6);}
|
|
18
18
|
.t1v3ienx{padding:12px 24px;}
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
.w16agr8o.ant-space{width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}
|
|
23
23
|
.i1u1f5zp{white-space:pre-line;}
|
|
24
24
|
.c8jy7dc{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;padding:8px 10px;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;gap:8px;-webkit-align-self:stretch;-ms-flex-item-align:stretch;align-self:stretch;border-radius:4px;background:rgba(237,241,250,0.6);}.c8jy7dc:not(:last-of-type){margin-bottom:8px;}
|
|
25
|
-
.k2sddxl{color:rgba(44,56,82,0.
|
|
25
|
+
.k2sddxl{color:rgba(44,56,82,0.75);width:calc(30% - 4px);margin-right:8px;word-break:break-all;}
|
|
26
26
|
.v16vicsr{word-break:break-all;white-space:pre-wrap;width:calc(70% - 4px);}
|
|
27
27
|
.w14056kz{width:100%;}
|
|
28
28
|
.hisq2gt{width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}.hisq2gt.expanded{margin-bottom:8px;}
|
|
@@ -1506,12 +1506,12 @@
|
|
|
1506
1506
|
.e1cjl2b8{border-radius:8px;border:1px solid rgba(211,218,235,0.60);}.e1cjl2b8 .monaco-editor,.e1cjl2b8 .monaco-scrollable-element,.e1cjl2b8 .overflow-guard > .margin{border-radius:8px;}
|
|
1507
1507
|
.w1akirqw{height:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}
|
|
1508
1508
|
.t30srnq{line-height:32px !important;}
|
|
1509
|
-
.sj0ggy.ant-select
|
|
1509
|
+
.sj0ggy.ant-select{-webkit-align-self:flex-start;-ms-flex-item-align:start;align-self:flex-start;min-width:276px;max-width:100%;}.sj0ggy.ant-select .ant-select-selector{display:block;overflow:hidden;padding-right:32px;white-space:nowrap;}.sj0ggy.ant-select .ant-select-selector > span:nth-child(-n + 8):not(.ant-select-selection-search){display:inline-block;max-width:var(--tag-max-width);margin-right:4px;}.sj0ggy.ant-select .ant-select-selection-search{display:none;}.sj0ggy.ant-select .zoom-leave{opacity:0;position:absolute;}
|
|
1510
1510
|
.d1eo8uqs{border-radius:6px;}
|
|
1511
1511
|
.s64gojc.s64gojc.ant-input-affix-wrapper{border:unset;border-bottom:1px solid rgba(211,218,235,.6);border-radius:unset;box-shadow:unset;outline:unset;padding:5px 18px;}.s64gojc.s64gojc.ant-input-affix-wrapper:hover,.s64gojc.s64gojc.ant-input-affix-wrapper:focus{box-shadow:unset;outline:unset;}
|
|
1512
1512
|
.s16fqgtu .ant-select-item-group{border-bottom:1px solid rgba(211,218,235,0.6);min-height:0;padding:0;overflow:hidden;margin:6px 0;}
|
|
1513
1513
|
.tgaujbg{max-width:100%;margin-right:0 !important;}
|
|
1514
|
-
.c1vbd54v{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;margin-right:0;}
|
|
1514
|
+
.c1vbd54v{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;margin-right:0 !important;}
|
|
1515
1515
|
|
|
1516
1516
|
.lqrghwd{margin-right:8px;}
|
|
1517
1517
|
.api7z1z{border-radius:4px;margin:6px;margin-bottom:0;padding:4px 8px 4px 12px;}
|
package/lib/src/App.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createBrowserHistory } from 'history';
|
|
3
|
+
import { GlobalStore } from 'k8s-api-provider';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import { I18nextProvider } from 'react-i18next';
|
|
6
|
+
import { Route, Router } from 'react-router-dom';
|
|
7
|
+
import { Layout } from './components';
|
|
8
|
+
import { CRONJOB_INIT_VALUE, DAEMONSET_INIT_VALUE, STATEFULSET_INIT_VALUE, POD_INIT_VALUE, } from './constants/k8s';
|
|
9
|
+
import { Dovetail } from './Dovetail';
|
|
10
|
+
import i18n from './i18n';
|
|
11
|
+
import { ConfigMapConfig } from './pages/configmaps';
|
|
12
|
+
import { CronJobForm, CronJobList, CronJobShow } from './pages/cronjobs';
|
|
13
|
+
import { DaemonSetForm, DaemonSetList, DaemonSetShow } from './pages/daemonsets';
|
|
14
|
+
import { DeploymentForm, DeploymentList, DeploymentShow } from './pages/deployments';
|
|
15
|
+
import { IngressConfig } from './pages/ingresses';
|
|
16
|
+
import { JobConfig } from './pages/jobs';
|
|
17
|
+
import { NetworkPolicyConfig } from './pages/networkPolicies';
|
|
18
|
+
import { PodShow, PodList, PodForm } from './pages/pods';
|
|
19
|
+
import { SecretsConfig } from './pages/secrets';
|
|
20
|
+
import { ServicesConfig } from './pages/services';
|
|
21
|
+
import { StatefulSetShow, StatefulSetList, StatefulSetForm } from './pages/statefulsets';
|
|
22
|
+
import { ProviderPlugins } from './plugins';
|
|
23
|
+
import { RESOURCE_GROUP, FormType } from './types';
|
|
24
|
+
function App() {
|
|
25
|
+
const histroy = createBrowserHistory();
|
|
26
|
+
const resourcesConfig = useMemo(() => {
|
|
27
|
+
return [
|
|
28
|
+
{
|
|
29
|
+
name: 'cronjobs',
|
|
30
|
+
basePath: '/apis/batch/v1beta1',
|
|
31
|
+
kind: 'CronJob',
|
|
32
|
+
parent: RESOURCE_GROUP.WORKLOAD,
|
|
33
|
+
label: 'CronJobs',
|
|
34
|
+
initValue: CRONJOB_INIT_VALUE,
|
|
35
|
+
isCustom: true,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'daemonsets',
|
|
39
|
+
basePath: '/apis/apps/v1',
|
|
40
|
+
kind: 'DaemonSet',
|
|
41
|
+
parent: RESOURCE_GROUP.WORKLOAD,
|
|
42
|
+
label: 'DaemonSets',
|
|
43
|
+
initValue: DAEMONSET_INIT_VALUE,
|
|
44
|
+
isCustom: true,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'deployments',
|
|
48
|
+
basePath: '/apis/apps/v1',
|
|
49
|
+
kind: 'Deployment',
|
|
50
|
+
parent: RESOURCE_GROUP.WORKLOAD,
|
|
51
|
+
label: 'Deployments',
|
|
52
|
+
formType: FormType.MODAL,
|
|
53
|
+
FormModal: DeploymentForm,
|
|
54
|
+
isCustom: true,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'statefulsets',
|
|
58
|
+
basePath: '/apis/apps/v1',
|
|
59
|
+
kind: 'StatefulSet',
|
|
60
|
+
parent: RESOURCE_GROUP.WORKLOAD,
|
|
61
|
+
label: 'StatefulSets',
|
|
62
|
+
initValue: STATEFULSET_INIT_VALUE,
|
|
63
|
+
isCustom: true,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'pods',
|
|
67
|
+
basePath: '/api/v1',
|
|
68
|
+
kind: 'Pod',
|
|
69
|
+
parent: RESOURCE_GROUP.WORKLOAD,
|
|
70
|
+
label: 'Pods',
|
|
71
|
+
initValue: POD_INIT_VALUE,
|
|
72
|
+
isCustom: true,
|
|
73
|
+
},
|
|
74
|
+
JobConfig,
|
|
75
|
+
IngressConfig,
|
|
76
|
+
NetworkPolicyConfig,
|
|
77
|
+
ConfigMapConfig,
|
|
78
|
+
SecretsConfig,
|
|
79
|
+
ServicesConfig,
|
|
80
|
+
];
|
|
81
|
+
}, []);
|
|
82
|
+
const globalStore = useMemo(() => {
|
|
83
|
+
return new GlobalStore({
|
|
84
|
+
apiUrl: '/api/k8s',
|
|
85
|
+
watchWsApiUrl: 'api/sks-ws/k8s',
|
|
86
|
+
prefix: 'default',
|
|
87
|
+
}, ProviderPlugins);
|
|
88
|
+
}, []);
|
|
89
|
+
return (_jsx(I18nextProvider, { i18n: i18n, children: _jsx(Dovetail, { resourcesConfig: resourcesConfig, Layout: Layout, history: histroy, globalStore: globalStore, children: _jsxs(Router, { history: histroy, children: [_jsx(Route, { path: "/cronjobs", exact: true, children: _jsx(CronJobList, {}) }), _jsx(Route, { path: "/cronjobs/show", children: _jsx(CronJobShow, {}) }), _jsx(Route, { path: "/cronjobs/create", children: _jsx(CronJobForm, {}) }), _jsx(Route, { path: "/cronjobs/edit", children: _jsx(CronJobForm, {}) }), _jsx(Route, { path: "/daemonsets", exact: true, children: _jsx(DaemonSetList, {}) }), _jsx(Route, { path: "/daemonsets/show", children: _jsx(DaemonSetShow, {}) }), _jsx(Route, { path: "/daemonsets/create", children: _jsx(DaemonSetForm, {}) }), _jsx(Route, { path: "/daemonsets/edit", children: _jsx(DaemonSetForm, {}) }), _jsx(Route, { path: "/deployments", exact: true, children: _jsx(DeploymentList, {}) }), _jsx(Route, { path: "/deployments/show", children: _jsx(DeploymentShow, {}) }), _jsx(Route, { path: "/statefulsets", exact: true, children: _jsx(StatefulSetList, {}) }), _jsx(Route, { path: "/statefulsets/show", children: _jsx(StatefulSetShow, {}) }), _jsx(Route, { path: "/statefulsets/create", children: _jsx(StatefulSetForm, {}) }), _jsx(Route, { path: "/statefulsets/edit", children: _jsx(StatefulSetForm, {}) }), _jsx(Route, { path: "/pods", exact: true, children: _jsx(PodList, {}) }), _jsx(Route, { path: "/pods/show", children: _jsx(PodShow, {}) }), _jsx(Route, { path: "/pods/create", children: _jsx(PodForm, {}) }), _jsx(Route, { path: "/pods/edit", children: _jsx(PodForm, {}) })] }) }) }));
|
|
90
|
+
}
|
|
91
|
+
export default App;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { KitStoreProvider, ModalStack } from '@cloudtower/eagle';
|
|
3
|
+
import { Refine } from '@refinedev/core';
|
|
4
|
+
import { dataProvider, liveProvider } from 'k8s-api-provider';
|
|
5
|
+
import { keyBy } from 'lodash-es';
|
|
6
|
+
import { useMemo } from 'react';
|
|
7
|
+
import { Router } from 'react-router-dom';
|
|
8
|
+
import ConfigsContext from 'src/contexts/configs';
|
|
9
|
+
import { ResourceCRUD } from './components/ResourceCRUD';
|
|
10
|
+
import GlobalStoreContext from './contexts/global-store';
|
|
11
|
+
import { routerProvider } from './providers/router-provider';
|
|
12
|
+
import './styles.css';
|
|
13
|
+
export const Dovetail = props => {
|
|
14
|
+
const { resourcesConfig, urlPrefix = '', Layout, history, globalStore } = props;
|
|
15
|
+
const notCustomResources = useMemo(() => {
|
|
16
|
+
return resourcesConfig.filter(c => !c.isCustom);
|
|
17
|
+
}, [resourcesConfig]);
|
|
18
|
+
const content = useMemo(() => {
|
|
19
|
+
const _content = (_jsxs(_Fragment, { children: [_jsx(ModalStack, {}), _jsx(ResourceCRUD, { configs: notCustomResources, urlPrefix: urlPrefix }), props.children] }));
|
|
20
|
+
if (Layout) {
|
|
21
|
+
return _jsx(Layout, { children: _content });
|
|
22
|
+
}
|
|
23
|
+
return _content;
|
|
24
|
+
}, [Layout, notCustomResources, props.children, urlPrefix]);
|
|
25
|
+
return (_jsx(Router, { history: history, children: _jsx(KitStoreProvider, { children: _jsx(GlobalStoreContext.Provider, { value: { globalStore }, children: _jsx(ConfigsContext.Provider, { value: keyBy(resourcesConfig, 'name'), children: _jsx(Refine, { dataProvider: {
|
|
26
|
+
default: dataProvider(globalStore),
|
|
27
|
+
}, routerProvider: routerProvider, liveProvider: liveProvider(globalStore), options: {
|
|
28
|
+
warnWhenUnsavedChanges: true,
|
|
29
|
+
liveMode: 'auto',
|
|
30
|
+
}, resources: resourcesConfig.map(c => {
|
|
31
|
+
return {
|
|
32
|
+
name: c.name,
|
|
33
|
+
meta: {
|
|
34
|
+
resourceBasePath: c.basePath,
|
|
35
|
+
kind: c.kind,
|
|
36
|
+
parent: c.parent,
|
|
37
|
+
label: `${c.kind}s`,
|
|
38
|
+
},
|
|
39
|
+
list: `${urlPrefix}/${c.name}`,
|
|
40
|
+
show: `${urlPrefix}/${c.name}/show`,
|
|
41
|
+
create: `${urlPrefix}/${c.name}/create`,
|
|
42
|
+
edit: `${urlPrefix}/${c.name}/edit`,
|
|
43
|
+
};
|
|
44
|
+
}), children: content }) }) }) }) }));
|
|
45
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { css, cx } from '@linaria/core';
|
|
3
|
+
import { useBreadcrumb } from '@refinedev/core';
|
|
4
|
+
import { Link } from 'react-router-dom';
|
|
5
|
+
const BreadcrumbStyle = css `
|
|
6
|
+
display: flex;
|
|
7
|
+
|
|
8
|
+
.breadcrumb-item {
|
|
9
|
+
&:not(:last-of-type):after {
|
|
10
|
+
content: '>';
|
|
11
|
+
margin: 0 8px;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
15
|
+
export function Breadcrumb(props) {
|
|
16
|
+
const { breadcrumbs } = useBreadcrumb();
|
|
17
|
+
return (_jsx("ul", { className: cx(BreadcrumbStyle, props.className), children: breadcrumbs.map(breadcrumb => {
|
|
18
|
+
return (_jsx("li", { className: "breadcrumb-item", children: breadcrumb.href ? (_jsx(Link, { to: breadcrumb.href, children: breadcrumb.label })) : (_jsx("span", { children: breadcrumb.label })) }, `breadcrumb-${breadcrumb.label}`));
|
|
19
|
+
}) }));
|
|
20
|
+
}
|