@dovetail-v2/refine 0.0.35-beta.4 → 0.0.36

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.
@@ -1391,11 +1391,11 @@ var __publicField = (obj, key, value) => {
1391
1391
  const port_mapping_title_tooltip = "Service 端口与 Pod 端口的映射关系。";
1392
1392
  const in_cluster_desc = "ClusterIP、NodePort 和 LoadBalancer 类型的服务,展示 ClusterIP 字段,为虚拟 IP 地址,只能在集群内部使用。";
1393
1393
  const in_cluster_ip_desc = "ClusterIP 为无头服务时,内容为空。";
1394
- const in_cluster_external_name_desc = "ExternalName 类型展示的是 externalName 字段。";
1394
+ const in_cluster_external_name_desc = "ExternalName 类型展示的是 DNS 记录。";
1395
1395
  const out_cluster_ip_desc = "ClusterIP 不支持集群外部访问。";
1396
1396
  const out_cluster_node_port_desc = "NodePort 展示<strong>节点 IP:nodeport</strong>。";
1397
- const out_cluster_lb_desc = "LoadBalancer 展示 <strong>external-IP</strong>。";
1398
- const out_external_name_desc = "ExternalName 展示为空。";
1397
+ const out_cluster_lb_desc = "LoadBalancer 展示 <strong>ingress[*].ip</strong>。";
1398
+ const out_external_name_desc = "ExternalName 展示 <strong>external-ip</strong>。";
1399
1399
  const dovetail = {
1400
1400
  copy,
1401
1401
  reset_arguments,
@@ -7940,11 +7940,12 @@ var __publicField = (obj, key, value) => {
7940
7940
  return response.json();
7941
7941
  }
7942
7942
  async findSchema(kind) {
7943
+ var _a;
7943
7944
  const result = this.response || await this.fetch();
7944
7945
  const schema = Object.values(result.components.schemas).find(
7945
7946
  (schema2) => {
7946
- var _a;
7947
- return (_a = schema2["x-kubernetes-group-version-kind"]) == null ? void 0 : _a.some(
7947
+ var _a2;
7948
+ return (_a2 = schema2["x-kubernetes-group-version-kind"]) == null ? void 0 : _a2.some(
7948
7949
  ({ kind: schemaKind, version: schemaVersion, group: schemaGroup }) => kind === schemaKind && this.apiVersion === `${schemaGroup ? schemaGroup + "/" : ""}${schemaVersion}`
7949
7950
  );
7950
7951
  }
@@ -7960,6 +7961,9 @@ var __publicField = (obj, key, value) => {
7960
7961
  }
7961
7962
  });
7962
7963
  }
7964
+ if ((_a = schema == null ? void 0 : schema.properties) == null ? void 0 : _a.status) {
7965
+ schema == null ? true : delete schema.properties.status;
7966
+ }
7963
7967
  return schema;
7964
7968
  }
7965
7969
  }
