@dovetail-v2/refine 0.3.1 → 0.3.2

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.
@@ -7,13 +7,13 @@ var __publicField = (obj, key2, value2) => {
7
7
  import dayjs from "dayjs";
8
8
  import i18n from "i18next";
9
9
  import { w as warnOnce, g as getDefaults, a as warn, b as getI18n, s as setDefaults, d as setI18n, I as I18nContext, j as jsxRuntimeExports, u as useTranslation, c as cx_default, S as SocketStatus } from "./common-feae5742.js";
10
- import { ResourceContext, matchResourceFromRoute, useResource, useDelete, useNavigation, useBreadcrumb, useList, CanAccess, useUpdate, useParsed, useGo, useCan, useTable, useDeleteMany, useShow, useDataProvider, useRefineContext, useTranslate, useWarnAboutChange, useForm as useForm$2, flattenObjectKeys, pickNotDeprecated, useMenu, Refine } from "@refinedev/core";
10
+ import { ResourceContext, matchResourceFromRoute, useResource, useDelete, useNavigation, useBreadcrumb, useList, CanAccess, useUpdate, useParsed, useGo, useCan, useTable, useDeleteMany, useDataProvider, useShow, useRefineContext, useTranslate, useWarnAboutChange, useForm as useForm$2, flattenObjectKeys, pickNotDeprecated, useMenu, Refine } from "@refinedev/core";
11
11
  import { parse, stringify } from "qs";
12
12
  import * as React from "react";
13
13
  import React__default, { createElement, isValidElement, cloneElement, Children, useContext, useCallback, createContext, useState, useEffect, useMemo, useRef, useImperativeHandle, lazy, Suspense, forwardRef } from "react";
14
14
  import { useLocation, useHistory, useParams, matchPath, Link, Route, NavLink, Router } from "react-router-dom";
15
- import { usePushModal, usePopModal, DeleteDialog, Tag, RejectDialog, RejectDialogType, Input, Select, AntdOption, Button, Form, Space, TextArea, kitContext, Typo, Loading, Table as Table$2, Pagination, Alert, Modal, Fields, Units, Link as Link$1, OverflowTooltip, Tooltip, Dropdown, Menu as Menu$1, Icon as Icon$1, Divider, StatusCapsule, Tabs as Tabs$1, TabsTabPane, Row, Col, Popover, AntdTable, TableForm, Upload, getOptions, DonutChart, SegmentControl, Checkbox, useMessage, SearchInput, Token, AntdSelectOptGroup, MenuItemGroup, Layout as Layout$1, Time as Time$1, ModalStack, KitStoreProvider, ConfigProvider } from "@cloudtower/eagle";
16
- import { EditPen16PrimaryIcon, Download16GradientBlueIcon, TrashBinDelete16Icon, MoreEllipsis324BoldSecondaryIcon, MoreEllipsis324BoldBlueIcon, MoreEllipsis316BoldBlueIcon, PlusAddCreateNew16BoldOntintIcon, ArrowChevronLeft16BoldTertiaryIcon, ArrowChevronLeftSmall16BoldBlueIcon, ViewEye16GradientGrayIcon, EntityFilterIgnoreGradient16GrayIcon, InfoICircleFill16GrayIcon, InfoICircleFill16Gray70Icon, RecoverContinue16GradientBlueIcon, SuspendedPause16GradientBlueIcon, Retry16GradientBlueIcon, OpenTerminal16GradientBlueIcon, HierarchyTriangleRight16GrayIcon, HierarchyTriangleRight16BlueIcon, ClipboardCopy16GradientGrayIcon, ClipboardCopy16GradientBlueIcon, Retry16GradientGrayIcon, EditPen16GradientGrayIcon, EditPen16GradientBlueIcon, Showdiff16GradientGrayIcon, Showdiff16GradientBlueIcon, XmarkFailedSeriousWarningFill16RedIcon, ExclamationErrorCircleFill16RedIcon, Pause16GradientBlueIcon, EditPen16BlueIcon } from "@cloudtower/icons-react";
15
+ import { usePushModal, usePopModal, DeleteDialog, Tag, RejectDialog, RejectDialogType, Input, Select, AntdOption, Button, Form, Space, TextArea, kitContext, Typo, Loading, Table as Table$2, Pagination, Alert, Modal, Fields, Units, Link as Link$1, OverflowTooltip, Tooltip, Dropdown, Menu as Menu$1, Icon as Icon$1, Divider, StatusCapsule, Popover, AntdTable, TableForm, Upload, getOptions, DonutChart, SegmentControl, Checkbox, Tabs as Tabs$1, TabsTabPane, Row, Col, useMessage, SearchInput, Token, AntdSelectOptGroup, MenuItemGroup, Layout as Layout$1, Time as Time$1, ModalStack, KitStoreProvider, ConfigProvider } from "@cloudtower/eagle";
16
+ import { EditPen16PrimaryIcon, Download16GradientBlueIcon, TrashBinDelete16Icon, MoreEllipsis324BoldSecondaryIcon, MoreEllipsis324BoldBlueIcon, MoreEllipsis316BoldBlueIcon, PlusAddCreateNew16BoldOntintIcon, ViewEye16GradientGrayIcon, EntityFilterIgnoreGradient16GrayIcon, InfoICircleFill16GrayIcon, InfoICircleFill16Gray70Icon, RecoverContinue16GradientBlueIcon, SuspendedPause16GradientBlueIcon, ArrowChevronLeft16BoldTertiaryIcon, ArrowChevronLeftSmall16BoldBlueIcon, Retry16GradientBlueIcon, OpenTerminal16GradientBlueIcon, HierarchyTriangleRight16GrayIcon, HierarchyTriangleRight16BlueIcon, ClipboardCopy16GradientGrayIcon, ClipboardCopy16GradientBlueIcon, Retry16GradientGrayIcon, EditPen16GradientGrayIcon, EditPen16GradientBlueIcon, Showdiff16GradientGrayIcon, Showdiff16GradientBlueIcon, XmarkFailedSeriousWarningFill16RedIcon, ExclamationErrorCircleFill16RedIcon, Pause16GradientBlueIcon, EditPen16BlueIcon } from "@cloudtower/icons-react";
17
17
  import { first, get as get$2, cloneDeep, set, omit as omit$1, merge, isEqual, debounce, last, setWith, clone, isObject as isObject$3, uniq, keyBy } from "lodash-es";
18
18
  import yaml$2 from "js-yaml";
19
19
  import { useLocalStorage } from "usehooks-ts";
@@ -9254,7 +9254,7 @@ var ResourceState = /* @__PURE__ */ ((ResourceState2) => {
9254
9254
  return ResourceState2;
9255
9255
  })(ResourceState || {});
9256
9256
  function matchSelector(pod2, selector, namespace2 = "default") {
9257
- var _a, _b, _c;
9257
+ var _a, _b, _c, _d;
9258
9258
  let match = true;
9259
9259
  if (selector) {
9260
9260
  for (const key2 in selector.matchLabels) {
@@ -9263,7 +9263,7 @@ function matchSelector(pod2, selector, namespace2 = "default") {
9263
9263
  }
9264
9264
  }
9265
9265
  }
9266
- return match && pod2.metadata.namespace === namespace2;
9266
+ return match && ((_d = pod2.metadata) == null ? void 0 : _d.namespace) === namespace2;
9267
9267
  }
9268
9268
  class WorkloadBaseModel extends ResourceModel {
9269
9269
  constructor(_rawYaml, _globalStore) {
@@ -9353,10 +9353,14 @@ class WorkloadModel extends WorkloadBaseModel {
9353
9353
  constructor(_rawYaml, _globalStore) {
9354
9354
  super(_rawYaml, _globalStore);
9355
9355
  __publicField(this, "restarts", 0);
9356
+ __publicField(this, "services", []);
9357
+ __publicField(this, "ingresses", []);
9356
9358
  this._rawYaml = _rawYaml;
9357
9359
  }
9358
9360
  async init() {
9359
9361
  await this.getRestarts();
9362
+ await this.getServices();
9363
+ await this.getIngresses();
9360
9364
  }
9361
9365
  async getRestarts() {
9362
9366
  const pods = await this._globalStore.get("pods", {
@@ -9372,6 +9376,29 @@ class WorkloadModel extends WorkloadBaseModel {
9372
9376
  const result = lodashExports.sumBy(myPods, "restarts");
9373
9377
  this.restarts = result;
9374
9378
  }
9379
+ async getServices() {
9380
+ const services = await this._globalStore.get("services", {
9381
+ resourceBasePath: "/api/v1",
9382
+ kind: "Service"
9383
+ });
9384
+ const myServices = services.items.filter(
9385
+ (p) => {
9386
+ var _a;
9387
+ return matchSelector(p, (_a = this.spec) == null ? void 0 : _a.selector, this.metadata.namespace);
9388
+ }
9389
+ );
9390
+ this.services = myServices;
9391
+ }
9392
+ async getIngresses() {
9393
+ const allIngresses = /* @__PURE__ */ new Map();
9394
+ for (const service of this.services) {
9395
+ for (const ingress of service.ingresses) {
9396
+ const key2 = `${ingress.namespace}-${ingress.name}`;
9397
+ allIngresses.set(key2, ingress);
9398
+ }
9399
+ }
9400
+ this.ingresses = Array.from(allIngresses.values());
9401
+ }
9375
9402
  get replicas() {
9376
9403
  return this.spec && "replicas" in this.spec ? this.spec.replicas : 0;
9377
9404
  }
@@ -9512,6 +9539,38 @@ class PodMetricsModel extends ResourceModel {
9512
9539
  };
9513
9540
  }
9514
9541
  }
9542
+ class ReplicaSetModel extends ResourceModel {
9543
+ constructor(_rawYaml, _globalStore) {
9544
+ super(_rawYaml, _globalStore);
9545
+ __publicField(this, "pods", []);
9546
+ __publicField(this, "restarts", 0);
9547
+ this._rawYaml = _rawYaml;
9548
+ }
9549
+ async init() {
9550
+ await this.getPods();
9551
+ }
9552
+ async getPods() {
9553
+ const pods = await this._globalStore.get("pods", {
9554
+ resourceBasePath: "/api/v1",
9555
+ kind: "Pod"
9556
+ });
9557
+ const myPods = pods.items.filter(
9558
+ (pod2) => {
9559
+ var _a;
9560
+ return matchSelector(pod2, (_a = this.spec) == null ? void 0 : _a.selector, this.metadata.namespace);
9561
+ }
9562
+ );
9563
+ this.pods = myPods;
9564
+ this.restarts = lodashExports.sumBy(this.pods, (pod2) => pod2.restarts || 0);
9565
+ }
9566
+ get ownerDeploymentName() {
9567
+ var _a;
9568
+ const ownerRef = (_a = this.metadata.ownerReferences) == null ? void 0 : _a.find(
9569
+ (ref) => ref.kind === "Deployment" && ref.apiVersion === "apps/v1"
9570
+ );
9571
+ return ownerRef == null ? void 0 : ownerRef.name;
9572
+ }
9573
+ }
9515
9574
  class CronJobModel extends WorkloadBaseModel {
9516
9575
  constructor(_rawYaml, _globalStore) {
9517
9576
  super(_rawYaml, _globalStore);
@@ -9554,8 +9613,27 @@ class EventModel extends ResourceModel {
9554
9613
  class DeploymentModel extends WorkloadModel {
9555
9614
  constructor(_rawYaml, _globalStore) {
9556
9615
  super(_rawYaml, _globalStore);
9616
+ __publicField(this, "replicaSets", []);
9557
9617
  this._rawYaml = _rawYaml;
9558
9618
  }
9619
+ async init() {
9620
+ await super.init();
9621
+ await this.getReplicaSets();
9622
+ }
9623
+ async getReplicaSets() {
9624
+ const replicaSets = await this._globalStore.get("replicasets", {
9625
+ resourceBasePath: "/apis/apps/v1",
9626
+ kind: "ReplicaSet"
9627
+ });
9628
+ const myReplicaSets = replicaSets.items.filter((rs) => {
9629
+ var _a, _b, _c;
9630
+ const ownerRef = (_b = (_a = rs.metadata) == null ? void 0 : _a.ownerReferences) == null ? void 0 : _b.find(
9631
+ (ref) => ref.kind === "Deployment" && ref.apiVersion === "apps/v1" && ref.name === this.name && ref.uid === this.metadata.uid
9632
+ );
9633
+ return !!ownerRef && ((_c = rs.metadata) == null ? void 0 : _c.namespace) === this.metadata.namespace;
9634
+ });
9635
+ this.replicaSets = myReplicaSets;
9636
+ }
9559
9637
  get stateDisplay() {
9560
9638
  var _a, _b, _c;
9561
9639
  if (((_a = this.spec) == null ? void 0 : _a.replicas) === 0) {
@@ -9611,8 +9689,25 @@ var ServiceTypeEnum = /* @__PURE__ */ ((ServiceTypeEnum2) => {
9611
9689
  class ServiceModel extends ResourceModel {
9612
9690
  constructor(_rawYaml, _globalStore) {
9613
9691
  super(_rawYaml, _globalStore);
9692
+ __publicField(this, "ingresses", []);
9614
9693
  this._rawYaml = _rawYaml;
9615
9694
  }
9695
+ async init() {
9696
+ await this.getIngresses();
9697
+ }
9698
+ async getIngresses() {
9699
+ const ingresses = await this._globalStore.get("ingresses", {
9700
+ resourceBasePath: "/apis/networking.k8s.io/v1",
9701
+ kind: "Ingress"
9702
+ });
9703
+ const myIngresses = ingresses.items.filter((ingress) => {
9704
+ const rules = ingress.getFlattenedRules([]);
9705
+ return rules.some(
9706
+ (rule2) => rule2.serviceName === this.name
9707
+ );
9708
+ });
9709
+ this.ingresses = myIngresses;
9710
+ }
9616
9711
  get displayType() {
9617
9712
  const spec = this._rawYaml.spec;
9618
9713
  const type2 = spec.type;
@@ -10975,278 +11070,14 @@ function KeyValueAnnotation(props) {
10975
11070
  }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
10976
11071
  value: ""
10977
11072
  })
10978
- }), isExpand ? /* @__PURE__ */ jsxRuntimeExports.jsx(KeyValue, {
10979
- data: data2
10980
- }) : null]
10981
- });
10982
- }
10983
- function Tabs(props) {
10984
- const { tabs, className } = props;
10985
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Tabs$1, { className, children: tabs.map((tab) => {
10986
- return /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTabPane, { tab: tab.title, children: tab.children }, tab.title);
10987
- }) });
10988
- }
10989
- const StateTag = (props) => {
10990
- const {
10991
- state: state2 = ResourceState.UPDATING,
10992
- hideBackground,
10993
- className,
10994
- customResourceStateMap
10995
- } = props;
10996
- const { t: t2 } = useTranslation();
10997
- const defaultStateMap = {
10998
- [ResourceState.UPDATING]: "loading",
10999
- [ResourceState.READY]: "green",
11000
- [ResourceState.COMPLETED]: "gray",
11001
- [ResourceState.FAILED]: "red",
11002
- [ResourceState.SUSPENDED]: "warning",
11003
- [ResourceState.RUNNING]: "green",
11004
- [ResourceState.SUCCEEDED]: "blue",
11005
- [ResourceState.UNKNOWN]: "gray",
11006
- [ResourceState.TERMINATING]: "loading",
11007
- [ResourceState.PENDING]: "warning",
11008
- [ResourceState.WAITING]: "warning",
11009
- [ResourceState.TERMINATED]: "gray",
11010
- [ResourceState.STOPPED]: "gray",
11011
- [ResourceState.AVAILABLE]: "blue",
11012
- [ResourceState.BOUND]: "green",
11013
- [ResourceState.RELEASED]: "gray",
11014
- [ResourceState.LOST]: "red",
11015
- [ResourceState.ACTIVE]: "green",
11016
- [ResourceState.DELETING]: "loading"
11017
- };
11018
- const finalColorMap = (customResourceStateMap == null ? void 0 : customResourceStateMap.color) || defaultStateMap;
11019
- const finalTextMap = customResourceStateMap == null ? void 0 : customResourceStateMap.text;
11020
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
11021
- StatusCapsule,
11022
- {
11023
- className: cx_default(className, StateTagStyle, hideBackground && "no-background"),
11024
- color: finalColorMap[state2] !== "loading" ? finalColorMap[state2] : void 0,
11025
- loading: finalColorMap[state2] === "loading",
11026
- children: finalTextMap ? finalTextMap[state2] : t2(`dovetail.${state2 || "updating"}_state`)
11027
- }
11028
- );
11029
- };
11030
- const ShowContent_1g0ejph = "";
11031
- const ShowContentWrapperStyle = "s9agep2";
11032
- const BackButton = "bo89gfi";
11033
- const ToolBarWrapper = "t1ohe42f";
11034
- const NameStyle = "nqm4qz0";
11035
- const TopBarStyle = "ticl0qc";
11036
- const ShowContentHeaderStyle = "so9uwk1";
11037
- const GroupStyle$1 = "ge26ou0";
11038
- const GroupTitleStyle = "g17f8vl9";
11039
- const FullTabContentStyle = "fykgn2i";
11040
- const FieldWrapperStyle = "fngr745";
11041
- const TabContentStyle = "t11wg61l";
11042
- const ValueStyle$1 = "v1x3rivf";
11043
- const TabsStyle = "tf5s6s";
11044
- function ShowGroupComponent(props) {
11045
- const {
11046
- title,
11047
- className,
11048
- children,
11049
- operationEle
11050
- } = props;
11051
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
11052
- className: cx_default(GroupStyle$1, className),
11053
- children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
11054
- className: cx_default(Typo.Heading.h2_bold_title, GroupTitleStyle),
11055
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
11056
- children: title
11057
- }), operationEle]
11058
- }), children]
11059
- });
11060
- }
11061
- const ShowContent = (props) => {
11062
- var _a, _b, _c, _d, _e, _f;
11063
- const {
11064
- showConfig,
11065
- formatter,
11066
- Dropdown: Dropdown2 = K8sDropdown
11067
- } = props;
11068
- const parsed = useParsed();
11069
- const {
11070
- resource
11071
- } = useResource();
11072
- const id = (_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a.id;
11073
- const {
11074
- queryResult
11075
- } = useShow({
11076
- id,
11077
- errorNotification: false
11078
- });
11079
- const {
11080
- t: t2
11081
- } = useTranslation();
11082
- const {
11083
- data: data2
11084
- } = queryResult;
11085
- const navigation = useNavigation();
11086
- const go = useGo();
11087
- const openForm = useOpenForm();
11088
- const Component = useContext(ComponentContext);
11089
- const configs = useContext(ConfigsContext);
11090
- const config = configs[(resource == null ? void 0 : resource.name) || ""];
11091
- const Tabs$12 = Component.Tabs || Tabs;
11092
- if (!(data2 == null ? void 0 : data2.data)) {
11093
- return null;
11094
- }
11095
- const model = data2.data;
11096
- const record = formatter ? formatter(model) : data2 == null ? void 0 : data2.data;
11097
- function renderFields(fields, areaType, hasCol = true) {
11098
- if (!record)
11099
- return null;
11100
- return fields.map((field) => {
11101
- if (field.hidden)
11102
- return null;
11103
- let content;
11104
- const value2 = get$2(record, field.path);
11105
- if (field.renderContent) {
11106
- content = field.renderContent(value2, record, field);
11107
- } else {
11108
- content = get$2(record, field.path);
11109
- }
11110
- return hasCol ? /* @__PURE__ */ jsxRuntimeExports.jsx(Col, {
11111
- flex: areaType === AreaType.Inline ? "none" : "",
11112
- span: field.col || 24,
11113
- children: field.render ? field.render(value2, record, field) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
11114
- className: FieldWrapperStyle,
11115
- children: [field.title && /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
11116
- className: Typo.Label.l4_regular_title,
11117
- style: {
11118
- width: field.labelWidth || "165px",
11119
- marginRight: 8,
11120
- flexShrink: 0,
11121
- color: "#2C385299"
11122
- },
11123
- children: field.title
11124
- }), /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
11125
- style: {
11126
- flex: 1,
11127
- minWidth: 0
11128
- },
11129
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
11130
- className: cx_default(Typo.Label.l4_regular_title, ValueStyle$1),
11131
- value: content,
11132
- useOverflow: false
11133
- })
11134
- })]
11135
- })
11136
- }, field.key) : /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
11137
- style: {
11138
- height: "100%"
11139
- },
11140
- value: content,
11141
- useOverflow: false
11142
- });
11143
- });
11144
- }
11145
- const stateDisplay = get$2(record, "stateDisplay");
11146
- const topBar = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
11147
- className: ToolBarWrapper,
11148
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
11149
- className: cx_default(Typo.Label.l4_bold, BackButton),
11150
- onClick: () => {
11151
- go({
11152
- to: navigation.listUrl((resource == null ? void 0 : resource.name) || "")
11153
- });
11154
- },
11155
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, {
11156
- src: ArrowChevronLeft16BoldTertiaryIcon,
11157
- hoverSrc: ArrowChevronLeftSmall16BoldBlueIcon,
11158
- style: {
11159
- marginRight: 4
11160
- },
11161
- children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
11162
- className: "button-text",
11163
- children: (config == null ? void 0 : config.displayName) || ((_b = resource == null ? void 0 : resource.meta) == null ? void 0 : _b.kind)
11164
- })
11165
- })
11166
- }), /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
11167
- className: TopBarStyle,
11168
- children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
11169
- style: {
11170
- display: "flex"
11171
- },
11172
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
11173
- className: cx_default(Typo.Display.d2_regular_title, NameStyle),
11174
- children: ((_c = showConfig.displayName) == null ? void 0 : _c.call(showConfig, record)) || ((_d = record == null ? void 0 : record.metadata) == null ? void 0 : _d.name)
11175
- }), stateDisplay ? /* @__PURE__ */ jsxRuntimeExports.jsx(StateTag, {
11176
- state: stateDisplay,
11177
- customResourceStateMap: showConfig.resourceStateMap
11178
- }) : void 0]
11179
- }), /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
11180
- children: [(_e = showConfig.renderExtraButton) == null ? void 0 : _e.call(showConfig, record), !config.hideEdit ? /* @__PURE__ */ jsxRuntimeExports.jsx(CanAccess, {
11181
- resource: resource == null ? void 0 : resource.name,
11182
- action: AccessControlAuth.Edit,
11183
- params: {
11184
- namespace: record.namespace
11185
- },
11186
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
11187
- style: {
11188
- marginRight: 8
11189
- },
11190
- onClick: () => openForm({
11191
- id
11192
- }),
11193
- children: ((_f = config.formConfig) == null ? void 0 : _f.formType) === FormType.FORM ? t2("dovetail.edit") : t2("dovetail.edit_yaml")
11194
- })
11195
- }) : null, /* @__PURE__ */ jsxRuntimeExports.jsx(Dropdown2, {
11196
- record,
11197
- size: "large"
11198
- })]
11199
- })]
11200
- })]
11201
- });
11202
- const tabs = /* @__PURE__ */ jsxRuntimeExports.jsx(Tabs$12, {
11203
- tabs: (showConfig.tabs || []).map((tab, tabIndex) => {
11204
- var _a2;
11205
- return {
11206
- title: tab.title,
11207
- key: tab.key,
11208
- children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
11209
- className: cx_default(TabContentStyle, tab.groups.length <= 1 && tabIndex !== 0 && FullTabContentStyle),
11210
- children: (_a2 = tab.groups) == null ? void 0 : _a2.map((group) => {
11211
- const GroupContainer = group.title ? ShowGroupComponent : React__default.Fragment;
11212
- const FieldContainer = group.title ? Row : React__default.Fragment;
11213
- const groupContainerProps = group.title ? {
11214
- title: group.title || ""
11215
- } : {};
11216
- const fieldContainerProps = group.title ? {
11217
- gutter: [24, 8]
11218
- } : {};
11219
- return /* @__PURE__ */ jsxRuntimeExports.jsx(GroupContainer, {
11220
- ...groupContainerProps,
11221
- children: group.areas.map((area, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
11222
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx(FieldContainer, {
11223
- ...fieldContainerProps,
11224
- children: renderFields(area.fields, area.type, !!group.title)
11225
- }, index2), index2 !== group.areas.length - 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, {
11226
- style: {
11227
- margin: "8px 0 12px 0"
11228
- }
11229
- }) : null]
11230
- }))
11231
- }, group.title);
11232
- })
11233
- })
11234
- };
11235
- }),
11236
- className: TabsStyle
11237
- });
11238
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
11239
- className: ShowContentWrapperStyle,
11240
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx(Space, {
11241
- direction: "vertical",
11242
- className: ShowContentHeaderStyle,
11243
- children: topBar
11244
- }), tabs]
11073
+ }), isExpand ? /* @__PURE__ */ jsxRuntimeExports.jsx(KeyValue, {
11074
+ data: data2
11075
+ }) : null]
11245
11076
  });
