@dovetail-v2/refine 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1181,6 +1181,8 @@ const cant_delete_resource = "无法删除{{resource}}";
1181
1181
  const cant_delete_resource_with_name = "无法删除{{resource}} <0>{{name}}</0> 。";
1182
1182
  const close = "关闭";
1183
1183
  const import_from_file = "从文件读取";
1184
+ const view_all_info = "查看全部信息";
1185
+ const collapse = "收起";
1184
1186
  const dovetail = {
1185
1187
  copy,
1186
1188
  reset_arguments,
@@ -1423,7 +1425,9 @@ const dovetail = {
1423
1425
  cant_delete_resource,
1424
1426
  cant_delete_resource_with_name,
1425
1427
  close,
1426
- import_from_file
1428
+ import_from_file,
1429
+ view_all_info,
1430
+ collapse
1427
1431
  };
1428
1432
  const ZH = {
1429
1433
  dovetail
@@ -9271,7 +9275,7 @@ var ResourceState = /* @__PURE__ */ ((ResourceState2) => {
9271
9275
  return ResourceState2;
9272
9276
  })(ResourceState || {});
9273
9277
  function matchSelector(pod2, selector, namespace2 = "default") {
9274
- var _a, _b, _c;
9278
+ var _a, _b, _c, _d;
9275
9279
  let match = true;
9276
9280
  if (selector) {
9277
9281
  for (const key2 in selector.matchLabels) {
@@ -9280,7 +9284,7 @@ function matchSelector(pod2, selector, namespace2 = "default") {
9280
9284
  }
9281
9285
  }
9282
9286
  }
9283
- return match && pod2.metadata.namespace === namespace2;
9287
+ return match && ((_d = pod2.metadata) == null ? void 0 : _d.namespace) === namespace2;
9284
9288
  }
9285
9289
  class WorkloadBaseModel extends ResourceModel {
9286
9290
  constructor(_rawYaml, _globalStore) {
@@ -9370,10 +9374,14 @@ class WorkloadModel extends WorkloadBaseModel {
9370
9374
  constructor(_rawYaml, _globalStore) {
9371
9375
  super(_rawYaml, _globalStore);
9372
9376
  __publicField(this, "restarts", 0);
9377
+ __publicField(this, "services", []);
9378
+ __publicField(this, "ingresses", []);
9373
9379
  this._rawYaml = _rawYaml;
9374
9380
  }
9375
9381
  async init() {
9376
9382
  await this.getRestarts();
9383
+ await this.getServices();
9384
+ await this.getIngresses();
9377
9385
  }
9378
9386
  async getRestarts() {
9379
9387
  const pods = await this._globalStore.get("pods", {
@@ -9389,6 +9397,29 @@ class WorkloadModel extends WorkloadBaseModel {
9389
9397
  const result = lodashExports.sumBy(myPods, "restarts");
9390
9398
  this.restarts = result;
9391
9399
  }
9400
+ async getServices() {
9401
+ const services = await this._globalStore.get("services", {
9402
+ resourceBasePath: "/api/v1",
9403
+ kind: "Service"
9404
+ });
9405
+ const myServices = services.items.filter(
9406
+ (p) => {
9407
+ var _a;
9408
+ return matchSelector(p, (_a = this.spec) == null ? void 0 : _a.selector, this.metadata.namespace);
9409
+ }
9410
+ );
9411
+ this.services = myServices;
9412
+ }
9413
+ async getIngresses() {
9414
+ const allIngresses = /* @__PURE__ */ new Map();
9415
+ for (const service of this.services) {
9416
+ for (const ingress of service.ingresses) {
9417
+ const key2 = `${ingress.namespace}-${ingress.name}`;
9418
+ allIngresses.set(key2, ingress);
9419
+ }
9420
+ }
9421
+ this.ingresses = Array.from(allIngresses.values());
9422
+ }
9392
9423
  get replicas() {
9393
9424
  return this.spec && "replicas" in this.spec ? this.spec.replicas : 0;
9394
9425
  }
@@ -9529,6 +9560,38 @@ class PodMetricsModel extends ResourceModel {
9529
9560
  };
9530
9561
  }
9531
9562
  }
9563
+ class ReplicaSetModel extends ResourceModel {
9564
+ constructor(_rawYaml, _globalStore) {
9565
+ super(_rawYaml, _globalStore);
9566
+ __publicField(this, "pods", []);
9567
+ __publicField(this, "restarts", 0);
9568
+ this._rawYaml = _rawYaml;
9569
+ }
9570
+ async init() {
9571
+ await this.getPods();
9572
+ }
9573
+ async getPods() {
9574
+ const pods = await this._globalStore.get("pods", {
9575
+ resourceBasePath: "/api/v1",
9576
+ kind: "Pod"
9577
+ });
9578
+ const myPods = pods.items.filter(
9579
+ (pod2) => {
9580
+ var _a;
9581
+ return matchSelector(pod2, (_a = this.spec) == null ? void 0 : _a.selector, this.metadata.namespace);
9582
+ }
9583
+ );
9584
+ this.pods = myPods;
9585
+ this.restarts = lodashExports.sumBy(this.pods, (pod2) => pod2.restarts || 0);
9586
+ }
9587
+ get ownerDeploymentName() {
9588
+ var _a;
9589
+ const ownerRef = (_a = this.metadata.ownerReferences) == null ? void 0 : _a.find(
9590
+ (ref) => ref.kind === "Deployment" && ref.apiVersion === "apps/v1"
9591
+ );
9592
+ return ownerRef == null ? void 0 : ownerRef.name;
9593
+ }
9594
+ }
9532
9595
  class CronJobModel extends WorkloadBaseModel {
9533
9596
  constructor(_rawYaml, _globalStore) {
9534
9597
  super(_rawYaml, _globalStore);
@@ -9571,8 +9634,27 @@ class EventModel extends ResourceModel {
9571
9634
  class DeploymentModel extends WorkloadModel {
9572
9635
  constructor(_rawYaml, _globalStore) {
9573
9636
  super(_rawYaml, _globalStore);
9637
+ __publicField(this, "replicaSets", []);
9574
9638
  this._rawYaml = _rawYaml;
9575
9639
  }
9640
+ async init() {
9641
+ await super.init();
9642
+ await this.getReplicaSets();
9643
+ }
9644
+ async getReplicaSets() {
9645
+ const replicaSets = await this._globalStore.get("replicasets", {
9646
+ resourceBasePath: "/apis/apps/v1",
9647
+ kind: "ReplicaSet"
9648
+ });
9649
+ const myReplicaSets = replicaSets.items.filter((rs) => {
9650
+ var _a, _b, _c;
9651
+ const ownerRef = (_b = (_a = rs.metadata) == null ? void 0 : _a.ownerReferences) == null ? void 0 : _b.find(
9652
+ (ref) => ref.kind === "Deployment" && ref.apiVersion === "apps/v1" && ref.name === this.name && ref.uid === this.metadata.uid
9653
+ );
9654
+ return !!ownerRef && ((_c = rs.metadata) == null ? void 0 : _c.namespace) === this.metadata.namespace;
9655
+ });
9656
+ this.replicaSets = myReplicaSets;
9657
+ }
9576
9658
  get stateDisplay() {
9577
9659
  var _a, _b, _c;
9578
9660
  if (((_a = this.spec) == null ? void 0 : _a.replicas) === 0) {
@@ -9628,8 +9710,25 @@ var ServiceTypeEnum = /* @__PURE__ */ ((ServiceTypeEnum2) => {
9628
9710
  class ServiceModel extends ResourceModel {
9629
9711
  constructor(_rawYaml, _globalStore) {
9630
9712
  super(_rawYaml, _globalStore);
9713
+ __publicField(this, "ingresses", []);
9631
9714
  this._rawYaml = _rawYaml;
9632
9715
  }
9716
+ async init() {
9717
+ await this.getIngresses();
9718
+ }
9719
+ async getIngresses() {
9720
+ const ingresses = await this._globalStore.get("ingresses", {
9721
+ resourceBasePath: "/apis/networking.k8s.io/v1",
9722
+ kind: "Ingress"
9723
+ });
9724
+ const myIngresses = ingresses.items.filter((ingress) => {
9725
+ const rules = ingress.getFlattenedRules([]);
9726
+ return rules.some(
9727
+ (rule2) => rule2.serviceName === this.name
9728
+ );
9729
+ });
9730
+ this.ingresses = myIngresses;
9731
+ }
9633
9732
  get displayType() {
9634
9733
  const spec = this._rawYaml.spec;
9635
9734
  const type2 = spec.type;
@@ -10997,273 +11096,9 @@ function KeyValueAnnotation(props) {
10997
11096
  }) : null]
10998
11097
  });
10999
11098
  }
11000
- function Tabs(props) {
11001
- const { tabs, className } = props;
11002
- return /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Tabs, { className, children: tabs.map((tab) => {
11003
- return /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.TabsTabPane, { tab: tab.title, children: tab.children }, tab.title);
11004
- }) });
11005
- }
11006
- const StateTag = (props) => {
11007
- const {
11008
- state: state2 = ResourceState.UPDATING,
11009
- hideBackground,
11010
- className,
11011
- customResourceStateMap
11012
- } = props;
11013
- const { t: t2 } = common.useTranslation();
11014
- const defaultStateMap = {
11015
- [ResourceState.UPDATING]: "loading",
11016
- [ResourceState.READY]: "green",
11017
- [ResourceState.COMPLETED]: "gray",
11018
- [ResourceState.FAILED]: "red",
11019
- [ResourceState.SUSPENDED]: "warning",
11020
- [ResourceState.RUNNING]: "green",
11021
- [ResourceState.SUCCEEDED]: "blue",
11022
- [ResourceState.UNKNOWN]: "gray",
11023
- [ResourceState.TERMINATING]: "loading",
11024
- [ResourceState.PENDING]: "warning",
11025
- [ResourceState.WAITING]: "warning",
11026
- [ResourceState.TERMINATED]: "gray",
11027
- [ResourceState.STOPPED]: "gray",
11028
- [ResourceState.AVAILABLE]: "blue",
11029
- [ResourceState.BOUND]: "green",
11030
- [ResourceState.RELEASED]: "gray",
11031
- [ResourceState.LOST]: "red",
11032
- [ResourceState.ACTIVE]: "green",
11033
- [ResourceState.DELETING]: "loading"
11034
- };
11035
- const finalColorMap = (customResourceStateMap == null ? void 0 : customResourceStateMap.color) || defaultStateMap;
11036
- const finalTextMap = customResourceStateMap == null ? void 0 : customResourceStateMap.text;
11037
- return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11038
- eagle.StatusCapsule,
11039
- {
11040
- className: common.cx_default(className, StateTagStyle, hideBackground && "no-background"),
11041
- color: finalColorMap[state2] !== "loading" ? finalColorMap[state2] : void 0,
11042
- loading: finalColorMap[state2] === "loading",
11043
- children: finalTextMap ? finalTextMap[state2] : t2(`dovetail.${state2 || "updating"}_state`)
11044
- }
11045
- );
11046
- };
11047
- const ShowContent_1g0ejph = "";
11048
- const ShowContentWrapperStyle = "s9agep2";
11049
- const BackButton = "bo89gfi";
11050
- const ToolBarWrapper = "t1ohe42f";
11051
- const NameStyle = "nqm4qz0";
11052
- const TopBarStyle = "ticl0qc";
11053
- const ShowContentHeaderStyle = "so9uwk1";
11054
- const GroupStyle$1 = "ge26ou0";
11055
- const GroupTitleStyle = "g17f8vl9";
11056
- const FullTabContentStyle = "fykgn2i";
11057
- const FieldWrapperStyle = "fngr745";
11058
- const TabContentStyle = "t11wg61l";
11059
- const ValueStyle$1 = "v1x3rivf";
11060
- const TabsStyle = "tf5s6s";
11061
- function ShowGroupComponent(props) {
11062
- const {
11063
- title,
11064
- className,
11065
- children,
11066
- operationEle
11067
- } = props;
11068
- return /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
11069
- className: common.cx_default(GroupStyle$1, className),
11070
- children: [/* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
11071
- className: common.cx_default(eagle.Typo.Heading.h2_bold_title, GroupTitleStyle),
11072
- children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
11073
- children: title
11074
- }), operationEle]
11075
- }), children]
11076
- });
11077
- }
11078
- const ShowContent = (props) => {
11079
- var _a, _b, _c, _d, _e, _f;
11080
- const {
11081
- showConfig,
11082
- formatter,
11083
- Dropdown = K8sDropdown
11084
- } = props;
11085
- const parsed = core.useParsed();
11086
- const {
11087
- resource
11088
- } = core.useResource();
11089
- const id = (_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a.id;
11090
- const {
11091
- queryResult
11092
- } = core.useShow({
11093
- id,
11094
- errorNotification: false
11095
- });
11096
- const {
11097
- t: t2
11098
- } = common.useTranslation();
11099
- const {
11100
- data: data2
11101
- } = queryResult;
11102
- const navigation = core.useNavigation();
11103
- const go = core.useGo();
11104
- const openForm = useOpenForm();
11105
- const Component = React.useContext(ComponentContext);
11106
- const configs = React.useContext(ConfigsContext);
11107
- const config = configs[(resource == null ? void 0 : resource.name) || ""];
11108
- const Tabs$1 = Component.Tabs || Tabs;
11109
- if (!(data2 == null ? void 0 : data2.data)) {
11110
- return null;
11111
- }
11112
- const model = data2.data;
11113
- const record = formatter ? formatter(model) : data2 == null ? void 0 : data2.data;
11114
- function renderFields(fields, areaType, hasCol = true) {
11115
- if (!record)
11116
- return null;
11117
- return fields.map((field) => {
11118
- if (field.hidden)
11119
- return null;
11120
- let content;
11121
- const value2 = lodashEs.get(record, field.path);
11122
- if (field.renderContent) {
11123
- content = field.renderContent(value2, record, field);
11124
- } else {
11125
- content = lodashEs.get(record, field.path);
11126
- }
11127
- return hasCol ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Col, {
11128
- flex: areaType === AreaType.Inline ? "none" : "",
11129
- span: field.col || 24,
11130
- children: field.render ? field.render(value2, record, field) : /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
11131
- className: FieldWrapperStyle,
11132
- children: [field.title && /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
11133
- className: eagle.Typo.Label.l4_regular_title,
11134
- style: {
11135
- width: field.labelWidth || "165px",
11136
- marginRight: 8,
11137
- flexShrink: 0,
11138
- color: "#2C385299"
11139
- },
11140
- children: field.title
11141
- }), /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
11142
- style: {
11143
- flex: 1,
11144
- minWidth: 0
11145
- },
11146
- children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, {
11147
- className: common.cx_default(eagle.Typo.Label.l4_regular_title, ValueStyle$1),
11148
- value: content,
11149
- useOverflow: false
11150
- })
11151
- })]
11152
- })
11153
- }, field.key) : /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, {
11154
- style: {
11155
- height: "100%"
11156
- },
11157
- value: content,
11158
- useOverflow: false
11159
- });
11160
- });
11161
- }
11162
- const stateDisplay = lodashEs.get(record, "stateDisplay");
11163
- const topBar = /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
11164
- className: ToolBarWrapper,
11165
- children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
11166
- className: common.cx_default(eagle.Typo.Label.l4_bold, BackButton),
11167
- onClick: () => {
11168
- go({
11169
- to: navigation.listUrl((resource == null ? void 0 : resource.name) || "")
11170
- });
11171
- },
11172
- children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Icon, {
11173
- src: iconsReact.ArrowChevronLeft16BoldTertiaryIcon,
11174
- hoverSrc: iconsReact.ArrowChevronLeftSmall16BoldBlueIcon,
11175
- style: {
11176
- marginRight: 4
11177
- },
11178
- children: /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
11179
- className: "button-text",
11180
- children: (config == null ? void 0 : config.displayName) || ((_b = resource == null ? void 0 : resource.meta) == null ? void 0 : _b.kind)
11181
- })
11182
- })
11183
- }), /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, {
11184
- className: TopBarStyle,
11185
- children: [/* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
11186
- style: {
11187
- display: "flex"
11188
- },
11189
- children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
11190
- className: common.cx_default(eagle.Typo.Display.d2_regular_title, NameStyle),
11191
- children: ((_c = showConfig.displayName) == null ? void 0 : _c.call(showConfig, record)) || ((_d = record == null ? void 0 : record.metadata) == null ? void 0 : _d.name)
11192
- }), stateDisplay ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(StateTag, {
11193
- state: stateDisplay,
11194
- customResourceStateMap: showConfig.resourceStateMap
11195
- }) : void 0]
11196
- }), /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, {
11197
- children: [(_e = showConfig.renderExtraButton) == null ? void 0 : _e.call(showConfig, record), !config.hideEdit ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(core.CanAccess, {
11198
- resource: resource == null ? void 0 : resource.name,
11199
- action: AccessControlAuth.Edit,
11200
- params: {
11201
- namespace: record.namespace
11202
- },
11203
- children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Button, {
11204
- style: {
11205
- marginRight: 8
11206
- },
11207
- onClick: () => openForm({
11208
- id
11209
- }),
11210
- children: ((_f = config.formConfig) == null ? void 0 : _f.formType) === FormType.FORM ? t2("dovetail.edit") : t2("dovetail.edit_yaml")
11211
- })
11212
- }) : null, /* @__PURE__ */ common.jsxRuntimeExports.jsx(Dropdown, {
11213
- record,
11214
- size: "large"
11215
- })]
11216
- })]
11217
- })]
11218
- });
11219
- const tabs = /* @__PURE__ */ common.jsxRuntimeExports.jsx(Tabs$1, {
11220
- tabs: (showConfig.tabs || []).map((tab, tabIndex) => {
11221
- var _a2;
11222
- return {
11223
- title: tab.title,
11224
- key: tab.key,
11225
- children: /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
11226
- className: common.cx_default(TabContentStyle, tab.groups.length <= 1 && tabIndex !== 0 && FullTabContentStyle),
11227
- children: (_a2 = tab.groups) == null ? void 0 : _a2.map((group) => {
11228
- const GroupContainer = group.title ? ShowGroupComponent : React.Fragment;
11229
- const FieldContainer = group.title ? eagle.Row : React.Fragment;
11230
- const groupContainerProps = group.title ? {
11231
- title: group.title || ""
11232
- } : {};
11233
- const fieldContainerProps = group.title ? {
11234
- gutter: [24, 8]
11235
- } : {};
11236
- return /* @__PURE__ */ common.jsxRuntimeExports.jsx(GroupContainer, {
11237
- ...groupContainerProps,
11238
- children: group.areas.map((area, index2) => /* @__PURE__ */ common.jsxRuntimeExports.jsxs(common.jsxRuntimeExports.Fragment, {
11239
- children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx(FieldContainer, {
11240
- ...fieldContainerProps,
11241
- children: renderFields(area.fields, area.type, !!group.title)
11242
- }, index2), index2 !== group.areas.length - 1 ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Divider, {
11243
- style: {
11244
- margin: "8px 0 12px 0"
11245
- }
11246
- }) : null]
11247
- }))
11248
- }, group.title);
11249
- })
11250
- })
11251
- };
11252
- }),
11253
- className: TabsStyle
11254
- });
11255
- return /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
11256
- className: ShowContentWrapperStyle,
11257
- children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Space, {
11258
- direction: "vertical",
11259
- className: ShowContentHeaderStyle,
11260
- children: topBar
11261
- }), tabs]
11262
- });
11263
- };
11264
11099
  const KeyValueSecret_c3ji18 = "";
