@dovetail-v2/refine 0.0.6 → 0.0.7

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.
@@ -5,12 +5,12 @@ var __publicField = (obj, key, value) => {
5
5
  return value;
6
6
  };
7
7
  import React, { useCallback, useContext, createContext, useState, useRef, useEffect, useMemo, useLayoutEffect, forwardRef, useImperativeHandle, Suspense } from "react";
8
- import { ResourceContext, matchResourceFromRoute, useResource, useForm as useForm$1, pickNotDeprecated, useWarnAboutChange, useDelete, useNavigation, useParsed, useGo, useList, useTable, useBreadcrumb, useUpdate, useDeleteMany, useShow, useMenu, Refine } from "@refinedev/core";
8
+ import { ResourceContext, matchResourceFromRoute, useResource, useForm as useForm$1, pickNotDeprecated, useWarnAboutChange, useDelete, useNavigation, useUpdate, useGo, useParsed, useList, useTable, useBreadcrumb, useDeleteMany, useShow, useMenu, Refine } from "@refinedev/core";
9
9
  import { parse, stringify } from "qs";
10
10
  import { useLocation, useHistory, useParams, matchPath, Link, Route, NavLink, Switch, Router } from "react-router-dom";
11
- import { useUIKit, Icon, Typo, kitContext } from "@cloudtower/eagle";
11
+ import { useUIKit, Typo, Icon, kitContext } from "@cloudtower/eagle";
12
12
  import yaml from "js-yaml";
13
- import { isObject, merge, get, cloneDeep, set } from "lodash-es";
13
+ import { isObject, get, merge, cloneDeep, set } from "lodash-es";
14
14
  import { useForm } from "sunflower-antd";
15
15
  import { EditPen16PrimaryIcon, TrashBinDelete16Icon, Download16GradientBlueIcon, MoreEllipsis316BoldBlueIcon, SettingsGear16GradientGrayIcon, CheckmarkDoneSuccessCorrect16BoldGreenIcon, XmarkFailed16BoldRedIcon, DynamicResourceSchedule16BlueIcon, HierarchyTriangleRight16GrayIcon, HierarchyTriangleRight16BlueIcon, ClipboardCopy16GradientGrayIcon, ClipboardCopy16GradientBlueIcon, Retry16GradientGrayIcon, Retry16GradientBlueIcon, EditPen16GradientGrayIcon, EditPen16GradientBlueIcon, Showdiff16GradientGrayIcon, Showdiff16GradientBlueIcon, XmarkFailedSeriousWarningFill16RedIcon, VmResume16Icon, SuspendedPause16GradientGrayIcon } from "@cloudtower/icons-react";
16
16
  import * as monaco from "monaco-editor";
@@ -6928,601 +6928,111 @@ const useDeleteModal = (resource) => {
6928
6928
  }
6929
6929
  return { modalProps, visible, openDeleteConfirmModal };
6930
6930
  };