@@ -8526,8 +8530,7 @@ var __publicField = (obj, key, value) => {
8526
8530
  const WidgetErrorContent$1 = (props) => {
8527
8531
  const {
8528
8532
  refetch,
8529
- errorText,
8530
- hiddenRetry
8533
+ errorText
8531
8534
  } = props;
8532
8535
  const kit = React.useContext(eagle.kitContext);
8533
8536
  const {
@@ -8540,7 +8543,7 @@ var __publicField = (obj, key, value) => {
8540
8543
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx("p", {
8541
8544
  className: cx_default(eagle.Typo.Label.l1_regular_title, "title"),
8542
8545
  children: errorText || t2("dovetail.obtain_data_error")
8543
- }), hiddenRetry ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(kit.button, {
8546
+ }), !refetch ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(kit.button, {
8544
8547
  size: "small",
8545
8548
  type: "ordinary",
8546
8549
  onClick: (e2) => {
@@ -8708,8 +8711,7 @@ var __publicField = (obj, key, value) => {
8708
8711
  WidgetErrorContent$1,
8709
8712
  {
8710
8713
  errorText: t2("dovetail.no_resource", { kind: ` ${t2("dovetail.pod_selector")}` }),
8711
- style: { padding: "15px 0" },
8712
- hiddenRetry: true
8714
+ style: { padding: "15px 0" }
8713
8715
  }
8714
8716
  );
8715
8717
  }
@@ -8776,7 +8778,7 @@ var __publicField = (obj, key, value) => {
8776
8778
  id: port2.name || ""
8777
8779
  }));
8778
8780
  if ((ports == null ? void 0 : ports.length) === 0) {
8779
- return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent$1, { errorText: t2("dovetail.no_resource", { kind: t2("dovetail.port") }), style: { padding: "15px 0" }, hiddenRetry: true });
8781
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent$1, { errorText: t2("dovetail.no_resource", { kind: t2("dovetail.port") }), style: { padding: "15px 0" } });
8780
8782
  }
8781
8783
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
8782
8784
  Table$1,
@@ -9405,6 +9407,12 @@ var __publicField = (obj, key, value) => {
9405
9407
  WorkloadState2["WAITING"] = "waiting";
9406
9408
  return WorkloadState2;
9407
9409
  })(WorkloadState || {});
9410
+ var AccessControlAuth = /* @__PURE__ */ ((AccessControlAuth2) => {
9411
+ AccessControlAuth2["Edit"] = "Edit";
9412
+ AccessControlAuth2["Delete"] = "Delete";
9413
+ AccessControlAuth2["Create"] = "Create";
9414
+ return AccessControlAuth2;
9415
+ })(AccessControlAuth || {});
9408
9416
  function matchSelector(pod2, selector) {
9409
9417
  var _a, _b, _c;
9410
9418
  let match = true;
@@ -9829,8 +9837,9 @@ var __publicField = (obj, key, value) => {
9829
9837
  this._globalStore = _globalStore;
9830
9838
  }
9831
9839
  get displayType() {
9832
- const type2 = this._rawYaml.spec.type;
9833
- if (type2 === "ClusterIP" && !this._rawYaml.spec.clusterIP) {
9840
+ const spec = this._rawYaml.spec;
9841
+ const type2 = spec.type;
9842
+ if (type2 === "ClusterIP" && (!spec.clusterIP || spec.clusterIP === "None")) {
9834
9843
  return "Headless";
9835
9844
  }
9836
9845
  return type2;
@@ -9842,22 +9851,26 @@ var __publicField = (obj, key, value) => {
9842
9851
  var _a;
9843
9852
  return (_a = this._rawYaml.spec.ports) == null ? void 0 : _a.map((p) => {
9844
9853
  let servicePort = `${p.port}`;
9845
- if (this._rawYaml.spec.clusterIP) {
9854
+ if (this._rawYaml.spec.clusterIP && this._rawYaml.spec.clusterIP !== "None") {
9846
9855
  servicePort = `${this._rawYaml.spec.clusterIP}:${p.port}`;
9847
9856
  }
9848
- return `${servicePort} > ${p.targetPort}/${p.protocol}`;
9857
+ return {
9858
+ servicePort,
9859
+ targetPort: p.targetPort,
9860
+ protocol: p.protocol
9861
+ };
9849
9862
  });
9850
9863
  }
9851
9864
  }
9852
- const index_1lzkrja = "";
9865
+ const index_w8956m = "";
9853
9866
  const ServiceInClusterAccessComponent = ({
9854
9867
  service
9855
9868
  }) => {
9856
9869
  const spec = service._rawYaml.spec;
9857
9870
  switch (spec.type) {
9858
9871
  case ServiceTypeEnum.ExternalName:
9859
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
9860
- children: spec.externalName
9872
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
9873
+ value: service.dnsRecord
9861
9874
  });
9862
9875
  default:
9863
9876
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
@@ -9866,22 +9879,25 @@ var __publicField = (obj, key, value) => {
9866
9879
  }
9867
9880
  };
9868
9881
  const BreakLineStyle = "b1vtjd4k";
9882
+ const LinkStyle = "luro4rx";
9869
9883
  const ServiceOutClusterAccessComponent = ({
9870
9884
  service,
9871
9885
  clusterVip,
9872
9886
  breakLine = true
9873
9887
  }) => {
9874
- var _a, _b;
9888
+ var _a, _b, _c, _d;
9875
9889
  const spec = service._rawYaml.spec;
9890
+ const status = service._rawYaml.status;
9876
9891
  let content = "-";
9877
9892
  switch (spec.type) {
9878
9893
  case ServiceTypeEnum.NodePort:
9879
9894
  content = (_a = spec.ports) == null ? void 0 : _a.filter((v) => !!v).map((p, index) => /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Link, {
9880
9895
  target: "_blank",
9881
9896
  href: `http://${clusterVip}:${p.nodePort}`,
9882
- className: breakLine ? BreakLineStyle : "",
9897
+ className: cx_default(breakLine ? BreakLineStyle : "", LinkStyle),
9883
9898
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.OverflowTooltip, {
9884
- content: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
9899
+ content: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
9900
+ className: eagle.Typo.Label.l4_regular_title,
9885
9901
  children: [clusterVip, ":", p.nodePort, !breakLine && index !== (spec.ports || []).length - 1 ? ", " : ""]
9886
9902
  }),
9887
9903
  tooltip: `${clusterVip}:${p.nodePort}`
@@ -9890,8 +9906,17 @@ var __publicField = (obj, key, value) => {
9890
9906
  return /* @__PURE__ */ jsxRuntimeExports.jsx("ul", {
9891
9907
  children: content
9892
9908
  });
9909
+ case ServiceTypeEnum.ExternalName:
9910
+ content = /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
9911
+ value: (_b = spec.externalIPs) == null ? void 0 : _b.join(breakLine ? "\n" : ", ")
9912
+ });
9913
+ break;
9893
9914
  case ServiceTypeEnum.LoadBalancer:
9894
- content = (_b = spec.externalIPs) == null ? void 0 : _b.join(breakLine ? "\n" : ", ");
9915
+ content = /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
9916
+ value: (_d = (_c = status.loadBalancer) == null ? void 0 : _c.ingress) == null ? void 0 : _d.map(({
9917
+ ip
9918
+ }) => ip).join(breakLine ? "\n" : ", ")
9919
+ });
9895
9920
  break;
9896
9921
  default:
9897
9922
  content = /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
@@ -10315,7 +10340,11 @@ var __publicField = (obj, key, value) => {
10315
10340
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.space, {
10316
10341
  children: [selectedKeys.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(DeleteManyButton, {
10317
10342
  ids: selectedKeys
10318
- }) : void 0, !hideCreate ? /* @__PURE__ */ jsxRuntimeExports.jsx(CreateButton, {}) : null]
10343
+ }) : void 0, /* @__PURE__ */ jsxRuntimeExports.jsx(core.CanAccess, {
10344
+ resource: resource == null ? void 0 : resource.name,
10345
+ action: AccessControlAuth.Create,
10346
+ children: !hideCreate ? /* @__PURE__ */ jsxRuntimeExports.jsx(CreateButton, {}) : null
10347
+ })]
10319
10348
  })]
