@dovetail-v2/refine 0.3.2 → 0.3.3

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.
@@ -1181,6 +1181,8 @@ const cant_delete_resource = "无法删除{{resource}}";
1181
1181
  const cant_delete_resource_with_name = "无法删除{{resource}} <0>{{name}}</0> 。";
1182
1182
  const close = "关闭";
1183
1183
  const import_from_file = "从文件读取";
1184
+ const view_all_info = "查看全部信息";
1185
+ const collapse = "收起";
1184
1186
  const dovetail = {
1185
1187
  copy,
1186
1188
  reset_arguments,
@@ -1423,7 +1425,9 @@ const dovetail = {
1423
1425
  cant_delete_resource,
1424
1426
  cant_delete_resource_with_name,
1425
1427
  close,
1426
- import_from_file
1428
+ import_from_file,
1429
+ view_all_info,
1430
+ collapse
1427
1431
  };
1428
1432
  const ZH = {
1429
1433
  dovetail
@@ -12480,13 +12484,14 @@ const ResourceTableField = (resource, useTableParams) => {
12480
12484
  };
12481
12485
  };
12482
12486
  const baseNoReset = "";
12483
- const index_v855ki = "";
12487
+ const index_14irc29 = "";
12484
12488
  const WrapperStyle$3 = "wve7dfm";
12485
12489
  const ToolbarStyle = "t9oeh3c";
12486
12490
  const ToolbarAreaStyle = "t1u2zqn6";
12487
12491
  const ContentStyle$1 = "c8wrcus";
12488
12492
  const PodLog = ({
12489
- pod: pod2
12493
+ pod: pod2,
12494
+ apiUrl
12490
12495
  }) => {
12491
12496
  var _a, _b, _c, _d, _e;
12492
12497
  const [selectedContainer, setSelectedContainer] = React.useState(((_b = (_a = pod2.spec) == null ? void 0 : _a.containers[0]) == null ? void 0 : _b.name) || "");
@@ -12497,8 +12502,6 @@ const PodLog = ({
12497
12502
  const [wrap, setWrap] = React.useState(false);
12498
12503
  const logViewerRef = React.useRef(null);
12499
12504
  const abortControllerRef = React.useRef(null);
12500
- const dataProvider = core.useDataProvider();
12501
- const apiUrl = dataProvider()["getApiUrl"]();
12502
12505
  const {
12503
12506
  t: t2
12504
12507
  } = common.useTranslation();
@@ -12688,7 +12691,7 @@ const EventsTab = (i18n2) => ({
12688
12691
  }
12689
12692
  ]
12690
12693
  });
12691
- const PodLogTab = (i18n2) => ({
12694
+ const PodLogTab = (i18n2, apiUrl) => ({
12692
12695
  title: i18n2.t("dovetail.log"),
12693
12696
  key: "pod-log",
12694
12697
  groups: [
@@ -12700,7 +12703,7 @@ const PodLogTab = (i18n2) => ({
12700
12703
  key: "log",
12701
12704
  path: [],
12702
12705
  renderContent: (_, record) => {
12703
- return /* @__PURE__ */ common.jsxRuntimeExports.jsx(PodLog, { pod: record });
12706
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(PodLog, { pod: record, apiUrl });
12704
12707
  }
12705
12708
  }
12706
12709
  ]
@@ -12710,7 +12713,7 @@ const PodLogTab = (i18n2) => ({
12710
12713
  ]
12711
12714
  });
12712
12715
  const NetworkPolicyRulesViewer_r6jity = "";
12713
- const MonacoYamlEditor$1 = React.lazy(() => Promise.resolve().then(() => require("./MonacoYamlEditor-bdd52136.cjs")));
12716
+ const MonacoYamlEditor$1 = React.lazy(() => Promise.resolve().then(() => require("./MonacoYamlEditor-1554bc96.cjs")));
12714
12717
  const EditorStyle$1 = "e1cjl2b8";
12715
12718
  const NetworkPolicyRulesViewer = ({
12716
12719
  ingressOrEgress,
@@ -13054,7 +13057,7 @@ function Tabs(props) {
13054
13057
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.TabsTabPane, { tab: tab.title, children: tab.children }, tab.title);
13055
13058
  }) });
13056
13059
  }
13057
- const ShowContentView_1mvcyif = "";
13060
+ const ShowContentView_19saq6u = "";
13058
13061
  const ShowContentWrapperStyle = "soapvs9";
13059
13062
  const BackButton = "b13d603q";
13060
13063
  const ToolBarWrapper = "tm8eaia";
@@ -13062,12 +13065,14 @@ const NameStyle = "nhnus27";
13062
13065
  const TopBarStyle = "t16t20f5";
13063
13066
  const ShowContentHeaderStyle = "s97y2wr";
13064
13067
  const GroupStyle = "g1rhnxqx";
13065
- const GroupTitleStyle = "g1f1s2pc";
13066
- const FullTabContentStyle = "f1qw3bxx";
13067
- const FieldWrapperStyle = "flfewds";
13068
- const TabContentStyle = "t1c7cta8";
13069
- const ValueStyle = "v1pt61xk";
13070
- const TabsStyle = "t1to6fie";
13068
+ const BasicGroupStyle = "b1f1s2pc";
13069
+ const GroupTitleStyle = "g1qw3bxx";
13070
+ const FullTabContentStyle = "flfewds";
13071
+ const FieldWrapperStyle = "f1c7cta8";
13072
+ const TabContentStyle = "t1pt61xk";
13073
+ const ValueStyle = "v1to6fie";
13074
+ const TabsStyle = "tca5959";
13075
+ const KindTagStyle = "k3dcesi";
13071
13076
  function ShowGroupComponent(props) {
13072
13077
  const {
13073
13078
  title,
@@ -13085,6 +13090,15 @@ function ShowGroupComponent(props) {
13085
13090
  }), children]
13086
13091
  });
13087
13092
  }