6931
- function download(filename, content) {
6932
- const element = document.createElement("a");
6933
- element.setAttribute(
6934
- "href",
6935
- "data:text/plain;charset=utf-8," + encodeURIComponent(content)
6936
- );
6937
- element.setAttribute("download", filename);
6938
- element.style.display = "none";
6939
- document.body.appendChild(element);
6940
- element.click();
6941
- document.body.removeChild(element);
6942
- }
6943
- function useDownloadYAML() {
6944
- return function(options) {
6945
- const { name: name2, item } = options;
6946
- const content = yaml.dump(item);
6947
- download(`${name2}.yaml`, content);
6948
- };
6949
- }
6950
- function useEdit() {
6951
- const { resource } = useParsed();
6952
- const go = useGo();
6953
- const edit2 = useCallback(
6954
- (id) => {
6955
- go({
6956
- to: `/${resource == null ? void 0 : resource.name}/edit`,
6957
- query: {
6958
- id
6959
- }
6960
- });
6961
- },
6962
- [go, resource == null ? void 0 : resource.name]
6963
- );
6964
- return { edit: edit2 };
6965
- }
6966
- function K8sDropdown(props) {
6967
- const { data: data2 } = props;
6968
- const kit = useUIKit();
6969
- const useResourceResult = useResource();
6970
- const resource = useResourceResult.resource;
6971
- const { edit: edit2 } = useEdit();
6972
- const { modalProps, visible, openDeleteConfirmModal } = useDeleteModal(
6973
- (resource == null ? void 0 : resource.name) || ""
6974
- );
6975
- const download2 = useDownloadYAML();
6976
- const { t } = useTranslation();
6977
- return /* @__PURE__ */ jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment, { children: [
6978
- /* @__PURE__ */ jsxRuntime.exports.jsx(
6979
- kit.dropdown,
6980
- {
6981
- overlay: /* @__PURE__ */ jsxRuntime.exports.jsxs(kit.menu, { children: [
6982
- /* @__PURE__ */ jsxRuntime.exports.jsx(
6983
- kit.menuItem,
6984
- {
6985
- onClick: () => {
6986
- if (data2.id) {
6987
- edit2(data2.id);
6988
- }
6989
- },
6990
- children: /* @__PURE__ */ jsxRuntime.exports.jsx(Icon, { src: EditPen16PrimaryIcon, children: t("edit") })
6991
- }
6992
- ),
6993
- /* @__PURE__ */ jsxRuntime.exports.jsx(
6994
- kit.menuItem,
6995
- {
6996
- danger: true,
6997
- onClick: () => {
6998
- openDeleteConfirmModal(data2.id);
6999
- },
7000
- children: /* @__PURE__ */ jsxRuntime.exports.jsx(Icon, { src: TrashBinDelete16Icon, children: t("delete") })
7001
- }
7002
- ),
7003
- /* @__PURE__ */ jsxRuntime.exports.jsx(
7004
- kit.menu.Item,
7005
- {
7006
- onClick: () => {
7007
- var _a;
7008
- if (data2.id) {
7009
- download2({
7010
- name: ((_a = data2.metadata) == null ? void 0 : _a.name) || data2.kind || "",
7011
- item: data2
7012
- });
7013
- }
7014
- },
7015
- children: /* @__PURE__ */ jsxRuntime.exports.jsx(Icon, { src: Download16GradientBlueIcon, children: t("download_yaml") })
7016
- }
7017
- ),
7018
- props.children
7019
- ] }),
7020
- children: /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, { type: "tertiary", size: "small", children: /* @__PURE__ */ jsxRuntime.exports.jsx(Icon, { src: MoreEllipsis316BoldBlueIcon }) })
7021
- }
7022
- ),
7023
- visible ? /* @__PURE__ */ jsxRuntime.exports.jsx(kit.modal, { ...modalProps }) : null
7024
- ] });
7025
- }
7026
- globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
7027
- function adopt(value) {
7028
- return value instanceof P ? value : new P(function(resolve) {
7029
- resolve(value);
7030
- });
7031
- }
7032
- return new (P || (P = Promise))(function(resolve, reject) {
7033
- function fulfilled(value) {
7034
- try {
7035
- step(generator.next(value));
7036
- } catch (e) {
7037
- reject(e);
7038
- }
7039
- }
7040
- function rejected(value) {
7041
- try {
7042
- step(generator["throw"](value));
7043
- } catch (e) {
7044
- reject(e);
6931
+ var cx = function cx2() {
6932
+ const presentClassNames = Array.prototype.slice.call(arguments).filter(Boolean);
6933
+ const atomicClasses = {};
6934
+ const nonAtomicClasses = [];
6935
+ presentClassNames.forEach((arg) => {
6936
+ const individualClassNames = arg ? arg.split(" ") : [];
6937
+ individualClassNames.forEach((className) => {
6938
+ if (className.startsWith("atm_")) {
6939
+ const [, keyHash] = className.split("_");
6940
+ atomicClasses[keyHash] = className;
6941
+ } else {
6942
+ nonAtomicClasses.push(className);
7045
6943
  }
7046
- }
7047
- function step(result) {
7048
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
7049
- }
7050
- step((generator = generator.apply(thisArg, _arguments || [])).next());
7051
- });
7052
- };
7053
- function useEventCallback(fn) {
7054
- const ref = useRef(() => {
7055
- throw new Error("Cannot call an event handler while rendering.");
7056
- });
7057
- useIsomorphicLayoutEffect(() => {
7058
- ref.current = fn;
7059
- }, [fn]);
7060
- return useCallback((...args) => ref.current(...args), [ref]);
7061
- }
7062
- function useEventListener(eventName, handler, element, options) {
7063
- const savedHandler = useRef(handler);
7064
- useIsomorphicLayoutEffect(() => {
7065
- savedHandler.current = handler;
7066
- }, [handler]);
7067
- useEffect(() => {
7068
- var _a;
7069
- const targetElement = (_a = element === null || element === void 0 ? void 0 : element.current) !== null && _a !== void 0 ? _a : window;
7070
- if (!(targetElement && targetElement.addEventListener))
7071
- return;
7072
- const listener = (event) => savedHandler.current(event);
7073
- targetElement.addEventListener(eventName, listener, options);
7074
- return () => {
7075
- targetElement.removeEventListener(eventName, listener, options);
7076
- };
7077
- }, [eventName, element, options]);
7078
- }
7079
- globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
7080
- function adopt(value) {
7081
- return value instanceof P ? value : new P(function(resolve) {
7082
- resolve(value);
7083
6944
  });
7084
- }
7085
- return new (P || (P = Promise))(function(resolve, reject) {
7086
- function fulfilled(value) {
7087
- try {
7088
- step(generator.next(value));
7089
- } catch (e) {
7090
- reject(e);
7091
- }
7092
- }
7093
- function rejected(value) {
7094
- try {
7095
- step(generator["throw"](value));
7096
- } catch (e) {
7097
- reject(e);
7098
- }
7099
- }
7100
- function step(result) {
7101
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
7102
- }
7103
- step((generator = generator.apply(thisArg, _arguments || [])).next());
7104
- });
7105
- };
7106
- const useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
7107
- function useLocalStorage(key, initialValue) {
7108
- const readValue = useCallback(() => {
7109
- if (typeof window === "undefined") {
7110
- return initialValue;
7111
- }
7112
- try {
7113
- const item = window.localStorage.getItem(key);
7114
- return item ? parseJSON(item) : initialValue;
7115
- } catch (error) {
7116
- console.warn(`Error reading localStorage key \u201C${key}\u201D:`, error);
7117
- return initialValue;
7118
- }
7119
- }, [initialValue, key]);
7120
- const [storedValue, setStoredValue] = useState(readValue);
7121
- const setValue = useEventCallback((value) => {
7122
- if (typeof window === "undefined") {
7123
- console.warn(`Tried setting localStorage key \u201C${key}\u201D even though environment is not a client`);
7124
- }
7125
- try {
7126
- const newValue = value instanceof Function ? value(storedValue) : value;
7127
- window.localStorage.setItem(key, JSON.stringify(newValue));
7128
- setStoredValue(newValue);
7129
- window.dispatchEvent(new Event("local-storage"));
7130
- } catch (error) {
7131
- console.warn(`Error setting localStorage key \u201C${key}\u201D:`, error);
7132
- }
7133
6945
  });
7134
- useEffect(() => {
7135
- setStoredValue(readValue());
7136
- }, []);
7137
- const handleStorageChange = useCallback((event) => {
7138
- if ((event === null || event === void 0 ? void 0 : event.key) && event.key !== key) {
7139
- return;
6946
+ const result = [];
6947
+ for (const keyHash in atomicClasses) {
6948
+ if (Object.prototype.hasOwnProperty.call(atomicClasses, keyHash)) {
6949
+ result.push(atomicClasses[keyHash]);
7140
6950
  }
7141
- setStoredValue(readValue());
7142
- }, [key, readValue]);
7143
- useEventListener("storage", handleStorageChange);
7144
- useEventListener("local-storage", handleStorageChange);
7145
- return [storedValue, setValue];
7146
- }
7147
- function parseJSON(value) {
7148
- try {
7149
- return value === "undefined" ? void 0 : JSON.parse(value !== null && value !== void 0 ? value : "");
7150
- } catch (_a) {
7151
- console.log("parsing error on", { value });
7152
- return void 0;
7153
6951
  }
7154
- }
7155
- const NS_STORE_KEY = "namespace-filter";
7156
- const ALL_NS = "_all";
7157
- const useNamespacesFilter = () => {
7158
- const [value] = useLocalStorage(NS_STORE_KEY, ALL_NS);
7159
- return {
7160
- value
7161
- };
6952
+ result.push(...nonAtomicClasses);
6953
+ return result.join(" ");
7162
6954
  };
7163
- const NamespacesFilter = () => {
6955
+ var cx_default = cx;
6956
+ const index_86mllf = "";
6957
+ const MoreTriggerStyle = "m1u1f5zp";
6958
+ const ImageNames = ({
6959
+ value
6960
+ }) => {
7164
6961
  const kit = useUIKit();
7165
- const { t } = useTranslation();
7166
- const { data: data2 } = useList({
7167
- resource: "namespaces",
7168
- meta: {
7169
- resourceBasePath: "/api/v1",
7170
- kind: "Namespace"
7171
- }
7172
- });
7173
- const [value, setValue] = useLocalStorage(NS_STORE_KEY, ALL_NS);
7174
- return /* @__PURE__ */ jsxRuntime.exports.jsxs(
7175
- kit.select,
7176
- {
7177
- input: {
7178
- value,
7179
- onChange(value2) {
7180
- setValue(value2);
7181
- }
7182
- },
7183
- children: [
7184
- /* @__PURE__ */ jsxRuntime.exports.jsx(kit.option, { value: "_all", children: t("dovetail.all_namespaces") }, "_all"),
7185
- data2 == null ? void 0 : data2.data.map((namespace2) => {
7186
- const { name: name2 } = namespace2.metadata;
7187
- return /* @__PURE__ */ jsxRuntime.exports.jsx(kit.option, { value: name2, children: name2 }, name2);
6962
+ const {
6963
+ t
6964
+ } = useTranslation();
6965
+ return /* @__PURE__ */ jsxRuntime.exports.jsxs("div", {
6966
+ children: [/* @__PURE__ */ jsxRuntime.exports.jsx("div", {
6967
+ children: value[0]
6968
+ }), value.length > 1 && /* @__PURE__ */ jsxRuntime.exports.jsx(kit.tooltip, {
6969
+ title: /* @__PURE__ */ jsxRuntime.exports.jsx(jsxRuntime.exports.Fragment, {
6970
+ children: value.slice(1).map((name2, index) => {
6971
+ return /* @__PURE__ */ jsxRuntime.exports.jsx("div", {
6972
+ children: name2
6973
+ }, index);
7188
6974
  })
7189
- ]
7190
- }
7191
- );
6975
+ }),
6976
+ children: /* @__PURE__ */ jsxRuntime.exports.jsxs("div", {
6977
+ className: cx_default(Typo.Label.l4_regular, MoreTriggerStyle),
6978
+ children: ["+", value.length - 1, " ", t("dovetail.more")]
6979
+ })
6980
+ })]
6981
+ });
7192
6982
  };
7193
- var ColumnKeys = /* @__PURE__ */ ((ColumnKeys2) => {
7194
- ColumnKeys2["age"] = "age";
7195
- ColumnKeys2["name"] = "name";
7196
- ColumnKeys2["namespace"] = "namespace";
7197
- ColumnKeys2["phase"] = "phase";
7198
- ColumnKeys2["replicas"] = "replicas";
7199
- ColumnKeys2["deploymentImage"] = "deploymentImage";
7200
- ColumnKeys2["podImage"] = "podImage";
7201
- return ColumnKeys2;
7202
- })(ColumnKeys || {});
7203
- const useEagleTable = (params) => {
7204
- var _a;
7205
- const { columns, tableProps, formatter, Dropdown = K8sDropdown } = params;
7206
- const [selectedKeys, setSelectedKeys] = useState([]);
7207
- const [currentPage, setCurrentPage] = useState((tableProps == null ? void 0 : tableProps.currentPage) || 1);
7208
- const { value: nsFilter } = useNamespacesFilter();
7209
- const useTableParams = useMemo(() => {
7210
- const mergedParams = merge(params.useTableParams, {
7211
- filters: {
7212
- permanent: [
7213
- {
7214
- field: "metadata.namespace",
7215
- operator: "eq",
7216
- value: nsFilter === ALL_NS ? null : nsFilter
7217
- }
7218
- ]
7219
- }
7220
- });
7221
- return mergedParams;
7222
- }, [params.useTableParams, nsFilter]);
7223
- const table = useTable(useTableParams);
7224
- const onPageChange = useCallback(
7225
- (page) => {
7226
- setCurrentPage(page);
7227
- },
7228
- [setCurrentPage]
7229
- );
7230
- const actionColumn = {
7231
- key: "action",
7232
- display: true,
7233
- dataIndex: [],
7234
- title: () => /* @__PURE__ */ jsxRuntime.exports.jsx(Icon, { src: SettingsGear16GradientGrayIcon }),
7235
- render: (_2, record) => {
7236
- return /* @__PURE__ */ jsxRuntime.exports.jsx(Dropdown, { data: record });
7237
- }
7238
- };
7239
- const finalDataSource = (_a = table.tableQueryResult.data) == null ? void 0 : _a.data.map(formatter);
7240
- const finalProps = {
7241
- loading: table.tableQueryResult.isLoading,
7242
- dataSource: finalDataSource || [],
7243
- columns: [...columns, actionColumn],
7244
- refetch: () => null,
7245
- error: false,
7246
- rowKey: "id",
7247
- currentPage,
7248
- currentSize: (tableProps == null ? void 0 : tableProps.currentSize) || 5,
7249
- onPageChange,
7250
- onSelect: (keys) => {
7251
- setSelectedKeys(keys);
7252
- }
6983
+ const StateTag = ({ state: state2 }) => {
6984
+ const kit = useUIKit();
6985
+ const colorMap = {
6986
+ running: "green",
6987
+ active: "green",
6988
+ succeeded: "blue",
6989
+ terminated: "red",
6990
+ pending: "gray"
7253
6991
  };
7254
- return { tableProps: finalProps, selectedKeys, ...table };
6992
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(kit.tag, { color: colorMap[(state2 == null ? void 0 : state2.toLowerCase()) || ""] || "green", children: state2 || "Active" });
7255
6993
  };
7256
- var cx = function cx2() {
7257
- const presentClassNames = Array.prototype.slice.call(arguments).filter(Boolean);
7258
- const atomicClasses = {};
7259
- const nonAtomicClasses = [];
7260
- presentClassNames.forEach((arg) => {
7261
- const individualClassNames = arg ? arg.split(" ") : [];
7262
- individualClassNames.forEach((className) => {
7263
- if (className.startsWith("atm_")) {
7264
- const [, keyHash] = className.split("_");
7265
- atomicClasses[keyHash] = className;
6994
+ var dayjs_min = { exports: {} };
6995
+ (function(module, exports) {
6996
+ !function(t, e) {
6997
+ module.exports = e();
6998
+ }(commonjsGlobal, function() {
6999
+ var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f2 = "quarter", h = "year", d2 = "date", l = "Invalid Date", $2 = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y2 = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M2 = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
7000
+ var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
7001
+ return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
7002
+ } }, m = function(t2, e2, n2) {
7003
+ var r2 = String(t2);
7004
+ return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
7005
+ }, v2 = { s: m, z: function(t2) {
7006
+ var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
7007
+ return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
7008
+ }, m: function t2(e2, n2) {
7009
+ if (e2.date() < n2.date())
7010
+ return -t2(n2, e2);
7011
+ var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
7012
+ return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
7013
+ }, a: function(t2) {
7014
+ return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
7015
+ }, p: function(t2) {
7016
+ return { M: c, y: h, w: o, d: a, D: d2, h: u, m: s, s: i, ms: r, Q: f2 }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
7017
+ }, u: function(t2) {
7018
+ return void 0 === t2;
7019
+ } }, g = "en", D2 = {};
7020
+ D2[g] = M2;
7021
+ var p = "$isDayjsObject", S2 = function(t2) {
7022
+ return t2 instanceof _2 || !(!t2 || !t2[p]);
7023
+ }, w2 = function t2(e2, n2, r2) {
7024
+ var i2;
7025
+ if (!e2)
7026
+ return g;
7027
+ if ("string" == typeof e2) {
7028
+ var s2 = e2.toLowerCase();
7029
+ D2[s2] && (i2 = s2), n2 && (D2[s2] = n2, i2 = s2);
7030
+ var u2 = e2.split("-");
7031
+ if (!i2 && u2.length > 1)
7032
+ return t2(u2[0]);
7266
7033
  } else {
7267
- nonAtomicClasses.push(className);
7268
- }
7269
- });
7270
- });
7271
- const result = [];
7272
- for (const keyHash in atomicClasses) {
7273
- if (Object.prototype.hasOwnProperty.call(atomicClasses, keyHash)) {
7274
- result.push(atomicClasses[keyHash]);
7275
- }
7276
- }
7277
- result.push(...nonAtomicClasses);
7278
- return result.join(" ");
7279
- };
7280
- var cx_default = cx;
7281
- const index_hex8jv = "";
7282
- const BreadcrumbStyle = "b142d7q8";
7283
- function Breadcrumb(props) {
7284
- const {
7285
- breadcrumbs
7286
- } = useBreadcrumb();
7287
- return /* @__PURE__ */ jsxRuntime.exports.jsx("ul", {
7288
- className: cx_default(BreadcrumbStyle, props.className),
7289
- children: breadcrumbs.map((breadcrumb) => {
7290
- return /* @__PURE__ */ jsxRuntime.exports.jsx("li", {
7291
- className: "breadcrumb-item",
7292
- children: breadcrumb.href ? /* @__PURE__ */ jsxRuntime.exports.jsx(Link, {
7293
- to: breadcrumb.href,
7294
- children: breadcrumb.label
7295
- }) : /* @__PURE__ */ jsxRuntime.exports.jsx("span", {
7296
- children: breadcrumb.label
7297
- })
7298
- }, `breadcrumb-${breadcrumb.label}`);
7299
- })
7300
- });
7301
- }
7302
- function NameInputWidget(props) {
7303
- const kit = useUIKit();
7304
- const { action } = useResource();
7305
- return /* @__PURE__ */ jsxRuntime.exports.jsx(kit.input, { ...props, disabled: action === "edit" });
7306
- }
7307
- const dnsSubDomainRules = [
7308
- {
7309
- required: true,
7310
- message: "\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"
7311
- },
7312
- {
7313
- pattern: /^[a-z0-9]([-.a-z0-9]*[a-z0-9])?$/,
7314
- message: "\u540D\u79F0\u53EA\u80FD\u5305\u542B\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\uFF0C\u4EE5\u53CA '-' \u548C '.'\uFF0C\u4E14\u5FC5\u987B\u4EE5\u5B57\u6BCD\u6216\u6570\u5B57\u5F00\u5934\u548C\u7ED3\u675F"
7315
- },
7316
- {
7317
- max: 253,
7318
- message: "\u540D\u79F0\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7253\u4E2A\u5B57\u7B26"
7319
- }
7320
- ];
7321
- const rfc1123LabelRules = [
7322
- {
7323
- required: true,
7324
- message: "\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"
7325
- },
7326
- {
7327
- pattern: /^[a-z0-9]([-a-z0-9]*[a-z0-9])?$/,
7328
- message: "\u540D\u79F0\u53EA\u80FD\u5305\u542B\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\uFF0C\u4EE5\u53CA '-'\uFF0C\u4E14\u4EE5\u5B57\u6BCD\u6216\u6570\u5B57\u5F00\u5934\u548C\u7ED3\u675F"
7329
- },
7330
- {
7331
- max: 63,
7332
- message: "\u540D\u79F0\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC763\u4E2A\u5B57\u7B26"
7333
- }
7334
- ];
7335
- const rfc1035LabelRules = [
7336
- {
7337
- required: true,
7338
- message: "\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"
7339
- },
7340
- {
7341
- pattern: /^[a-z]([-a-z0-9]*[a-z0-9])?$/,
7342
- message: "\u540D\u79F0\u53EA\u80FD\u5305\u542B\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\uFF0C\u4EE5\u53CA '-'\uFF0C\u4E14\u4EE5\u5B57\u6BCD\u5F00\u5934\uFF0C\u5B57\u6BCD\u6216\u6570\u5B57\u7ED3\u675F"
7343
- },
7344
- {
7345
- max: 63,
7346
- message: "\u540D\u79F0\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC763\u4E2A\u5B57\u7B26"
7347
- }
7348
- ];
7349
- function NamespaceSelectWidget(props) {
7350
- const kit = useUIKit();
7351
- const { action } = useResource();
7352
- const { data: data2 } = useList({
7353
- resource: "namespaces",
7354
- meta: {
7355
- resourceBasePath: "/api/v1",
7356
- kind: "Namespace"
7357
- }
7358
- });
7359
- return /* @__PURE__ */ jsxRuntime.exports.jsx(kit.select, { input: props, disabled: action === "edit", children: data2 == null ? void 0 : data2.data.map((namespace2) => /* @__PURE__ */ jsxRuntime.exports.jsx(kit.option, { value: namespace2.metadata.name, children: namespace2.metadata.name }, namespace2.metadata.name)) });
7360
- }
7361
- const namespaceRules = [
7362
- {
7363
- required: true,
7364
- message: "Please input the namespace."
7365
- }
7366
- ];
7367
- function KeyValueInput(props) {
7368
- const { children, item } = props;
7369
- const kit = useUIKit();
7370
- const onKeyChange = useCallback(
7371
- (event) => {
7372
- var _a;
7373
- const key = event.target.value;
7374
- (_a = props.onChange) == null ? void 0 : _a.call(props, {
7375
- ...item,
7376
- key
7377
- });
7378
- },
7379
- [item, props]
7380
- );
7381
- const onValueChange = useCallback(
7382
- (event) => {
7383
- var _a;
7384
- console.log(event);
7385
- const value = event.target.value;
7386
- (_a = props.onChange) == null ? void 0 : _a.call(props, {
7387
- ...item,
7388
- value
7389
- });
7390
- },
7391
- [item, props]
7392
- );
7393
- return /* @__PURE__ */ jsxRuntime.exports.jsxs(kit.space, { children: [
7394
- /* @__PURE__ */ jsxRuntime.exports.jsx(kit.input, { value: item.key, onChange: onKeyChange }),
7395
- /* @__PURE__ */ jsxRuntime.exports.jsx(kit.textArea, { value: item.value, onChange: onValueChange }),
7396
- children
7397
- ] });
7398
- }
7399
- function KeyValueListWidget(props) {
7400
- const kit = useUIKit();
7401
- const { value } = props;
7402
- const items = useMemo(() => {
7403
- return Object.entries(value || {}).map(([key, value2]) => ({
7404
- key,
7405
- value: value2
7406
- }));
7407
- }, [value]);
7408
- const onChange = useCallback(
7409
- (newItems) => {
7410
- var _a;
7411
- const newValue = newItems.reduce((result, item) => {
7412
- result[item.key] = item.value;
7413
- return result;
7414
- }, {});
7415
- (_a = props.onChange) == null ? void 0 : _a.call(props, newValue);
7416
- },
7417
- [props]
7418
- );
7419
- const onRemove = useCallback(
7420
- (index) => {
7421
- const result = [...items];
7422
- result.splice(index, 1);
7423
- onChange(result);
7424
- },
7425
- [onChange, items]
7426
- );
7427
- const onAdd = useCallback(() => {
7428
- onChange([...items, { key: "", value: "" }]);
7429
- }, [onChange, items]);
7430
- return /* @__PURE__ */ jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment, { children: [
7431
- items.map((item, index) => {
7432
- return /* @__PURE__ */ jsxRuntime.exports.jsx(
7433
- KeyValueInput,
7434
- {
7435
- item,
7436
- onChange: (newItem) => {
7437
- console.log(newItem);
7438
- const temp = [...items];
7439
- temp.splice(index, 1, newItem);
7440
- onChange(temp);
7441
- },
7442
- children: /* @__PURE__ */ jsxRuntime.exports.jsx(
7443
- kit.button,
7444
- {
7445
- onClick: () => {
7446
- onRemove(index);
7447
- },
7448
- danger: true,
7449
- children: "Remove"
7450
- }
7451
- )
7452
- },
7453
- index
7454
- );
7455
- }),
7456
- /* @__PURE__ */ jsxRuntime.exports.jsx(kit.form.Item, { children: /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, { type: "primary", onClick: onAdd, children: "Add" }) })
7457
- ] });
7458
- }
7459
- function MetadataForm() {
7460
- const kit = useUIKit();
7461
- return /* @__PURE__ */ jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment, { children: [
7462
- /* @__PURE__ */ jsxRuntime.exports.jsx(kit.form.Item, { label: "Name", name: ["metadata", "name"], rules: rfc1123LabelRules, children: /* @__PURE__ */ jsxRuntime.exports.jsx(NameInputWidget, {}) }),
7463
- /* @__PURE__ */ jsxRuntime.exports.jsx(
7464
- kit.form.Item,
7465
- {
7466
- label: "Namespace",
7467
- name: ["metadata", "namespace"],
7468
- rules: namespaceRules,
7469
- children: /* @__PURE__ */ jsxRuntime.exports.jsx(NamespaceSelectWidget, {})
7470
- }
7471
- ),
7472
- /* @__PURE__ */ jsxRuntime.exports.jsx(kit.form.Item, { name: ["metadata", "labels"], label: "Labels", children: /* @__PURE__ */ jsxRuntime.exports.jsx(KeyValueListWidget, {}) }),
7473
- /* @__PURE__ */ jsxRuntime.exports.jsx(kit.form.Item, { name: ["metadata", "annotations"], label: "Annotations", children: /* @__PURE__ */ jsxRuntime.exports.jsx(KeyValueListWidget, {}) })
7474
- ] });
7475
- }
7476
- function addId(arr, idKey) {
7477
- return arr.map((e) => {
7478
- return {
7479
- id: e[idKey],
7480
- ...e
7481
- };
7482
- });
7483
- }
7484
- var dayjs_min = { exports: {} };
7485
- (function(module, exports) {
7486
- !function(t, e) {
7487
- module.exports = e();
7488
- }(commonjsGlobal, function() {
7489
- var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f2 = "quarter", h = "year", d2 = "date", l = "Invalid Date", $2 = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y2 = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M2 = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
7490
- var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
7491
- return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
7492
- } }, m = function(t2, e2, n2) {
7493
- var r2 = String(t2);
7494
- return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
7495
- }, v2 = { s: m, z: function(t2) {
7496
- var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
7497
- return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
7498
- }, m: function t2(e2, n2) {
7499
- if (e2.date() < n2.date())
7500
- return -t2(n2, e2);
7501
- var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
7502
- return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
7503
- }, a: function(t2) {
7504
- return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
7505
- }, p: function(t2) {
7506
- return { M: c, y: h, w: o, d: a, D: d2, h: u, m: s, s: i, ms: r, Q: f2 }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
7507
- }, u: function(t2) {
7508
- return void 0 === t2;
7509
- } }, g = "en", D2 = {};
7510
- D2[g] = M2;
7511
- var p = "$isDayjsObject", S2 = function(t2) {
7512
- return t2 instanceof _2 || !(!t2 || !t2[p]);
7513
- }, w2 = function t2(e2, n2, r2) {
7514
- var i2;
7515
- if (!e2)
7516
- return g;
7517
- if ("string" == typeof e2) {
7518
- var s2 = e2.toLowerCase();
7519
- D2[s2] && (i2 = s2), n2 && (D2[s2] = n2, i2 = s2);
7520
- var u2 = e2.split("-");
7521
- if (!i2 && u2.length > 1)
7522
- return t2(u2[0]);
7523
- } else {
7524
- var a2 = e2.name;
7525
- D2[a2] = e2, i2 = a2;
7034
+ var a2 = e2.name;
7035
+ D2[a2] = e2, i2 = a2;
7526
7036
  }
7527
7037
  return !r2 && i2 && (g = i2), i2 || !r2 && g;
7528
7038
  }, O = function(t2, e2) {
@@ -7800,7 +7310,742 @@ const Time = (props) => {
7800
7310
  time.format(timeTemplate)
7801
7311
  ] })
7802
7312
  ] });
7803
- };
7313
+ };
7314
+ const index_1wf16rt = "";
7315
+ const MinusButtonStyle = "m8ychfk";
7316
+ const PlusButtonStyle = "p1o004do";
7317
+ const WorkloadReplicas = ({
7318
+ record
7319
+ }) => {
7320
+ const kit = useUIKit();
7321
+ const {
7322
+ resource
7323
+ } = useResource();
7324
+ const {
7325
+ mutate
7326
+ } = useUpdate();
7327
+ const readyReplicas = record.status && "readyReplicas" in record.status ? record.status.readyReplicas : 0;
7328
+ const replicas2 = record.status && "replicas" in record.status ? record.status.replicas : 0;
7329
+ const canScale = record.kind === "Deployment" || record.kind === "StatefulSet";
7330
+ const currentReplicas = get(record, "spec.replicas", 0);
7331
+ const scale = (delta) => {
7332
+ const v2 = record.scale(currentReplicas + delta);
7333
+ const id = v2.id;
7334
+ pruneBeforeEdit(v2);
7335
+ mutate({
7336
+ id,
7337
+ resource: (resource == null ? void 0 : resource.name) || "",
7338
+ values: v2
7339
+ });
7340
+ };
7341
+ return /* @__PURE__ */ jsxRuntime.exports.jsxs("span", {
7342
+ children: [canScale && /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, {
7343
+ className: MinusButtonStyle,
7344
+ type: "ordinary",
7345
+ size: "small",
7346
+ onClick: () => scale(-1),
7347
+ children: "-"
7348
+ }), readyReplicas, "/", replicas2, canScale && /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, {
7349
+ className: PlusButtonStyle,
7350
+ type: "ordinary",
7351
+ size: "small",
7352
+ onClick: () => scale(1),
7353
+ children: "+"
7354
+ })]
7355
+ });
7356
+ };
7357
+ const NameLink = (props) => {
7358
+ var _a;
7359
+ const { name: name2, id, resource } = props;
7360
+ const kit = useUIKit();
7361
+ const go = useGo();
7362
+ const navigation = useNavigation();
7363
+ const parsed = useParsed();
7364
+ const resourceName = resource || ((_a = parsed.resource) == null ? void 0 : _a.name) || "";
7365
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(
7366
+ kit.button,
7367
+ {
7368
+ type: "link",
7369
+ onClick: () => {
7370
+ go({
7371
+ to: navigation.showUrl(resourceName, ""),
7372
+ query: {
7373
+ id
7374
+ }
7375
+ });
7376
+ },
7377
+ children: name2
7378
+ }
7379
+ );
7380
+ };
7381
+ const CommonSorter = (dataIndex) => (a, b2) => {
7382
+ const valA = lodash.exports.get(a, dataIndex);
7383
+ const valB = lodash.exports.get(b2, dataIndex);
7384
+ if (valA === valB)
7385
+ return 0;
7386
+ if (valA > valB)
7387
+ return 1;
7388
+ return -1;
7389
+ };
7390
+ const NameColumnRenderer = (i18n2, resource = "") => {
7391
+ const dataIndex = ["metadata", "name"];
7392
+ return {
7393
+ key: "name",
7394
+ display: true,
7395
+ dataIndex,
7396
+ title: i18n2.t("name"),
7397
+ sortable: true,
7398
+ sorter: CommonSorter(dataIndex),
7399
+ render: (v2, record) => {
7400
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(NameLink, { name: v2, id: record.id, resource });
7401
+ }
7402
+ };
7403
+ };
7404
+ const NameSpaceColumnRenderer = (i18n2) => {
7405
+ const dataIndex = ["metadata", "namespace"];
7406
+ return {
7407
+ key: "namespace",
7408
+ display: true,
7409
+ dataIndex,
7410
+ title: i18n2.t("namespace"),
7411
+ sortable: true,
7412
+ sorter: CommonSorter(dataIndex)
7413
+ };
7414
+ };
7415
+ const PhaseColumnRenderer = (i18n2) => {
7416
+ const dataIndex = ["status", "phase"];
7417
+ return {
7418
+ key: "phase",
7419
+ display: true,
7420
+ dataIndex,
7421
+ title: i18n2.t("phase"),
7422
+ sortable: true,
7423
+ sorter: CommonSorter(dataIndex),
7424
+ render: (v2) => /* @__PURE__ */ jsxRuntime.exports.jsx(StateTag, { state: v2 })
7425
+ };
7426
+ };
7427
+ const WorkloadImageColumnRenderer = (i18n2) => {
7428
+ const dataIndex = ["imageNames"];
7429
+ return {
7430
+ key: "image",
7431
+ display: true,
7432
+ dataIndex,
7433
+ title: i18n2.t("image"),
7434
+ sortable: true,
7435
+ sorter: CommonSorter(dataIndex),
7436
+ render(value) {
7437
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(ImageNames, { value });
7438
+ }
7439
+ };
7440
+ };
7441
+ const ReplicasColumnRenderer = (i18n2) => {
7442
+ const dataIndex = ["status", "replicas"];
7443
+ return {
7444
+ key: "replicas",
7445
+ display: true,
7446
+ dataIndex,
7447
+ title: i18n2.t("replicas"),
7448
+ sortable: true,
7449
+ sorter: CommonSorter(dataIndex),
7450
+ render: (_2, record) => {
7451
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(WorkloadReplicas, { record });
7452
+ }
7453
+ };
7454
+ };
7455
+ const AgeColumnRenderer = (i18n2) => {
7456
+ const dataIndex = ["metadata", "creationTimestamp"];
7457
+ return {
7458
+ key: "creationTimestamp",
7459
+ display: true,
7460
+ dataIndex,
7461
+ title: i18n2.t("created_time"),
7462
+ sortable: true,
7463
+ sorter: (a, b2) => {
7464
+ const valA = new Date(lodash.exports.get(a, dataIndex));
7465
+ const valB = new Date(lodash.exports.get(b2, dataIndex));
7466
+ if (valA === valB)
7467
+ return 0;
7468
+ if (valA > valB)
7469
+ return 1;
7470
+ return -1;
7471
+ },
7472
+ render: (value) => {
7473
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(Time, { date: new Date(value) });
7474
+ }
7475
+ };
7476
+ };
7477
+ const NodeNameColumnRenderer = (i18n2) => {
7478
+ const dataIndex = ["spec", "nodeName"];
7479
+ return {
7480
+ key: "node",
7481
+ display: true,
7482
+ dataIndex,
7483
+ title: i18n2.t("node_name"),
7484
+ sortable: true,
7485
+ sorter: CommonSorter(dataIndex)
7486
+ };
7487
+ };
7488
+ const RestartCountColumnRenderer = (i18n2) => {
7489
+ const dataIndex = ["restartCount"];
7490
+ return {
7491
+ key: "restartCount",
7492
+ display: true,
7493
+ dataIndex,
7494
+ title: i18n2.t("restarts"),
7495
+ sortable: true,
7496
+ sorter: CommonSorter(dataIndex)
7497
+ };
7498
+ };
7499
+ const CompletionsCountColumnRenderer = (i18n2) => {
7500
+ const dataIndex = ["completionsDisplay"];
7501
+ return {
7502
+ key: "completions",
7503
+ display: true,
7504
+ dataIndex,
7505
+ title: i18n2.t("completions"),
7506
+ sortable: true,
7507
+ sorter: CommonSorter(dataIndex)
7508
+ };
7509
+ };
7510
+ const DurationColumnRenderer = (i18n2) => {
7511
+ const dataIndex = ["durationDisplay"];
7512
+ return {
7513
+ key: "duration",
7514
+ display: true,
7515
+ dataIndex,
7516
+ title: i18n2.t("duration"),
7517
+ sortable: true,
7518
+ sorter: CommonSorter(dataIndex)
7519
+ };
7520
+ };
7521
+ function download(filename, content) {
7522
+ const element = document.createElement("a");
7523
+ element.setAttribute(
7524
+ "href",
7525
+ "data:text/plain;charset=utf-8," + encodeURIComponent(content)
7526
+ );
7527
+ element.setAttribute("download", filename);
7528
+ element.style.display = "none";
7529
+ document.body.appendChild(element);
7530
+ element.click();
7531
+ document.body.removeChild(element);
7532
+ }
7533
+ function useDownloadYAML() {
7534
+ return function(options) {
7535
+ const { name: name2, item } = options;
7536
+ const content = yaml.dump(item);
7537
+ download(`${name2}.yaml`, content);
7538
+ };
7539
+ }
7540
+ function useEdit() {
7541
+ const { resource } = useParsed();
7542
+ const go = useGo();
7543
+ const edit2 = useCallback(
7544
+ (id) => {
7545
+ go({
7546
+ to: `/${resource == null ? void 0 : resource.name}/edit`,
7547
+ query: {
7548
+ id
7549
+ }
7550
+ });
7551
+ },
7552
+ [go, resource == null ? void 0 : resource.name]
7553
+ );
7554
+ return { edit: edit2 };
7555
+ }
7556
+ function K8sDropdown(props) {
7557
+ const { data: data2 } = props;
7558
+ const kit = useUIKit();
7559
+ const useResourceResult = useResource();
7560
+ const resource = useResourceResult.resource;
7561
+ const { edit: edit2 } = useEdit();
7562
+ const { modalProps, visible, openDeleteConfirmModal } = useDeleteModal(
7563
+ (resource == null ? void 0 : resource.name) || ""
7564
+ );
7565
+ const download2 = useDownloadYAML();
7566
+ const { t } = useTranslation();
7567
+ return /* @__PURE__ */ jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment, { children: [
7568
+ /* @__PURE__ */ jsxRuntime.exports.jsx(
7569
+ kit.dropdown,
7570
+ {
7571
+ overlay: /* @__PURE__ */ jsxRuntime.exports.jsxs(kit.menu, { children: [
7572
+ /* @__PURE__ */ jsxRuntime.exports.jsx(
7573
+ kit.menuItem,
7574
+ {
7575
+ onClick: () => {
7576
+ if (data2.id) {
7577
+ edit2(data2.id);
7578
+ }
7579
+ },
7580
+ children: /* @__PURE__ */ jsxRuntime.exports.jsx(Icon, { src: EditPen16PrimaryIcon, children: t("edit") })
7581
+ }
7582
+ ),
7583
+ /* @__PURE__ */ jsxRuntime.exports.jsx(
7584
+ kit.menuItem,
7585
+ {
7586
+ danger: true,
7587
+ onClick: () => {
7588
+ openDeleteConfirmModal(data2.id);
7589
+ },
7590
+ children: /* @__PURE__ */ jsxRuntime.exports.jsx(Icon, { src: TrashBinDelete16Icon, children: t("delete") })
7591
+ }
7592
+ ),
7593
+ /* @__PURE__ */ jsxRuntime.exports.jsx(
7594
+ kit.menu.Item,
7595
+ {
7596
+ onClick: () => {
7597
+ var _a;
7598
+ if (data2.id) {
7599
+ download2({
7600
+ name: ((_a = data2.metadata) == null ? void 0 : _a.name) || data2.kind || "",
7601
+ item: data2
7602
+ });
7603
+ }
7604
+ },
7605
+ children: /* @__PURE__ */ jsxRuntime.exports.jsx(Icon, { src: Download16GradientBlueIcon, children: t("download_yaml") })
7606
+ }
7607
+ ),
7608
+ props.children
7609
+ ] }),
7610
+ children: /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, { type: "tertiary", size: "small", children: /* @__PURE__ */ jsxRuntime.exports.jsx(Icon, { src: MoreEllipsis316BoldBlueIcon }) })
7611
+ }
7612
+ ),
7613
+ visible ? /* @__PURE__ */ jsxRuntime.exports.jsx(kit.modal, { ...modalProps }) : null
7614
+ ] });
7615
+ }
7616
+ globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
7617
+ function adopt(value) {
7618
+ return value instanceof P ? value : new P(function(resolve) {
7619
+ resolve(value);
7620
+ });
7621
+ }
7622
+ return new (P || (P = Promise))(function(resolve, reject) {
7623
+ function fulfilled(value) {
7624
+ try {
7625
+ step(generator.next(value));
7626
+ } catch (e) {
7627
+ reject(e);
7628
+ }
7629
+ }
7630
+ function rejected(value) {
7631
+ try {
7632
+ step(generator["throw"](value));
7633
+ } catch (e) {
7634
+ reject(e);
7635
+ }
7636
+ }
7637
+ function step(result) {
7638
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
7639
+ }
7640
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
7641
+ });
7642
+ };
7643
+ function useEventCallback(fn) {
7644
+ const ref = useRef(() => {
7645
+ throw new Error("Cannot call an event handler while rendering.");
7646
+ });
7647
+ useIsomorphicLayoutEffect(() => {
7648
+ ref.current = fn;
7649
+ }, [fn]);
7650
+ return useCallback((...args) => ref.current(...args), [ref]);
7651
+ }
7652
+ function useEventListener(eventName, handler, element, options) {
7653
+ const savedHandler = useRef(handler);
7654
+ useIsomorphicLayoutEffect(() => {
7655
+ savedHandler.current = handler;
7656
+ }, [handler]);
7657
+ useEffect(() => {
7658
+ var _a;
7659
+ const targetElement = (_a = element === null || element === void 0 ? void 0 : element.current) !== null && _a !== void 0 ? _a : window;
7660
+ if (!(targetElement && targetElement.addEventListener))
7661
+ return;
7662
+ const listener = (event) => savedHandler.current(event);
7663
+ targetElement.addEventListener(eventName, listener, options);
7664
+ return () => {
7665
+ targetElement.removeEventListener(eventName, listener, options);
7666
+ };
7667
+ }, [eventName, element, options]);
7668
+ }
7669
+ globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
7670
+ function adopt(value) {
7671
+ return value instanceof P ? value : new P(function(resolve) {
7672
+ resolve(value);
7673
+ });
7674
+ }
7675
+ return new (P || (P = Promise))(function(resolve, reject) {
7676
+ function fulfilled(value) {
7677
+ try {
7678
+ step(generator.next(value));
7679
+ } catch (e) {
7680
+ reject(e);
7681
+ }
7682
+ }
7683
+ function rejected(value) {
7684
+ try {
7685
+ step(generator["throw"](value));
7686
+ } catch (e) {
7687
+ reject(e);
7688
+ }
7689
+ }
7690
+ function step(result) {
7691
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
7692
+ }
7693
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
7694
+ });
7695
+ };
7696
+ const useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
7697
+ function useLocalStorage(key, initialValue) {
7698
+ const readValue = useCallback(() => {
7699
+ if (typeof window === "undefined") {
7700
+ return initialValue;
7701
+ }
7702
+ try {
7703
+ const item = window.localStorage.getItem(key);
7704
+ return item ? parseJSON(item) : initialValue;
7705
+ } catch (error) {
7706
+ console.warn(`Error reading localStorage key \u201C${key}\u201D:`, error);
7707
+ return initialValue;
7708
+ }
7709
+ }, [initialValue, key]);
7710
+ const [storedValue, setStoredValue] = useState(readValue);
7711
+ const setValue = useEventCallback((value) => {
7712
+ if (typeof window === "undefined") {
7713
+ console.warn(`Tried setting localStorage key \u201C${key}\u201D even though environment is not a client`);
7714
+ }
7715
+ try {
7716
+ const newValue = value instanceof Function ? value(storedValue) : value;
7717
+ window.localStorage.setItem(key, JSON.stringify(newValue));
7718
+ setStoredValue(newValue);
7719
+ window.dispatchEvent(new Event("local-storage"));
7720
+ } catch (error) {
7721
+ console.warn(`Error setting localStorage key \u201C${key}\u201D:`, error);
7722
+ }
7723
+ });
7724
+ useEffect(() => {
7725
+ setStoredValue(readValue());
7726
+ }, []);
7727
+ const handleStorageChange = useCallback((event) => {
7728
+ if ((event === null || event === void 0 ? void 0 : event.key) && event.key !== key) {
7729
+ return;
7730
+ }
7731
+ setStoredValue(readValue());
7732
+ }, [key, readValue]);
7733
+ useEventListener("storage", handleStorageChange);
7734
+ useEventListener("local-storage", handleStorageChange);
7735
+ return [storedValue, setValue];
7736
+ }
7737
+ function parseJSON(value) {
7738
+ try {
7739
+ return value === "undefined" ? void 0 : JSON.parse(value !== null && value !== void 0 ? value : "");
7740
+ } catch (_a) {
7741
+ console.log("parsing error on", { value });
7742
+ return void 0;
7743
+ }
7744
+ }
7745
+ const NS_STORE_KEY = "namespace-filter";
7746
+ const ALL_NS = "_all";
7747
+ const useNamespacesFilter = () => {
7748
+ const [value] = useLocalStorage(NS_STORE_KEY, ALL_NS);
7749
+ return {
7750
+ value
7751
+ };
7752
+ };
7753
+ const NamespacesFilter = () => {
7754
+ const kit = useUIKit();
7755
+ const { t } = useTranslation();
7756
+ const { data: data2 } = useList({
7757
+ resource: "namespaces",
7758
+ meta: {
7759
+ resourceBasePath: "/api/v1",
7760
+ kind: "Namespace"
7761
+ }
7762
+ });
7763
+ const [value, setValue] = useLocalStorage(NS_STORE_KEY, ALL_NS);
7764
+ return /* @__PURE__ */ jsxRuntime.exports.jsxs(
7765
+ kit.select,
7766
+ {
7767
+ input: {
7768
+ value,
7769
+ onChange(value2) {
7770
+ setValue(value2);
7771
+ }
7772
+ },
7773
+ children: [
7774
+ /* @__PURE__ */ jsxRuntime.exports.jsx(kit.option, { value: "_all", children: t("dovetail.all_namespaces") }, "_all"),
7775
+ data2 == null ? void 0 : data2.data.map((namespace2) => {
7776
+ const { name: name2 } = namespace2.metadata;
7777
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(kit.option, { value: name2, children: name2 }, name2);
7778
+ })
7779
+ ]
7780
+ }
7781
+ );
7782
+ };
7783
+ var ColumnKeys = /* @__PURE__ */ ((ColumnKeys2) => {
7784
+ ColumnKeys2["age"] = "age";
7785
+ ColumnKeys2["name"] = "name";
7786
+ ColumnKeys2["namespace"] = "namespace";
7787
+ ColumnKeys2["phase"] = "phase";
7788
+ ColumnKeys2["replicas"] = "replicas";
7789
+ ColumnKeys2["deploymentImage"] = "deploymentImage";
7790
+ ColumnKeys2["podImage"] = "podImage";
7791
+ return ColumnKeys2;
7792
+ })(ColumnKeys || {});
7793
+ const useEagleTable = (params) => {
7794
+ var _a;
7795
+ const { columns, tableProps, formatter, Dropdown = K8sDropdown } = params;
7796
+ const [selectedKeys, setSelectedKeys] = useState([]);
7797
+ const [currentPage, setCurrentPage] = useState((tableProps == null ? void 0 : tableProps.currentPage) || 1);
7798
+ const { value: nsFilter } = useNamespacesFilter();
7799
+ const useTableParams = useMemo(() => {
7800
+ const mergedParams = merge(params.useTableParams, {
7801
+ filters: {
7802
+ permanent: [
7803
+ {
7804
+ field: "metadata.namespace",
7805
+ operator: "eq",
7806
+ value: nsFilter === ALL_NS ? null : nsFilter
7807
+ }
7808
+ ]
7809
+ }
7810
+ });
7811
+ return mergedParams;
7812
+ }, [params.useTableParams, nsFilter]);
7813
+ const table = useTable(useTableParams);
7814
+ const onPageChange = useCallback(
7815
+ (page) => {
7816
+ setCurrentPage(page);
7817
+ },
7818
+ [setCurrentPage]
7819
+ );
7820
+ const actionColumn = {
7821
+ key: "action",
7822
+ display: true,
7823
+ dataIndex: [],
7824
+ title: () => /* @__PURE__ */ jsxRuntime.exports.jsx(Icon, { src: SettingsGear16GradientGrayIcon }),
7825
+ render: (_2, record) => {
7826
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(Dropdown, { data: record });
7827
+ }
7828
+ };
7829
+ const finalDataSource = (_a = table.tableQueryResult.data) == null ? void 0 : _a.data.map(formatter);
7830
+ const finalProps = {
7831
+ loading: table.tableQueryResult.isLoading,
7832
+ dataSource: finalDataSource || [],
7833
+ columns: [...columns, actionColumn],
7834
+ refetch: () => null,
7835
+ error: false,
7836
+ rowKey: "id",
7837
+ currentPage,
7838
+ currentSize: (tableProps == null ? void 0 : tableProps.currentSize) || 5,
7839
+ onPageChange,
7840
+ onSelect: (keys) => {
7841
+ setSelectedKeys(keys);
7842
+ }
7843
+ };
7844
+ return { tableProps: finalProps, selectedKeys, ...table };
7845
+ };
7846
+ const index_hex8jv = "";
7847
+ const BreadcrumbStyle = "b142d7q8";
7848
+ function Breadcrumb(props) {
7849
+ const {
7850
+ breadcrumbs
7851
+ } = useBreadcrumb();
7852
+ return /* @__PURE__ */ jsxRuntime.exports.jsx("ul", {
7853
+ className: cx_default(BreadcrumbStyle, props.className),
7854
+ children: breadcrumbs.map((breadcrumb) => {
7855
+ return /* @__PURE__ */ jsxRuntime.exports.jsx("li", {
7856
+ className: "breadcrumb-item",
7857
+ children: breadcrumb.href ? /* @__PURE__ */ jsxRuntime.exports.jsx(Link, {
7858
+ to: breadcrumb.href,
7859
+ children: breadcrumb.label
7860
+ }) : /* @__PURE__ */ jsxRuntime.exports.jsx("span", {
7861
+ children: breadcrumb.label
7862
+ })
7863
+ }, `breadcrumb-${breadcrumb.label}`);
7864
+ })
7865
+ });
7866
+ }
7867
+ function NameInputWidget(props) {
7868
+ const kit = useUIKit();
7869
+ const { action } = useResource();
7870
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(kit.input, { ...props, disabled: action === "edit" });
7871
+ }
7872
+ const dnsSubDomainRules = [
7873
+ {
7874
+ required: true,
7875
+ message: "\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"
7876
+ },
7877
+ {
7878
+ pattern: /^[a-z0-9]([-.a-z0-9]*[a-z0-9])?$/,
7879
+ message: "\u540D\u79F0\u53EA\u80FD\u5305\u542B\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\uFF0C\u4EE5\u53CA '-' \u548C '.'\uFF0C\u4E14\u5FC5\u987B\u4EE5\u5B57\u6BCD\u6216\u6570\u5B57\u5F00\u5934\u548C\u7ED3\u675F"
7880
+ },
7881
+ {
7882
+ max: 253,
7883
+ message: "\u540D\u79F0\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7253\u4E2A\u5B57\u7B26"
7884
+ }
7885
+ ];
7886
+ const rfc1123LabelRules = [
7887
+ {
7888
+ required: true,
7889
+ message: "\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"
7890
+ },
7891
+ {
7892
+ pattern: /^[a-z0-9]([-a-z0-9]*[a-z0-9])?$/,
7893
+ message: "\u540D\u79F0\u53EA\u80FD\u5305\u542B\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\uFF0C\u4EE5\u53CA '-'\uFF0C\u4E14\u4EE5\u5B57\u6BCD\u6216\u6570\u5B57\u5F00\u5934\u548C\u7ED3\u675F"
7894
+ },
7895
+ {
7896
+ max: 63,
7897
+ message: "\u540D\u79F0\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC763\u4E2A\u5B57\u7B26"
7898
+ }
7899
+ ];
7900
+ const rfc1035LabelRules = [
7901
+ {
7902
+ required: true,
7903
+ message: "\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"
7904
+ },
7905
+ {
7906
+ pattern: /^[a-z]([-a-z0-9]*[a-z0-9])?$/,
7907
+ message: "\u540D\u79F0\u53EA\u80FD\u5305\u542B\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\uFF0C\u4EE5\u53CA '-'\uFF0C\u4E14\u4EE5\u5B57\u6BCD\u5F00\u5934\uFF0C\u5B57\u6BCD\u6216\u6570\u5B57\u7ED3\u675F"
7908
+ },
7909
+ {
7910
+ max: 63,
7911
+ message: "\u540D\u79F0\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC763\u4E2A\u5B57\u7B26"
7912
+ }
7913
+ ];
7914
+ function NamespaceSelectWidget(props) {
7915
+ const kit = useUIKit();
7916
+ const { action } = useResource();
7917
+ const { data: data2 } = useList({
7918
+ resource: "namespaces",
7919
+ meta: {
7920
+ resourceBasePath: "/api/v1",
7921
+ kind: "Namespace"
7922
+ }
7923
+ });
7924
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(kit.select, { input: props, disabled: action === "edit", children: data2 == null ? void 0 : data2.data.map((namespace2) => /* @__PURE__ */ jsxRuntime.exports.jsx(kit.option, { value: namespace2.metadata.name, children: namespace2.metadata.name }, namespace2.metadata.name)) });
7925
+ }
7926
+ const namespaceRules = [
7927
+ {
7928
+ required: true,
7929
+ message: "Please input the namespace."
7930
+ }
7931
+ ];
7932
+ function KeyValueInput(props) {
7933
+ const { children, item } = props;
7934
+ const kit = useUIKit();
7935
+ const onKeyChange = useCallback(
7936
+ (event) => {
7937
+ var _a;
7938
+ const key = event.target.value;
7939
+ (_a = props.onChange) == null ? void 0 : _a.call(props, {
7940
+ ...item,
7941
+ key
7942
+ });
7943
+ },
7944
+ [item, props]
7945
+ );
7946
+ const onValueChange = useCallback(
7947
+ (event) => {
7948
+ var _a;
7949
+ console.log(event);
7950
+ const value = event.target.value;
7951
+ (_a = props.onChange) == null ? void 0 : _a.call(props, {
7952
+ ...item,
7953
+ value
7954
+ });
7955
+ },
7956
+ [item, props]
7957
+ );
7958
+ return /* @__PURE__ */ jsxRuntime.exports.jsxs(kit.space, { children: [
7959
+ /* @__PURE__ */ jsxRuntime.exports.jsx(kit.input, { value: item.key, onChange: onKeyChange }),
7960
+ /* @__PURE__ */ jsxRuntime.exports.jsx(kit.textArea, { value: item.value, onChange: onValueChange }),
7961
+ children
7962
+ ] });
7963
+ }
7964
+ function KeyValueListWidget(props) {
7965
+ const kit = useUIKit();
7966
+ const { value } = props;
7967
+ const items = useMemo(() => {
7968
+ return Object.entries(value || {}).map(([key, value2]) => ({
7969
+ key,
7970
+ value: value2
7971
+ }));
7972
+ }, [value]);
7973
+ const onChange = useCallback(
7974
+ (newItems) => {
7975
+ var _a;
7976
+ const newValue = newItems.reduce((result, item) => {
7977
+ result[item.key] = item.value;
7978
+ return result;
7979
+ }, {});
7980
+ (_a = props.onChange) == null ? void 0 : _a.call(props, newValue);
7981
+ },
7982
+ [props]
7983
+ );
7984
+ const onRemove = useCallback(
7985
+ (index) => {
7986
+ const result = [...items];
7987
+ result.splice(index, 1);
7988
+ onChange(result);
7989
+ },
7990
+ [onChange, items]
7991
+ );
7992
+ const onAdd = useCallback(() => {
7993
+ onChange([...items, { key: "", value: "" }]);
7994
+ }, [onChange, items]);
7995
+ return /* @__PURE__ */ jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment, { children: [
7996
+ items.map((item, index) => {
7997
+ return /* @__PURE__ */ jsxRuntime.exports.jsx(
7998
+ KeyValueInput,
7999
+ {
8000
+ item,
8001
+ onChange: (newItem) => {
8002
+ console.log(newItem);
8003
+ const temp = [...items];
8004
+ temp.splice(index, 1, newItem);
8005
+ onChange(temp);
8006
+ },
8007
+ children: /* @__PURE__ */ jsxRuntime.exports.jsx(
8008
+ kit.button,
8009
+ {
8010
+ onClick: () => {
8011
+ onRemove(index);
8012
+ },
8013
+ danger: true,
8014
+ children: "Remove"
8015
+ }
8016
+ )
8017
+ },
8018
+ index
8019
+ );
8020
+ }),
8021
+ /* @__PURE__ */ jsxRuntime.exports.jsx(kit.form.Item, { children: /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, { type: "primary", onClick: onAdd, children: "Add" }) })
8022
+ ] });
8023
+ }
8024
+ function MetadataForm() {
8025
+ const kit = useUIKit();
8026
+ return /* @__PURE__ */ jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment, { children: [
8027
+ /* @__PURE__ */ jsxRuntime.exports.jsx(kit.form.Item, { label: "Name", name: ["metadata", "name"], rules: rfc1123LabelRules, children: /* @__PURE__ */ jsxRuntime.exports.jsx(NameInputWidget, {}) }),
8028
+ /* @__PURE__ */ jsxRuntime.exports.jsx(
8029
+ kit.form.Item,
8030
+ {
8031
+ label: "Namespace",
8032
+ name: ["metadata", "namespace"],
8033
+ rules: namespaceRules,
8034
+ children: /* @__PURE__ */ jsxRuntime.exports.jsx(NamespaceSelectWidget, {})
8035
+ }
8036
+ ),
8037
+ /* @__PURE__ */ jsxRuntime.exports.jsx(kit.form.Item, { name: ["metadata", "labels"], label: "Labels", children: /* @__PURE__ */ jsxRuntime.exports.jsx(KeyValueListWidget, {}) }),
8038
+ /* @__PURE__ */ jsxRuntime.exports.jsx(kit.form.Item, { name: ["metadata", "annotations"], label: "Annotations", children: /* @__PURE__ */ jsxRuntime.exports.jsx(KeyValueListWidget, {}) })
8039
+ ] });
8040
+ }
8041
+ function addId(arr, idKey) {
8042
+ return arr.map((e) => {
8043
+ return {
8044
+ id: e[idKey],
8045
+ ...e
8046
+ };
8047
+ });
8048
+ }
7804
8049
  const ConditionsTable = ({ conditions = [] }) => {
7805
8050
  const kit = useUIKit();
7806
8051
  const { t } = useTranslation();
@@ -7850,237 +8095,6 @@ const ConditionsTable = ({ conditions = [] }) => {
7850
8095
  }
7851
8096
  );
