@dovetail-v2/refine 0.0.28 → 0.0.29

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 (50) hide show
  1. package/dist/{MonacoYamlDiffEditor-b459d49b.js → MonacoYamlDiffEditor-37f2db86.js} +1 -1
  2. package/dist/{index-432360ef.js → index-3716ce7b.js} +39 -34
  3. package/dist/refine.js +1 -1
  4. package/dist/refine.umd.cjs +40 -35
  5. package/lib/src/App.js +0 -2
  6. package/lib/src/components/ConditionsTable/ConditionsTable.js +2 -2
  7. package/lib/src/components/CreateButton/index.js +2 -2
  8. package/lib/src/components/CronJobDropdown/index.js +2 -2
  9. package/lib/src/components/CronjobJobsTable/index.js +2 -2
  10. package/lib/src/components/DeleteButton/index.js +2 -2
  11. package/lib/src/components/DeleteManyButton/index.js +2 -2
  12. package/lib/src/components/EditField/index.js +3 -3
  13. package/lib/src/components/ErrorContent/index.js +2 -2
  14. package/lib/src/components/EventsTable/EventsTable.js +2 -2
  15. package/lib/src/components/FormLayout/index.js +2 -2
  16. package/lib/src/components/FormModal/index.js +2 -2
  17. package/lib/src/components/ImageNames/index.js +2 -2
  18. package/lib/src/components/IngressRulesTable/IngressRulesTable.js +2 -2
  19. package/lib/src/components/K8sDropdown/index.js +2 -2
  20. package/lib/src/components/KeyValueData/index.js +2 -2
  21. package/lib/src/components/NamespacesFilter/index.js +2 -2
  22. package/lib/src/components/NetworkPolicyRulesTable/NetworkPolicyRulesTable.js +2 -2
  23. package/lib/src/components/PodContainersTable/PodContainersTable.js +2 -2
  24. package/lib/src/components/PodLog/index.js +2 -2
  25. package/lib/src/components/ResourceCRUD/list/index.js +2 -2
  26. package/lib/src/components/ShowContent/ShowContent.js +2 -2
  27. package/lib/src/components/StateTag/StateTag.js +2 -2
  28. package/lib/src/components/Table/ErrorContent.js +2 -2
  29. package/lib/src/components/Table/index.js +2 -2
  30. package/lib/src/components/WorkloadDropdown/index.js +2 -2
  31. package/lib/src/components/WorkloadPodsTable/WorkloadPodsTable.js +2 -2
  32. package/lib/src/components/YamlEditor/YamlEditorComponent.js +2 -2
  33. package/lib/src/components/YamlForm/index.js +2 -2
  34. package/lib/src/hooks/useDeleteModal/useDeleteManyModal.js +2 -2
  35. package/lib/src/hooks/useDeleteModal/useDeleteModal.js +2 -2
  36. package/lib/src/hooks/useEagleForm.js +2 -2
  37. package/lib/src/hooks/useSubmitForm.js +2 -2
  38. package/lib/src/i18n.d.ts +1 -0
  39. package/lib/src/i18n.js +6 -1
  40. package/lib/src/pages/cronjobs/list/index.js +2 -2
  41. package/lib/src/pages/cronjobs/show/index.js +2 -2
  42. package/lib/src/pages/daemonsets/list/index.js +2 -2
  43. package/lib/src/pages/daemonsets/show/index.js +2 -2
  44. package/lib/src/pages/deployments/list/index.js +2 -2
  45. package/lib/src/pages/deployments/show/index.js +2 -2
  46. package/lib/src/pages/pods/list/index.js +2 -2
  47. package/lib/src/pages/pods/show/index.js +2 -2
  48. package/lib/src/pages/statefulsets/list/index.js +2 -2
  49. package/lib/src/pages/statefulsets/show/index.js +2 -2
  50. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { j as jsxRuntimeExports } from "./index-432360ef.js";
1
+ import { j as jsxRuntimeExports } from "./index-3716ce7b.js";
2
2
  import * as monaco from "monaco-editor";
3
3
  import { useRef, useEffect } from "react";
4
4
  import "i18next";
@@ -536,6 +536,11 @@ i18n.use(initReactI18next).init({
536
536
  lng: "zh-CN",
537
537
  nsSeparator: "."
538
538
  });
539
+ const useD2Translation = () => {
540
+ return useTranslation(void 0, {
541
+ i18n
542
+ });
543
+ };
539
544
  var jsxRuntime = { exports: {} };
540
545
  var reactJsxRuntime_production_min = {};