13093
+ function BasicShowGroupComponent(props) {
13094
+ const {
13095
+ children
13096
+ } = props;
13097
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
13098
+ className: BasicGroupStyle,
13099
+ children
13100
+ });
13101
+ }
13088
13102
  const ShowContentView = (props) => {
13089
13103
  var _a, _b, _c, _d;
13090
13104
  const {
@@ -13092,8 +13106,10 @@ const ShowContentView = (props) => {
13092
13106
  resourceName,
13093
13107
  showConfig,
13094
13108
  formatter,
13109
+ children,
13095
13110
  Dropdown = K8sDropdown,
13096
- hideBackButton = false
13111
+ hideBackButton = false,
13112
+ canCollapseTabs = false
13097
13113
  } = props;
13098
13114
  const {
13099
13115
  queryResult
@@ -13136,7 +13152,7 @@ const ShowContentView = (props) => {
13136
13152
  return hasCol ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Col, {
13137
13153
  flex: areaType === AreaType.Inline ? "none" : "",
13138
13154
  span: field.col || 24,
13139
- className: "cca5959",
13155
+ className: "czyzuo8",
13140
13156
  children: field.render ? field.render(value2, record, field) : /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
13141
13157
  className: FieldWrapperStyle,
13142
13158
  children: [field.title && /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
@@ -13169,8 +13185,13 @@ const ShowContentView = (props) => {
13169
13185
  });
13170
13186
  });
13171
13187
  }
13172
- function renderGroup(group) {
13173
- const GroupContainer = group.title ? ShowGroupComponent : React.Fragment;
13188
+ function renderGroup(group, isBasicGroup = false) {
13189
+ let GroupContainer = React.Fragment;
13190
+ if (isBasicGroup) {
13191
+ GroupContainer = BasicShowGroupComponent;
13192
+ } else if (group.title) {
13193
+ GroupContainer = ShowGroupComponent;
13194
+ }
13174
13195
  const FieldContainer = group.title ? eagle.Row : React.Fragment;
13175
13196
  const groupContainerProps = group.title ? {
13176
13197
  title: group.title || ""
@@ -13219,7 +13240,10 @@ const ShowContentView = (props) => {
13219
13240
  style: {
13220
13241
  display: "flex"
13221
13242
  },
13222
- children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
13243
+ children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Tag.NameTag, {
13244
+ className: KindTagStyle,
13245
+ children: config.kind
13246
+ }), /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
13223
13247
  className: common.cx_default(eagle.Typo.Display.d2_regular_title, NameStyle),
13224
13248
  children: ((_a = showConfig.displayName) == null ? void 0 : _a.call(showConfig, record)) || ((_b = record == null ? void 0 : record.metadata) == null ? void 0 : _b.name)
13225
13249
  }), stateDisplay ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(StateTag, {
@@ -13257,25 +13281,72 @@ const ShowContentView = (props) => {
13257
13281
  key: tab.key,
13258
13282
  children: /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
13259
13283
  className: common.cx_default(TabContentStyle, tab.groups.length <= 1 && tabIndex !== 0 && FullTabContentStyle),
13260
- children: (_a2 = tab.groups) == null ? void 0 : _a2.map(renderGroup)
13284
+ children: (_a2 = tab.groups) == null ? void 0 : _a2.map((group) => renderGroup(group, false))
13261
13285
  })
13262
13286
  };
13263
13287
  }),
13264
13288
  className: TabsStyle
13265
13289
  });