7852
8097
  };
7853
- const index_86mllf = "";
7854
- const MoreTriggerStyle = "m1u1f5zp";
7855
- const ImageNames = ({
7856
- value
7857
- }) => {
7858
- const kit = useUIKit();
7859
- const {
7860
- t
7861
- } = useTranslation();
7862
- return /* @__PURE__ */ jsxRuntime.exports.jsxs("div", {
7863
- children: [/* @__PURE__ */ jsxRuntime.exports.jsx("div", {
7864
- children: value[0]
7865
- }), value.length > 1 && /* @__PURE__ */ jsxRuntime.exports.jsx(kit.tooltip, {
7866
- title: /* @__PURE__ */ jsxRuntime.exports.jsx(jsxRuntime.exports.Fragment, {
7867
- children: value.slice(1).map((name2, index) => {
7868
- return /* @__PURE__ */ jsxRuntime.exports.jsx("div", {
7869
- children: name2
7870
- }, index);
7871
- })
7872
- }),
7873
- children: /* @__PURE__ */ jsxRuntime.exports.jsxs("div", {
7874
- className: cx_default(Typo.Label.l4_regular, MoreTriggerStyle),
7875
- children: ["+", value.length - 1, " ", t("dovetail.more")]
7876
- })
7877
- })]
7878
- });
7879
- };
7880
- const StateTag = ({ state: state2 }) => {
7881
- const kit = useUIKit();
7882
- const colorMap = {
7883
- running: "green",
7884
- active: "green",
7885
- succeeded: "blue",
7886
- terminated: "red",
7887
- pending: "gray"
7888
- };
7889
- return /* @__PURE__ */ jsxRuntime.exports.jsx(kit.tag, { color: colorMap[(state2 == null ? void 0 : state2.toLowerCase()) || ""] || "green", children: state2 || "Active" });
7890
- };
7891
- const index_1wf16rt = "";
7892
- const MinusButtonStyle = "m8ychfk";
7893
- const PlusButtonStyle = "p1o004do";
7894
- const WorkloadReplicas = ({
7895
- record
7896
- }) => {
7897
- const kit = useUIKit();
7898
- const {
7899
- resource
7900
- } = useResource();
7901
- const {
7902
- mutate
7903
- } = useUpdate();
7904
- const readyReplicas = record.status && "readyReplicas" in record.status ? record.status.readyReplicas : 0;
7905
- const replicas2 = record.status && "replicas" in record.status ? record.status.replicas : 0;
7906
- const canScale = record.kind === "Deployment" || record.kind === "StatefulSet";
7907
- const currentReplicas = get(record, "spec.replicas", 0);
7908
- const scale = (delta) => {
7909
- const v2 = record.scale(currentReplicas + delta);
7910
- const id = v2.id;
7911
- pruneBeforeEdit(v2);
7912
- mutate({
7913
- id,
7914
- resource: (resource == null ? void 0 : resource.name) || "",
7915
- values: v2
7916
- });
7917
- };
7918
- return /* @__PURE__ */ jsxRuntime.exports.jsxs("span", {
7919
- children: [canScale && /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, {
7920
- className: MinusButtonStyle,
7921
- type: "ordinary",
7922
- size: "small",
7923
- onClick: () => scale(-1),
7924
- children: "-"
7925
- }), readyReplicas, "/", replicas2, canScale && /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, {
7926
- className: PlusButtonStyle,
7927
- type: "ordinary",
7928
- size: "small",
7929
- onClick: () => scale(1),
7930
- children: "+"
7931
- })]
7932
- });
7933
- };
7934
- const NameLink = (props) => {
7935
- var _a;
7936
- const { name: name2, id, resource } = props;
7937
- const kit = useUIKit();
7938
- const go = useGo();
7939
- const navigation = useNavigation();
7940
- const parsed = useParsed();
7941
- const resourceName = resource || ((_a = parsed.resource) == null ? void 0 : _a.name) || "";
7942
- return /* @__PURE__ */ jsxRuntime.exports.jsx(
7943
- kit.button,
7944
- {
7945
- type: "link",
7946
- onClick: () => {
7947
- go({
7948
- to: navigation.showUrl(resourceName, ""),
7949
- query: {
7950
- id
7951
- }
7952
- });
7953
- },
7954
- children: name2
7955
- }
7956
- );
7957
- };
7958
- const CommonSorter = (dataIndex) => (a, b2) => {
7959
- const valA = lodash.exports.get(a, dataIndex);
7960
- const valB = lodash.exports.get(b2, dataIndex);
7961
- if (valA === valB)
7962
- return 0;
7963
- if (valA > valB)
7964
- return 1;
7965
- return -1;
7966
- };
7967
- const NameColumnRenderer = (i18n2, resource = "") => {
7968
- const dataIndex = ["metadata", "name"];
7969
- return {
7970
- key: "name",
7971
- display: true,
7972
- dataIndex,
7973
- title: i18n2.t("name"),
7974
- sortable: true,
7975
- sorter: CommonSorter(dataIndex),
7976
- render: (v2, record) => {
7977
- return /* @__PURE__ */ jsxRuntime.exports.jsx(NameLink, { name: v2, id: record.id, resource });
7978
- }
7979
- };
7980
- };
7981
- const NameSpaceColumnRenderer = (i18n2) => {
7982
- const dataIndex = ["metadata", "namespace"];
7983
- return {
7984
- key: "namespace",
7985
- display: true,
7986
- dataIndex,
7987
- title: i18n2.t("namespace"),
7988
- sortable: true,
7989
- sorter: CommonSorter(dataIndex)
7990
- };
7991
- };
7992
- const PhaseColumnRenderer = (i18n2) => {
7993
- const dataIndex = ["status", "phase"];
7994
- return {
7995
- key: "phase",
7996
- display: true,
7997
- dataIndex,
7998
- title: i18n2.t("phase"),
7999
- sortable: true,
8000
- sorter: CommonSorter(dataIndex),
8001
- render: (v2) => /* @__PURE__ */ jsxRuntime.exports.jsx(StateTag, { state: v2 })
8002
- };
8003
- };
8004
- const WorkloadImageColumnRenderer = (i18n2) => {
8005
- const dataIndex = ["imageNames"];
8006
- return {
8007
- key: "image",
8008
- display: true,
8009
- dataIndex,
8010
- title: i18n2.t("image"),
8011
- sortable: true,
8012
- sorter: CommonSorter(dataIndex),
8013
- render(value) {
8014
- return /* @__PURE__ */ jsxRuntime.exports.jsx(ImageNames, { value });
8015
- }
8016
- };
8017
- };
8018
- const AgeColumnRenderer = (i18n2) => {
8019
- const dataIndex = ["metadata", "creationTimestamp"];
8020
- return {
8021
- key: "creationTimestamp",
8022
- display: true,
8023
- dataIndex,
8024
- title: i18n2.t("created_time"),
8025
- sortable: true,
8026
- sorter: (a, b2) => {
8027
- const valA = new Date(lodash.exports.get(a, dataIndex));
8028
- const valB = new Date(lodash.exports.get(b2, dataIndex));
8029
- if (valA === valB)
8030
- return 0;
8031
- if (valA > valB)
8032
- return 1;
8033
- return -1;
8034
- },
8035
- render: (value) => {
8036
- return /* @__PURE__ */ jsxRuntime.exports.jsx(Time, { date: new Date(value) });
8037
- }
8038
- };
8039
- };
8040
- const NodeNameColumnRenderer = (i18n2) => {
8041
- const dataIndex = ["spec", "nodeName"];
8042
- return {
8043
- key: "node",
8044
- display: true,
8045
- dataIndex,
8046
- title: i18n2.t("node_name"),
8047
- sortable: true,
8048
- sorter: CommonSorter(dataIndex)
8049
- };
8050
- };
8051
- const RestartCountColumnRenderer = (i18n2) => {
8052
- const dataIndex = ["restartCount"];
8053
- return {
8054
- key: "restartCount",
8055
- display: true,
8056
- dataIndex,
8057
- title: i18n2.t("restarts"),
8058
- sortable: true,
8059
- sorter: CommonSorter(dataIndex)
8060
- };
8061
- };
8062
- const CompletionsCountColumnRenderer = (i18n2) => {
8063
- const dataIndex = ["completionsDisplay"];
8064
- return {
8065
- key: "completions",
8066
- display: true,
8067
- dataIndex,
8068
- title: i18n2.t("completions"),
8069
- sortable: true,
8070
- sorter: CommonSorter(dataIndex)
8071
- };
8072
- };
8073
- const DurationColumnRenderer = (i18n2) => {
8074
- const dataIndex = ["durationDisplay"];
8075
- return {
8076
- key: "duration",
8077
- display: true,
8078
- dataIndex,
8079
- title: i18n2.t("duration"),
8080
- sortable: true,
8081
- sorter: CommonSorter(dataIndex)
8082
- };
8083
- };
8084
8098
  function getSecondsDiff(startDate, endDate) {
8085
8099
  return Math.round(Math.abs(Date.parse(endDate) - Date.parse(startDate)) / 1e3);
8086
8100
  }