541
546
  /** @license React v16.14.0
@@ -7088,7 +7093,7 @@ const useEagleForm = ({
7088
7093
  var _a, _b, _c;
7089
7094
  const editor = useRef(null);
7090
7095
  const isFoldRef = useRef(false);
7091
- const { t } = useTranslation();
7096
+ const { t } = useD2Translation();
7092
7097
  const [enableEditor, setEnableEditor] = useState(false);
7093
7098
  const [isYamlValid, setIsYamlValid] = useState(true);
7094
7099
  const [isSchemaValid, setIsSchemaValid] = useState(true);
@@ -7261,7 +7266,7 @@ const useDeleteModal = (resource) => {
7261
7266
  const [visible, setVisible] = useState(false);
7262
7267
  const navigation = useNavigation();
7263
7268
  const [id, setId] = useState("");
7264
- const { t } = useTranslation();
7269
+ const { t } = useD2Translation();
7265
7270
  const modalProps = {
7266
7271
  title: t("dovetail.delete"),
7267
7272
  okText: t("dovetail.delete"),
@@ -7527,7 +7532,7 @@ const WidgetErrorContent$1 = (props) => {
7527
7532
  const kit = useContext(kitContext);
7528
7533
  const {
7529
7534
  t
7530
- } = useTranslation();
7535
+ } = useD2Translation();
7531
7536
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
7532
7537
  className: ErrorWrapper$1,
7533
7538
  style: props.style,
@@ -7870,7 +7875,7 @@ const Time = (props) => {
7870
7875
  };
7871
7876
  const ConditionsTable = ({ conditions = [] }) => {
7872
7877
  const kit = useUIKit();
7873
- const { t } = useTranslation();
7878
+ const { t } = useD2Translation();
7874
7879
  const conditionsWithId = addId(conditions, "type");
7875
7880
  const columns = [
7876
7881
  {
@@ -8056,7 +8061,7 @@ function Table(props) {
8056
8061
  const kit = useUIKit();
8057
8062
  const {
8058
8063
  t
8059
- } = useTranslation();
8064
+ } = useD2Translation();
8060
8065
  const {
8061
8066
  loading,
8062
8067
  error,
@@ -9773,7 +9778,7 @@ const WidgetErrorContent = (props) => {
9773
9778
  const kit = useContext(kitContext);
9774
9779
  const {
9775
9780
  t
9776
- } = useTranslation();
9781
+ } = useD2Translation();
9777
9782
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorWrapper, {
9778
9783
  className: props.className,
9779
9784
  style: props.style,
@@ -9825,7 +9830,7 @@ function FormLayout(props) {
9825
9830
  } = useResource();
9826
9831
  const {
9827
9832
  t
9828
- } = useTranslation();
9833
+ } = useD2Translation();
9829
9834
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
9830
9835
  className: WrapperStyle$3,
9831
9836
  children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
@@ -9859,7 +9864,7 @@ const ErrorMsgStyle = "eh2qjnl";
9859
9864
  const ErrorWrapperStyle = "e19q2bnp";
9860
9865
  const YamlEditorStyle = "y16u5v3w";
9861
9866
  const MonacoYamlEditor$2 = React__default.lazy(() => Promise.resolve().then(() => MonacoYamlEditor$1));
9862
- const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-b459d49b.js"));
9867
+ const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-37f2db86.js"));
9863
9868
  const YamlEditorComponent = forwardRef(
9864
9869
  function YamlEditorComponent2(props, ref) {
9865
9870
  const {
@@ -9875,7 +9880,7 @@ const YamlEditorComponent = forwardRef(
9875
9880
  className
9876
9881
  } = props;
9877
9882
  const kit = useUIKit();
9878
- const { t } = useTranslation();
9883
+ const { t } = useD2Translation();
9879
9884
  const [isCollapsed, setIsCollapsed] = useState(
9880
9885
  collapsable ? isDefaultCollapsed : false
9881
9886
  );
@@ -10397,7 +10402,7 @@ function YamlForm(props) {
10397
10402
  const {
10398
10403
  t,
10399
10404
  i18n: i18n2
10400
- } = useTranslation();
10405
+ } = useD2Translation();
10401
10406
  const responseErrors = errorResponseBody ? getCommonErrors(errorResponseBody, i18n2) : [];
10402
10407
  const FormWrapper = isShowLayout ? FormLayout : React__default.Fragment;
10403
10408
  const schema = useMemo(() => {
@@ -10462,7 +10467,7 @@ function FormModal(props) {
10462
10467
  } = props;
10463
10468
  const {
10464
10469
  i18n: i18n2
10465
- } = useTranslation();
10470
+ } = useD2Translation();
10466
10471
  const {
10467
10472
  resource
10468
10473
  } = useResource();
@@ -10584,14 +10589,14 @@ function useOpenForm(options) {
10584
10589
  }
10585
10590
  function CreateButton() {
10586
10591
  const kit = useUIKit();
10587
- const { t } = useTranslation();
10592
+ const { t } = useD2Translation();
10588
10593
  const openForm = useOpenForm();
10589
10594
  return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.button, { type: "primary", onClick: openForm, children: t("dovetail.create") });
10590
10595
  }
10591
10596
  const useDeleteManyModal = (resource, ids) => {
10592
10597
  const { mutate } = useDeleteMany();
10593
10598
  const [visible, setVisible] = useState(false);
10594
- const { t } = useTranslation();
10599
+ const { t } = useD2Translation();
10595
10600
  const modalProps = {
10596
10601
  title: t("dovetail.delete"),
10597
10602
  okText: t("dovetail.delete"),
@@ -10619,7 +10624,7 @@ const useDeleteManyModal = (resource, ids) => {
10619
10624
  const DeleteManyButton = (props) => {
10620
10625
  const { resource } = useResource();
10621
10626
  const kit = useUIKit();
10622
- const { t } = useTranslation();
10627
+ const { t } = useD2Translation();
10623
10628
  const { modalProps, visible, setVisible } = useDeleteManyModal(
10624
10629
  (resource == null ? void 0 : resource.name) || "",
10625
10630
  props.ids
@@ -10668,7 +10673,7 @@ const CronjobJobsTable = ({
10668
10673
  }) => {
10669
10674
  const {
10670
10675
  i18n: i18n2
10671
- } = useTranslation();
10676
+ } = useD2Translation();
10672
10677
  const kit = useUIKit();
10673
10678
  const [selectedKeys, setSelectedKeys] = useState([]);
10674
10679
  const [currentPage, setCurrentPage] = useState(1);
@@ -10710,7 +10715,7 @@ const CronjobJobsTable = ({
10710
10715
  });
10711
10716
  };
10712
10717
  const EventsTable = ({}) => {
10713
- const { i18n: i18n2 } = useTranslation();
10718
+ const { i18n: i18n2 } = useD2Translation();
10714
10719
  const [currentPage, setCurrentPage] = useState(1);
10715
10720
  const { data: data2, isLoading } = useList({
10716
10721
  resource: "events",
@@ -10786,7 +10791,7 @@ const ImageNames = ({
10786
10791
  const kit = useUIKit();
10787
10792
  const {
10788
10793
  t
10789
- } = useTranslation();
10794
+ } = useD2Translation();
10790
10795
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
10791
10796
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
10792
10797
  children: value[0]
@@ -10825,7 +10830,7 @@ const ResourceLink = (props) => {
10825
10830
  };
10826
10831
  const IngressRulesTable = ({ ingress }) => {
10827
10832
  const kit = useUIKit();
10828
- const { t } = useTranslation();
10833
+ const { t } = useD2Translation();
10829
10834
  const rows = useMemo(() => {
10830
10835
  return addId(ingress.flattenedRules, "fullPath");
10831
10836
  }, [ingress.flattenedRules]);
@@ -10932,7 +10937,7 @@ const WorkloadPodsTable = ({
10932
10937
  }) => {
10933
10938
  const {
10934
10939
  i18n: i18n2
10935
- } = useTranslation();
10940
+ } = useD2Translation();
10936
10941
  const kit = useUIKit();
10937
10942
  const [selectedKeys, setSelectedKeys] = useState([]);
10938
10943
  const [currentPage, setCurrentPage] = useState(1);
@@ -10978,7 +10983,7 @@ const WorkloadPodsTable = ({
10978
10983
  };
10979
10984
  function useSubmitForm(options) {
10980
10985
  const { formRef, onSubmitSuccess } = options;
10981
- const { i18n: i18n2 } = useTranslation();
10986
+ const { i18n: i18n2 } = useD2Translation();
10982
10987
  const [submitting, setSubmitting] = useState(false);
10983
10988
  const [errorMsgs, setErrorMsgs] = useState([]);
10984
10989
  const reset = useCallback(() => {
@@ -11025,7 +11030,7 @@ function EditFieldModal(props) {
11025
11030
  const kit = useUIKit();
11026
11031
  const {
11027
11032
  i18n: i18n2
11028
- } = useTranslation();
11033
+ } = useD2Translation();
11029
11034
  const {
11030
11035
  submitting,
11031
11036
  errorMsgs,
@@ -11062,7 +11067,7 @@ function EditField(props) {
11062
11067
  const kit = useUIKit();
11063
11068
  const {
11064
11069
  i18n: i18n2
11065
- } = useTranslation();
11070
+ } = useD2Translation();
11066
11071
  return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.button, {
11067
11072
  className: EditButtonStyle,
11068
11073
  type: "link",
@@ -11346,7 +11351,7 @@ function K8sDropdown(props) {
11346
11351
  (resource == null ? void 0 : resource.name) || ""
11347
11352
  );
11348
11353
  const download2 = useDownloadYAML();
11349
- const { t } = useTranslation();
11354
+ const { t } = useD2Translation();
11350
11355
  const openForm = useOpenForm({ id: record.id });
11351
11356
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
11352
11357
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -11409,7 +11414,7 @@ function KeyValueData(props) {
11409
11414
  const kit = useUIKit();
11410
11415
  const {
11411
11416
  t
11412
- } = useTranslation();
11417
+ } = useD2Translation();
11413
11418
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
11414
11419
  className: WrapperStyle$1,
11415
11420
  children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
@@ -11605,7 +11610,7 @@ var WorkloadState = /* @__PURE__ */ ((WorkloadState2) => {
11605
11610
  })(WorkloadState || {});