10320
10349
  }), description ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
10321
10350
  className: DescriptionStyle,
@@ -10440,8 +10469,7 @@ var __publicField = (obj, key, value) => {
10440
10469
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
10441
10470
  WidgetErrorContent$1,
10442
10471
  {
10443
- errorText: i18n2.t("dovetail.no_resource", { kind: i18n2.t("dovetail.event") }),
10444
- hiddenRetry: true
10472
+ errorText: i18n2.t("dovetail.no_resource", { kind: i18n2.t("dovetail.event") })
10445
10473
  }
10446
10474
  );
10447
10475
  }
@@ -10562,7 +10590,7 @@ var __publicField = (obj, key, value) => {
10562
10590
  }
10563
10591
  ];
10564
10592
  if ((rows == null ? void 0 : rows.length) === 0) {
10565
- return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent$1, { errorText: t2("dovetail.no_resource", { kind: t2("dovetail.rule") }), style: { padding: "15px 0" }, hiddenRetry: true });
10593
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent$1, { errorText: t2("dovetail.no_resource", { kind: t2("dovetail.rule") }), style: { padding: "15px 0" } });
10566
10594
  }
10567
10595
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
10568
10596
  Table$1,
@@ -10605,8 +10633,7 @@ var __publicField = (obj, key, value) => {
10605
10633
  }, key2));
10606
10634
  if (!result.length) {
10607
10635
  return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent$1, {
10608
- errorText: empty2 || t2("dovetail.empty"),
10609
- hiddenRetry: true
10636
+ errorText: empty2 || t2("dovetail.empty")
10610
10637
  });
10611
10638
  }
10612
10639
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {
@@ -10687,12 +10714,20 @@ var __publicField = (obj, key, value) => {
10687
10714
  const { t: t2 } = useTranslation();
10688
10715
  const openForm = useOpenForm({ id: record.id });
10689
10716
  const isInShowPage = useResourceResult.action === "show";
10717
+ const { data: canEditData } = core.useCan({
10718
+ resource: resource == null ? void 0 : resource.name,
10719
+ action: AccessControlAuth.Edit
10720
+ });
10721
+ const { data: canDeleteData } = core.useCan({
10722
+ resource: resource == null ? void 0 : resource.name,
10723
+ action: AccessControlAuth.Delete
10724
+ });
10690
10725
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
10691
10726
  /* @__PURE__ */ jsxRuntimeExports.jsx(
10692
10727
  kit.dropdown,
10693
10728
  {
10694
10729
  overlay: /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.menu, { children: [
10695
- isInShowPage ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
10730
+ isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
10696
10731
  kit.menuItem,
10697
10732
  {
10698
10733
  onClick: openForm,
@@ -10715,8 +10750,8 @@ var __publicField = (obj, key, value) => {
10715
10750
  }
10716
10751
  ),
10717
10752
  props.children,
10718
- /* @__PURE__ */ jsxRuntimeExports.jsx(kit.divider, { style: { margin: 0 } }),
10719
- /* @__PURE__ */ jsxRuntimeExports.jsx(
10753
+ (canDeleteData == null ? void 0 : canDeleteData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.divider, { style: { margin: 0 } }) : null,
10754
+ (canDeleteData == null ? void 0 : canDeleteData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(
10720
10755
  kit.menuItem,
10721
10756
  {
10722
10757
  danger: true,
@@ -10725,12 +10760,13 @@ var __publicField = (obj, key, value) => {
10725
10760
  },
10726
10761
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.TrashBinDelete16Icon, children: t2("dovetail.delete") })
10727
10762
  }
10728
- )
10763
+ ) : null
10729
10764
  ] }),
10765
+ trigger: ["click"],
10730
10766
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
10731
10767
  kit.button,
10732
10768
  {
10733
- type: size === "large" ? "quiet" : "tertiary",
10769
+ type: "quiet",
10734
10770
  size: size === "large" ? "middle" : "small",
10735
10771
  prefixIcon: size === "large" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
10736
10772
  eagle.Icon,
@@ -10901,13 +10937,17 @@ var __publicField = (obj, key, value) => {
10901
10937
  state: stateDisplay
10902
10938
  }) : void 0]
10903
10939
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.space, {
10904
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx(kit.button, {
10905
- style: {
10906
- marginRight: 8
10907
- },
10908
- onClick: openForm,
10909
- prefixIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(iconsReact.EditPen16GradientBlueIcon, {}),
10910
- children: t2("dovetail.edit_yaml")
10940
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx(core.CanAccess, {
10941
+ resource: resource == null ? void 0 : resource.name,
10942
+ action: AccessControlAuth.Edit,
10943
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.button, {
10944
+ style: {
10945
+ marginRight: 8
10946
+ },
10947
+ onClick: openForm,
10948
+ prefixIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(iconsReact.EditPen16GradientBlueIcon, {}),
10949
+ children: t2("dovetail.edit_yaml")
10950
+ })
10911
10951
  }), /* @__PURE__ */ jsxRuntimeExports.jsx(Dropdown, {
10912
10952
  record,
10913
10953
  size: "large"
@@ -10958,7 +10998,7 @@ var __publicField = (obj, key, value) => {
10958
10998
  eagle.Button,
10959
10999
  {
10960
11000
  type: "quiet",
10961
- prefixIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.ViewEye16GrayIcon }),
11001
+ prefixIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: hideSecret ? iconsReact.ViewEye16GrayIcon : iconsReact.EntityFilterIgnoreGradient16GrayIcon }),
10962
11002
  onClick: () => setHideSecret((v) => !v),
10963
11003
  children: hideSecret ? i18n2.t("dovetail.show_data_value") : i18n2.t("dovetail.hide_data_value")
10964
11004
  }
@@ -11009,8 +11049,7 @@ var __publicField = (obj, key, value) => {
11009
11049
  }),
11010
11050
  style: {
11011
11051
  padding: "15px 0"
11012
- },
11013
- hiddenRetry: true
11052
+ }
11014
11053
  });