13266
- const basicInfo = showConfig.basicGroup ? renderGroup(showConfig.basicGroup) : null;
13290
+ const basicInfo = showConfig.basicGroup ? renderGroup(showConfig.basicGroup, true) : null;
13267
13291
  return /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
13268
13292
  className: ShowContentWrapperStyle,
13269
13293
  children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Space, {
13270
13294
  direction: "vertical",
13271
13295
  className: ShowContentHeaderStyle,
13272
13296
  children: topBar
13273
- }), basicInfo, tabs]
13297
+ }), basicInfo, canCollapseTabs ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(CollapseTabs, {
13298
+ children: tabs
13299
+ }) : tabs, children]
13274
13300
  });
13275
13301
  };
13302
+ const CollapseTabs = (props) => {
13303
+ const [isCollapsed, setIsCollapsed] = React.useState(true);
13304
+ const {
13305
+ t: t2
13306
+ } = common.useTranslation();
13307
+ if (isCollapsed) {
13308
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
13309
+ style: {
13310
+ display: "flex"
13311
+ },
13312
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Button, {
13313
+ style: {
13314
+ margin: "auto",
13315
+ cursor: "pointer"
13316
+ },
13317
+ type: "quiet",
13318
+ onClick: () => setIsCollapsed((v) => !v),
13319
+ suffixIcon: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Icon, {
13320
+ src: iconsReact.ArrowChevronUp16BoldSecondaryIcon
13321
+ }),
13322
+ children: t2("dovetail.view_all_info")
13323
+ })
13324
+ });
13325
+ } else {
13326
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsxs(common.jsxRuntimeExports.Fragment, {
13327
+ children: [props.children, /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
13328
+ style: {
13329
+ display: "flex"
13330
+ },
13331
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Button, {
13332
+ style: {
13333
+ margin: "auto",
13334
+ cursor: "pointer"
13335
+ },
13336
+ type: "quiet",
13337
+ onClick: () => setIsCollapsed((v) => !v),
13338
+ suffixIcon: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Icon, {
13339
+ src: iconsReact.ArrowBoldDown16Icon
13340
+ }),
13341
+ children: t2("dovetail.collapse")
13342
+ })
13343
+ })]
13344
+ });
13345
+ }
13346
+ };
13276
13347
  const ShowContent = (props) => {
13277
13348
  var _a;
13278
- const { showConfig, formatter, Dropdown = K8sDropdown } = props;
13349
+ const { showConfig, formatter, Dropdown = K8sDropdown, children, canCollapseTabs } = props;
13279
13350
  const parsed = core.useParsed();
13280
13351
  const { resource } = core.useResource();
13281
13352
  const id = (_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a.id;
@@ -13286,7 +13357,9 @@ const ShowContent = (props) => {
13286
13357
  resourceName: (resource == null ? void 0 : resource.name) || "",
13287
13358
  showConfig,
13288
13359
  formatter,
13289
- Dropdown
13360
+ Dropdown,
13361
+ canCollapseTabs,
13362
+ children
13290
13363
  }
13291
13364
  );
13292
13365
  };