11246
- };
11077
+ }
11247
11078
  const KeyValueSecret_c3ji18 = "";
11248
11079
  const ButtonStyle = "b11tbgf7";
11249
- const GroupStyle = "gtbyh5g";
11080
+ const GroupStyle$1 = "gtbyh5g";
11250
11081
  function KeyValueSecret(props) {
11251
11082
  const {
11252
11083
  data: data2 = {}
@@ -11268,7 +11099,7 @@ function KeyValueSecret(props) {
11268
11099
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ShowGroupComponent, {
11269
11100
  title: i18n2.t("dovetail.data"),
11270
11101
  operationEle: toggleButton,
11271
- className: GroupStyle,
11102
+ className: GroupStyle$1,
11272
11103
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(KeyValue, {
11273
11104
  data: data2,
11274
11105
  hideSecret,
@@ -11859,6 +11690,47 @@ function ResourceTable(props) {
11859
11690
  }
11860
11691
  );
11861
11692
  }
11693
+ const StateTag = (props) => {
11694
+ const {
11695
+ state: state2 = ResourceState.UPDATING,
11696
+ hideBackground,
11697
+ className,
11698
+ customResourceStateMap
11699
+ } = props;
11700
+ const { t: t2 } = useTranslation();
11701
+ const defaultStateMap = {
11702
+ [ResourceState.UPDATING]: "loading",
11703
+ [ResourceState.READY]: "green",
11704
+ [ResourceState.COMPLETED]: "gray",
11705
+ [ResourceState.FAILED]: "red",
11706
+ [ResourceState.SUSPENDED]: "warning",
11707
+ [ResourceState.RUNNING]: "green",
11708
+ [ResourceState.SUCCEEDED]: "blue",
11709
+ [ResourceState.UNKNOWN]: "gray",
11710
+ [ResourceState.TERMINATING]: "loading",
11711
+ [ResourceState.PENDING]: "warning",
11712
+ [ResourceState.WAITING]: "warning",
11713
+ [ResourceState.TERMINATED]: "gray",
11714
+ [ResourceState.STOPPED]: "gray",
11715
+ [ResourceState.AVAILABLE]: "blue",
11716
+ [ResourceState.BOUND]: "green",
11717
+ [ResourceState.RELEASED]: "gray",
11718
+ [ResourceState.LOST]: "red",
11719
+ [ResourceState.ACTIVE]: "green",
11720
+ [ResourceState.DELETING]: "loading"
11721
+ };
11722
+ const finalColorMap = (customResourceStateMap == null ? void 0 : customResourceStateMap.color) || defaultStateMap;
11723
+ const finalTextMap = customResourceStateMap == null ? void 0 : customResourceStateMap.text;
11724
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
11725
+ StatusCapsule,
11726
+ {
11727
+ className: cx_default(className, StateTagStyle, hideBackground && "no-background"),
11728
+ color: finalColorMap[state2] !== "loading" ? finalColorMap[state2] : void 0,
11729
+ loading: finalColorMap[state2] === "loading",
11730
+ children: finalTextMap ? finalTextMap[state2] : t2(`dovetail.${state2 || "updating"}_state`)
11731
+ }
11732
+ );
11733
+ };
11862
11734
  const WorkloadPodsTable_975j2t = "";
11863
11735
  const WorkloadPodsTable = ({
11864
11736
  namespace: namespace2,
@@ -11940,7 +11812,7 @@ const ReadyValueStyle = "r1bm8olw";
11940
11812
  const ReplicasValueStyle = "r1oqudbh";
11941
11813
  const ContentWrapperStyle = "c18i6jtg";
11942
11814
  const LabelStyle = "lpm22il";
11943
- const ValueStyle = "v1ixr1me";
11815
+ const ValueStyle$1 = "v1ixr1me";
11944
11816
  const WorkloadReplicasForm = React__default.forwardRef(function WorkloadReplicasForm2(props, ref) {
11945
11817
  const {
11946
11818
  defaultValue,
@@ -12070,7 +11942,7 @@ function WorkloadReplicas({
12070
11942
  className: cx_default(LabelStyle, Typo.Label.l3_regular),
12071
11943
  children: record.kind === "Job" ? t2("dovetail.pod_complete_num") : t2("dovetail.pod_ready_num")
12072
11944
  }), /* @__PURE__ */ jsxRuntimeExports.jsx("td", {
12073
- className: cx_default(ValueStyle, Typo.Label.l3_regular),
11945
+ className: cx_default(ValueStyle$1, Typo.Label.l3_regular),
12074
11946
  children: readyReplicas
12075
11947
  })]
12076
11948
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs("tr", {
@@ -12078,7 +11950,7 @@ function WorkloadReplicas({
12078
11950
  className: cx_default(LabelStyle, Typo.Label.l3_regular),
12079
11951
  children: t2("dovetail.pod_replicas_num")
12080
11952
  }), /* @__PURE__ */ jsxRuntimeExports.jsx("td", {
12081
- className: cx_default(ValueStyle, Typo.Label.l3_regular),
11953
+ className: cx_default(ValueStyle$1, Typo.Label.l3_regular),
12082
11954
  children: replicas
12083
11955
  }), /* @__PURE__ */ jsxRuntimeExports.jsx("td", {
12084
11956
  children: editable && canScale && /* @__PURE__ */ jsxRuntimeExports.jsx(EditField, {
@@ -12109,6 +11981,7 @@ var AreaType = /* @__PURE__ */ ((AreaType2) => {
12109
11981
  const ImageField = (i18n2) => {
12110
11982
  return {
12111
11983
  key: "Image",
11984
+ col: 12,
12112
11985
  title: i18n2.t("dovetail.image"),
12113
11986
  path: ["imageNames"],
12114
11987
  renderContent(value2) {
@@ -12215,6 +12088,7 @@ const SecretDataField = () => {
12215
12088
  const StartTimeField = (i18n2) => {
12216
12089
  return {
12217
12090
  key: "started",
12091
+ col: 12,
12218
12092
  title: i18n2.t("dovetail.started"),
12219
12093
  path: ["status", "startTime"],
12220
12094
  renderContent(value2) {
@@ -12225,6 +12099,7 @@ const StartTimeField = (i18n2) => {
12225
12099
  const ServiceTypeField = (i18n2) => {
12226
12100
  return {
12227
12101
  key: "type",
12102
+ col: 12,
12228
12103
  title: i18n2.t("dovetail.type"),
12229
12104
  path: ["displayType"]
12230
12105
  };
@@ -12232,6 +12107,7 @@ const ServiceTypeField = (i18n2) => {
12232
12107
  const ClusterIpField = (i18n2) => {
12233
12108
  return {
12234
12109
  key: "clusterIp",
12110
+ col: 12,
12235
12111
  title: i18n2.t("dovetail.clusterIp"),
12236
12112
  path: ["spec", "clusterIP"]
12237
12113
  };
@@ -12239,6 +12115,7 @@ const ClusterIpField = (i18n2) => {
12239
12115
  const SessionAffinityField = (i18n2) => {
12240
12116
  return {
12241
12117
  key: "clusterIp",
12118
+ col: 12,
12242
12119
  title: i18n2.t("dovetail.sessionAffinity"),
12243
12120
  path: ["spec", "sessionAffinity"]
12244
12121
  };
@@ -12283,11 +12160,13 @@ const EventsTableTabField = () => {
12283
12160
  };
12284
12161
  const NamespaceField = (i18n2) => ({
12285
12162
  key: "NameSpace",
12163
+ col: 12,
12286
12164
  title: i18n2.t("dovetail.namespace"),
12287
12165
  path: ["metadata", "namespace"]
12288
12166
  });
12289
12167
  const AgeField = (i18n2) => ({
12290
12168
  key: "Age",
12169
+ col: 12,
12291
12170
  title: i18n2.t("dovetail.created_time"),
12292
12171
  path: ["metadata", "creationTimestamp"],
12293
12172
  renderContent(value2) {
@@ -12315,6 +12194,7 @@ const AnnotationsField = (i18n2) => ({
12315
12194
  });
12316
12195
  const ServiceInnerClusterAccessField = () => ({
12317
12196
  key: "innerClusterAccess",
12197
+ col: 12,
12318
12198
  title: /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceInClusterAccessTitle, {}),
12319
12199
  path: [],
12320
12200
  renderContent: (_, record) => {
@@ -12323,6 +12203,7 @@ const ServiceInnerClusterAccessField = () => ({
12323
12203
  });
12324
12204
  const ServiceOutClusterAccessField = (clusterVip) => ({
12325
12205
  key: "innerClusterAccess",
12206
+ col: 12,
12326
12207
  title: /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceOutClusterAccessTitle, {}),
12327
12208
  path: [],
12328
12209
  renderContent: (_, record) => {
@@ -12355,6 +12236,7 @@ const PortsTableField = () => ({
12355
12236
  const DurationField = (i18n2) => {
12356
12237
  return {
12357
12238
  key: "duration",
12239
+ col: 12,
12358
12240
  path: ["duration"],
12359
12241
  title: i18n2.t("dovetail.duration"),
12360
12242
  renderContent: (v) => {
@@ -12365,6 +12247,7 @@ const DurationField = (i18n2) => {
12365
12247
  const StorageClassProvisionerField = (i18n2) => {
12366
12248
  return {
12367
12249
  key: "provisioner",
12250
+ col: 12,
12368
12251
  path: ["provisioner"],
12369
12252
  title: i18n2.t("dovetail.provisioner")
12370
12253
  };
@@ -12400,6 +12283,7 @@ const StorageClassPvField = () => {
12400
12283
  const PVCapacityField = (i18n2) => {
12401
12284
  return {
12402
12285
  key: "capacity",
12286
+ col: 12,
12403
12287
  path: ["spec", "capacity", "storage"],
12404
12288
  title: i18n2.t("dovetail.capacity"),
12405
12289
  renderContent(value2) {
@@ -12410,6 +12294,7 @@ const PVCapacityField = (i18n2) => {
12410
12294
  const PVCStorageField = (i18n2) => {
12411
12295
  return {
12412
12296
  key: "storage",
12297
+ col: 12,
12413
12298
  path: ["spec", "resources", "requests", "storage"],
12414
12299
  title: i18n2.t("dovetail.distributed"),
12415
12300
  renderContent(value2, pvc2) {
@@ -12420,6 +12305,7 @@ const PVCStorageField = (i18n2) => {
12420
12305
  const PVRefField = (i18n2) => {
12421
12306
  return {
12422
12307
  key: "pv",
12308
+ col: 12,
12423
12309
  path: ["pv"],
12424
12310
  title: i18n2.t("dovetail.pv"),
12425
12311
  renderContent(value2) {
@@ -12437,6 +12323,7 @@ const PVRefField = (i18n2) => {
12437
12323
  const PVStorageClassField = (i18n2) => {
12438
12324
  return {
12439
12325
  key: "storageClass",
12326
+ col: 12,
12440
12327
  path: ["spec", "storageClassName"],
12441
12328
  title: i18n2.t("dovetail.storage_class"),
12442
12329
  renderContent(value2) {
@@ -12447,6 +12334,7 @@ const PVStorageClassField = (i18n2) => {
12447
12334
  const PVPhaseField = (i18n2) => {
12448
12335
  return {
12449
12336
  key: "phase",
12337
+ col: 12,
12450
12338
  path: ["stateDisplay"],
12451
12339
  title: i18n2.t("dovetail.state"),
12452
12340
  renderContent(value2) {
@@ -12457,6 +12345,7 @@ const PVPhaseField = (i18n2) => {
12457
12345
  const PVVolumeModeField = (i18n2) => {
12458
12346
  return {
12459
12347
  key: "mode",
12348
+ col: 12,
12460
12349
  path: ["spec", "volumeMode"],
12461
12350
  title: i18n2.t("dovetail.volume_mode"),
12462
12351
  renderContent(value2) {
@@ -12467,6 +12356,7 @@ const PVVolumeModeField = (i18n2) => {
12467
12356
  const PVAccessModeField = (i18n2) => {
12468
12357
  return {
12469
12358
  key: "accessMode",
12359
+ col: 12,
12470
12360
  path: ["spec", "accessModes"],
12471
12361
  title: i18n2.t("dovetail.access_mode"),
12472
12362
  renderContent(value2) {
@@ -12502,6 +12392,7 @@ const PVCPodsField = () => {
12502
12392
  const PVCRefField = (i18n2) => {
12503
12393
  return {
12504
12394
  key: "pvc",
12395
+ col: 12,
12505
12396
  path: ["pvc"],
12506
12397
  title: i18n2.t("dovetail.pvc"),
12507
12398
  renderContent(value2, pv2) {
@@ -12520,6 +12411,7 @@ const PVCRefField = (i18n2) => {
12520
12411
  const PVCSIRefField = (i18n2) => {
12521
12412
  return {
12522
12413
  key: "csi",
12414
+ col: 12,
12523
12415
  path: ["csi"],
12524
12416
  title: i18n2.t("dovetail.csi")
12525
12417
  };
@@ -12527,6 +12419,7 @@ const PVCSIRefField = (i18n2) => {
12527
12419
  const IsDefaultSCField = (i18n2) => {
12528
12420
  return {
12529
12421
  key: "isDefaultSC",
12422
+ col: 12,
12530
12423
  path: ["isDefaultSC"],
12531
12424
  title: i18n2.t("dovetail.default_sc"),
12532
12425
  renderContent(val) {
@@ -12537,6 +12430,7 @@ const IsDefaultSCField = (i18n2) => {
12537
12430
  const SCReclaimPolicyField = (i18n2) => {
12538
12431
  return {
12539
12432
  key: "reclaimPolicy",
12433
+ col: 12,
12540
12434
  path: ["reclaimPolicy"],
12541
12435
  title: i18n2.t("dovetail.reclaim_policy"),
12542
12436
  renderContent(val) {
@@ -12551,6 +12445,7 @@ const SCReclaimPolicyField = (i18n2) => {
12551
12445
  const IsSCAllowVolumeExpansionField = (i18n2) => {
12552
12446
  return {
12553
12447
  key: "allowVolumeExpansion",
12448
+ col: 12,
12554
12449
  path: ["allowVolumeExpansion"],
12555
12450
  title: i18n2.t("dovetail.allow_expand"),
12556
12451
  renderContent(val) {
@@ -12798,7 +12693,7 @@ const PodLogTab = (i18n2) => ({
12798
12693
  ]
12799
12694
  });
12800
12695
  const NetworkPolicyRulesViewer_r6jity = "";
12801
- const MonacoYamlEditor$1 = lazy(() => import("./MonacoYamlEditor-5e4c98ce.js"));
12696
+ const MonacoYamlEditor$1 = lazy(() => import("./MonacoYamlEditor-d09e7de9.js"));
12802
12697
  const EditorStyle$1 = "e1cjl2b8";
12803
12698
  const NetworkPolicyRulesViewer = ({
12804
12699
  ingressOrEgress,
@@ -13136,6 +13031,248 @@ const ResourceTableGroup = (resource, title) => ({
13136
13031
  }
13137
13032
  ]
13138
13033
  });
13034
+ function Tabs(props) {
13035
+ const { tabs, className } = props;
13036
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Tabs$1, { className, children: tabs.map((tab) => {
13037
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTabPane, { tab: tab.title, children: tab.children }, tab.title);
13038
+ }) });
13039
+ }
13040
+ const ShowContentView_1mvcyif = "";
13041
+ const ShowContentWrapperStyle = "soapvs9";
13042
+ const BackButton = "b13d603q";
13043
+ const ToolBarWrapper = "tm8eaia";
13044
+ const NameStyle = "nhnus27";
13045
+ const TopBarStyle = "t16t20f5";
13046
+ const ShowContentHeaderStyle = "s97y2wr";
13047
+ const GroupStyle = "g1rhnxqx";
13048
+ const GroupTitleStyle = "g1f1s2pc";
13049
+ const FullTabContentStyle = "f1qw3bxx";
13050
+ const FieldWrapperStyle = "flfewds";
13051
+ const TabContentStyle = "t1c7cta8";
13052
+ const ValueStyle = "v1pt61xk";
13053
+ const TabsStyle = "t1to6fie";
13054
+ function ShowGroupComponent(props) {
13055
+ const {
13056
+ title,
13057
+ className,
13058
+ children,
13059
+ operationEle
13060
+ } = props;
13061
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
13062
+ className: cx_default(GroupStyle, className),
13063
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
13064
+ className: cx_default(Typo.Heading.h2_bold_title, GroupTitleStyle),
13065
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
13066
+ children: title
13067
+ }), operationEle]
13068
+ }), children]
13069
+ });
13070
+ }
13071
+ const ShowContentView = (props) => {
13072
+ var _a, _b, _c, _d;
13073
+ const {
13074
+ id,
13075
+ resourceName,
13076
+ showConfig,
13077
+ formatter,
13078
+ Dropdown: Dropdown2 = K8sDropdown,
13079
+ hideBackButton = false
13080
+ } = props;
13081
+ const {
13082
+ queryResult
13083
+ } = useShow({
13084
+ id,
13085
+ resource: resourceName,
13086
+ errorNotification: false
13087
+ });
13088
+ const {
13089
+ t: t2
13090
+ } = useTranslation();
13091
+ const {
13092
+ data: data2
13093
+ } = queryResult;
13094
+ const navigation = useNavigation();
13095
+ const go = useGo();
13096
+ const openForm = useOpenForm();
13097
+ const Component = useContext(ComponentContext);
13098
+ const configs = useContext(ConfigsContext);
13099
+ const config = configs[resourceName];
13100
+ const Tabs$12 = Component.Tabs || Tabs;
13101
+ if (!(data2 == null ? void 0 : data2.data)) {
13102
+ return null;
13103
+ }
13104
+ const model = data2.data;
13105
+ const record = formatter ? formatter(model) : data2 == null ? void 0 : data2.data;
13106
+ function renderFields(fields, areaType, hasCol = true) {
13107
+ if (!record)
13108
+ return null;
13109
+ return fields.map((field) => {
13110
+ if (field.hidden)
13111
+ return null;
13112
+ let content;
13113
+ const value2 = get$2(record, field.path);
13114
+ if (field.renderContent) {
13115
+ content = field.renderContent(value2, record, field);
13116
+ } else {
13117
+ content = get$2(record, field.path);
13118
+ }
13119
+ return hasCol ? /* @__PURE__ */ jsxRuntimeExports.jsx(Col, {
13120
+ flex: areaType === AreaType.Inline ? "none" : "",
13121
+ span: field.col || 24,
13122
+ className: "cca5959",
13123
+ children: field.render ? field.render(value2, record, field) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
13124
+ className: FieldWrapperStyle,
13125
+ children: [field.title && /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
13126
+ className: Typo.Label.l4_regular_title,
13127
+ style: {
13128
+ width: field.labelWidth || "165px",
13129
+ marginRight: 8,
13130
+ flexShrink: 0,
13131
+ color: "#2C385299"
13132
+ },
13133
+ children: field.title
13134
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
13135
+ style: {
13136
+ flex: 1,
13137
+ minWidth: 0
13138
+ },
13139
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
13140
+ className: cx_default(Typo.Label.l4_regular_title, ValueStyle),
13141
+ value: content,
13142
+ useOverflow: false
13143
+ })
13144
+ })]
13145
+ })
13146
+ }, field.key) : /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
13147
+ style: {
13148
+ height: "100%"
13149
+ },
13150
+ value: content,
13151
+ useOverflow: false
13152
+ });
13153
+ });
13154
+ }
13155
+ function renderGroup(group) {
13156
+ const GroupContainer = group.title ? ShowGroupComponent : React__default.Fragment;
13157
+ const FieldContainer = group.title ? Row : React__default.Fragment;
13158
+ const groupContainerProps = group.title ? {
13159
+ title: group.title || ""
13160
+ } : {};
13161
+ const fieldContainerProps = group.title ? {
13162
+ gutter: [24, 8]
13163
+ } : {};
13164
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(GroupContainer, {
13165
+ ...groupContainerProps,
13166
+ children: group.areas.map((area, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
13167
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx(FieldContainer, {
13168
+ ...fieldContainerProps,
13169
+ children: renderFields(area.fields, area.type, !!group.title)
13170
+ }, index2), index2 !== group.areas.length - 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, {
13171
+ style: {
13172
+ margin: "8px 0 12px 0"
13173
+ }
13174
+ }) : null]
13175
+ }))
13176
+ }, group.title);
13177
+ }
13178
+ const stateDisplay = get$2(record, "stateDisplay");
13179
+ const topBar = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
13180
+ className: ToolBarWrapper,
13181
+ children: [!hideBackButton && /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
13182
+ className: cx_default(Typo.Label.l4_bold, BackButton),
13183
+ onClick: () => {
13184
+ go({
13185
+ to: navigation.listUrl(resourceName)
13186
+ });
13187
+ },
13188
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, {
13189
+ src: ArrowChevronLeft16BoldTertiaryIcon,
13190
+ hoverSrc: ArrowChevronLeftSmall16BoldBlueIcon,
13191
+ style: {
13192
+ marginRight: 4
13193
+ },
13194
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
13195
+ className: "button-text",
13196
+ children: (config == null ? void 0 : config.displayName) || resourceName
13197
+ })
13198
+ })
13199
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
13200
+ className: TopBarStyle,
13201
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
13202
+ style: {
13203
+ display: "flex"
13204
+ },
13205
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
13206
+ className: cx_default(Typo.Display.d2_regular_title, NameStyle),
13207
+ children: ((_a = showConfig.displayName) == null ? void 0 : _a.call(showConfig, record)) || ((_b = record == null ? void 0 : record.metadata) == null ? void 0 : _b.name)
13208
+ }), stateDisplay ? /* @__PURE__ */ jsxRuntimeExports.jsx(StateTag, {
13209
+ state: stateDisplay,
13210
+ customResourceStateMap: showConfig.resourceStateMap
13211
+ }) : void 0]
13212
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
13213
+ children: [(_c = showConfig.renderExtraButton) == null ? void 0 : _c.call(showConfig, record), !config.hideEdit ? /* @__PURE__ */ jsxRuntimeExports.jsx(CanAccess, {
13214
+ resource: resourceName,
13215
+ action: AccessControlAuth.Edit,
13216
+ params: {
13217
+ namespace: record.namespace
13218
+ },
13219
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
13220
+ style: {
13221
+ marginRight: 8
13222
+ },
13223
+ onClick: () => openForm({
13224
+ id
13225
+ }),
13226
+ children: ((_d = config.formConfig) == null ? void 0 : _d.formType) === FormType.FORM ? t2("dovetail.edit") : t2("dovetail.edit_yaml")
13227
+ })
13228
+ }) : null, /* @__PURE__ */ jsxRuntimeExports.jsx(Dropdown2, {
13229
+ record,
13230
+ size: "large"
13231
+ })]
13232
+ })]
13233
+ })]
13234
+ });
13235
+ const tabs = /* @__PURE__ */ jsxRuntimeExports.jsx(Tabs$12, {
13236
+ tabs: (showConfig.tabs || []).map((tab, tabIndex) => {
13237
+ var _a2;
13238
+ return {
13239
+ title: tab.title,
13240
+ key: tab.key,
13241
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
13242
+ className: cx_default(TabContentStyle, tab.groups.length <= 1 && tabIndex !== 0 && FullTabContentStyle),
13243
+ children: (_a2 = tab.groups) == null ? void 0 : _a2.map(renderGroup)
13244
+ })
13245
+ };
13246
+ }),
13247
+ className: TabsStyle
13248
+ });
13249
+ const basicInfo = showConfig.basicGroup ? renderGroup(showConfig.basicGroup) : null;
13250
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
13251
+ className: ShowContentWrapperStyle,
13252
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx(Space, {
13253
+ direction: "vertical",
13254
+ className: ShowContentHeaderStyle,
13255
+ children: topBar
13256
+ }), basicInfo, tabs]
13257
+ });
13258
+ };
13259
+ const ShowContent = (props) => {
13260
+ var _a;
13261
+ const { showConfig, formatter, Dropdown: Dropdown2 = K8sDropdown } = props;
13262
+ const parsed = useParsed();
13263
+ const { resource } = useResource();
13264
+ const id = (_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a.id;
13265
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
13266
+ ShowContentView,
13267
+ {
13268
+ id,
13269
+ resourceName: (resource == null ? void 0 : resource.name) || "",
13270
+ showConfig,
13271
+ formatter,
13272
+ Dropdown: Dropdown2
13273
+ }
13274
+ );
13275
+ };
13139
13276
  const PageShow = (props) => {
13140
13277
  var _a;
13141
13278
  const parsed = useParsed();
@@ -16237,7 +16374,7 @@ const PlainCodeStyle = "pqch97v";
16237
16374
  const ErrorMsgStyle = "eh2qjnl";
16238
16375
  const ErrorWrapperStyle = "e19q2bnp";
16239
16376
  const YamlEditorStyle = "y16u5v3w";
16240
- const MonacoYamlEditor = React__default.lazy(() => import("./MonacoYamlEditor-5e4c98ce.js"));
16377
+ const MonacoYamlEditor = React__default.lazy(() => import("./MonacoYamlEditor-d09e7de9.js"));
16241
16378
  const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-7de94ad2.js"));
16242
16379
  const YamlEditorComponent = forwardRef(
16243
16380
  function YamlEditorComponent2(props, ref) {
@@ -16265,20 +16402,18 @@ const YamlEditorComponent = forwardRef(
16265
16402
  const editorInstance = useRef();
16266
16403
  const [copyTooltip, setCopyTooltip] = useState(t2("dovetail.copy"));
16267
16404
  const [resetTooltip, setResetTooltip] = useState(t2("dovetail.reset_arguments"));
16268
- useImperativeHandle(ref, () => {
16269
- return {
16270
- setValue: _setValue,
16271
- setEditorValue: (value22) => {
16272
- var _a, _b;
16273
- (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(value22);
16274
- },
16275
- getEditorValue: () => {
16276
- var _a;
16277
- return ((_a = editorInstance.current) == null ? void 0 : _a.getValue()) ?? "";
16278
- },
16279
- getEditorInstance: () => editorInstance.current || null
16280
- };
16281
- });
16405
+ const defaultValueString = useMemo(() => {
16406
+ if (typeof defaultValue === "string") {
16407
+ return defaultValue;
16408
+ }
16409
+ return yaml$2.dump(defaultValue);
16410
+ }, [defaultValue]);
16411
+ const _valueString = useMemo(() => {
16412
+ if (typeof _value === "string") {
16413
+ return _value;
16414
+ }
16415
+ return yaml$2.dump(_value);
16416
+ }, [_value]);
16282
16417
  const onChange = useCallback(
16283
16418
  (newVal) => {
16284
16419
  var _a;
@@ -16301,7 +16436,7 @@ const YamlEditorComponent = forwardRef(
16301
16436
  (editor) => {
16302
16437
  var _a, _b, _c;
16303
16438
  if (editor.getValue() !== _value) {
16304
- (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(_value);
16439
+ (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(_valueString);
16305
16440
  }
16306
16441
  (_c = props.onEditorCreate) == null ? void 0 : _c.call(props, editor);
16307
16442
  },
@@ -16310,13 +16445,29 @@ const YamlEditorComponent = forwardRef(
16310
16445
  const getInstance = useCallback((ins) => {
16311
16446
  editorInstance.current = ins;
16312
16447
  }, []);
16448
+ const getEditorValue = useCallback(() => {
16449
+ var _a;
16450
+ return ((_a = editorInstance.current) == null ? void 0 : _a.getValue()) ?? "";
16451
+ }, []);
16313
16452
  useEffect(() => {
16314
16453
  var _a, _b;
16315
- if (value2 !== void 0 && value2 !== _value) {
16454
+ if (value2 !== void 0 && !isEqual(value2, _value)) {
16455
+ const valueString = typeof value2 === "string" ? value2 : yaml$2.dump(value2);
16316
16456
  _setValue(value2);
16317
- (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(value2);
16457
+ (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(valueString);
16318
16458
  }
16319
16459
  }, [value2]);
16460
+ useImperativeHandle(ref, () => {
16461
+ return {
16462
+ setValue: _setValue,
16463
+ setEditorValue: (value22) => {
16464
+ var _a, _b;
16465
+ (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(value22);
16466
+ },
16467
+ getEditorValue,
16468
+ getEditorInstance: () => editorInstance.current || null
16469
+ };
16470
+ });
16320
16471
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
16321
16472
  "div",
16322
16473
  {
@@ -16370,7 +16521,7 @@ const YamlEditorComponent = forwardRef(
16370
16521
  iconHeight: 16,
16371
16522
  onClick: () => {
16372
16523
  if (!isCollapsed) {
16373
- copyToClipboard(_value);
16524
+ copyToClipboard(getEditorValue());
16374
16525
  setCopyTooltip(t2("dovetail.copied"));
16375
16526
  }
16376
16527
  }
@@ -16402,7 +16553,7 @@ const YamlEditorComponent = forwardRef(
16402
16553
  onClick: () => {
16403
16554
  var _a;
16404
16555
  if (!isCollapsed) {
16405
- (_a = editorInstance.current) == null ? void 0 : _a.setValue(defaultValue);
16556
+ (_a = editorInstance.current) == null ? void 0 : _a.setValue(defaultValueString);
16406
16557
  setResetTooltip(t2("dovetail.already_reset"));
16407
16558
  }
16408
16559
  }
@@ -16463,7 +16614,7 @@ const YamlEditorComponent = forwardRef(
16463
16614
  zIndex: 1
16464
16615
  },
16465
16616
  children: [
16466
- /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _value }), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { display: isDiff ? "none" : "block" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
16617
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _valueString }), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { display: isDiff ? "none" : "block" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
16467
16618
  MonacoYamlEditor,
16468
16619
  {
16469
16620
  id: props.id,
@@ -16479,12 +16630,12 @@ const YamlEditorComponent = forwardRef(
16479
16630
  isScrollOnFocus
16480
16631
  }
16481
16632
  ) }) }),
16482
- isDiff ? /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _value }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
16633
+ isDiff ? /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _valueString }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
16483
16634
  MonacoYamlDiffEditor,
16484
16635
  {
16485
16636
  id: props.id,
16486
- origin: defaultValue,
16487
- modified: _value,
16637
+ origin: defaultValueString,
16638
+ modified: _valueString,
16488
16639
  height
16489
16640
  }
16490
16641
  ) }) : null
@@ -18761,7 +18912,8 @@ class ModelPlugin {
18761
18912
  Node: NodeModel,
18762
18913
  StorageClass: StorageClassModel,
18763
18914
  PersistentVolume: PersistentVolumeModel,
18764
- PersistentVolumeClaim: PersistentVolumeClaimModel
18915
+ PersistentVolumeClaim: PersistentVolumeClaimModel,
18916
+ ReplicaSet: ReplicaSetModel
18765
18917
  })
18766
18918
  ));
18767
18919
  }
@@ -18982,7 +19134,7 @@ export {
18982
19134
  CronjobJobsTable as ay,
18983
19135
  KeyValue as az,
18984
19136
  useSchema as b,
18985
- Tags as b$,
19137
+ ServiceOutClusterAccessComponent as b$,
18986
19138
  PodSelectorField as b0,
18987
19139
  PortsTableField as b1,
18988
19140
  DurationField as b2,
@@ -18995,31 +19147,31 @@ export {
18995
19147
  PVPhaseField as b9,
18996
19148
  StorageClassPvGroup as bA,
18997
19149
  ResourceTableGroup as bB,
18998
- ShowGroupComponent as bC,
18999
- ShowContent as bD,
19000
- DeleteManyButton as bE,
19001
- ListPage as bF,
19002
- StateTag as bG,
19003
- DrawerShow as bH,
19004
- Menu as bI,
19005
- Table as bJ,
19006
- EditButton as bK,
19007
- ReferenceLink as bL,
19008
- ResourceLink as bM,
19009
- NS_STORE_KEY as bN,
19010
- ALL_NS as bO,
19011
- useNamespacesFilter as bP,
19012
- NamespacesFilter as bQ,
19013
- FormModal as bR,
19014
- renderCommonFormFiled as bS,
19015
- RefineFormContent as bT,
19016
- RefineFormPage as bU,
19017
- SchemaStrategy as bV,
19018
- YamlForm as bW,
19019
- useRefineForm as bX,
19020
- FormItemLayout as bY,
19021
- ServiceInClusterAccessComponent as bZ,
19022
- ServiceOutClusterAccessComponent as b_,
19150
+ ShowContent as bC,
19151
+ ShowGroupComponent as bD,
19152
+ ShowContentView as bE,
19153
+ DeleteManyButton as bF,
19154
+ ListPage as bG,
19155
+ StateTag as bH,
19156
+ DrawerShow as bI,
19157
+ Menu as bJ,
19158
+ Table as bK,
19159
+ EditButton as bL,
19160
+ ReferenceLink as bM,
19161
+ ResourceLink as bN,
19162
+ NS_STORE_KEY as bO,
19163
+ ALL_NS as bP,
19164
+ useNamespacesFilter as bQ,
19165
+ NamespacesFilter as bR,
19166
+ FormModal as bS,
19167
+ renderCommonFormFiled as bT,
19168
+ RefineFormContent as bU,
19169
+ RefineFormPage as bV,
19170
+ SchemaStrategy as bW,
19171
+ YamlForm as bX,
19172
+ useRefineForm as bY,
19173
+ FormItemLayout as bZ,
19174
+ ServiceInClusterAccessComponent as b_,
19023
19175
  PVVolumeModeField as ba,
19024
19176
  PVAccessModeField as bb,
19025
19177
  PVCPodsField as bc,
@@ -19047,91 +19199,93 @@ export {
19047
19199
  NetworkPolicyIngressRulesGroup as by,
19048
19200
  NetworkPolicyEgressRulesGroup as bz,
19049
19201
  useDeleteModal as c,
19050
- ServiceModel as c$,
19051
- TextTags as c0,
19052
- PodLog as c1,
19053
- NetworkPolicyRulesViewer as c2,
19054
- PVVolumeModeDisplay as c3,
19055
- Tabs as c4,
19056
- ResourceSelect as c5,
19057
- PodShellModal as c6,
19058
- PodShell as c7,
19059
- ResourceTable as c8,
19060
- ErrorWrapper as c9,
19061
- STORAGE_CLASS_INIT_VALUE as cA,
19062
- PV_INIT_VALUE as cB,
19063
- PVC_INIT_VALUE as cC,
19064
- ResourceState as cD,
19065
- AccessControlAuth as cE,
19066
- Dovetail as cF,
19067
- RESOURCE_GROUP as cG,
19068
- FormContainerType as cH,
19069
- FormType as cI,
19070
- FormMode as cJ,
19071
- ComponentContext as cK,
19072
- GlobalStoreContext as cL,
19073
- ConfigsContext as cM,
19074
- IngressModel as cN,
19075
- NetworkPolicyModel as cO,
19076
- JobModel as cP,
19077
- WorkloadModel as cQ,
19078
- WorkloadBaseModel as cR,
19079
- PodModel as cS,
19080
- PodMetricsModel as cT,
19081
- ResourceModel as cU,
19082
- CronJobModel as cV,
19083
- EventModel as cW,
19084
- DeploymentModel as cX,
19085
- DaemonSetModel as cY,
19086
- StatefulSetModel as cZ,
19087
- ServiceTypeEnum as c_,
19088
- ErrorContentType as ca,
19089
- KeyValueTableForm as cb,
19090
- BASE_INIT_VALUE as cc,
19091
- DEPLOYMENT_INIT_VALUE as cd,
19092
- CRONJOB_INIT_VALUE as ce,
19093
- DAEMONSET_INIT_VALUE as cf,
19094
- JOB_INIT_VALUE as cg,
19095
- STATEFULSET_INIT_VALUE as ch,
19096
- POD_INIT_VALUE as ci,
19097
- SERVICE_CLUSTER_IP_INIT_VALUE as cj,
19098
- SERVICE_NODE_PORT_INIT_VALUE as ck,
19099
- SERVICE_LOAD_BALANCER_INIT_VALUE as cl,
19100
- SERVICE_EXTERNAL_NAME_INIT_VALUE as cm,
19101
- SERVICE_HEADLESS_INIT_VALUE as cn,
19102
- INGRESS_INIT_VALUE as co,
19103
- NETWORK_POLICY_INIT_VALUE as cp,
19104
- CONFIG_MAP_INIT_VALUE as cq,
19105
- SERVER_INSTANCE_INIT_VALUE as cr,
19106
- REDEPLOY_TIMESTAMP_KEY as cs,
19107
- SECRET_OPAQUE_INIT_VALUE as ct,
19108
- SECRET_IMAGE_REPO_INIT_VALUE as cu,
19109
- SECRET_BASIC_AUTH_INIT_VALUE as cv,
19110
- SECRET_SSH_AUTH_INIT_VALUE as cw,
19111
- SECRET_TLS_INIT_VALUE as cx,
19112
- SECRET_CUSTOM_INIT_VALUE as cy,
19113
- NODE_INIT_VALUE as cz,
19202
+ StatefulSetModel as c$,
19203
+ Tags as c0,
19204
+ TextTags as c1,
19205
+ PodLog as c2,
19206
+ NetworkPolicyRulesViewer as c3,
19207
+ PVVolumeModeDisplay as c4,
19208
+ Tabs as c5,
19209
+ ResourceSelect as c6,
19210
+ PodShellModal as c7,
19211
+ PodShell as c8,
19212
+ ResourceTable as c9,
19213
+ NODE_INIT_VALUE as cA,
19214
+ STORAGE_CLASS_INIT_VALUE as cB,
19215
+ PV_INIT_VALUE as cC,
19216
+ PVC_INIT_VALUE as cD,
19217
+ ResourceState as cE,
19218
+ AccessControlAuth as cF,
19219
+ Dovetail as cG,
19220
+ RESOURCE_GROUP as cH,
19221
+ FormContainerType as cI,
19222
+ FormType as cJ,
19223
+ FormMode as cK,
19224
+ ComponentContext as cL,
19225
+ GlobalStoreContext as cM,
19226
+ ConfigsContext as cN,
19227
+ IngressModel as cO,
19228
+ NetworkPolicyModel as cP,
19229
+ JobModel as cQ,
19230
+ WorkloadModel as cR,
19231
+ WorkloadBaseModel as cS,
19232
+ PodModel as cT,
19233
+ PodMetricsModel as cU,
19234
+ ResourceModel as cV,
19235
+ ReplicaSetModel as cW,
19236
+ CronJobModel as cX,
19237
+ EventModel as cY,
19238
+ DeploymentModel as cZ,
19239
+ DaemonSetModel as c_,
19240
+ ErrorWrapper as ca,
19241
+ ErrorContentType as cb,
19242
+ KeyValueTableForm as cc,
19243
+ BASE_INIT_VALUE as cd,
19244
+ DEPLOYMENT_INIT_VALUE as ce,
19245
+ CRONJOB_INIT_VALUE as cf,
19246
+ DAEMONSET_INIT_VALUE as cg,
19247
+ JOB_INIT_VALUE as ch,
19248
+ STATEFULSET_INIT_VALUE as ci,
19249
+ POD_INIT_VALUE as cj,
19250
+ SERVICE_CLUSTER_IP_INIT_VALUE as ck,
19251
+ SERVICE_NODE_PORT_INIT_VALUE as cl,
19252
+ SERVICE_LOAD_BALANCER_INIT_VALUE as cm,
19253
+ SERVICE_EXTERNAL_NAME_INIT_VALUE as cn,
19254
+ SERVICE_HEADLESS_INIT_VALUE as co,
19255
+ INGRESS_INIT_VALUE as cp,
19256
+ NETWORK_POLICY_INIT_VALUE as cq,
19257
+ CONFIG_MAP_INIT_VALUE as cr,
19258
+ SERVER_INSTANCE_INIT_VALUE as cs,
19259
+ REDEPLOY_TIMESTAMP_KEY as ct,
19260
+ SECRET_OPAQUE_INIT_VALUE as cu,
19261
+ SECRET_IMAGE_REPO_INIT_VALUE as cv,
19262
+ SECRET_BASIC_AUTH_INIT_VALUE as cw,
19263
+ SECRET_SSH_AUTH_INIT_VALUE as cx,
19264
+ SECRET_TLS_INIT_VALUE as cy,
19265
+ SECRET_CUSTOM_INIT_VALUE as cz,
19114
19266
  dovetailRefineI18n as d,
19115
- NodeRole as d0,
19116
- NodeModel as d1,
19117
- StorageClassModel as d2,
19118
- PersistentVolumeModel as d3,
19119
- PersistentVolumeClaimModel as d4,
19120
- ProviderPlugins as d5,
19121
- ModelPlugin as d6,
19122
- modelPlugin as d7,
19123
- RelationPlugin as d8,
19124
- relationPlugin as d9,
19125
- generateValueFromSchema as da,
19126
- generateSchemaTypeValue as db,
19127
- resolveRef as dc,
19128
- getApiVersion as dd,
19129
- pruneBeforeEdit as de,
19130
- matchSelector as df,
19131
- getResourceNameByKind as dg,
19132
- validateDnsSubdomain as dh,
19133
- validateLabelKey as di,
19134
- validateLabelValue as dj,
19267
+ ServiceTypeEnum as d0,
19268
+ ServiceModel as d1,
19269
+ NodeRole as d2,
19270
+ NodeModel as d3,
19271
+ StorageClassModel as d4,
19272
+ PersistentVolumeModel as d5,
19273
+ PersistentVolumeClaimModel as d6,
19274
+ ProviderPlugins as d7,
19275
+ ModelPlugin as d8,
19276
+ modelPlugin as d9,
19277
+ RelationPlugin as da,
19278
+ relationPlugin as db,
19279
+ generateValueFromSchema as dc,
19280
+ generateSchemaTypeValue as dd,
19281
+ resolveRef as de,
19282
+ getApiVersion as df,
19283
+ pruneBeforeEdit as dg,
19284
+ matchSelector as dh,
19285
+ getResourceNameByKind as di,
19286
+ validateDnsSubdomain as dj,
19287
+ validateLabelKey as dk,
19288
+ validateLabelValue as dl,
19135
19289
  useDeleteModalOnly as e,
19136
19290
  useFailedModal as f,
19137
19291
  NameSpaceColumnRenderer as g,