11015
11054
  }
11016
11055
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.space, {
@@ -11194,16 +11233,23 @@ var __publicField = (obj, key, value) => {
11194
11233
  const {
11195
11234
  i18n: i18n2
11196
11235
  } = useTranslation();
11197
- return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.button, {
11198
- className: EditButtonStyle,
11199
- type: "link",
11200
- onClick: () => {
11201
- eagle.pushModal({
11202
- component: EditFieldModal,
11203
- props: modalProps
11204
- });
11205
- },
11206
- children: i18n2.t("dovetail.edit")
11236
+ const {
11237
+ resource
11238
+ } = core.useResource();
11239
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(core.CanAccess, {
11240
+ resource: resource == null ? void 0 : resource.name,
11241
+ action: AccessControlAuth.Edit,
11242
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.button, {
11243
+ className: EditButtonStyle,
11244
+ type: "link",
11245
+ onClick: () => {
11246
+ eagle.pushModal({
11247
+ component: EditFieldModal,
11248
+ props: modalProps
11249
+ });
11250
+ },
11251
+ children: i18n2.t("dovetail.edit")
11252
+ })
11207
11253
  });
11208
11254
  }
11209
11255
  const index_c9frt4 = "";
@@ -11571,17 +11617,17 @@ var __publicField = (obj, key, value) => {
11571
11617
  return /* @__PURE__ */ jsxRuntimeExports.jsx(KeyValueAnnotation, { data: value2, expandable: true });
11572
11618
  }
11573
11619
  });
11574
- const ServiceInnerClusterAccessField = (i18n2) => ({
11620
+ const ServiceInnerClusterAccessField = () => ({
11575
11621
  key: "innerClusterAccess",
11576
- title: i18n2.t("dovetail.in_cluster_access"),
11622
+ title: /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceInClusterAccessTitle, {}),
11577
11623
  path: [],
11578
11624
  renderContent: (_, record) => {
11579
11625
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceInClusterAccessComponent, { service: record });
11580
11626
  }
11581
11627
  });