@@ -13339,7 +13412,7 @@ const PageShow = (props) => {
13339
13412
  nav.list(resource);
13340
13413
  }
13341
13414
  }, [isError, nav, resource, queryResult, parsed, msg, notExistMsg, isLoading]);
13342
- return isLoading ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Loading, {}) : /* @__PURE__ */ common.jsxRuntimeExports.jsx(ShowContent, { ...props });
13415
+ return isLoading ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Loading, {}) : /* @__PURE__ */ common.jsxRuntimeExports.jsx(ShowContent, { ...props, children: props.children });
13343
13416
  };
13344
13417
  const index_az4wrx = "";
13345
13418
  const WrapperStyle$2 = "w1akirqw";
@@ -16391,7 +16464,7 @@ const PlainCodeStyle = "pqch97v";
16391
16464
  const ErrorMsgStyle = "eh2qjnl";
16392
16465
  const ErrorWrapperStyle = "e19q2bnp";
16393
16466
  const YamlEditorStyle = "y16u5v3w";
16394
- const MonacoYamlEditor = React.lazy(() => Promise.resolve().then(() => require("./MonacoYamlEditor-bdd52136.cjs")));
16467
+ const MonacoYamlEditor = React.lazy(() => Promise.resolve().then(() => require("./MonacoYamlEditor-1554bc96.cjs")));
16395
16468
  const MonacoYamlDiffEditor = React.lazy(() => Promise.resolve().then(() => require("./MonacoYamlDiffEditor-7a07db88.cjs")));
16396
16469
  const YamlEditorComponent = React.forwardRef(
16397
16470
  function YamlEditorComponent2(props, ref) {
@@ -19064,6 +19137,7 @@ exports.AnnotationsField = AnnotationsField;
19064
19137
  exports.AreaType = AreaType;
19065
19138
  exports.BASE_INIT_VALUE = BASE_INIT_VALUE;
19066
19139
  exports.BasicGroup = BasicGroup;
19140
+ exports.BasicShowGroupComponent = BasicShowGroupComponent;
19067
19141
  exports.Breadcrumb = Breadcrumb;
19068
19142
  exports.CONFIG_MAP_INIT_VALUE = CONFIG_MAP_INIT_VALUE;
19069
19143
  exports.CRONJOB_INIT_VALUE = CRONJOB_INIT_VALUE;
@@ -242,6 +242,8 @@ declare const _default: {
242
242
  cant_delete_resource_with_name: string;
243
243
  close: string;
244
244
  import_from_file: string;
245
+ view_all_info: string;
246
+ collapse: string;
245
247
  };
246
248
  };
247
249
  export default _default;
package/dist/refine.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const refine = require("./index-ec66ac8f.cjs");
3
+ const refine = require("./index-c1aada44.cjs");
4
4
  require("./common-1eb43414.cjs");
5
5
  require("@cloudtower/eagle");
6
6
  require("@refinedev/core");
@@ -26,6 +26,7 @@ exports.AnnotationsField = refine.AnnotationsField;
26
26
  exports.AreaType = refine.AreaType;
27
27
  exports.BASE_INIT_VALUE = refine.BASE_INIT_VALUE;
28
28
  exports.BasicGroup = refine.BasicGroup;
29
+ exports.BasicShowGroupComponent = refine.BasicShowGroupComponent;
29
30
  exports.Breadcrumb = refine.Breadcrumb;
30
31
  exports.CONFIG_MAP_INIT_VALUE = refine.CONFIG_MAP_INIT_VALUE;
31
32
  exports.CRONJOB_INIT_VALUE = refine.CRONJOB_INIT_VALUE;