11606
11611
  const StateTag = ({ state: state2 = WorkloadState.UPDATEING, className }) => {
11607
11612
  const kit = useUIKit();
11608
- const { t } = useTranslation();
11613
+ const { t } = useD2Translation();
11609
11614
  const colorMap = {
11610
11615
  updating: "blue",
11611
11616
  ready: "green",
@@ -11684,7 +11689,7 @@ const ShowContent = (props) => {
11684
11689
  });
11685
11690
  const {
11686
11691
  t
11687
- } = useTranslation();
11692
+ } = useD2Translation();
11688
11693
  const {
11689
11694
  fold: fold2
11690
11695
  } = useK8sYamlEditor();
@@ -11868,7 +11873,7 @@ const PodContainersTable = ({
11868
11873
  initContainerStatuses
11869
11874
  }) => {
11870
11875
  const kit = useUIKit();
11871
- const { i18n: i18n2 } = useTranslation();
11876
+ const { i18n: i18n2 } = useD2Translation();
11872
11877
  const columns = useMemo(
11873
11878
  () => [
11874
11879
  {
@@ -11962,7 +11967,7 @@ function WorkloadDropdown(props) {
11962
11967
  const kit = useUIKit();
11963
11968
  const { resource } = useResource();
11964
11969
  const { mutate } = useUpdate();
11965
- const { t } = useTranslation();
11970
+ const { t } = useD2Translation();
11966
11971
  return /* @__PURE__ */ jsxRuntimeExports.jsx(K8sDropdown, { record, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
11967
11972
  kit.menu.Item,
11968
11973
  {
@@ -12010,7 +12015,7 @@ function ListPage(props) {
12010
12015
  }
12011
12016
  function ResourceList(props) {
12012
12017
  const { formatter, name: name2, columns, Dropdown } = props;
12013
- const { i18n: i18n2 } = useTranslation();
12018
+ const { i18n: i18n2 } = useD2Translation();
12014
12019
  const { tableProps, selectedKeys } = useEagleTable({
12015
12020
  useTableParams: {},
12016
12021
  columns: [NameColumnRenderer(i18n2), ...columns],
@@ -12083,7 +12088,7 @@ function CronJobDropdown(props) {
12083
12088
  const kit = useUIKit();
12084
12089
  const { resource } = useResource();
12085
12090
  const { mutate } = useUpdate();
12086
- const { t } = useTranslation();
12091
+ const { t } = useD2Translation();
12087
12092
  const suspended2 = Boolean(spec == null ? void 0 : spec.suspend);
12088
12093
  return /* @__PURE__ */ jsxRuntimeExports.jsx(K8sDropdown, { record, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
12089
12094
  kit.menu.Item,
@@ -12238,7 +12243,7 @@ const DeleteButton = () => {
12238
12243
  const { resource } = useResource();
12239
12244
  const { id } = useParsed();
12240
12245
  const kit = useUIKit();
12241
- const { t } = useTranslation();
12246
+ const { t } = useD2Translation();
12242
12247
  const { modalProps, visible, openDeleteConfirmModal } = useDeleteModal(
12243
12248
  (resource == null ? void 0 : resource.name) || ""
12244
12249
  );
@@ -12412,7 +12417,7 @@ const useNamespacesFilter = () => {
12412
12417
  };
12413
12418
  const NamespacesFilter = () => {
12414
12419
  const kit = useUIKit();
12415
- const { t } = useTranslation();
12420
+ const { t } = useD2Translation();
12416
12421
  const { data: data2 } = useList({
12417
12422
  resource: "namespaces",
12418
12423
  meta: {
@@ -18148,7 +18153,7 @@ const PodLog = ({
18148
18153
  const apiUrl = dataProvider2()["getApiUrl"]();
18149
18154
  const {
18150
18155
  t
18151
- } = useTranslation();
18156
+ } = useD2Translation();
18152
18157
  useEffect(() => {
18153
18158
  if (!paused && logs.length > 0) {
18154
18159
  setCurrentItemCount(logs.length);
@@ -18300,7 +18305,7 @@ const NetworkPolicyRulesTable = ({ ingressOrEgress }) => {
18300
18305
  };
18301
18306
  const IngressRuleTable = ({ peers }) => {
18302
18307
  const kit = useUIKit();
18303
- const { t } = useTranslation();
18308
+ const { t } = useD2Translation();
18304
18309
  const rows = useMemo(() => {
18305
18310
  const rows2 = (peers == null ? void 0 : peers.map((p) => {
18306
18311
  return Object.keys(p).map((key) => {
package/dist/refine.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ar, A, ay, B, aA, ab, l, C, g, aN, a4, z, aP, G, U, aY, Y, D, aB, az, a$, a7, a0, ai, a_, aK, al, h, an, aZ, af, aw, aM, aO, aG, a2, H, k, aQ, I, ae, aC, aS, a6, Z, K, a1, aj, am, M, aH, aq, N, q, b, w, at, aR, ax, e, aE, y, E, av, aW, aV, P, a5, b1, aL, ao, a3, R, Q, O, ap, J, aX, L, V, f, aF, aD, ah, a8, _, ad, i, aa, ac, ag, a9, S, ak, b0, aI, au, aU, F, W, aT, T, X, c, aJ, $, s, d, x, v, t, r, a, n, m, o, p, as, u } from "./index-432360ef.js";
1
+ import { ar, A, ay, B, aA, ab, l, C, g, aN, a4, z, aP, G, U, aY, Y, D, aB, az, a$, a7, a0, ai, a_, aK, al, h, an, aZ, af, aw, aM, aO, aG, a2, H, k, aQ, I, ae, aC, aS, a6, Z, K, a1, aj, am, M, aH, aq, N, q, b, w, at, aR, ax, e, aE, y, E, av, aW, aV, P, a5, b1, aL, ao, a3, R, Q, O, ap, J, aX, L, V, f, aF, aD, ah, a8, _, ad, i, aa, ac, ag, a9, S, ak, b0, aI, au, aU, F, W, aT, T, X, c, aJ, $, s, d, x, v, t, r, a, n, m, o, p, as, u } from "./index-3716ce7b.js";
2
2
  import "@cloudtower/eagle";
3
3
  import "@refinedev/core";
4
4
  import "js-yaml";
@@ -1,6 +1,6 @@
1
1
  (function(global2, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("i18next"), require("@refinedev/core"), require("qs"), require("react"), require("react-router-dom"), require("@cloudtower/eagle"), require("js-yaml"), require("lodash-es"), require("sunflower-antd"), require("@cloudtower/icons-react"), require("monaco-editor"), require("monaco-yaml"), require("react-dom"), require("antd"), require("k8s-api-provider")) : typeof define === "function" && define.amd ? define(["exports", "i18next", "@refinedev/core", "qs", "react", "react-router-dom", "@cloudtower/eagle", "js-yaml", "lodash-es", "sunflower-antd", "@cloudtower/icons-react", "monaco-editor", "monaco-yaml", "react-dom", "antd", "k8s-api-provider"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.dovetail = {}, global2.i18n, global2.core, global2.qs, global2.React, global2.reactRouterDom, global2.eagle, global2.yaml, global2.lodashEs, global2.sunflowerAntd, global2.iconsReact, global2.monaco, global2.monacoYaml, global2.ReactDOM, global2.antd, global2.k8sApiProvider));
3
- })(this, function(exports2, i18n, core, qs, React, reactRouterDom, eagle, yaml, lodashEs, sunflowerAntd, iconsReact, monaco, monacoYaml, ReactDOM, antd, k8sApiProvider) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("i18next"), require("react"), require("@refinedev/core"), require("qs"), require("react-router-dom"), require("@cloudtower/eagle"), require("js-yaml"), require("lodash-es"), require("sunflower-antd"), require("@cloudtower/icons-react"), require("monaco-editor"), require("monaco-yaml"), require("react-dom"), require("antd"), require("k8s-api-provider")) : typeof define === "function" && define.amd ? define(["exports", "i18next", "react", "@refinedev/core", "qs", "react-router-dom", "@cloudtower/eagle", "js-yaml", "lodash-es", "sunflower-antd", "@cloudtower/icons-react", "monaco-editor", "monaco-yaml", "react-dom", "antd", "k8s-api-provider"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.dovetail = {}, global2.i18n, global2.React, global2.core, global2.qs, global2.reactRouterDom, global2.eagle, global2.yaml, global2.lodashEs, global2.sunflowerAntd, global2.iconsReact, global2.monaco, global2.monacoYaml, global2.ReactDOM, global2.antd, global2.k8sApiProvider));
3
+ })(this, function(exports2, i18n, React, core, qs, reactRouterDom, eagle, yaml, lodashEs, sunflowerAntd, iconsReact, monaco, monacoYaml, ReactDOM, antd, k8sApiProvider) {
4
4
  "use strict";var __defProp = Object.defineProperty;
5
5
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
6
  var __publicField = (obj, key, value) => {
@@ -542,6 +542,11 @@ var __publicField = (obj, key, value) => {
542
542
  lng: "zh-CN",
543
543
  nsSeparator: "."
544
544
  });
545
+ const useD2Translation = () => {
546
+ return useTranslation(void 0, {
547
+ i18n
548
+ });
549
+ };
545
550
  var jsxRuntime = { exports: {} };
546
551
  var reactJsxRuntime_production_min = {};
547
552
  /** @license React v16.14.0
@@ -7094,7 +7099,7 @@ var __publicField = (obj, key, value) => {
7094
7099
  var _a, _b, _c;
7095
7100
  const editor = React.useRef(null);
7096
7101
  const isFoldRef = React.useRef(false);
7097
- const { t } = useTranslation();
7102
+ const { t } = useD2Translation();
7098
7103
  const [enableEditor, setEnableEditor] = React.useState(false);
7099
7104
  const [isYamlValid, setIsYamlValid] = React.useState(true);
7100
7105
  const [isSchemaValid, setIsSchemaValid] = React.useState(true);
@@ -7267,7 +7272,7 @@ var __publicField = (obj, key, value) => {
7267
7272
  const [visible, setVisible] = React.useState(false);
7268
7273
  const navigation = core.useNavigation();
7269
7274
  const [id, setId] = React.useState("");
7270
- const { t } = useTranslation();
7275
+ const { t } = useD2Translation();
7271
7276
  const modalProps = {
7272
7277
  title: t("dovetail.delete"),
7273
7278
  okText: t("dovetail.delete"),
@@ -7533,7 +7538,7 @@ var __publicField = (obj, key, value) => {
7533
7538
  const kit = React.useContext(eagle.kitContext);
7534
7539
  const {
7535
7540
  t
7536
- } = useTranslation();
7541
+ } = useD2Translation();
7537
7542
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
7538
7543
  className: ErrorWrapper$1,
7539
7544
  style: props.style,
@@ -7876,7 +7881,7 @@ var __publicField = (obj, key, value) => {
7876
7881
  };
7877
7882
  const ConditionsTable = ({ conditions = [] }) => {
7878
7883
  const kit = eagle.useUIKit();
7879
- const { t } = useTranslation();
7884
+ const { t } = useD2Translation();
7880
7885
  const conditionsWithId = addId(conditions, "type");
7881
7886
  const columns = [
7882
7887
  {
@@ -8062,7 +8067,7 @@ var __publicField = (obj, key, value) => {
8062
8067
  const kit = eagle.useUIKit();
8063
8068
  const {
8064
8069
  t
8065
- } = useTranslation();
8070
+ } = useD2Translation();
8066
8071
  const {
8067
8072
  loading,
8068
8073
  error,
@@ -9779,7 +9784,7 @@ var __publicField = (obj, key, value) => {
9779
9784
  const kit = React.useContext(eagle.kitContext);
9780
9785
  const {
9781
9786
  t
9782
- } = useTranslation();
9787
+ } = useD2Translation();
9783
9788
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorWrapper, {
9784
9789
  className: props.className,
9785
9790
  style: props.style,
@@ -9831,7 +9836,7 @@ var __publicField = (obj, key, value) => {
9831
9836
  } = core.useResource();
9832
9837
  const {
9833
9838
  t
9834
- } = useTranslation();
9839
+ } = useD2Translation();
9835
9840
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
9836
9841
  className: WrapperStyle$3,
9837
9842
  children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
@@ -9881,7 +9886,7 @@ var __publicField = (obj, key, value) => {
9881
9886
  className
9882
9887
  } = props;
9883
9888
  const kit = eagle.useUIKit();
9884
- const { t } = useTranslation();
9889
+ const { t } = useD2Translation();
9885
9890
  const [isCollapsed, setIsCollapsed] = React.useState(
9886
9891
  collapsable ? isDefaultCollapsed : false
9887
9892
  );
@@ -10403,7 +10408,7 @@ var __publicField = (obj, key, value) => {
10403
10408
  const {
10404
10409
  t,
10405
10410
  i18n: i18n2
10406
- } = useTranslation();
10411
+ } = useD2Translation();
10407
10412
  const responseErrors = errorResponseBody ? getCommonErrors(errorResponseBody, i18n2) : [];
10408
10413
  const FormWrapper = isShowLayout ? FormLayout : React.Fragment;
10409
10414
  const schema = React.useMemo(() => {
@@ -10468,7 +10473,7 @@ var __publicField = (obj, key, value) => {
10468
10473
  } = props;
10469
10474
  const {
10470
10475
  i18n: i18n2
10471
- } = useTranslation();
10476
+ } = useD2Translation();
10472
10477
  const {
10473
10478
  resource
10474
10479
  } = core.useResource();
@@ -10590,14 +10595,14 @@ var __publicField = (obj, key, value) => {
10590
10595
  }
10591
10596
  function CreateButton() {
10592
10597
  const kit = eagle.useUIKit();
10593
- const { t } = useTranslation();
10598
+ const { t } = useD2Translation();
10594
10599
  const openForm = useOpenForm();
10595
10600
  return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.button, { type: "primary", onClick: openForm, children: t("dovetail.create") });
10596
10601
  }
10597
10602
  const useDeleteManyModal = (resource, ids) => {
10598
10603
  const { mutate } = core.useDeleteMany();
10599
10604
  const [visible, setVisible] = React.useState(false);
10600
- const { t } = useTranslation();
10605
+ const { t } = useD2Translation();
10601
10606
  const modalProps = {
10602
10607
  title: t("dovetail.delete"),
10603
10608
  okText: t("dovetail.delete"),
@@ -10625,7 +10630,7 @@ var __publicField = (obj, key, value) => {
10625
10630
  const DeleteManyButton = (props) => {
10626
10631
  const { resource } = core.useResource();
10627
10632
  const kit = eagle.useUIKit();
10628
- const { t } = useTranslation();
10633
+ const { t } = useD2Translation();
10629
10634
  const { modalProps, visible, setVisible } = useDeleteManyModal(
10630
10635
  (resource == null ? void 0 : resource.name) || "",
10631
10636
  props.ids
@@ -10674,7 +10679,7 @@ var __publicField = (obj, key, value) => {
10674
10679
  }) => {
10675
10680
  const {
10676
10681
  i18n: i18n2
10677
- } = useTranslation();
10682
+ } = useD2Translation();
10678
10683
  const kit = eagle.useUIKit();
10679
10684
  const [selectedKeys, setSelectedKeys] = React.useState([]);
10680
10685
  const [currentPage, setCurrentPage] = React.useState(1);
@@ -10716,7 +10721,7 @@ var __publicField = (obj, key, value) => {
10716
10721
  });
10717
10722
  };
10718
10723
  const EventsTable = ({}) => {
10719
- const { i18n: i18n2 } = useTranslation();
10724
+ const { i18n: i18n2 } = useD2Translation();
10720
10725
  const [currentPage, setCurrentPage] = React.useState(1);
10721
10726
  const { data: data2, isLoading } = core.useList({
10722
10727
  resource: "events",
@@ -10792,7 +10797,7 @@ var __publicField = (obj, key, value) => {
10792
10797
  const kit = eagle.useUIKit();
10793
10798
  const {
10794
10799
  t
10795
- } = useTranslation();
10800
+ } = useD2Translation();
10796
10801
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
10797
10802
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
10798
10803
  children: value[0]
@@ -10831,7 +10836,7 @@ var __publicField = (obj, key, value) => {
10831
10836
  };
10832
10837
  const IngressRulesTable = ({ ingress }) => {
10833
10838
  const kit = eagle.useUIKit();
10834
- const { t } = useTranslation();
10839
+ const { t } = useD2Translation();
10835
10840
  const rows = React.useMemo(() => {
10836
10841
  return addId(ingress.flattenedRules, "fullPath");
10837
10842
  }, [ingress.flattenedRules]);
@@ -10938,7 +10943,7 @@ var __publicField = (obj, key, value) => {
10938
10943
  }) => {
10939
10944
  const {
10940
10945
  i18n: i18n2
10941
- } = useTranslation();
10946
+ } = useD2Translation();
10942
10947
  const kit = eagle.useUIKit();
10943
10948
  const [selectedKeys, setSelectedKeys] = React.useState([]);
10944
10949
  const [currentPage, setCurrentPage] = React.useState(1);
@@ -10984,7 +10989,7 @@ var __publicField = (obj, key, value) => {
10984
10989
  };
10985
10990
  function useSubmitForm(options) {
10986
10991
  const { formRef, onSubmitSuccess } = options;
10987
- const { i18n: i18n2 } = useTranslation();
10992
+ const { i18n: i18n2 } = useD2Translation();
10988
10993
  const [submitting, setSubmitting] = React.useState(false);
10989
10994
  const [errorMsgs, setErrorMsgs] = React.useState([]);
10990
10995
  const reset = React.useCallback(() => {
@@ -11031,7 +11036,7 @@ var __publicField = (obj, key, value) => {
11031
11036
  const kit = eagle.useUIKit();
11032
11037
  const {
11033
11038
  i18n: i18n2
11034
- } = useTranslation();
11039
+ } = useD2Translation();
11035
11040
  const {
11036
11041
  submitting,
11037
11042
  errorMsgs,
@@ -11068,7 +11073,7 @@ var __publicField = (obj, key, value) => {
11068
11073
  const kit = eagle.useUIKit();
11069
11074
  const {
11070
11075
  i18n: i18n2
11071
- } = useTranslation();
11076
+ } = useD2Translation();
11072
11077
  return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.button, {
11073
11078
  className: EditButtonStyle,
11074
11079
  type: "link",
@@ -11352,7 +11357,7 @@ var __publicField = (obj, key, value) => {
11352
11357
  (resource == null ? void 0 : resource.name) || ""
11353
11358
  );
11354
11359
  const download2 = useDownloadYAML();
11355
- const { t } = useTranslation();
11360
+ const { t } = useD2Translation();
11356
11361
  const openForm = useOpenForm({ id: record.id });
11357
11362
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
11358
11363
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -11415,7 +11420,7 @@ var __publicField = (obj, key, value) => {
11415
11420
  const kit = eagle.useUIKit();
11416
11421
  const {
11417
11422
  t
11418
- } = useTranslation();
11423
+ } = useD2Translation();
11419
11424
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
11420
11425
  className: WrapperStyle$1,
11421
11426
  children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
@@ -11611,7 +11616,7 @@ var __publicField = (obj, key, value) => {
11611
11616
  })(WorkloadState || {});
11612
11617
  const StateTag = ({ state: state2 = WorkloadState.UPDATEING, className }) => {
11613
11618
  const kit = eagle.useUIKit();
11614
- const { t } = useTranslation();
11619
+ const { t } = useD2Translation();
11615
11620
  const colorMap = {
11616
11621
  updating: "blue",
11617
11622
  ready: "green",
@@ -11690,7 +11695,7 @@ var __publicField = (obj, key, value) => {
11690
11695
  });
11691
11696
  const {
11692
11697
  t
11693
- } = useTranslation();
11698
+ } = useD2Translation();
11694
11699
  const {
11695
11700
  fold: fold2
11696
11701
  } = useK8sYamlEditor();
@@ -11874,7 +11879,7 @@ var __publicField = (obj, key, value) => {
11874
11879
  initContainerStatuses
11875
11880
  }) => {
11876
11881
  const kit = eagle.useUIKit();
11877
- const { i18n: i18n2 } = useTranslation();
11882
+ const { i18n: i18n2 } = useD2Translation();
11878
11883
  const columns = React.useMemo(
11879
11884
  () => [
11880
11885
  {
@@ -11968,7 +11973,7 @@ var __publicField = (obj, key, value) => {
11968
11973
  const kit = eagle.useUIKit();
11969
11974
  const { resource } = core.useResource();
11970
11975
  const { mutate } = core.useUpdate();
11971
- const { t } = useTranslation();
11976
+ const { t } = useD2Translation();
11972
11977
  return /* @__PURE__ */ jsxRuntimeExports.jsx(K8sDropdown, { record, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
11973
11978
  kit.menu.Item,
11974
11979
  {
@@ -12016,7 +12021,7 @@ var __publicField = (obj, key, value) => {
12016
12021
  }
12017
12022
  function ResourceList(props) {
12018
12023
  const { formatter, name: name2, columns, Dropdown } = props;
12019
- const { i18n: i18n2 } = useTranslation();
12024
+ const { i18n: i18n2 } = useD2Translation();
12020
12025
  const { tableProps, selectedKeys } = useEagleTable({
12021
12026
  useTableParams: {},
12022
12027
  columns: [NameColumnRenderer(i18n2), ...columns],
@@ -12089,7 +12094,7 @@ var __publicField = (obj, key, value) => {
12089
12094
  const kit = eagle.useUIKit();
12090
12095
  const { resource } = core.useResource();
12091
12096
  const { mutate } = core.useUpdate();
12092
- const { t } = useTranslation();
12097
+ const { t } = useD2Translation();
12093
12098
  const suspended2 = Boolean(spec == null ? void 0 : spec.suspend);
12094
12099
  return /* @__PURE__ */ jsxRuntimeExports.jsx(K8sDropdown, { record, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
12095
12100
  kit.menu.Item,
@@ -12244,7 +12249,7 @@ var __publicField = (obj, key, value) => {
12244
12249
  const { resource } = core.useResource();
12245
12250
  const { id } = core.useParsed();
12246
12251
  const kit = eagle.useUIKit();
12247
- const { t } = useTranslation();
12252
+ const { t } = useD2Translation();
12248
12253
  const { modalProps, visible, openDeleteConfirmModal } = useDeleteModal(
12249
12254
  (resource == null ? void 0 : resource.name) || ""
12250
12255
  );
@@ -12418,7 +12423,7 @@ var __publicField = (obj, key, value) => {
12418
12423
  };
12419
12424
  const NamespacesFilter = () => {
12420
12425
  const kit = eagle.useUIKit();
12421
- const { t } = useTranslation();
12426
+ const { t } = useD2Translation();
12422
12427
  const { data: data2 } = core.useList({
12423
12428
  resource: "namespaces",
12424
12429
  meta: {
@@ -18154,7 +18159,7 @@ var __publicField = (obj, key, value) => {
18154
18159
  const apiUrl = dataProvider()["getApiUrl"]();
18155
18160
  const {
18156
18161
  t
18157
- } = useTranslation();
18162
+ } = useD2Translation();
18158
18163
  React.useEffect(() => {
18159
18164
  if (!paused && logs.length > 0) {
18160
18165
  setCurrentItemCount(logs.length);
@@ -18306,7 +18311,7 @@ var __publicField = (obj, key, value) => {
18306
18311
  };
18307
18312
  const IngressRuleTable = ({ peers }) => {
18308
18313
  const kit = eagle.useUIKit();
18309
- const { t } = useTranslation();
18314
+ const { t } = useD2Translation();
18310
18315
  const rows = React.useMemo(() => {
18311
18316
  const rows2 = (peers == null ? void 0 : peers.map((p) => {
18312
18317
  return Object.keys(p).map((key) => {
package/lib/src/App.js CHANGED
@@ -21,8 +21,6 @@ import { ServicesConfig } from './pages/services';
21
21
  import { StatefulSetShow, StatefulSetList, StatefulSetForm } from './pages/statefulsets';
22
22
  import { ProviderPlugins } from './plugins';
23
23
  import { RESOURCE_GROUP, FormType } from './types';
24
- import * as resources from './locales';
25
- console.log('resources', resources);
26
24
  function App() {
27
25
  const histroy = createBrowserHistory();
28
26
  const resourcesConfig = useMemo(() => {
@@ -1,12 +1,12 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useUIKit } from '@cloudtower/eagle';
3
- import { useTranslation } from 'react-i18next';
3
+ import { useD2Translation } from '../../i18n';
4
4
  import { addId } from '../../utils/addId';
5
5
  import ErrorContent from '../Table/ErrorContent';
6
6
  import Time from '../Time';
7
7
  export const ConditionsTable = ({ conditions = [] }) => {
8
8
  const kit = useUIKit();
9
- const { t } = useTranslation();
9
+ const { t } = useD2Translation();
10
10
  const conditionsWithId = addId(conditions, 'type');
11
11
  const columns = [
12
12
  {
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useUIKit } from '@cloudtower/eagle';
3
- import { useTranslation } from 'react-i18next';
4
3
  import { useOpenForm } from 'src/hooks/useOpenForm';
4
+ import { useD2Translation } from '../../i18n';
5
5
  export function CreateButton() {
6
6
  const kit = useUIKit();
7
- const { t } = useTranslation();
7
+ const { t } = useD2Translation();
8
8
  const openForm = useOpenForm();
9
9
  return (_jsx(kit.button, { type: "primary", onClick: openForm, children: t('dovetail.create') }));
10
10
  }