11582
- const ServiceOutClusterAccessField = (i18n2, clusterVip) => ({
11628
+ const ServiceOutClusterAccessField = (clusterVip) => ({
11583
11629
  key: "innerClusterAccess",
11584
- title: i18n2.t("dovetail.out_cluster_access"),
11630
+ title: /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceOutClusterAccessTitle, {}),
11585
11631
  path: [],
11586
11632
  renderContent: (_, record) => {
11587
11633
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceOutClusterAccessComponent, { service: record, clusterVip, breakLine: false });
@@ -17272,6 +17318,10 @@ var __publicField = (obj, key, value) => {
17272
17318
  signal
17273
17319
  }).then((response) => {
17274
17320
  var _a3;
17321
+ if (response.status !== 200) {
17322
+ setLogs([]);
17323
+ return;
17324
+ }
17275
17325
  const reader = (_a3 = response.body) == null ? void 0 : _a3.getReader();
17276
17326
  if (!reader) {
17277
17327
  return;
@@ -17292,6 +17342,7 @@ var __publicField = (obj, key, value) => {
17292
17342
  }
17293
17343
  const total = buffer + chunk.slice(0, lastIndex);
17294
17344
  buffer = chunk.slice(lastIndex + 1);
17345
+ console.log(total);
17295
17346
  const formattedLogs = total.split("\n").filter(Boolean).map((line) => {
17296
17347
  const [timestamps, ...content] = line.split(" ");
17297
17348
  const t22 = new Date(timestamps).toLocaleString();
@@ -17381,8 +17432,7 @@ var __publicField = (obj, key, value) => {
17381
17432
  },
17382
17433
  errorText: t2("dovetail.no_resource", {
17383
17434
  kind: t2("dovetail.previous_log")
17384
- }),
17385
- hiddenRetry: true
17435
+ })
17386
17436
  }) : /* @__PURE__ */ jsxRuntimeExports.jsx(LogViewer, {
17387
17437
  innerRef: logViewerRef,
17388
17438
  height: "100%",
@@ -17499,7 +17549,7 @@ var __publicField = (obj, key, value) => {
17499
17549
  model.dispose();
17500
17550
  editor.dispose();
17501
17551
  };
17502
- }, [defaultValue, schema, id, readOnly, isScrollOnFocus, getInstance]);
17552
+ }, [schema, id, readOnly, isScrollOnFocus, getInstance]);
17503
17553
  React.useEffect(() => {
17504
17554
  const editor = instanceRef.current.editor;
17505
17555
  if (editor) {
@@ -17608,8 +17658,7 @@ var __publicField = (obj, key, value) => {
17608
17658
  }),
17609
17659
  style: {
17610
17660
  padding: "15px 0"
17611
- },
17612
- hiddenRetry: true
17661
+ }
17613
17662
  });
17614
17663
  }
17615
17664
  return /* @__PURE__ */ jsxRuntimeExports.jsx(MonacoYamlEditor$1, {
@@ -17690,7 +17739,7 @@ var __publicField = (obj, key, value) => {
17690
17739
  [containerStatuses, initContainerStatuses]
17691
17740
  );
17692
17741
  if (dataSource.length === 0) {
17693
- return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent$1, { errorText: i18n2.t("dovetail.no_resource", { kind: i18n2.t("dovetail.container") }), style: { padding: "15px 0" }, hiddenRetry: true });
17742
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent$1, { errorText: i18n2.t("dovetail.no_resource", { kind: i18n2.t("dovetail.container") }), style: { padding: "15px 0" } });
17694
17743
  }
17695
17744
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
17696
17745
  Table$1,
@@ -17928,8 +17977,12 @@ var __publicField = (obj, key, value) => {
17928
17977
  const { resource } = core.useResource();
17929
17978
  const { mutateAsync } = core.useUpdate();
17930
17979
  const { t: t2 } = useTranslation();
17980
+ const { data: canEditData } = core.useCan({
17981
+ resource: resource == null ? void 0 : resource.name,
17982
+ action: AccessControlAuth.Edit
17983
+ });
17931
17984
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(K8sDropdown, { record, size, children: [
17932
- /* @__PURE__ */ jsxRuntimeExports.jsx(
17985
+ (canEditData == null ? void 0 : canEditData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(
17933
17986
  kit.menu.Item,
17934
17987
  {
17935
17988
  onClick: async () => {
@@ -17968,7 +18021,7 @@ var __publicField = (obj, key, value) => {
17968
18021
  },
17969
18022
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.Retry16GradientBlueIcon, children: t2("dovetail.redeploy") })
17970
18023
  }
17971
- ),
18024
+ ) : null,
17972
18025
  children
17973
18026
  ] });
17974
18027
  }