11265
11100
  const ButtonStyle = "b11tbgf7";
11266
- const GroupStyle = "gtbyh5g";
11101
+ const GroupStyle$1 = "gtbyh5g";
11267
11102
  function KeyValueSecret(props) {
11268
11103
  const {
11269
11104
  data: data2 = {}
@@ -11285,7 +11120,7 @@ function KeyValueSecret(props) {
11285
11120
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(ShowGroupComponent, {
11286
11121
  title: i18n2.t("dovetail.data"),
11287
11122
  operationEle: toggleButton,
11288
- className: GroupStyle,
11123
+ className: GroupStyle$1,
11289
11124
  children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(KeyValue, {
11290
11125
  data: data2,
11291
11126
  hideSecret,
@@ -11866,16 +11701,57 @@ function ResourceTable(props) {
11866
11701
  tableProps.onPageChange(1);
11867
11702
  }, []);
11868
11703
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11869
- Table,
11704
+ Table,
11705
+ {
11706
+ tableProps,
11707
+ displayName: config.displayName || config.kind,
11708
+ errorContentProps: {
11709
+ type: ErrorContentType.Card
11710
+ }
11711
+ }
11712
+ );
11713
+ }
11714
+ const StateTag = (props) => {
11715
+ const {
11716
+ state: state2 = ResourceState.UPDATING,
11717
+ hideBackground,
11718
+ className,
11719
+ customResourceStateMap
11720
+ } = props;
11721
+ const { t: t2 } = common.useTranslation();
11722
+ const defaultStateMap = {
11723
+ [ResourceState.UPDATING]: "loading",
11724
+ [ResourceState.READY]: "green",
11725
+ [ResourceState.COMPLETED]: "gray",
11726
+ [ResourceState.FAILED]: "red",
11727
+ [ResourceState.SUSPENDED]: "warning",
11728
+ [ResourceState.RUNNING]: "green",
11729
+ [ResourceState.SUCCEEDED]: "blue",
11730
+ [ResourceState.UNKNOWN]: "gray",
11731
+ [ResourceState.TERMINATING]: "loading",
11732
+ [ResourceState.PENDING]: "warning",
11733
+ [ResourceState.WAITING]: "warning",
11734
+ [ResourceState.TERMINATED]: "gray",
11735
+ [ResourceState.STOPPED]: "gray",
11736
+ [ResourceState.AVAILABLE]: "blue",
11737
+ [ResourceState.BOUND]: "green",
11738
+ [ResourceState.RELEASED]: "gray",
11739
+ [ResourceState.LOST]: "red",
11740
+ [ResourceState.ACTIVE]: "green",
11741
+ [ResourceState.DELETING]: "loading"
11742
+ };
11743
+ const finalColorMap = (customResourceStateMap == null ? void 0 : customResourceStateMap.color) || defaultStateMap;
11744
+ const finalTextMap = customResourceStateMap == null ? void 0 : customResourceStateMap.text;
11745
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11746
+ eagle.StatusCapsule,
11870
11747
  {
11871
- tableProps,
11872
- displayName: config.displayName || config.kind,
11873
- errorContentProps: {
11874
- type: ErrorContentType.Card
11875
- }
11748
+ className: common.cx_default(className, StateTagStyle, hideBackground && "no-background"),
11749
+ color: finalColorMap[state2] !== "loading" ? finalColorMap[state2] : void 0,
11750
+ loading: finalColorMap[state2] === "loading",
11751
+ children: finalTextMap ? finalTextMap[state2] : t2(`dovetail.${state2 || "updating"}_state`)
11876
11752
  }
11877
11753
  );
11878
- }
11754
+ };
11879
11755
  const WorkloadPodsTable_975j2t = "";
11880
11756
  const WorkloadPodsTable = ({
11881
11757
  namespace: namespace2,
@@ -11957,7 +11833,7 @@ const ReadyValueStyle = "r1bm8olw";
11957
11833
  const ReplicasValueStyle = "r1oqudbh";
11958
11834
  const ContentWrapperStyle = "c18i6jtg";
11959
11835
  const LabelStyle = "lpm22il";
11960
- const ValueStyle = "v1ixr1me";
11836
+ const ValueStyle$1 = "v1ixr1me";
11961
11837
  const WorkloadReplicasForm = React.forwardRef(function WorkloadReplicasForm2(props, ref) {
11962
11838
  const {
11963
11839
  defaultValue,
@@ -12087,7 +11963,7 @@ function WorkloadReplicas({
12087
11963
  className: common.cx_default(LabelStyle, eagle.Typo.Label.l3_regular),
12088
11964
  children: record.kind === "Job" ? t2("dovetail.pod_complete_num") : t2("dovetail.pod_ready_num")
12089
11965
  }), /* @__PURE__ */ common.jsxRuntimeExports.jsx("td", {
12090
- className: common.cx_default(ValueStyle, eagle.Typo.Label.l3_regular),
11966
+ className: common.cx_default(ValueStyle$1, eagle.Typo.Label.l3_regular),
12091
11967
  children: readyReplicas
12092
11968
  })]
12093
11969
  }), /* @__PURE__ */ common.jsxRuntimeExports.jsxs("tr", {
@@ -12095,7 +11971,7 @@ function WorkloadReplicas({
12095
11971
  className: common.cx_default(LabelStyle, eagle.Typo.Label.l3_regular),
12096
11972
  children: t2("dovetail.pod_replicas_num")
12097
11973
  }), /* @__PURE__ */ common.jsxRuntimeExports.jsx("td", {
12098
- className: common.cx_default(ValueStyle, eagle.Typo.Label.l3_regular),
11974
+ className: common.cx_default(ValueStyle$1, eagle.Typo.Label.l3_regular),
12099
11975
  children: replicas
12100
11976
  }), /* @__PURE__ */ common.jsxRuntimeExports.jsx("td", {
12101
11977
  children: editable && canScale && /* @__PURE__ */ common.jsxRuntimeExports.jsx(EditField, {
@@ -12126,6 +12002,7 @@ var AreaType = /* @__PURE__ */ ((AreaType2) => {
12126
12002
  const ImageField = (i18n2) => {
12127
12003
  return {
12128
12004
  key: "Image",
12005
+ col: 12,
12129
12006
  title: i18n2.t("dovetail.image"),
12130
12007
  path: ["imageNames"],
12131
12008
  renderContent(value2) {
@@ -12232,6 +12109,7 @@ const SecretDataField = () => {
12232
12109
  const StartTimeField = (i18n2) => {
12233
12110
  return {
12234
12111
  key: "started",
12112
+ col: 12,
12235
12113
  title: i18n2.t("dovetail.started"),
12236
12114
  path: ["status", "startTime"],
12237
12115
  renderContent(value2) {
@@ -12242,6 +12120,7 @@ const StartTimeField = (i18n2) => {
12242
12120
  const ServiceTypeField = (i18n2) => {
12243
12121
  return {
12244
12122
  key: "type",
12123
+ col: 12,
12245
12124
  title: i18n2.t("dovetail.type"),
12246
12125
  path: ["displayType"]
12247
12126
  };
@@ -12249,6 +12128,7 @@ const ServiceTypeField = (i18n2) => {
12249
12128
  const ClusterIpField = (i18n2) => {
12250
12129
  return {
12251
12130
  key: "clusterIp",
12131
+ col: 12,
12252
12132
  title: i18n2.t("dovetail.clusterIp"),
12253
12133
  path: ["spec", "clusterIP"]
12254
12134
  };
@@ -12256,6 +12136,7 @@ const ClusterIpField = (i18n2) => {
12256
12136
  const SessionAffinityField = (i18n2) => {
12257
12137
  return {
12258
12138
  key: "clusterIp",
12139
+ col: 12,
12259
12140
  title: i18n2.t("dovetail.sessionAffinity"),
12260
12141
  path: ["spec", "sessionAffinity"]
12261
12142
  };
@@ -12300,11 +12181,13 @@ const EventsTableTabField = () => {
12300
12181
  };
12301
12182
  const NamespaceField = (i18n2) => ({
12302
12183
  key: "NameSpace",
12184
+ col: 12,
12303
12185
  title: i18n2.t("dovetail.namespace"),
12304
12186
  path: ["metadata", "namespace"]
12305
12187
  });
12306
12188
  const AgeField = (i18n2) => ({
12307
12189
  key: "Age",
12190
+ col: 12,
12308
12191
  title: i18n2.t("dovetail.created_time"),
12309
12192
  path: ["metadata", "creationTimestamp"],
12310
12193
  renderContent(value2) {
@@ -12332,6 +12215,7 @@ const AnnotationsField = (i18n2) => ({
12332
12215
  });
12333
12216
  const ServiceInnerClusterAccessField = () => ({
12334
12217
  key: "innerClusterAccess",
12218
+ col: 12,
12335
12219
  title: /* @__PURE__ */ common.jsxRuntimeExports.jsx(ServiceInClusterAccessTitle, {}),
12336
12220
  path: [],
12337
12221
  renderContent: (_, record) => {
@@ -12340,6 +12224,7 @@ const ServiceInnerClusterAccessField = () => ({
12340
12224
  });
12341
12225
  const ServiceOutClusterAccessField = (clusterVip) => ({
12342
12226
  key: "innerClusterAccess",
12227
+ col: 12,
12343
12228
  title: /* @__PURE__ */ common.jsxRuntimeExports.jsx(ServiceOutClusterAccessTitle, {}),
12344
12229
  path: [],
12345
12230
  renderContent: (_, record) => {
@@ -12372,6 +12257,7 @@ const PortsTableField = () => ({
12372
12257
  const DurationField = (i18n2) => {
12373
12258
  return {
12374
12259
  key: "duration",
12260
+ col: 12,
12375
12261
  path: ["duration"],
12376
12262
  title: i18n2.t("dovetail.duration"),
12377
12263
  renderContent: (v) => {
@@ -12382,6 +12268,7 @@ const DurationField = (i18n2) => {
12382
12268
  const StorageClassProvisionerField = (i18n2) => {
12383
12269
  return {
12384
12270
  key: "provisioner",
12271
+ col: 12,
12385
12272
  path: ["provisioner"],
12386
12273
  title: i18n2.t("dovetail.provisioner")
12387
12274
  };
@@ -12417,6 +12304,7 @@ const StorageClassPvField = () => {
12417
12304
  const PVCapacityField = (i18n2) => {
12418
12305
  return {
12419
12306
  key: "capacity",
12307
+ col: 12,
12420
12308
  path: ["spec", "capacity", "storage"],
12421
12309
  title: i18n2.t("dovetail.capacity"),
12422
12310
  renderContent(value2) {
@@ -12427,6 +12315,7 @@ const PVCapacityField = (i18n2) => {
12427
12315
  const PVCStorageField = (i18n2) => {
12428
12316
  return {
12429
12317
  key: "storage",
12318
+ col: 12,
12430
12319
  path: ["spec", "resources", "requests", "storage"],
12431
12320
  title: i18n2.t("dovetail.distributed"),
12432
12321
  renderContent(value2, pvc2) {
@@ -12437,6 +12326,7 @@ const PVCStorageField = (i18n2) => {
12437
12326
  const PVRefField = (i18n2) => {
12438
12327
  return {
12439
12328
  key: "pv",
12329
+ col: 12,
12440
12330
  path: ["pv"],
12441
12331
  title: i18n2.t("dovetail.pv"),
12442
12332
  renderContent(value2) {
@@ -12454,6 +12344,7 @@ const PVRefField = (i18n2) => {
12454
12344
  const PVStorageClassField = (i18n2) => {
12455
12345
  return {
12456
12346
  key: "storageClass",
12347
+ col: 12,
12457
12348
  path: ["spec", "storageClassName"],
12458
12349
  title: i18n2.t("dovetail.storage_class"),
12459
12350
  renderContent(value2) {
@@ -12464,6 +12355,7 @@ const PVStorageClassField = (i18n2) => {
12464
12355
  const PVPhaseField = (i18n2) => {
12465
12356
  return {
12466
12357
  key: "phase",
12358
+ col: 12,
12467
12359
  path: ["stateDisplay"],
12468
12360
  title: i18n2.t("dovetail.state"),
12469
12361
  renderContent(value2) {
@@ -12474,6 +12366,7 @@ const PVPhaseField = (i18n2) => {
12474
12366
  const PVVolumeModeField = (i18n2) => {
12475
12367
  return {
12476
12368
  key: "mode",
12369
+ col: 12,
12477
12370
  path: ["spec", "volumeMode"],
12478
12371
  title: i18n2.t("dovetail.volume_mode"),
12479
12372
  renderContent(value2) {
@@ -12484,6 +12377,7 @@ const PVVolumeModeField = (i18n2) => {
12484
12377
  const PVAccessModeField = (i18n2) => {
12485
12378
  return {
12486
12379
  key: "accessMode",
12380
+ col: 12,
12487
12381
  path: ["spec", "accessModes"],
12488
12382
  title: i18n2.t("dovetail.access_mode"),
12489
12383
  renderContent(value2) {
@@ -12519,6 +12413,7 @@ const PVCPodsField = () => {
12519
12413
  const PVCRefField = (i18n2) => {
12520
12414
  return {
12521
12415
  key: "pvc",
12416
+ col: 12,
12522
12417
  path: ["pvc"],
12523
12418
  title: i18n2.t("dovetail.pvc"),
12524
12419
  renderContent(value2, pv2) {
@@ -12537,6 +12432,7 @@ const PVCRefField = (i18n2) => {
12537
12432
  const PVCSIRefField = (i18n2) => {
12538
12433
  return {
12539
12434
  key: "csi",
12435
+ col: 12,
12540
12436
  path: ["csi"],
12541
12437
  title: i18n2.t("dovetail.csi")
12542
12438
  };
@@ -12544,6 +12440,7 @@ const PVCSIRefField = (i18n2) => {
12544
12440
  const IsDefaultSCField = (i18n2) => {
12545
12441
  return {
12546
12442
  key: "isDefaultSC",
12443
+ col: 12,
12547
12444
  path: ["isDefaultSC"],
12548
12445
  title: i18n2.t("dovetail.default_sc"),
12549
12446
  renderContent(val) {
@@ -12554,6 +12451,7 @@ const IsDefaultSCField = (i18n2) => {
12554
12451
  const SCReclaimPolicyField = (i18n2) => {
12555
12452
  return {
12556
12453
  key: "reclaimPolicy",
12454
+ col: 12,
12557
12455
  path: ["reclaimPolicy"],
12558
12456
  title: i18n2.t("dovetail.reclaim_policy"),
12559
12457
  renderContent(val) {
@@ -12568,6 +12466,7 @@ const SCReclaimPolicyField = (i18n2) => {
12568
12466
  const IsSCAllowVolumeExpansionField = (i18n2) => {
12569
12467
  return {
12570
12468
  key: "allowVolumeExpansion",
12469
+ col: 12,
12571
12470
  path: ["allowVolumeExpansion"],
12572
12471
  title: i18n2.t("dovetail.allow_expand"),
12573
12472
  renderContent(val) {
@@ -12585,13 +12484,14 @@ const ResourceTableField = (resource, useTableParams) => {
12585
12484
  };
12586
12485
  };
12587
12486
  const baseNoReset = "";
12588
- const index_v855ki = "";
12487
+ const index_14irc29 = "";
12589
12488
  const WrapperStyle$3 = "wve7dfm";
12590
12489
  const ToolbarStyle = "t9oeh3c";
12591
12490
  const ToolbarAreaStyle = "t1u2zqn6";
12592
12491
  const ContentStyle$1 = "c8wrcus";
12593
12492
  const PodLog = ({
12594
- pod: pod2
12493
+ pod: pod2,
12494
+ apiUrl
12595
12495
  }) => {
12596
12496
  var _a, _b, _c, _d, _e;
12597
12497
  const [selectedContainer, setSelectedContainer] = React.useState(((_b = (_a = pod2.spec) == null ? void 0 : _a.containers[0]) == null ? void 0 : _b.name) || "");
@@ -12602,8 +12502,6 @@ const PodLog = ({
12602
12502
  const [wrap, setWrap] = React.useState(false);
12603
12503
  const logViewerRef = React.useRef(null);
12604
12504
  const abortControllerRef = React.useRef(null);
12605
- const dataProvider = core.useDataProvider();
12606
- const apiUrl = dataProvider()["getApiUrl"]();
12607
12505
  const {
12608
12506
  t: t2
12609
12507
  } = common.useTranslation();
@@ -12793,7 +12691,7 @@ const EventsTab = (i18n2) => ({
12793
12691
  }
12794
12692
  ]
12795
12693
  });
12796
- const PodLogTab = (i18n2) => ({
12694
+ const PodLogTab = (i18n2, apiUrl) => ({
12797
12695
  title: i18n2.t("dovetail.log"),
12798
12696
  key: "pod-log",
12799
12697
  groups: [
@@ -12805,7 +12703,7 @@ const PodLogTab = (i18n2) => ({
12805
12703
  key: "log",
12806
12704
  path: [],
12807
12705
  renderContent: (_, record) => {
12808
- return /* @__PURE__ */ common.jsxRuntimeExports.jsx(PodLog, { pod: record });
12706
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(PodLog, { pod: record, apiUrl });
12809
12707
  }
12810
12708
  }
12811
12709
  ]
@@ -12815,7 +12713,7 @@ const PodLogTab = (i18n2) => ({
12815
12713
  ]
12816
12714
  });
12817
12715
  const NetworkPolicyRulesViewer_r6jity = "";
12818
- const MonacoYamlEditor$1 = React.lazy(() => Promise.resolve().then(() => require("./MonacoYamlEditor-9b8b7cef.cjs")));
12716
+ const MonacoYamlEditor$1 = React.lazy(() => Promise.resolve().then(() => require("./MonacoYamlEditor-1554bc96.cjs")));
12819
12717
  const EditorStyle$1 = "e1cjl2b8";
12820
12718
  const NetworkPolicyRulesViewer = ({
12821
12719
  ingressOrEgress,
@@ -13153,6 +13051,318 @@ const ResourceTableGroup = (resource, title) => ({
13153
13051
  }
13154
13052
  ]
13155
13053
  });
13054
+ function Tabs(props) {
13055
+ const { tabs, className } = props;
13056
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Tabs, { className, children: tabs.map((tab) => {
13057
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.TabsTabPane, { tab: tab.title, children: tab.children }, tab.title);
13058
+ }) });
13059
+ }
13060
+ const ShowContentView_19saq6u = "";
13061
+ const ShowContentWrapperStyle = "soapvs9";
13062
+ const BackButton = "b13d603q";
13063
+ const ToolBarWrapper = "tm8eaia";
13064
+ const NameStyle = "nhnus27";
13065
+ const TopBarStyle = "t16t20f5";
13066
+ const ShowContentHeaderStyle = "s97y2wr";
13067
+ const GroupStyle = "g1rhnxqx";
13068
+ const BasicGroupStyle = "b1f1s2pc";
13069
+ const GroupTitleStyle = "g1qw3bxx";
13070
+ const FullTabContentStyle = "flfewds";
13071
+ const FieldWrapperStyle = "f1c7cta8";
13072
+ const TabContentStyle = "t1pt61xk";
13073
+ const ValueStyle = "v1to6fie";
13074
+ const TabsStyle = "tca5959";
13075
+ const KindTagStyle = "k3dcesi";
13076
+ function ShowGroupComponent(props) {
13077
+ const {
13078
+ title,
13079
+ className,
13080
+ children,
13081
+ operationEle
13082
+ } = props;
13083
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
13084
+ className: common.cx_default(GroupStyle, className),
13085
+ children: [/* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
13086
+ className: common.cx_default(eagle.Typo.Heading.h2_bold_title, GroupTitleStyle),
13087
+ children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
13088
+ children: title
13089
+ }), operationEle]
13090
+ }), children]
13091
+ });
13092
+ }
13093
+ function BasicShowGroupComponent(props) {
13094
+ const {
13095
+ children
13096
+ } = props;
13097
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
13098
+ className: BasicGroupStyle,
13099
+ children
13100
+ });
13101
+ }
13102
+ const ShowContentView = (props) => {
13103
+ var _a, _b, _c, _d;
13104
+ const {
13105
+ id,
13106
+ resourceName,
13107
+ showConfig,
13108
+ formatter,
13109
+ children,
13110
+ Dropdown = K8sDropdown,
13111
+ hideBackButton = false,
13112
+ canCollapseTabs = false
13113
+ } = props;
13114
+ const {
13115
+ queryResult
13116
+ } = core.useShow({
13117
+ id,
13118
+ resource: resourceName,
13119
+ errorNotification: false
13120
+ });
13121
+ const {
13122
+ t: t2
13123
+ } = common.useTranslation();
13124
+ const {
13125
+ data: data2
13126
+ } = queryResult;
13127
+ const navigation = core.useNavigation();
13128
+ const go = core.useGo();
13129
+ const openForm = useOpenForm();
13130
+ const Component = React.useContext(ComponentContext);
13131
+ const configs = React.useContext(ConfigsContext);
13132
+ const config = configs[resourceName];
13133
+ const Tabs$1 = Component.Tabs || Tabs;
13134
+ if (!(data2 == null ? void 0 : data2.data)) {
13135
+ return null;
13136
+ }
13137
+ const model = data2.data;
13138
+ const record = formatter ? formatter(model) : data2 == null ? void 0 : data2.data;
13139
+ function renderFields(fields, areaType, hasCol = true) {
13140
+ if (!record)
13141
+ return null;
13142
+ return fields.map((field) => {
13143
+ if (field.hidden)
13144
+ return null;
13145
+ let content;
13146
+ const value2 = lodashEs.get(record, field.path);
13147
+ if (field.renderContent) {
13148
+ content = field.renderContent(value2, record, field);
13149
+ } else {
13150
+ content = lodashEs.get(record, field.path);
13151
+ }
13152
+ return hasCol ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Col, {
13153
+ flex: areaType === AreaType.Inline ? "none" : "",
13154
+ span: field.col || 24,
13155
+ className: "czyzuo8",
13156
+ children: field.render ? field.render(value2, record, field) : /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
13157
+ className: FieldWrapperStyle,
13158
+ children: [field.title && /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
13159
+ className: eagle.Typo.Label.l4_regular_title,
13160
+ style: {
13161
+ width: field.labelWidth || "165px",
13162
+ marginRight: 8,
13163
+ flexShrink: 0,
13164
+ color: "#2C385299"
13165
+ },
13166
+ children: field.title
13167
+ }), /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
13168
+ style: {
13169
+ flex: 1,
13170
+ minWidth: 0
13171
+ },
13172
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, {
13173
+ className: common.cx_default(eagle.Typo.Label.l4_regular_title, ValueStyle),
13174
+ value: content,
13175
+ useOverflow: false
13176
+ })
13177
+ })]
13178
+ })
13179
+ }, field.key) : /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, {
13180
+ style: {
13181
+ height: "100%"
13182
+ },
13183
+ value: content,
13184
+ useOverflow: false
13185
+ });
13186
+ });
13187
+ }
13188
+ function renderGroup(group, isBasicGroup = false) {
13189
+ let GroupContainer = React.Fragment;
13190
+ if (isBasicGroup) {
13191
+ GroupContainer = BasicShowGroupComponent;
13192
+ } else if (group.title) {
13193
+ GroupContainer = ShowGroupComponent;
13194
+ }
13195
+ const FieldContainer = group.title ? eagle.Row : React.Fragment;
13196
+ const groupContainerProps = group.title ? {
13197
+ title: group.title || ""
13198
+ } : {};
13199
+ const fieldContainerProps = group.title ? {
13200
+ gutter: [24, 8]
13201
+ } : {};
13202
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(GroupContainer, {
13203
+ ...groupContainerProps,
13204
+ children: group.areas.map((area, index2) => /* @__PURE__ */ common.jsxRuntimeExports.jsxs(common.jsxRuntimeExports.Fragment, {
13205
+ children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx(FieldContainer, {
13206
+ ...fieldContainerProps,
13207
+ children: renderFields(area.fields, area.type, !!group.title)
13208
+ }, index2), index2 !== group.areas.length - 1 ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Divider, {
13209
+ style: {
13210
+ margin: "8px 0 12px 0"
13211
+ }
13212
+ }) : null]
13213
+ }))
13214
+ }, group.title);
13215
+ }
13216
+ const stateDisplay = lodashEs.get(record, "stateDisplay");
13217
+ const topBar = /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
13218
+ className: ToolBarWrapper,
13219
+ children: [!hideBackButton && /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
13220
+ className: common.cx_default(eagle.Typo.Label.l4_bold, BackButton),
13221
+ onClick: () => {
13222
+ go({
13223
+ to: navigation.listUrl(resourceName)
13224
+ });
13225
+ },
13226
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Icon, {
13227
+ src: iconsReact.ArrowChevronLeft16BoldTertiaryIcon,
13228
+ hoverSrc: iconsReact.ArrowChevronLeftSmall16BoldBlueIcon,
13229
+ style: {
13230
+ marginRight: 4
13231
+ },
13232
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
13233
+ className: "button-text",
13234
+ children: (config == null ? void 0 : config.displayName) || resourceName
13235
+ })
13236
+ })
13237
+ }), /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, {
13238
+ className: TopBarStyle,
13239
+ children: [/* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
13240
+ style: {
13241
+ display: "flex"
13242
+ },
13243
+ children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Tag.NameTag, {
13244
+ className: KindTagStyle,
13245
+ children: config.kind
13246
+ }), /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
13247
+ className: common.cx_default(eagle.Typo.Display.d2_regular_title, NameStyle),
13248
+ children: ((_a = showConfig.displayName) == null ? void 0 : _a.call(showConfig, record)) || ((_b = record == null ? void 0 : record.metadata) == null ? void 0 : _b.name)
13249
+ }), stateDisplay ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(StateTag, {
13250
+ state: stateDisplay,
13251
+ customResourceStateMap: showConfig.resourceStateMap
13252
+ }) : void 0]
13253
+ }), /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, {
13254
+ children: [(_c = showConfig.renderExtraButton) == null ? void 0 : _c.call(showConfig, record), !config.hideEdit ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(core.CanAccess, {
13255
+ resource: resourceName,
13256
+ action: AccessControlAuth.Edit,
13257
+ params: {
13258
+ namespace: record.namespace
13259
+ },
13260
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Button, {
13261
+ style: {
13262
+ marginRight: 8
13263
+ },
13264
+ onClick: () => openForm({
13265
+ id
13266
+ }),
13267
+ children: ((_d = config.formConfig) == null ? void 0 : _d.formType) === FormType.FORM ? t2("dovetail.edit") : t2("dovetail.edit_yaml")
13268
+ })
13269
+ }) : null, /* @__PURE__ */ common.jsxRuntimeExports.jsx(Dropdown, {
13270
+ record,
13271
+ size: "large"
13272
+ })]
13273
+ })]
13274
+ })]
13275
+ });
13276
+ const tabs = /* @__PURE__ */ common.jsxRuntimeExports.jsx(Tabs$1, {
13277
+ tabs: (showConfig.tabs || []).map((tab, tabIndex) => {
13278
+ var _a2;
13279
+ return {
13280
+ title: tab.title,
13281
+ key: tab.key,
13282
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
13283
+ className: common.cx_default(TabContentStyle, tab.groups.length <= 1 && tabIndex !== 0 && FullTabContentStyle),
13284
+ children: (_a2 = tab.groups) == null ? void 0 : _a2.map((group) => renderGroup(group, false))
13285
+ })
13286
+ };
13287
+ }),
13288
+ className: TabsStyle
13289
+ });
13290
+ const basicInfo = showConfig.basicGroup ? renderGroup(showConfig.basicGroup, true) : null;
13291
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
13292
+ className: ShowContentWrapperStyle,
13293
+ children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Space, {
13294
+ direction: "vertical",
13295
+ className: ShowContentHeaderStyle,
13296
+ children: topBar
13297
+ }), basicInfo, canCollapseTabs ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(CollapseTabs, {
13298
+ children: tabs
13299
+ }) : tabs, children]
13300
+ });
13301
+ };
13302
+ const CollapseTabs = (props) => {
13303
+ const [isCollapsed, setIsCollapsed] = React.useState(true);
13304
+ const {
13305
+ t: t2
13306
+ } = common.useTranslation();
13307
+ if (isCollapsed) {
13308
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
13309
+ style: {
13310
+ display: "flex"
13311
+ },
13312
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Button, {
13313
+ style: {
13314
+ margin: "auto",
13315
+ cursor: "pointer"
13316
+ },
13317
+ type: "quiet",
13318
+ onClick: () => setIsCollapsed((v) => !v),
13319
+ suffixIcon: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Icon, {
13320
+ src: iconsReact.ArrowChevronUp16BoldSecondaryIcon
13321
+ }),
13322
+ children: t2("dovetail.view_all_info")
13323
+ })
13324
+ });
13325
+ } else {
13326
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsxs(common.jsxRuntimeExports.Fragment, {
13327
+ children: [props.children, /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
13328
+ style: {
13329
+ display: "flex"
13330
+ },
13331
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Button, {
13332
+ style: {
13333
+ margin: "auto",
13334
+ cursor: "pointer"
13335
+ },
13336
+ type: "quiet",
13337
+ onClick: () => setIsCollapsed((v) => !v),
13338
+ suffixIcon: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Icon, {
13339
+ src: iconsReact.ArrowBoldDown16Icon
13340
+ }),
13341
+ children: t2("dovetail.collapse")
13342
+ })
13343
+ })]
13344
+ });
13345
+ }
13346
+ };
13347
+ const ShowContent = (props) => {
13348
+ var _a;
13349
+ const { showConfig, formatter, Dropdown = K8sDropdown, children, canCollapseTabs } = props;
13350
+ const parsed = core.useParsed();
13351
+ const { resource } = core.useResource();
13352
+ const id = (_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a.id;
13353
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
13354
+ ShowContentView,
13355
+ {
13356
+ id,
13357
+ resourceName: (resource == null ? void 0 : resource.name) || "",
13358
+ showConfig,
13359
+ formatter,
13360
+ Dropdown,
13361
+ canCollapseTabs,
13362
+ children
13363
+ }
13364
+ );
13365
+ };
13156
13366
  const PageShow = (props) => {
13157
13367
  var _a;
13158
13368
  const parsed = core.useParsed();
@@ -13202,7 +13412,7 @@ const PageShow = (props) => {
13202
13412
  nav.list(resource);
13203
13413
  }
13204
13414
  }, [isError, nav, resource, queryResult, parsed, msg, notExistMsg, isLoading]);
13205
- return isLoading ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Loading, {}) : /* @__PURE__ */ common.jsxRuntimeExports.jsx(ShowContent, { ...props });
13415
+ return isLoading ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Loading, {}) : /* @__PURE__ */ common.jsxRuntimeExports.jsx(ShowContent, { ...props, children: props.children });
13206
13416
  };
13207
13417
  const index_az4wrx = "";
13208
13418
  const WrapperStyle$2 = "w1akirqw";
@@ -16254,7 +16464,7 @@ const PlainCodeStyle = "pqch97v";
16254
16464
  const ErrorMsgStyle = "eh2qjnl";
16255
16465
  const ErrorWrapperStyle = "e19q2bnp";
16256
16466
  const YamlEditorStyle = "y16u5v3w";
16257
- const MonacoYamlEditor = React.lazy(() => Promise.resolve().then(() => require("./MonacoYamlEditor-9b8b7cef.cjs")));
16467
+ const MonacoYamlEditor = React.lazy(() => Promise.resolve().then(() => require("./MonacoYamlEditor-1554bc96.cjs")));
16258
16468
  const MonacoYamlDiffEditor = React.lazy(() => Promise.resolve().then(() => require("./MonacoYamlDiffEditor-7a07db88.cjs")));
16259
16469
  const YamlEditorComponent = React.forwardRef(
16260
16470
  function YamlEditorComponent2(props, ref) {
@@ -16282,20 +16492,18 @@ const YamlEditorComponent = React.forwardRef(
16282
16492
  const editorInstance = React.useRef();
16283
16493
  const [copyTooltip, setCopyTooltip] = React.useState(t2("dovetail.copy"));
16284
16494
  const [resetTooltip, setResetTooltip] = React.useState(t2("dovetail.reset_arguments"));
16285
- React.useImperativeHandle(ref, () => {
16286
- return {
16287
- setValue: _setValue,
16288
- setEditorValue: (value22) => {
16289
- var _a, _b;
16290
- (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(value22);
16291
- },
16292
- getEditorValue: () => {
16293
- var _a;
16294
- return ((_a = editorInstance.current) == null ? void 0 : _a.getValue()) ?? "";
16295
- },
16296
- getEditorInstance: () => editorInstance.current || null
16297
- };
16298
- });
16495
+ const defaultValueString = React.useMemo(() => {
16496
+ if (typeof defaultValue === "string") {
16497
+ return defaultValue;
16498
+ }
16499
+ return yaml$2.dump(defaultValue);
16500
+ }, [defaultValue]);
16501
+ const _valueString = React.useMemo(() => {
16502
+ if (typeof _value === "string") {
16503
+ return _value;
16504
+ }
16505
+ return yaml$2.dump(_value);
16506
+ }, [_value]);
16299
16507
  const onChange = React.useCallback(
16300
16508
  (newVal) => {
16301
16509
  var _a;
@@ -16318,7 +16526,7 @@ const YamlEditorComponent = React.forwardRef(
16318
16526
  (editor) => {
16319
16527
  var _a, _b, _c;
16320
16528
  if (editor.getValue() !== _value) {
16321
- (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(_value);
16529
+ (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(_valueString);
16322
16530
  }
16323
16531
  (_c = props.onEditorCreate) == null ? void 0 : _c.call(props, editor);
16324
16532
  },
@@ -16327,13 +16535,29 @@ const YamlEditorComponent = React.forwardRef(
16327
16535
  const getInstance = React.useCallback((ins) => {
16328
16536
  editorInstance.current = ins;
16329
16537
  }, []);
16538
+ const getEditorValue = React.useCallback(() => {
16539
+ var _a;
16540
+ return ((_a = editorInstance.current) == null ? void 0 : _a.getValue()) ?? "";
16541
+ }, []);
16330
16542
  React.useEffect(() => {
16331
16543
  var _a, _b;
16332
- if (value2 !== void 0 && value2 !== _value) {
16544
+ if (value2 !== void 0 && !lodashEs.isEqual(value2, _value)) {
16545
+ const valueString = typeof value2 === "string" ? value2 : yaml$2.dump(value2);
16333
16546
  _setValue(value2);
16334
- (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(value2);
16547
+ (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(valueString);
16335
16548
  }
16336
16549
  }, [value2]);
16550
+ React.useImperativeHandle(ref, () => {
16551
+ return {
16552
+ setValue: _setValue,
16553
+ setEditorValue: (value22) => {
16554
+ var _a, _b;
16555
+ (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(value22);
16556
+ },
16557
+ getEditorValue,
16558
+ getEditorInstance: () => editorInstance.current || null
16559
+ };
16560
+ });
16337
16561
  return /* @__PURE__ */ common.jsxRuntimeExports.jsxs(
16338
16562
  "div",
16339
16563
  {
@@ -16387,7 +16611,7 @@ const YamlEditorComponent = React.forwardRef(
16387
16611
  iconHeight: 16,
16388
16612
  onClick: () => {
16389
16613
  if (!isCollapsed) {
16390
- copyToClipboard(_value);
16614
+ copyToClipboard(getEditorValue());
16391
16615
  setCopyTooltip(t2("dovetail.copied"));
16392
16616
  }
16393
16617
  }
@@ -16419,7 +16643,7 @@ const YamlEditorComponent = React.forwardRef(
16419
16643
  onClick: () => {
16420
16644
  var _a;
16421
16645
  if (!isCollapsed) {
16422
- (_a = editorInstance.current) == null ? void 0 : _a.setValue(defaultValue);
16646
+ (_a = editorInstance.current) == null ? void 0 : _a.setValue(defaultValueString);
16423
16647
  setResetTooltip(t2("dovetail.already_reset"));
16424
16648
  }
16425
16649
  }
@@ -16480,7 +16704,7 @@ const YamlEditorComponent = React.forwardRef(
16480
16704
  zIndex: 1
16481
16705
  },
16482
16706
  children: [
16483
- /* @__PURE__ */ common.jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ common.jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _value }), children: /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", { style: { display: isDiff ? "none" : "block" }, children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
16707
+ /* @__PURE__ */ common.jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ common.jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _valueString }), children: /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", { style: { display: isDiff ? "none" : "block" }, children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
16484
16708
  MonacoYamlEditor,
16485
16709
  {
16486
16710
  id: props.id,
@@ -16496,12 +16720,12 @@ const YamlEditorComponent = React.forwardRef(
16496
16720
  isScrollOnFocus
16497
16721
  }
16498
16722
  ) }) }),
16499
- isDiff ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ common.jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _value }), children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
16723
+ isDiff ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ common.jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _valueString }), children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
16500
16724
  MonacoYamlDiffEditor,
16501
16725
  {
16502
16726
  id: props.id,
16503
- origin: defaultValue,
16504
- modified: _value,
16727
+ origin: defaultValueString,
16728
+ modified: _valueString,
16505
16729
  height
16506
16730
  }
16507
16731
  ) }) : null
@@ -18778,7 +19002,8 @@ class ModelPlugin {
18778
19002
  Node: NodeModel,
18779
19003
  StorageClass: StorageClassModel,
18780
19004
  PersistentVolume: PersistentVolumeModel,
18781
- PersistentVolumeClaim: PersistentVolumeClaimModel
19005
+ PersistentVolumeClaim: PersistentVolumeClaimModel,
19006
+ ReplicaSet: ReplicaSetModel
18782
19007
  })
18783
19008
  ));
18784
19009
  }
@@ -18912,6 +19137,7 @@ exports.AnnotationsField = AnnotationsField;
18912
19137
  exports.AreaType = AreaType;
18913
19138
  exports.BASE_INIT_VALUE = BASE_INIT_VALUE;
18914
19139
  exports.BasicGroup = BasicGroup;
19140
+ exports.BasicShowGroupComponent = BasicShowGroupComponent;
18915
19141
  exports.Breadcrumb = Breadcrumb;
18916
19142
  exports.CONFIG_MAP_INIT_VALUE = CONFIG_MAP_INIT_VALUE;
18917
19143
  exports.CRONJOB_INIT_VALUE = CRONJOB_INIT_VALUE;
@@ -19059,6 +19285,7 @@ exports.RefineFormContent = RefineFormContent;
19059
19285
  exports.RefineFormPage = RefineFormPage;
19060
19286
  exports.RelationPlugin = RelationPlugin;
19061
19287
  exports.ReplicaField = ReplicaField;
19288
+ exports.ReplicaSetModel = ReplicaSetModel;
19062
19289
  exports.ReplicasColumnRenderer = ReplicasColumnRenderer;
19063
19290
  exports.ReplicasDropdown = ReplicasDropdown;
19064
19291
  exports.ResourceCRUD = ResourceCRUD;
@@ -19111,6 +19338,7 @@ exports.ServiceTypeEnum = ServiceTypeEnum;
19111
19338
  exports.ServiceTypeField = ServiceTypeField;
19112
19339
  exports.SessionAffinityField = SessionAffinityField;
19113
19340
  exports.ShowContent = ShowContent;
19341
+ exports.ShowContentView = ShowContentView;
19114
19342
  exports.ShowGroupComponent = ShowGroupComponent;
19115
19343
  exports.StartTimeField = StartTimeField;
19116
19344
  exports.StateDisplayColumnRenderer = StateDisplayColumnRenderer;