@@ -9551,7 +9565,7 @@ const Separator = () => {
9551
9565
  });
9552
9566
  };
9553
9567
  const MonacoYamlEditor = React.lazy(() => Promise.resolve().then(() => MonacoYamlEditor$2));
9554
- const MonacoYamlDiffEditor = React.lazy(() => import("./MonacoYamlDiffEditor.8bad293e.js"));
9568
+ const MonacoYamlDiffEditor = React.lazy(() => import("./MonacoYamlDiffEditor.e4468695.js"));
9555
9569
  const YamlEditorComponent = forwardRef(
9556
9570
  function YamlEditorComponent2(props, ref) {
9557
9571
  const {
@@ -11671,67 +11685,78 @@ var RESOURCE_GROUP = /* @__PURE__ */ ((RESOURCE_GROUP2) => {
11671
11685
  return RESOURCE_GROUP2;
11672
11686
  })(RESOURCE_GROUP || {});
11673
11687
  export {
11674
- BASE_INIT_VALUE as $,
11675
- SecretDataField as A,
11688
+ ShowContent as $,
11689
+ AgeColumnRenderer as A,
11676
11690
  Breadcrumb as B,
11677
- ColumnKeys as C,
11678
- DeleteButton as D,
11679
- StartTimeField as E,
11680
- ShowContent as F,
11681
- DeleteManyButton as G,
11682
- StateTag as H,
11691
+ CommonSorter as C,
11692
+ DurationColumnRenderer as D,
11693
+ ResourceUsageBar as E,
11694
+ WorkloadReplicas as F,
11695
+ CronjobJobsTable as G,
11696
+ KeyValue as H,
11683
11697
  ImageNames as I,
11684
- JobsField as J,
11698
+ DeleteButton as J,
11685
11699
  KeyValueListWidget as K,
11686
11700
  Layout as L,
11687
11701
  MetadataForm as M,
11688
- NameInputWidget as N,
11689
- DrawerShow as O,
11690
- PageShow as P,
11691
- Menu as Q,
11692
- ResourceCRUD as R,
11702
+ NameColumnRenderer as N,
11703
+ ImageField as O,
11704
+ PhaseColumnRenderer as P,
11705
+ ReplicaField as Q,
11706
+ ReplicasColumnRenderer as R,
11693
11707
  Separator as S,
11694
- EditButton as T,
11695
- NS_STORE_KEY as U,
11696
- ALL_NS as V,
11697
- WorkloadDropdown as W,
11698
- useNamespacesFilter as X,
11708
+ ConditionsField as T,
11709
+ PodsField as U,
11710
+ JobsField as V,
11711
+ WorkloadImageColumnRenderer as W,
11712
+ DataField as X,
11699
11713
  YamlEditorComponent as Y,
11700
- NamespacesFilter as Z,
11701
- Tags as _,
11714
+ SecretDataField as Z,
11715
+ StartTimeField as _,
11702
11716
  useDeleteModal as a,
11703
- DEPLOYMENT_INIT_VALUE as a0,
11704
- CRONJOB_INIT_VALUE as a1,
11705
- DAEMONSET_INIT_VALUE as a2,
11706
- JOB_INIT_VALUE as a3,
11707
- STATEFULSET_INIT_VALUE as a4,
11708
- POD_INIT_VALUE as a5,
11709
- TIMESTAMP_LABEL as a6,
11710
- Dovetail as a7,
11711
- RESOURCE_GROUP as a8,
11712
- useEagleTable as b,
11713
- useDownloadYAML as c,
11714
- useEdit as d,
11715
- dnsSubDomainRules as e,
11716
- rfc1123LabelRules as f,
11717
- rfc1035LabelRules as g,
11718
- NamespaceSelectWidget as h,
11719
- ConditionsTable as i,
11717
+ DeleteManyButton as a0,
11718
+ StateTag as a1,
11719
+ DrawerShow as a2,
11720
+ Menu as a3,
11721
+ EditButton as a4,
11722
+ NS_STORE_KEY as a5,
11723
+ ALL_NS as a6,
11724
+ useNamespacesFilter as a7,
11725
+ NamespacesFilter as a8,
11726
+ Tags as a9,
11727
+ BASE_INIT_VALUE as aa,
11728
+ DEPLOYMENT_INIT_VALUE as ab,
11729
+ CRONJOB_INIT_VALUE as ac,
11730
+ DAEMONSET_INIT_VALUE as ad,
11731
+ JOB_INIT_VALUE as ae,
11732
+ STATEFULSET_INIT_VALUE as af,
11733
+ POD_INIT_VALUE as ag,
11734
+ TIMESTAMP_LABEL as ah,
11735
+ Dovetail as ai,
11736
+ RESOURCE_GROUP as aj,
11737
+ NameSpaceColumnRenderer as b,
11738
+ NodeNameColumnRenderer as c,
11739
+ RestartCountColumnRenderer as d,
11740
+ CompletionsCountColumnRenderer as e,
11741
+ ColumnKeys as f,
11742
+ useEagleTable as g,
11743
+ useDownloadYAML as h,
11744
+ useEdit as i,
11720
11745
  jsxRuntime as j,
11721
- PodContainersTable as k,
11722
- CreateButton as l,
11723
- WorkloadPodsTable as m,
11724
- namespaceRules as n,
11725
- CronJobDropdown as o,
11726
- ResourceUsageBar as p,
11727
- WorkloadReplicas as q,
11746
+ NameInputWidget as k,
11747
+ dnsSubDomainRules as l,
11748
+ rfc1123LabelRules as m,
11749
+ rfc1035LabelRules as n,
11750
+ NamespaceSelectWidget as o,
11751
+ namespaceRules as p,
11752
+ PageShow as q,
11728
11753
  routerProvider as r,
11729
- CronjobJobsTable as s,
11730
- KeyValue as t,
11754
+ ConditionsTable as s,
11755
+ PodContainersTable as t,
11731
11756
  useSchema as u,
11732
- ImageField as v,
11733
- ReplicaField as w,
11734
- ConditionsField as x,
11735
- PodsField as y,
11736
- DataField as z
11757
+ WorkloadDropdown as v,
11758
+ CreateButton as w,
11759
+ ResourceCRUD as x,
11760
+ WorkloadPodsTable as y,
11761
+ CronJobDropdown as z
11737
11762
  };