@@ -17977,10 +18030,14 @@ var __publicField = (obj, key, value) => {
17977
18030
  const kit = eagle.useUIKit();
17978
18031
  const { t: t2 } = useTranslation();
17979
18032
  const formRef = React.useRef(null);
17980
- const { action } = core.useResource();
18033
+ const { action, resource } = core.useResource();
17981
18034
  const isInShowPage = action === "show";
18035
+ const { data: canEditData } = core.useCan({
18036
+ resource: resource == null ? void 0 : resource.name,
18037
+ action: AccessControlAuth.Edit
18038
+ });
17982
18039
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(WorkloadDropdown, { record, size, children: [
17983
- isInShowPage ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
18040
+ isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
17984
18041
  kit.menu.Item,
17985
18042
  {
17986
18043
  onClick: () => {
@@ -18139,7 +18196,7 @@ var __publicField = (obj, key, value) => {
18139
18196
  return void 0;
18140
18197
  }
18141
18198
  }
18142
- const index_p3hly3 = "";
18199
+ const index_ccf0kl = "";
18143
18200
  const SelectStyle = "sj0ggy";
18144
18201
  const SearchInputStyle = "s1eo8uqs";
18145
18202
  const SelectContentStyle = "s64gojc";
@@ -18223,7 +18280,7 @@ var __publicField = (obj, key, value) => {
18223
18280
  },
18224
18281
  children: label2
18225
18282
  }) : /* @__PURE__ */ jsxRuntimeExports.jsx(kit.token, {
18226
- className: isCountToken ? CountTokenStyle : TokenStyle,
18283
+ className: cx_default(isCountToken ? CountTokenStyle : TokenStyle, isCountToken ? "" : "closable-token"),
18227
18284
  closable,
18228
18285
  onClose,
18229
18286
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
@@ -18233,6 +18290,8 @@ var __publicField = (obj, key, value) => {
18233
18290
  },
18234
18291
  maxTagCount: 1,
18235
18292
  optionLabelProp: "label",
18293
+ showArrow: true,
18294
+ showSearch: false,
18236
18295
  multiple: true,
18237
18296
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(kit.option, {
18238
18297
  value: "_all",
@@ -18303,8 +18362,7 @@ var __publicField = (obj, key, value) => {
18303
18362
  children: !(tableProps.data.length || tableProps.loading) ? /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent$1, {
18304
18363
  errorText: tableProps.empty || t2("dovetail.no_resource", {
18305
18364
  kind: ` ${config.kind}`
18306
- }),
18307
- hiddenRetry: true
18365
+ })
18308
18366
  }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Table$1, {
18309
18367
  ...tableProps,
18310
18368
  empty: tableProps.empty || t2("dovetail.no_resource", {
@@ -18320,7 +18378,7 @@ var __publicField = (obj, key, value) => {
18320
18378
  });
18321
18379
  }
18322
18380
  function ResourceList(props) {
18323
- const { formatter, name: name2, columns, Dropdown, noShow } = props.config;
18381
+ const { formatter, columns, Dropdown, noShow } = props.config;
18324
18382
  const { i18n: i18n2 } = useTranslation();
18325
18383
  const nameRenderer = noShow ? PlainTextNameColumnRenderer(i18n2) : NameColumnRenderer(i18n2);
18326
18384
  const { tableProps, selectedKeys } = useEagleTable({
@@ -22393,7 +22451,7 @@ var __publicField = (obj, key, value) => {
22393
22451
  ]
22394
22452
  }
22395
22453
  ),
22396
- /* @__PURE__ */ jsxRuntimeExports.jsx(
22454
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
22397
22455
  "div",
22398
22456
  {
22399
22457
  style: {
@@ -22402,29 +22460,32 @@ var __publicField = (obj, key, value) => {
22402
22460
  height: height || "500px",
22403
22461
  zIndex: 1
22404
22462
  },
22405
- children: isDiff ? /* @__PURE__ */ jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: value2 }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
22406
- MonacoYamlDiffEditor$2,
22407
- {
22408
- id: props.id,
22409
- origin: defaultValue,
22410
- modified: value2,
22411
- height
22412
- }
22413
- ) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: value2 }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
22414
- MonacoYamlEditor,
22415
- {
22416
- id: props.id,
22417
- getInstance,
22418
- defaultValue,
22419
- height,
22420
- onChange,
22421
- onValidate,
22422
- onEditorCreate,
22423
- onBlur: props.onBlur,
22424
- schema,
22425
- readOnly
22426
- }
22427
- ) })
22463
+ children: [
22464
+ /* @__PURE__ */ jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: value2 }), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { display: isDiff ? "none" : "block" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
22465
+ MonacoYamlEditor,
22466
+ {
22467
+ id: props.id,
22468
+ getInstance,
22469
+ defaultValue: value2,
22470
+ height,
22471
+ onChange,
22472
+ onValidate,
22473
+ onEditorCreate,
22474
+ onBlur: props.onBlur,
22475
+ schema,
22476
+ readOnly
22477
+ }
22478
+ ) }) }),
22479
+ isDiff ? /* @__PURE__ */ jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: value2 }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
22480
+ MonacoYamlDiffEditor$2,
22481
+ {
22482
+ id: props.id,
22483
+ origin: defaultValue,
22484
+ modified: value2,
22485
+ height
22486
+ }
22487
+ ) }) : null
22488
+ ]
22428
22489
  }
22429
22490
  )
22430
22491
  ]
@@ -23041,8 +23102,12 @@ var __publicField = (obj, key, value) => {
23041
23102
  const { resource } = core.useResource();
23042
23103
  const { mutateAsync } = core.useUpdate();
23043
23104
  const { t: t2 } = useTranslation();
23105
+ const { data: canEditData } = core.useCan({
23106
+ resource: resource == null ? void 0 : resource.name,
23107
+ action: AccessControlAuth.Edit
23108
+ });
23044
23109
  const suspended2 = Boolean(spec == null ? void 0 : spec.suspend);
23045
- return /* @__PURE__ */ jsxRuntimeExports.jsx(K8sDropdown, { record, size, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
23110
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(K8sDropdown, { record, size, children: (canEditData == null ? void 0 : canEditData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(
23046
23111
  kit.menu.Item,
23047
23112
  {
23048
23113
  onClick: async () => {
@@ -23081,7 +23146,7 @@ var __publicField = (obj, key, value) => {
23081
23146
  },
23082
23147
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: suspended2 ? iconsReact.RecoverContinue16GradientBlueIcon : iconsReact.Pause16GradientBlueIcon, children: t2(suspended2 ? "dovetail.resume" : "dovetail.suspend") })
23083
23148
  }
23084
- ) });
23149
+ ) : null });
23085
23150
  }
23086
23151
  const index_1wzdp7m = "";
23087
23152
  const WrapperStyle = "wfg6u6g";
@@ -23581,32 +23646,38 @@ var __publicField = (obj, key, value) => {
23581
23646
  sorter: CommonSorter(dataIndex)
23582
23647
  };
23583
23648
  };
23584
- const ServiceInClusterAccessColumnRenderer = (i18n2) => {
23585
- return {
23586
- key: "inClusterAccess",
23587
- title: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Tooltip, {
23588
- overlayClassName: ServiceClusterTooltipStyle,
23589
- title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
23649
+ function ServiceInClusterAccessTitle() {
23650
+ const {
23651
+ i18n: i18n2
23652
+ } = useTranslation();
23653
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Tooltip, {
23654
+ overlayClassName: ServiceClusterTooltipStyle,
23655
+ title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
23656
+ style: {
23657
+ lineHeight: "22px"
23658
+ },
23659
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
23660
+ children: i18n2.t("dovetail.in_cluster_desc")
23661
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
23662
+ children: i18n2.t("dovetail.in_cluster_ip_desc")
23663
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Divider, {
23590
23664
  style: {
23591
- lineHeight: "22px"
23592
- },
23593
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
23594
- children: i18n2.t("dovetail.in_cluster_desc")
23595
- }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
23596
- children: i18n2.t("dovetail.in_cluster_ip_desc")
23597
- }), /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Divider, {
23598
- style: {
23599
- margin: "6px 0"
23600
- }
23601
- }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
23602
- children: i18n2.t("dovetail.in_cluster_external_name_desc")
23603
- })]
23604
- }),
23605
- children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
23606
- className: DashedTitleStyle,
23607
- children: i18n2.t("dovetail.in_cluster_access")
23608
- })
23665
+ margin: "6px 0"
23666
+ }
23667
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
23668
+ children: i18n2.t("dovetail.in_cluster_external_name_desc")
23669
+ })]
23609
23670
  }),
23671
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
23672
+ className: DashedTitleStyle,
23673
+ children: i18n2.t("dovetail.in_cluster_access")
23674
+ })
23675
+ });
23676
+ }
23677
+ const ServiceInClusterAccessColumnRenderer = () => {
23678
+ return {
23679
+ key: "inClusterAccess",
23680
+ title: /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceInClusterAccessTitle, {}),
23610
23681
  display: true,
23611
23682
  dataIndex: [],
23612
23683
  width: 160,
@@ -23617,34 +23688,42 @@ var __publicField = (obj, key, value) => {
23617
23688
  }
23618
23689
  };
23619
23690
  };
23620
- const ServiceOutClusterAccessColumnRenderer = (i18n2, clusterVip) => {
23691
+ function ServiceOutClusterAccessTitle() {
23692
+ const {
23693
+ i18n: i18n2
23694
+ } = useTranslation();
23695
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Tooltip, {
23696
+ overlayClassName: ServiceClusterTooltipStyle,
23697
+ title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
23698
+ style: {
23699
+ lineHeight: "22px"
23700
+ },
23701
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
23702
+ children: i18n2.t("dovetail.out_cluster_ip_desc")
23703
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
23704
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Trans, {
23705
+ i18nKey: "dovetail.out_cluster_node_port_desc"
23706
+ })
23707
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
23708
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Trans, {
23709
+ i18nKey: "dovetail.out_cluster_lb_desc"
23710
+ })
23711
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
23712
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Trans, {
23713
+ i18nKey: "dovetail.out_external_name_desc"
23714
+ })
23715
+ })]
23716
+ }),
23717
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
23718
+ className: DashedTitleStyle,
23719
+ children: i18n2.t("dovetail.out_cluster_access")
23720
+ })
23721
+ });
23722
+ }
23723
+ const ServiceOutClusterAccessColumnRenderer = (clusterVip) => {
23621
23724
  return {
23622
23725
  key: "outClusterAccess",
23623
- title: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Tooltip, {
23624
- overlayClassName: ServiceClusterTooltipStyle,
23625
- title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
23626
- style: {
23627
- lineHeight: "22px"
23628
- },
23629
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
23630
- children: i18n2.t("dovetail.out_cluster_ip_desc")
23631
- }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
23632
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Trans, {
23633
- i18nKey: "dovetail.out_cluster_node_port_desc"
23634
- })
23635
- }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
23636
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Trans, {
23637
- i18nKey: "dovetail.out_cluster_lb_desc"
23638
- })
23639
- }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
23640
- children: i18n2.t("dovetail.out_external_name_desc")
23641
- })]
23642
- }),
23643
- children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
23644
- className: DashedTitleStyle,
23645
- children: i18n2.t("dovetail.out_cluster_access")
23646
- })
23647
- }),
23726
+ title: /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceOutClusterAccessTitle, {}),
23648
23727
  display: true,
23649
23728
  dataIndex: [],
23650
23729
  width: 160,
@@ -23667,6 +23746,11 @@ var __publicField = (obj, key, value) => {
23667
23746
  sorter: CommonSorter(dataIndex),
23668
23747
  width: 160,
23669
23748
  render(value2, record) {
23749
+ if (!(value2 == null ? void 0 : value2.length)) {
23750
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
23751
+ value: ""
23752
+ });
23753
+ }
23670
23754
  return value2.map((o) => /* @__PURE__ */ jsxRuntimeExports.jsx(ReferenceLink, {
23671
23755
  ownerReference: o,
23672
23756
  namespace: record.metadata.namespace || "default"
@@ -23801,10 +23885,21 @@ var __publicField = (obj, key, value) => {
23801
23885
  display: true,
23802
23886
  dataIndex: ["displayPortMapping"],
23803
23887
  width: 300,
23804
- render(value2) {
23805
- const content = value2.map((v) => /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.OverflowTooltip, {
23806
- content: v
23807
- }, v));
23888
+ render(value2, record) {
23889
+ var _a;
23890
+ const content = (_a = record.displayPortMapping) == null ? void 0 : _a.map((v) => /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.OverflowTooltip, {
23891
+ content: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
23892
+ style: {
23893
+ whiteSpace: "pre"
23894
+ },
23895
+ children: [record.displayType === "NodePort" ? /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Link, {
23896
+ href: `//${v.servicePort}`,
23897
+ target: "_blank",
23898
+ children: v.servicePort
23899
+ }) : v.servicePort, " > ", v.targetPort, "/", v.protocol]
23900
+ }),
23901
+ tooltip: `${v.servicePort} > ${v.targetPort}/${v.protocol}`
23902
+ }, v.servicePort));
23808
23903
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {
23809
23904
  children: content
23810
23905
  });
@@ -23894,7 +23989,7 @@ var __publicField = (obj, key, value) => {
23894
23989
  };
23895
23990
  const styles = "";
23896
23991
  const Dovetail = (props) => {
23897
- const { resourcesConfig, urlPrefix = "", Layout: Layout2, history, globalStore } = props;
23992
+ const { resourcesConfig, urlPrefix = "", Layout: Layout2, history, globalStore, accessControlProvider } = props;
23898
23993
  const msg = eagle.useMessage();
23899
23994
  const notCustomResources = React.useMemo(() => {
23900
23995
  return resourcesConfig.filter((c2) => !c2.isCustom);
@@ -23938,6 +24033,7 @@ var __publicField = (obj, key, value) => {
23938
24033
  liveMode: "auto",
23939
24034
  disableTelemetry: true
23940
24035
  },
24036
+ accessControlProvider,
23941
24037
  resources: resourcesConfig.map((c2) => {
23942
24038
  return {
23943
24039
  name: c2.name,
@@ -24133,6 +24229,7 @@ var __publicField = (obj, key, value) => {
24133
24229
  default: MonacoYamlDiffEditor
24134
24230
  }, Symbol.toStringTag, { value: "Module" }));
24135
24231
  exports2.ALL_NS = ALL_NS;
24232
+ exports2.AccessControlAuth = AccessControlAuth;
24136
24233
  exports2.AgeColumnRenderer = AgeColumnRenderer;
24137
24234
  exports2.AgeField = AgeField;
24138
24235
  exports2.AnnotationsField = AnnotationsField;
@@ -24264,11 +24361,13 @@ var __publicField = (obj, key, value) => {
24264
24361
  exports2.Separator = Separator;
24265
24362
  exports2.ServiceInClusterAccessColumnRenderer = ServiceInClusterAccessColumnRenderer;
24266
24363
  exports2.ServiceInClusterAccessComponent = ServiceInClusterAccessComponent;
24364
+ exports2.ServiceInClusterAccessTitle = ServiceInClusterAccessTitle;
24267
24365
  exports2.ServiceInnerClusterAccessField = ServiceInnerClusterAccessField;
24268
24366
  exports2.ServiceModel = ServiceModel;
24269
24367
  exports2.ServiceOutClusterAccessColumnRenderer = ServiceOutClusterAccessColumnRenderer;
24270
24368
  exports2.ServiceOutClusterAccessComponent = ServiceOutClusterAccessComponent;
24271
24369
  exports2.ServiceOutClusterAccessField = ServiceOutClusterAccessField;
24370
+ exports2.ServiceOutClusterAccessTitle = ServiceOutClusterAccessTitle;
24272
24371
  exports2.ServicePodsField = ServicePodsField;
24273
24372
  exports2.ServicePodsGroup = ServicePodsGroup;
24274
24373
  exports2.ServiceTypeColumnRenderer = ServiceTypeColumnRenderer;