@dovetail-v2/refine 0.0.6 → 0.0.8
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.
- package/dist/{MonacoYamlDiffEditor.8bad293e.js → MonacoYamlDiffEditor.aa479096.js} +1 -1
- package/dist/{index.294b375a.js → index.5cb49249.js} +950 -870
- package/dist/refine.js +70 -53
- package/dist/refine.umd.cjs +894 -814
- package/dist/style.css +2 -2
- package/lib/src/hooks/useEagleTable/index.d.ts +2 -52
- package/lib/src/hooks/useEagleTable/useEagleTable.d.ts +52 -0
- package/lib/src/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/refine.umd.cjs
CHANGED
|
@@ -6942,601 +6942,111 @@ var __publicField = (obj, key, value) => {
|
|
|
6942
6942
|
}
|
|
6943
6943
|
return { modalProps, visible, openDeleteConfirmModal };
|
|
6944
6944
|
};
|
|
6945
|
-
function
|
|
6946
|
-
const
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
function useDownloadYAML() {
|
|
6958
|
-
return function(options) {
|
|
6959
|
-
const { name: name2, item } = options;
|
|
6960
|
-
const content = yaml__default.default.dump(item);
|
|
6961
|
-
download(`${name2}.yaml`, content);
|
|
6962
|
-
};
|
|
6963
|
-
}
|
|
6964
|
-
function useEdit() {
|
|
6965
|
-
const { resource } = core.useParsed();
|
|
6966
|
-
const go = core.useGo();
|
|
6967
|
-
const edit2 = React.useCallback(
|
|
6968
|
-
(id) => {
|
|
6969
|
-
go({
|
|
6970
|
-
to: `/${resource == null ? void 0 : resource.name}/edit`,
|
|
6971
|
-
query: {
|
|
6972
|
-
id
|
|
6973
|
-
}
|
|
6974
|
-
});
|
|
6975
|
-
},
|
|
6976
|
-
[go, resource == null ? void 0 : resource.name]
|
|
6977
|
-
);
|
|
6978
|
-
return { edit: edit2 };
|
|
6979
|
-
}
|
|
6980
|
-
function K8sDropdown(props) {
|
|
6981
|
-
const { data: data2 } = props;
|
|
6982
|
-
const kit = eagle.useUIKit();
|
|
6983
|
-
const useResourceResult = core.useResource();
|
|
6984
|
-
const resource = useResourceResult.resource;
|
|
6985
|
-
const { edit: edit2 } = useEdit();
|
|
6986
|
-
const { modalProps, visible, openDeleteConfirmModal } = useDeleteModal(
|
|
6987
|
-
(resource == null ? void 0 : resource.name) || ""
|
|
6988
|
-
);
|
|
6989
|
-
const download2 = useDownloadYAML();
|
|
6990
|
-
const { t } = useTranslation();
|
|
6991
|
-
return /* @__PURE__ */ jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment, { children: [
|
|
6992
|
-
/* @__PURE__ */ jsxRuntime.exports.jsx(
|
|
6993
|
-
kit.dropdown,
|
|
6994
|
-
{
|
|
6995
|
-
overlay: /* @__PURE__ */ jsxRuntime.exports.jsxs(kit.menu, { children: [
|
|
6996
|
-
/* @__PURE__ */ jsxRuntime.exports.jsx(
|
|
6997
|
-
kit.menuItem,
|
|
6998
|
-
{
|
|
6999
|
-
onClick: () => {
|
|
7000
|
-
if (data2.id) {
|
|
7001
|
-
edit2(data2.id);
|
|
7002
|
-
}
|
|
7003
|
-
},
|
|
7004
|
-
children: /* @__PURE__ */ jsxRuntime.exports.jsx(eagle.Icon, { src: iconsReact.EditPen16PrimaryIcon, children: t("edit") })
|
|
7005
|
-
}
|
|
7006
|
-
),
|
|
7007
|
-
/* @__PURE__ */ jsxRuntime.exports.jsx(
|
|
7008
|
-
kit.menuItem,
|
|
7009
|
-
{
|
|
7010
|
-
danger: true,
|
|
7011
|
-
onClick: () => {
|
|
7012
|
-
openDeleteConfirmModal(data2.id);
|
|
7013
|
-
},
|
|
7014
|
-
children: /* @__PURE__ */ jsxRuntime.exports.jsx(eagle.Icon, { src: iconsReact.TrashBinDelete16Icon, children: t("delete") })
|
|
7015
|
-
}
|
|
7016
|
-
),
|
|
7017
|
-
/* @__PURE__ */ jsxRuntime.exports.jsx(
|
|
7018
|
-
kit.menu.Item,
|
|
7019
|
-
{
|
|
7020
|
-
onClick: () => {
|
|
7021
|
-
var _a;
|
|
7022
|
-
if (data2.id) {
|
|
7023
|
-
download2({
|
|
7024
|
-
name: ((_a = data2.metadata) == null ? void 0 : _a.name) || data2.kind || "",
|
|
7025
|
-
item: data2
|
|
7026
|
-
});
|
|
7027
|
-
}
|
|
7028
|
-
},
|
|
7029
|
-
children: /* @__PURE__ */ jsxRuntime.exports.jsx(eagle.Icon, { src: iconsReact.Download16GradientBlueIcon, children: t("download_yaml") })
|
|
7030
|
-
}
|
|
7031
|
-
),
|
|
7032
|
-
props.children
|
|
7033
|
-
] }),
|
|
7034
|
-
children: /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, { type: "tertiary", size: "small", children: /* @__PURE__ */ jsxRuntime.exports.jsx(eagle.Icon, { src: iconsReact.MoreEllipsis316BoldBlueIcon }) })
|
|
7035
|
-
}
|
|
7036
|
-
),
|
|
7037
|
-
visible ? /* @__PURE__ */ jsxRuntime.exports.jsx(kit.modal, { ...modalProps }) : null
|
|
7038
|
-
] });
|
|
7039
|
-
}
|
|
7040
|
-
globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
7041
|
-
function adopt(value) {
|
|
7042
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
7043
|
-
resolve(value);
|
|
7044
|
-
});
|
|
7045
|
-
}
|
|
7046
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
7047
|
-
function fulfilled(value) {
|
|
7048
|
-
try {
|
|
7049
|
-
step(generator.next(value));
|
|
7050
|
-
} catch (e) {
|
|
7051
|
-
reject(e);
|
|
7052
|
-
}
|
|
7053
|
-
}
|
|
7054
|
-
function rejected(value) {
|
|
7055
|
-
try {
|
|
7056
|
-
step(generator["throw"](value));
|
|
7057
|
-
} catch (e) {
|
|
7058
|
-
reject(e);
|
|
6945
|
+
var cx = function cx2() {
|
|
6946
|
+
const presentClassNames = Array.prototype.slice.call(arguments).filter(Boolean);
|
|
6947
|
+
const atomicClasses = {};
|
|
6948
|
+
const nonAtomicClasses = [];
|
|
6949
|
+
presentClassNames.forEach((arg) => {
|
|
6950
|
+
const individualClassNames = arg ? arg.split(" ") : [];
|
|
6951
|
+
individualClassNames.forEach((className) => {
|
|
6952
|
+
if (className.startsWith("atm_")) {
|
|
6953
|
+
const [, keyHash] = className.split("_");
|
|
6954
|
+
atomicClasses[keyHash] = className;
|
|
6955
|
+
} else {
|
|
6956
|
+
nonAtomicClasses.push(className);
|
|
7059
6957
|
}
|
|
7060
|
-
}
|
|
7061
|
-
function step(result) {
|
|
7062
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
7063
|
-
}
|
|
7064
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
7065
|
-
});
|
|
7066
|
-
};
|
|
7067
|
-
function useEventCallback(fn) {
|
|
7068
|
-
const ref = React.useRef(() => {
|
|
7069
|
-
throw new Error("Cannot call an event handler while rendering.");
|
|
7070
|
-
});
|
|
7071
|
-
useIsomorphicLayoutEffect(() => {
|
|
7072
|
-
ref.current = fn;
|
|
7073
|
-
}, [fn]);
|
|
7074
|
-
return React.useCallback((...args) => ref.current(...args), [ref]);
|
|
7075
|
-
}
|
|
7076
|
-
function useEventListener(eventName, handler, element, options) {
|
|
7077
|
-
const savedHandler = React.useRef(handler);
|
|
7078
|
-
useIsomorphicLayoutEffect(() => {
|
|
7079
|
-
savedHandler.current = handler;
|
|
7080
|
-
}, [handler]);
|
|
7081
|
-
React.useEffect(() => {
|
|
7082
|
-
var _a;
|
|
7083
|
-
const targetElement = (_a = element === null || element === void 0 ? void 0 : element.current) !== null && _a !== void 0 ? _a : window;
|
|
7084
|
-
if (!(targetElement && targetElement.addEventListener))
|
|
7085
|
-
return;
|
|
7086
|
-
const listener = (event) => savedHandler.current(event);
|
|
7087
|
-
targetElement.addEventListener(eventName, listener, options);
|
|
7088
|
-
return () => {
|
|
7089
|
-
targetElement.removeEventListener(eventName, listener, options);
|
|
7090
|
-
};
|
|
7091
|
-
}, [eventName, element, options]);
|
|
7092
|
-
}
|
|
7093
|
-
globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
7094
|
-
function adopt(value) {
|
|
7095
|
-
return value instanceof P ? value : new P(function(resolve) {
|
|
7096
|
-
resolve(value);
|
|
7097
6958
|
});
|
|
7098
|
-
}
|
|
7099
|
-
return new (P || (P = Promise))(function(resolve, reject) {
|
|
7100
|
-
function fulfilled(value) {
|
|
7101
|
-
try {
|
|
7102
|
-
step(generator.next(value));
|
|
7103
|
-
} catch (e) {
|
|
7104
|
-
reject(e);
|
|
7105
|
-
}
|
|
7106
|
-
}
|
|
7107
|
-
function rejected(value) {
|
|
7108
|
-
try {
|
|
7109
|
-
step(generator["throw"](value));
|
|
7110
|
-
} catch (e) {
|
|
7111
|
-
reject(e);
|
|
7112
|
-
}
|
|
7113
|
-
}
|
|
7114
|
-
function step(result) {
|
|
7115
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
7116
|
-
}
|
|
7117
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
7118
|
-
});
|
|
7119
|
-
};
|
|
7120
|
-
const useIsomorphicLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
7121
|
-
function useLocalStorage(key, initialValue) {
|
|
7122
|
-
const readValue = React.useCallback(() => {
|
|
7123
|
-
if (typeof window === "undefined") {
|
|
7124
|
-
return initialValue;
|
|
7125
|
-
}
|
|
7126
|
-
try {
|
|
7127
|
-
const item = window.localStorage.getItem(key);
|
|
7128
|
-
return item ? parseJSON(item) : initialValue;
|
|
7129
|
-
} catch (error) {
|
|
7130
|
-
console.warn(`Error reading localStorage key \u201C${key}\u201D:`, error);
|
|
7131
|
-
return initialValue;
|
|
7132
|
-
}
|
|
7133
|
-
}, [initialValue, key]);
|
|
7134
|
-
const [storedValue, setStoredValue] = React.useState(readValue);
|
|
7135
|
-
const setValue = useEventCallback((value) => {
|
|
7136
|
-
if (typeof window === "undefined") {
|
|
7137
|
-
console.warn(`Tried setting localStorage key \u201C${key}\u201D even though environment is not a client`);
|
|
7138
|
-
}
|
|
7139
|
-
try {
|
|
7140
|
-
const newValue = value instanceof Function ? value(storedValue) : value;
|
|
7141
|
-
window.localStorage.setItem(key, JSON.stringify(newValue));
|
|
7142
|
-
setStoredValue(newValue);
|
|
7143
|
-
window.dispatchEvent(new Event("local-storage"));
|
|
7144
|
-
} catch (error) {
|
|
7145
|
-
console.warn(`Error setting localStorage key \u201C${key}\u201D:`, error);
|
|
7146
|
-
}
|
|
7147
6959
|
});
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
if ((event === null || event === void 0 ? void 0 : event.key) && event.key !== key) {
|
|
7153
|
-
return;
|
|
6960
|
+
const result = [];
|
|
6961
|
+
for (const keyHash in atomicClasses) {
|
|
6962
|
+
if (Object.prototype.hasOwnProperty.call(atomicClasses, keyHash)) {
|
|
6963
|
+
result.push(atomicClasses[keyHash]);
|
|
7154
6964
|
}
|
|
7155
|
-
setStoredValue(readValue());
|
|
7156
|
-
}, [key, readValue]);
|
|
7157
|
-
useEventListener("storage", handleStorageChange);
|
|
7158
|
-
useEventListener("local-storage", handleStorageChange);
|
|
7159
|
-
return [storedValue, setValue];
|
|
7160
|
-
}
|
|
7161
|
-
function parseJSON(value) {
|
|
7162
|
-
try {
|
|
7163
|
-
return value === "undefined" ? void 0 : JSON.parse(value !== null && value !== void 0 ? value : "");
|
|
7164
|
-
} catch (_a) {
|
|
7165
|
-
console.log("parsing error on", { value });
|
|
7166
|
-
return void 0;
|
|
7167
6965
|
}
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
const ALL_NS = "_all";
|
|
7171
|
-
const useNamespacesFilter = () => {
|
|
7172
|
-
const [value] = useLocalStorage(NS_STORE_KEY, ALL_NS);
|
|
7173
|
-
return {
|
|
7174
|
-
value
|
|
7175
|
-
};
|
|
6966
|
+
result.push(...nonAtomicClasses);
|
|
6967
|
+
return result.join(" ");
|
|
7176
6968
|
};
|
|
7177
|
-
|
|
6969
|
+
var cx_default = cx;
|
|
6970
|
+
const index_86mllf = "";
|
|
6971
|
+
const MoreTriggerStyle = "m1u1f5zp";
|
|
6972
|
+
const ImageNames = ({
|
|
6973
|
+
value
|
|
6974
|
+
}) => {
|
|
7178
6975
|
const kit = eagle.useUIKit();
|
|
7179
|
-
const {
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
}
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
input: {
|
|
7192
|
-
value,
|
|
7193
|
-
onChange(value2) {
|
|
7194
|
-
setValue(value2);
|
|
7195
|
-
}
|
|
7196
|
-
},
|
|
7197
|
-
children: [
|
|
7198
|
-
/* @__PURE__ */ jsxRuntime.exports.jsx(kit.option, { value: "_all", children: t("dovetail.all_namespaces") }, "_all"),
|
|
7199
|
-
data2 == null ? void 0 : data2.data.map((namespace2) => {
|
|
7200
|
-
const { name: name2 } = namespace2.metadata;
|
|
7201
|
-
return /* @__PURE__ */ jsxRuntime.exports.jsx(kit.option, { value: name2, children: name2 }, name2);
|
|
6976
|
+
const {
|
|
6977
|
+
t
|
|
6978
|
+
} = useTranslation();
|
|
6979
|
+
return /* @__PURE__ */ jsxRuntime.exports.jsxs("div", {
|
|
6980
|
+
children: [/* @__PURE__ */ jsxRuntime.exports.jsx("div", {
|
|
6981
|
+
children: value[0]
|
|
6982
|
+
}), value.length > 1 && /* @__PURE__ */ jsxRuntime.exports.jsx(kit.tooltip, {
|
|
6983
|
+
title: /* @__PURE__ */ jsxRuntime.exports.jsx(jsxRuntime.exports.Fragment, {
|
|
6984
|
+
children: value.slice(1).map((name2, index) => {
|
|
6985
|
+
return /* @__PURE__ */ jsxRuntime.exports.jsx("div", {
|
|
6986
|
+
children: name2
|
|
6987
|
+
}, index);
|
|
7202
6988
|
})
|
|
7203
|
-
|
|
7204
|
-
|
|
7205
|
-
|
|
6989
|
+
}),
|
|
6990
|
+
children: /* @__PURE__ */ jsxRuntime.exports.jsxs("div", {
|
|
6991
|
+
className: cx_default(eagle.Typo.Label.l4_regular, MoreTriggerStyle),
|
|
6992
|
+
children: ["+", value.length - 1, " ", t("dovetail.more")]
|
|
6993
|
+
})
|
|
6994
|
+
})]
|
|
6995
|
+
});
|
|
7206
6996
|
};
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
return ColumnKeys2;
|
|
7216
|
-
})(ColumnKeys || {});
|
|
7217
|
-
const useEagleTable = (params) => {
|
|
7218
|
-
var _a;
|
|
7219
|
-
const { columns, tableProps, formatter, Dropdown = K8sDropdown } = params;
|
|
7220
|
-
const [selectedKeys, setSelectedKeys] = React.useState([]);
|
|
7221
|
-
const [currentPage, setCurrentPage] = React.useState((tableProps == null ? void 0 : tableProps.currentPage) || 1);
|
|
7222
|
-
const { value: nsFilter } = useNamespacesFilter();
|
|
7223
|
-
const useTableParams = React.useMemo(() => {
|
|
7224
|
-
const mergedParams = lodashEs.merge(params.useTableParams, {
|
|
7225
|
-
filters: {
|
|
7226
|
-
permanent: [
|
|
7227
|
-
{
|
|
7228
|
-
field: "metadata.namespace",
|
|
7229
|
-
operator: "eq",
|
|
7230
|
-
value: nsFilter === ALL_NS ? null : nsFilter
|
|
7231
|
-
}
|
|
7232
|
-
]
|
|
7233
|
-
}
|
|
7234
|
-
});
|
|
7235
|
-
return mergedParams;
|
|
7236
|
-
}, [params.useTableParams, nsFilter]);
|
|
7237
|
-
const table = core.useTable(useTableParams);
|
|
7238
|
-
const onPageChange = React.useCallback(
|
|
7239
|
-
(page) => {
|
|
7240
|
-
setCurrentPage(page);
|
|
7241
|
-
},
|
|
7242
|
-
[setCurrentPage]
|
|
7243
|
-
);
|
|
7244
|
-
const actionColumn = {
|
|
7245
|
-
key: "action",
|
|
7246
|
-
display: true,
|
|
7247
|
-
dataIndex: [],
|
|
7248
|
-
title: () => /* @__PURE__ */ jsxRuntime.exports.jsx(eagle.Icon, { src: iconsReact.SettingsGear16GradientGrayIcon }),
|
|
7249
|
-
render: (_2, record) => {
|
|
7250
|
-
return /* @__PURE__ */ jsxRuntime.exports.jsx(Dropdown, { data: record });
|
|
7251
|
-
}
|
|
7252
|
-
};
|
|
7253
|
-
const finalDataSource = (_a = table.tableQueryResult.data) == null ? void 0 : _a.data.map(formatter);
|
|
7254
|
-
const finalProps = {
|
|
7255
|
-
loading: table.tableQueryResult.isLoading,
|
|
7256
|
-
dataSource: finalDataSource || [],
|
|
7257
|
-
columns: [...columns, actionColumn],
|
|
7258
|
-
refetch: () => null,
|
|
7259
|
-
error: false,
|
|
7260
|
-
rowKey: "id",
|
|
7261
|
-
currentPage,
|
|
7262
|
-
currentSize: (tableProps == null ? void 0 : tableProps.currentSize) || 5,
|
|
7263
|
-
onPageChange,
|
|
7264
|
-
onSelect: (keys) => {
|
|
7265
|
-
setSelectedKeys(keys);
|
|
7266
|
-
}
|
|
6997
|
+
const StateTag = ({ state: state2 }) => {
|
|
6998
|
+
const kit = eagle.useUIKit();
|
|
6999
|
+
const colorMap = {
|
|
7000
|
+
running: "green",
|
|
7001
|
+
active: "green",
|
|
7002
|
+
succeeded: "blue",
|
|
7003
|
+
terminated: "red",
|
|
7004
|
+
pending: "gray"
|
|
7267
7005
|
};
|
|
7268
|
-
return {
|
|
7006
|
+
return /* @__PURE__ */ jsxRuntime.exports.jsx(kit.tag, { color: colorMap[(state2 == null ? void 0 : state2.toLowerCase()) || ""] || "green", children: state2 || "Active" });
|
|
7269
7007
|
};
|
|
7270
|
-
var
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7008
|
+
var dayjs_min = { exports: {} };
|
|
7009
|
+
(function(module2, exports3) {
|
|
7010
|
+
!function(t, e) {
|
|
7011
|
+
module2.exports = e();
|
|
7012
|
+
}(commonjsGlobal, function() {
|
|
7013
|
+
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) {
|
|
7014
|
+
var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
|
|
7015
|
+
return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
|
|
7016
|
+
} }, m = function(t2, e2, n2) {
|
|
7017
|
+
var r2 = String(t2);
|
|
7018
|
+
return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
|
|
7019
|
+
}, v2 = { s: m, z: function(t2) {
|
|
7020
|
+
var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
|
|
7021
|
+
return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
|
|
7022
|
+
}, m: function t2(e2, n2) {
|
|
7023
|
+
if (e2.date() < n2.date())
|
|
7024
|
+
return -t2(n2, e2);
|
|
7025
|
+
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);
|
|
7026
|
+
return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
|
|
7027
|
+
}, a: function(t2) {
|
|
7028
|
+
return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
|
|
7029
|
+
}, p: function(t2) {
|
|
7030
|
+
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$/, "");
|
|
7031
|
+
}, u: function(t2) {
|
|
7032
|
+
return void 0 === t2;
|
|
7033
|
+
} }, g = "en", D2 = {};
|
|
7034
|
+
D2[g] = M2;
|
|
7035
|
+
var p = "$isDayjsObject", S2 = function(t2) {
|
|
7036
|
+
return t2 instanceof _2 || !(!t2 || !t2[p]);
|
|
7037
|
+
}, w2 = function t2(e2, n2, r2) {
|
|
7038
|
+
var i2;
|
|
7039
|
+
if (!e2)
|
|
7040
|
+
return g;
|
|
7041
|
+
if ("string" == typeof e2) {
|
|
7042
|
+
var s2 = e2.toLowerCase();
|
|
7043
|
+
D2[s2] && (i2 = s2), n2 && (D2[s2] = n2, i2 = s2);
|
|
7044
|
+
var u2 = e2.split("-");
|
|
7045
|
+
if (!i2 && u2.length > 1)
|
|
7046
|
+
return t2(u2[0]);
|
|
7280
7047
|
} else {
|
|
7281
|
-
|
|
7282
|
-
|
|
7283
|
-
});
|
|
7284
|
-
});
|
|
7285
|
-
const result = [];
|
|
7286
|
-
for (const keyHash in atomicClasses) {
|
|
7287
|
-
if (Object.prototype.hasOwnProperty.call(atomicClasses, keyHash)) {
|
|
7288
|
-
result.push(atomicClasses[keyHash]);
|
|
7289
|
-
}
|
|
7290
|
-
}
|
|
7291
|
-
result.push(...nonAtomicClasses);
|
|
7292
|
-
return result.join(" ");
|
|
7293
|
-
};
|
|
7294
|
-
var cx_default = cx;
|
|
7295
|
-
const index_hex8jv = "";
|
|
7296
|
-
const BreadcrumbStyle = "b142d7q8";
|
|
7297
|
-
function Breadcrumb(props) {
|
|
7298
|
-
const {
|
|
7299
|
-
breadcrumbs
|
|
7300
|
-
} = core.useBreadcrumb();
|
|
7301
|
-
return /* @__PURE__ */ jsxRuntime.exports.jsx("ul", {
|
|
7302
|
-
className: cx_default(BreadcrumbStyle, props.className),
|
|
7303
|
-
children: breadcrumbs.map((breadcrumb) => {
|
|
7304
|
-
return /* @__PURE__ */ jsxRuntime.exports.jsx("li", {
|
|
7305
|
-
className: "breadcrumb-item",
|
|
7306
|
-
children: breadcrumb.href ? /* @__PURE__ */ jsxRuntime.exports.jsx(reactRouterDom.Link, {
|
|
7307
|
-
to: breadcrumb.href,
|
|
7308
|
-
children: breadcrumb.label
|
|
7309
|
-
}) : /* @__PURE__ */ jsxRuntime.exports.jsx("span", {
|
|
7310
|
-
children: breadcrumb.label
|
|
7311
|
-
})
|
|
7312
|
-
}, `breadcrumb-${breadcrumb.label}`);
|
|
7313
|
-
})
|
|
7314
|
-
});
|
|
7315
|
-
}
|
|
7316
|
-
function NameInputWidget(props) {
|
|
7317
|
-
const kit = eagle.useUIKit();
|
|
7318
|
-
const { action } = core.useResource();
|
|
7319
|
-
return /* @__PURE__ */ jsxRuntime.exports.jsx(kit.input, { ...props, disabled: action === "edit" });
|
|
7320
|
-
}
|
|
7321
|
-
const dnsSubDomainRules = [
|
|
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 '-' \u548C '.'\uFF0C\u4E14\u5FC5\u987B\u4EE5\u5B57\u6BCD\u6216\u6570\u5B57\u5F00\u5934\u548C\u7ED3\u675F"
|
|
7329
|
-
},
|
|
7330
|
-
{
|
|
7331
|
-
max: 253,
|
|
7332
|
-
message: "\u540D\u79F0\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7253\u4E2A\u5B57\u7B26"
|
|
7333
|
-
}
|
|
7334
|
-
];
|
|
7335
|
-
const rfc1123LabelRules = [
|
|
7336
|
-
{
|
|
7337
|
-
required: true,
|
|
7338
|
-
message: "\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"
|
|
7339
|
-
},
|
|
7340
|
-
{
|
|
7341
|
-
pattern: /^[a-z0-9]([-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\u6216\u6570\u5B57\u5F00\u5934\u548C\u7ED3\u675F"
|
|
7343
|
-
},
|
|
7344
|
-
{
|
|
7345
|
-
max: 63,
|
|
7346
|
-
message: "\u540D\u79F0\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC763\u4E2A\u5B57\u7B26"
|
|
7347
|
-
}
|
|
7348
|
-
];
|
|
7349
|
-
const rfc1035LabelRules = [
|
|
7350
|
-
{
|
|
7351
|
-
required: true,
|
|
7352
|
-
message: "\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"
|
|
7353
|
-
},
|
|
7354
|
-
{
|
|
7355
|
-
pattern: /^[a-z]([-a-z0-9]*[a-z0-9])?$/,
|
|
7356
|
-
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"
|
|
7357
|
-
},
|
|
7358
|
-
{
|
|
7359
|
-
max: 63,
|
|
7360
|
-
message: "\u540D\u79F0\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC763\u4E2A\u5B57\u7B26"
|
|
7361
|
-
}
|
|
7362
|
-
];
|
|
7363
|
-
function NamespaceSelectWidget(props) {
|
|
7364
|
-
const kit = eagle.useUIKit();
|
|
7365
|
-
const { action } = core.useResource();
|
|
7366
|
-
const { data: data2 } = core.useList({
|
|
7367
|
-
resource: "namespaces",
|
|
7368
|
-
meta: {
|
|
7369
|
-
resourceBasePath: "/api/v1",
|
|
7370
|
-
kind: "Namespace"
|
|
7371
|
-
}
|
|
7372
|
-
});
|
|
7373
|
-
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)) });
|
|
7374
|
-
}
|
|
7375
|
-
const namespaceRules = [
|
|
7376
|
-
{
|
|
7377
|
-
required: true,
|
|
7378
|
-
message: "Please input the namespace."
|
|
7379
|
-
}
|
|
7380
|
-
];
|
|
7381
|
-
function KeyValueInput(props) {
|
|
7382
|
-
const { children, item } = props;
|
|
7383
|
-
const kit = eagle.useUIKit();
|
|
7384
|
-
const onKeyChange = React.useCallback(
|
|
7385
|
-
(event) => {
|
|
7386
|
-
var _a;
|
|
7387
|
-
const key = event.target.value;
|
|
7388
|
-
(_a = props.onChange) == null ? void 0 : _a.call(props, {
|
|
7389
|
-
...item,
|
|
7390
|
-
key
|
|
7391
|
-
});
|
|
7392
|
-
},
|
|
7393
|
-
[item, props]
|
|
7394
|
-
);
|
|
7395
|
-
const onValueChange = React.useCallback(
|
|
7396
|
-
(event) => {
|
|
7397
|
-
var _a;
|
|
7398
|
-
console.log(event);
|
|
7399
|
-
const value = event.target.value;
|
|
7400
|
-
(_a = props.onChange) == null ? void 0 : _a.call(props, {
|
|
7401
|
-
...item,
|
|
7402
|
-
value
|
|
7403
|
-
});
|
|
7404
|
-
},
|
|
7405
|
-
[item, props]
|
|
7406
|
-
);
|
|
7407
|
-
return /* @__PURE__ */ jsxRuntime.exports.jsxs(kit.space, { children: [
|
|
7408
|
-
/* @__PURE__ */ jsxRuntime.exports.jsx(kit.input, { value: item.key, onChange: onKeyChange }),
|
|
7409
|
-
/* @__PURE__ */ jsxRuntime.exports.jsx(kit.textArea, { value: item.value, onChange: onValueChange }),
|
|
7410
|
-
children
|
|
7411
|
-
] });
|
|
7412
|
-
}
|
|
7413
|
-
function KeyValueListWidget(props) {
|
|
7414
|
-
const kit = eagle.useUIKit();
|
|
7415
|
-
const { value } = props;
|
|
7416
|
-
const items = React.useMemo(() => {
|
|
7417
|
-
return Object.entries(value || {}).map(([key, value2]) => ({
|
|
7418
|
-
key,
|
|
7419
|
-
value: value2
|
|
7420
|
-
}));
|
|
7421
|
-
}, [value]);
|
|
7422
|
-
const onChange = React.useCallback(
|
|
7423
|
-
(newItems) => {
|
|
7424
|
-
var _a;
|
|
7425
|
-
const newValue = newItems.reduce((result, item) => {
|
|
7426
|
-
result[item.key] = item.value;
|
|
7427
|
-
return result;
|
|
7428
|
-
}, {});
|
|
7429
|
-
(_a = props.onChange) == null ? void 0 : _a.call(props, newValue);
|
|
7430
|
-
},
|
|
7431
|
-
[props]
|
|
7432
|
-
);
|
|
7433
|
-
const onRemove = React.useCallback(
|
|
7434
|
-
(index) => {
|
|
7435
|
-
const result = [...items];
|
|
7436
|
-
result.splice(index, 1);
|
|
7437
|
-
onChange(result);
|
|
7438
|
-
},
|
|
7439
|
-
[onChange, items]
|
|
7440
|
-
);
|
|
7441
|
-
const onAdd = React.useCallback(() => {
|
|
7442
|
-
onChange([...items, { key: "", value: "" }]);
|
|
7443
|
-
}, [onChange, items]);
|
|
7444
|
-
return /* @__PURE__ */ jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment, { children: [
|
|
7445
|
-
items.map((item, index) => {
|
|
7446
|
-
return /* @__PURE__ */ jsxRuntime.exports.jsx(
|
|
7447
|
-
KeyValueInput,
|
|
7448
|
-
{
|
|
7449
|
-
item,
|
|
7450
|
-
onChange: (newItem) => {
|
|
7451
|
-
console.log(newItem);
|
|
7452
|
-
const temp = [...items];
|
|
7453
|
-
temp.splice(index, 1, newItem);
|
|
7454
|
-
onChange(temp);
|
|
7455
|
-
},
|
|
7456
|
-
children: /* @__PURE__ */ jsxRuntime.exports.jsx(
|
|
7457
|
-
kit.button,
|
|
7458
|
-
{
|
|
7459
|
-
onClick: () => {
|
|
7460
|
-
onRemove(index);
|
|
7461
|
-
},
|
|
7462
|
-
danger: true,
|
|
7463
|
-
children: "Remove"
|
|
7464
|
-
}
|
|
7465
|
-
)
|
|
7466
|
-
},
|
|
7467
|
-
index
|
|
7468
|
-
);
|
|
7469
|
-
}),
|
|
7470
|
-
/* @__PURE__ */ jsxRuntime.exports.jsx(kit.form.Item, { children: /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, { type: "primary", onClick: onAdd, children: "Add" }) })
|
|
7471
|
-
] });
|
|
7472
|
-
}
|
|
7473
|
-
function MetadataForm() {
|
|
7474
|
-
const kit = eagle.useUIKit();
|
|
7475
|
-
return /* @__PURE__ */ jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment, { children: [
|
|
7476
|
-
/* @__PURE__ */ jsxRuntime.exports.jsx(kit.form.Item, { label: "Name", name: ["metadata", "name"], rules: rfc1123LabelRules, children: /* @__PURE__ */ jsxRuntime.exports.jsx(NameInputWidget, {}) }),
|
|
7477
|
-
/* @__PURE__ */ jsxRuntime.exports.jsx(
|
|
7478
|
-
kit.form.Item,
|
|
7479
|
-
{
|
|
7480
|
-
label: "Namespace",
|
|
7481
|
-
name: ["metadata", "namespace"],
|
|
7482
|
-
rules: namespaceRules,
|
|
7483
|
-
children: /* @__PURE__ */ jsxRuntime.exports.jsx(NamespaceSelectWidget, {})
|
|
7484
|
-
}
|
|
7485
|
-
),
|
|
7486
|
-
/* @__PURE__ */ jsxRuntime.exports.jsx(kit.form.Item, { name: ["metadata", "labels"], label: "Labels", children: /* @__PURE__ */ jsxRuntime.exports.jsx(KeyValueListWidget, {}) }),
|
|
7487
|
-
/* @__PURE__ */ jsxRuntime.exports.jsx(kit.form.Item, { name: ["metadata", "annotations"], label: "Annotations", children: /* @__PURE__ */ jsxRuntime.exports.jsx(KeyValueListWidget, {}) })
|
|
7488
|
-
] });
|
|
7489
|
-
}
|
|
7490
|
-
function addId(arr, idKey) {
|
|
7491
|
-
return arr.map((e) => {
|
|
7492
|
-
return {
|
|
7493
|
-
id: e[idKey],
|
|
7494
|
-
...e
|
|
7495
|
-
};
|
|
7496
|
-
});
|
|
7497
|
-
}
|
|
7498
|
-
var dayjs_min = { exports: {} };
|
|
7499
|
-
(function(module2, exports3) {
|
|
7500
|
-
!function(t, e) {
|
|
7501
|
-
module2.exports = e();
|
|
7502
|
-
}(commonjsGlobal, function() {
|
|
7503
|
-
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) {
|
|
7504
|
-
var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
|
|
7505
|
-
return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
|
|
7506
|
-
} }, m = function(t2, e2, n2) {
|
|
7507
|
-
var r2 = String(t2);
|
|
7508
|
-
return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
|
|
7509
|
-
}, v2 = { s: m, z: function(t2) {
|
|
7510
|
-
var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
|
|
7511
|
-
return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
|
|
7512
|
-
}, m: function t2(e2, n2) {
|
|
7513
|
-
if (e2.date() < n2.date())
|
|
7514
|
-
return -t2(n2, e2);
|
|
7515
|
-
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);
|
|
7516
|
-
return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
|
|
7517
|
-
}, a: function(t2) {
|
|
7518
|
-
return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
|
|
7519
|
-
}, p: function(t2) {
|
|
7520
|
-
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$/, "");
|
|
7521
|
-
}, u: function(t2) {
|
|
7522
|
-
return void 0 === t2;
|
|
7523
|
-
} }, g = "en", D2 = {};
|
|
7524
|
-
D2[g] = M2;
|
|
7525
|
-
var p = "$isDayjsObject", S2 = function(t2) {
|
|
7526
|
-
return t2 instanceof _2 || !(!t2 || !t2[p]);
|
|
7527
|
-
}, w2 = function t2(e2, n2, r2) {
|
|
7528
|
-
var i2;
|
|
7529
|
-
if (!e2)
|
|
7530
|
-
return g;
|
|
7531
|
-
if ("string" == typeof e2) {
|
|
7532
|
-
var s2 = e2.toLowerCase();
|
|
7533
|
-
D2[s2] && (i2 = s2), n2 && (D2[s2] = n2, i2 = s2);
|
|
7534
|
-
var u2 = e2.split("-");
|
|
7535
|
-
if (!i2 && u2.length > 1)
|
|
7536
|
-
return t2(u2[0]);
|
|
7537
|
-
} else {
|
|
7538
|
-
var a2 = e2.name;
|
|
7539
|
-
D2[a2] = e2, i2 = a2;
|
|
7048
|
+
var a2 = e2.name;
|
|
7049
|
+
D2[a2] = e2, i2 = a2;
|
|
7540
7050
|
}
|
|
7541
7051
|
return !r2 && i2 && (g = i2), i2 || !r2 && g;
|
|
7542
7052
|
}, O = function(t2, e2) {
|
|
@@ -7815,6 +7325,741 @@ var __publicField = (obj, key, value) => {
|
|
|
7815
7325
|
] })
|
|
7816
7326
|
] });
|
|
7817
7327
|
};
|
|
7328
|
+
const index_1wf16rt = "";
|
|
7329
|
+
const MinusButtonStyle = "m8ychfk";
|
|
7330
|
+
const PlusButtonStyle = "p1o004do";
|
|
7331
|
+
const WorkloadReplicas = ({
|
|
7332
|
+
record
|
|
7333
|
+
}) => {
|
|
7334
|
+
const kit = eagle.useUIKit();
|
|
7335
|
+
const {
|
|
7336
|
+
resource
|
|
7337
|
+
} = core.useResource();
|
|
7338
|
+
const {
|
|
7339
|
+
mutate
|
|
7340
|
+
} = core.useUpdate();
|
|
7341
|
+
const readyReplicas = record.status && "readyReplicas" in record.status ? record.status.readyReplicas : 0;
|
|
7342
|
+
const replicas2 = record.status && "replicas" in record.status ? record.status.replicas : 0;
|
|
7343
|
+
const canScale = record.kind === "Deployment" || record.kind === "StatefulSet";
|
|
7344
|
+
const currentReplicas = lodashEs.get(record, "spec.replicas", 0);
|
|
7345
|
+
const scale = (delta) => {
|
|
7346
|
+
const v2 = record.scale(currentReplicas + delta);
|
|
7347
|
+
const id = v2.id;
|
|
7348
|
+
pruneBeforeEdit(v2);
|
|
7349
|
+
mutate({
|
|
7350
|
+
id,
|
|
7351
|
+
resource: (resource == null ? void 0 : resource.name) || "",
|
|
7352
|
+
values: v2
|
|
7353
|
+
});
|
|
7354
|
+
};
|
|
7355
|
+
return /* @__PURE__ */ jsxRuntime.exports.jsxs("span", {
|
|
7356
|
+
children: [canScale && /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, {
|
|
7357
|
+
className: MinusButtonStyle,
|
|
7358
|
+
type: "ordinary",
|
|
7359
|
+
size: "small",
|
|
7360
|
+
onClick: () => scale(-1),
|
|
7361
|
+
children: "-"
|
|
7362
|
+
}), readyReplicas, "/", replicas2, canScale && /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, {
|
|
7363
|
+
className: PlusButtonStyle,
|
|
7364
|
+
type: "ordinary",
|
|
7365
|
+
size: "small",
|
|
7366
|
+
onClick: () => scale(1),
|
|
7367
|
+
children: "+"
|
|
7368
|
+
})]
|
|
7369
|
+
});
|
|
7370
|
+
};
|
|
7371
|
+
const NameLink = (props) => {
|
|
7372
|
+
var _a;
|
|
7373
|
+
const { name: name2, id, resource } = props;
|
|
7374
|
+
const kit = eagle.useUIKit();
|
|
7375
|
+
const go = core.useGo();
|
|
7376
|
+
const navigation = core.useNavigation();
|
|
7377
|
+
const parsed = core.useParsed();
|
|
7378
|
+
const resourceName = resource || ((_a = parsed.resource) == null ? void 0 : _a.name) || "";
|
|
7379
|
+
return /* @__PURE__ */ jsxRuntime.exports.jsx(
|
|
7380
|
+
kit.button,
|
|
7381
|
+
{
|
|
7382
|
+
type: "link",
|
|
7383
|
+
onClick: () => {
|
|
7384
|
+
go({
|
|
7385
|
+
to: navigation.showUrl(resourceName, ""),
|
|
7386
|
+
query: {
|
|
7387
|
+
id
|
|
7388
|
+
}
|
|
7389
|
+
});
|
|
7390
|
+
},
|
|
7391
|
+
children: name2
|
|
7392
|
+
}
|
|
7393
|
+
);
|
|
7394
|
+
};
|
|
7395
|
+
const CommonSorter = (dataIndex) => (a, b2) => {
|
|
7396
|
+
const valA = lodash.exports.get(a, dataIndex);
|
|
7397
|
+
const valB = lodash.exports.get(b2, dataIndex);
|
|
7398
|
+
if (valA === valB)
|
|
7399
|
+
return 0;
|
|
7400
|
+
if (valA > valB)
|
|
7401
|
+
return 1;
|
|
7402
|
+
return -1;
|
|
7403
|
+
};
|
|
7404
|
+
const NameColumnRenderer = (i18n2, resource = "") => {
|
|
7405
|
+
const dataIndex = ["metadata", "name"];
|
|
7406
|
+
return {
|
|
7407
|
+
key: "name",
|
|
7408
|
+
display: true,
|
|
7409
|
+
dataIndex,
|
|
7410
|
+
title: i18n2.t("name"),
|
|
7411
|
+
sortable: true,
|
|
7412
|
+
sorter: CommonSorter(dataIndex),
|
|
7413
|
+
render: (v2, record) => {
|
|
7414
|
+
return /* @__PURE__ */ jsxRuntime.exports.jsx(NameLink, { name: v2, id: record.id, resource });
|
|
7415
|
+
}
|
|
7416
|
+
};
|
|
7417
|
+
};
|
|
7418
|
+
const NameSpaceColumnRenderer = (i18n2) => {
|
|
7419
|
+
const dataIndex = ["metadata", "namespace"];
|
|
7420
|
+
return {
|
|
7421
|
+
key: "namespace",
|
|
7422
|
+
display: true,
|
|
7423
|
+
dataIndex,
|
|
7424
|
+
title: i18n2.t("namespace"),
|
|
7425
|
+
sortable: true,
|
|
7426
|
+
sorter: CommonSorter(dataIndex)
|
|
7427
|
+
};
|
|
7428
|
+
};
|
|
7429
|
+
const PhaseColumnRenderer = (i18n2) => {
|
|
7430
|
+
const dataIndex = ["status", "phase"];
|
|
7431
|
+
return {
|
|
7432
|
+
key: "phase",
|
|
7433
|
+
display: true,
|
|
7434
|
+
dataIndex,
|
|
7435
|
+
title: i18n2.t("phase"),
|
|
7436
|
+
sortable: true,
|
|
7437
|
+
sorter: CommonSorter(dataIndex),
|
|
7438
|
+
render: (v2) => /* @__PURE__ */ jsxRuntime.exports.jsx(StateTag, { state: v2 })
|
|
7439
|
+
};
|
|
7440
|
+
};
|
|
7441
|
+
const WorkloadImageColumnRenderer = (i18n2) => {
|
|
7442
|
+
const dataIndex = ["imageNames"];
|
|
7443
|
+
return {
|
|
7444
|
+
key: "image",
|
|
7445
|
+
display: true,
|
|
7446
|
+
dataIndex,
|
|
7447
|
+
title: i18n2.t("image"),
|
|
7448
|
+
sortable: true,
|
|
7449
|
+
sorter: CommonSorter(dataIndex),
|
|
7450
|
+
render(value) {
|
|
7451
|
+
return /* @__PURE__ */ jsxRuntime.exports.jsx(ImageNames, { value });
|
|
7452
|
+
}
|
|
7453
|
+
};
|
|
7454
|
+
};
|
|
7455
|
+
const ReplicasColumnRenderer = (i18n2) => {
|
|
7456
|
+
const dataIndex = ["status", "replicas"];
|
|
7457
|
+
return {
|
|
7458
|
+
key: "replicas",
|
|
7459
|
+
display: true,
|
|
7460
|
+
dataIndex,
|
|
7461
|
+
title: i18n2.t("replicas"),
|
|
7462
|
+
sortable: true,
|
|
7463
|
+
sorter: CommonSorter(dataIndex),
|
|
7464
|
+
render: (_2, record) => {
|
|
7465
|
+
return /* @__PURE__ */ jsxRuntime.exports.jsx(WorkloadReplicas, { record });
|
|
7466
|
+
}
|
|
7467
|
+
};
|
|
7468
|
+
};
|
|
7469
|
+
const AgeColumnRenderer = (i18n2) => {
|
|
7470
|
+
const dataIndex = ["metadata", "creationTimestamp"];
|
|
7471
|
+
return {
|
|
7472
|
+
key: "creationTimestamp",
|
|
7473
|
+
display: true,
|
|
7474
|
+
dataIndex,
|
|
7475
|
+
title: i18n2.t("created_time"),
|
|
7476
|
+
sortable: true,
|
|
7477
|
+
sorter: (a, b2) => {
|
|
7478
|
+
const valA = new Date(lodash.exports.get(a, dataIndex));
|
|
7479
|
+
const valB = new Date(lodash.exports.get(b2, dataIndex));
|
|
7480
|
+
if (valA === valB)
|
|
7481
|
+
return 0;
|
|
7482
|
+
if (valA > valB)
|
|
7483
|
+
return 1;
|
|
7484
|
+
return -1;
|
|
7485
|
+
},
|
|
7486
|
+
render: (value) => {
|
|
7487
|
+
return /* @__PURE__ */ jsxRuntime.exports.jsx(Time, { date: new Date(value) });
|
|
7488
|
+
}
|
|
7489
|
+
};
|
|
7490
|
+
};
|
|
7491
|
+
const NodeNameColumnRenderer = (i18n2) => {
|
|
7492
|
+
const dataIndex = ["spec", "nodeName"];
|
|
7493
|
+
return {
|
|
7494
|
+
key: "node",
|
|
7495
|
+
display: true,
|
|
7496
|
+
dataIndex,
|
|
7497
|
+
title: i18n2.t("node_name"),
|
|
7498
|
+
sortable: true,
|
|
7499
|
+
sorter: CommonSorter(dataIndex)
|
|
7500
|
+
};
|
|
7501
|
+
};
|
|
7502
|
+
const RestartCountColumnRenderer = (i18n2) => {
|
|
7503
|
+
const dataIndex = ["restartCount"];
|
|
7504
|
+
return {
|
|
7505
|
+
key: "restartCount",
|
|
7506
|
+
display: true,
|
|
7507
|
+
dataIndex,
|
|
7508
|
+
title: i18n2.t("restarts"),
|
|
7509
|
+
sortable: true,
|
|
7510
|
+
sorter: CommonSorter(dataIndex)
|
|
7511
|
+
};
|
|
7512
|
+
};
|
|
7513
|
+
const CompletionsCountColumnRenderer = (i18n2) => {
|
|
7514
|
+
const dataIndex = ["completionsDisplay"];
|
|
7515
|
+
return {
|
|
7516
|
+
key: "completions",
|
|
7517
|
+
display: true,
|
|
7518
|
+
dataIndex,
|
|
7519
|
+
title: i18n2.t("completions"),
|
|
7520
|
+
sortable: true,
|
|
7521
|
+
sorter: CommonSorter(dataIndex)
|
|
7522
|
+
};
|
|
7523
|
+
};
|
|
7524
|
+
const DurationColumnRenderer = (i18n2) => {
|
|
7525
|
+
const dataIndex = ["durationDisplay"];
|
|
7526
|
+
return {
|
|
7527
|
+
key: "duration",
|
|
7528
|
+
display: true,
|
|
7529
|
+
dataIndex,
|
|
7530
|
+
title: i18n2.t("duration"),
|
|
7531
|
+
sortable: true,
|
|
7532
|
+
sorter: CommonSorter(dataIndex)
|
|
7533
|
+
};
|
|
7534
|
+
};
|
|
7535
|
+
function download(filename, content) {
|
|
7536
|
+
const element = document.createElement("a");
|
|
7537
|
+
element.setAttribute(
|
|
7538
|
+
"href",
|
|
7539
|
+
"data:text/plain;charset=utf-8," + encodeURIComponent(content)
|
|
7540
|
+
);
|
|
7541
|
+
element.setAttribute("download", filename);
|
|
7542
|
+
element.style.display = "none";
|
|
7543
|
+
document.body.appendChild(element);
|
|
7544
|
+
element.click();
|
|
7545
|
+
document.body.removeChild(element);
|
|
7546
|
+
}
|
|
7547
|
+
function useDownloadYAML() {
|
|
7548
|
+
return function(options) {
|
|
7549
|
+
const { name: name2, item } = options;
|
|
7550
|
+
const content = yaml__default.default.dump(item);
|
|
7551
|
+
download(`${name2}.yaml`, content);
|
|
7552
|
+
};
|
|
7553
|
+
}
|
|
7554
|
+
function useEdit() {
|
|
7555
|
+
const { resource } = core.useParsed();
|
|
7556
|
+
const go = core.useGo();
|
|
7557
|
+
const edit2 = React.useCallback(
|
|
7558
|
+
(id) => {
|
|
7559
|
+
go({
|
|
7560
|
+
to: `/${resource == null ? void 0 : resource.name}/edit`,
|
|
7561
|
+
query: {
|
|
7562
|
+
id
|
|
7563
|
+
}
|
|
7564
|
+
});
|
|
7565
|
+
},
|
|
7566
|
+
[go, resource == null ? void 0 : resource.name]
|
|
7567
|
+
);
|
|
7568
|
+
return { edit: edit2 };
|
|
7569
|
+
}
|
|
7570
|
+
function K8sDropdown(props) {
|
|
7571
|
+
const { data: data2 } = props;
|
|
7572
|
+
const kit = eagle.useUIKit();
|
|
7573
|
+
const useResourceResult = core.useResource();
|
|
7574
|
+
const resource = useResourceResult.resource;
|
|
7575
|
+
const { edit: edit2 } = useEdit();
|
|
7576
|
+
const { modalProps, visible, openDeleteConfirmModal } = useDeleteModal(
|
|
7577
|
+
(resource == null ? void 0 : resource.name) || ""
|
|
7578
|
+
);
|
|
7579
|
+
const download2 = useDownloadYAML();
|
|
7580
|
+
const { t } = useTranslation();
|
|
7581
|
+
return /* @__PURE__ */ jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment, { children: [
|
|
7582
|
+
/* @__PURE__ */ jsxRuntime.exports.jsx(
|
|
7583
|
+
kit.dropdown,
|
|
7584
|
+
{
|
|
7585
|
+
overlay: /* @__PURE__ */ jsxRuntime.exports.jsxs(kit.menu, { children: [
|
|
7586
|
+
/* @__PURE__ */ jsxRuntime.exports.jsx(
|
|
7587
|
+
kit.menuItem,
|
|
7588
|
+
{
|
|
7589
|
+
onClick: () => {
|
|
7590
|
+
if (data2.id) {
|
|
7591
|
+
edit2(data2.id);
|
|
7592
|
+
}
|
|
7593
|
+
},
|
|
7594
|
+
children: /* @__PURE__ */ jsxRuntime.exports.jsx(eagle.Icon, { src: iconsReact.EditPen16PrimaryIcon, children: t("edit") })
|
|
7595
|
+
}
|
|
7596
|
+
),
|
|
7597
|
+
/* @__PURE__ */ jsxRuntime.exports.jsx(
|
|
7598
|
+
kit.menuItem,
|
|
7599
|
+
{
|
|
7600
|
+
danger: true,
|
|
7601
|
+
onClick: () => {
|
|
7602
|
+
openDeleteConfirmModal(data2.id);
|
|
7603
|
+
},
|
|
7604
|
+
children: /* @__PURE__ */ jsxRuntime.exports.jsx(eagle.Icon, { src: iconsReact.TrashBinDelete16Icon, children: t("delete") })
|
|
7605
|
+
}
|
|
7606
|
+
),
|
|
7607
|
+
/* @__PURE__ */ jsxRuntime.exports.jsx(
|
|
7608
|
+
kit.menu.Item,
|
|
7609
|
+
{
|
|
7610
|
+
onClick: () => {
|
|
7611
|
+
var _a;
|
|
7612
|
+
if (data2.id) {
|
|
7613
|
+
download2({
|
|
7614
|
+
name: ((_a = data2.metadata) == null ? void 0 : _a.name) || data2.kind || "",
|
|
7615
|
+
item: data2
|
|
7616
|
+
});
|
|
7617
|
+
}
|
|
7618
|
+
},
|
|
7619
|
+
children: /* @__PURE__ */ jsxRuntime.exports.jsx(eagle.Icon, { src: iconsReact.Download16GradientBlueIcon, children: t("download_yaml") })
|
|
7620
|
+
}
|
|
7621
|
+
),
|
|
7622
|
+
props.children
|
|
7623
|
+
] }),
|
|
7624
|
+
children: /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, { type: "tertiary", size: "small", children: /* @__PURE__ */ jsxRuntime.exports.jsx(eagle.Icon, { src: iconsReact.MoreEllipsis316BoldBlueIcon }) })
|
|
7625
|
+
}
|
|
7626
|
+
),
|
|
7627
|
+
visible ? /* @__PURE__ */ jsxRuntime.exports.jsx(kit.modal, { ...modalProps }) : null
|
|
7628
|
+
] });
|
|
7629
|
+
}
|
|
7630
|
+
globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
7631
|
+
function adopt(value) {
|
|
7632
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
7633
|
+
resolve(value);
|
|
7634
|
+
});
|
|
7635
|
+
}
|
|
7636
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
7637
|
+
function fulfilled(value) {
|
|
7638
|
+
try {
|
|
7639
|
+
step(generator.next(value));
|
|
7640
|
+
} catch (e) {
|
|
7641
|
+
reject(e);
|
|
7642
|
+
}
|
|
7643
|
+
}
|
|
7644
|
+
function rejected(value) {
|
|
7645
|
+
try {
|
|
7646
|
+
step(generator["throw"](value));
|
|
7647
|
+
} catch (e) {
|
|
7648
|
+
reject(e);
|
|
7649
|
+
}
|
|
7650
|
+
}
|
|
7651
|
+
function step(result) {
|
|
7652
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
7653
|
+
}
|
|
7654
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
7655
|
+
});
|
|
7656
|
+
};
|
|
7657
|
+
function useEventCallback(fn) {
|
|
7658
|
+
const ref = React.useRef(() => {
|
|
7659
|
+
throw new Error("Cannot call an event handler while rendering.");
|
|
7660
|
+
});
|
|
7661
|
+
useIsomorphicLayoutEffect(() => {
|
|
7662
|
+
ref.current = fn;
|
|
7663
|
+
}, [fn]);
|
|
7664
|
+
return React.useCallback((...args) => ref.current(...args), [ref]);
|
|
7665
|
+
}
|
|
7666
|
+
function useEventListener(eventName, handler, element, options) {
|
|
7667
|
+
const savedHandler = React.useRef(handler);
|
|
7668
|
+
useIsomorphicLayoutEffect(() => {
|
|
7669
|
+
savedHandler.current = handler;
|
|
7670
|
+
}, [handler]);
|
|
7671
|
+
React.useEffect(() => {
|
|
7672
|
+
var _a;
|
|
7673
|
+
const targetElement = (_a = element === null || element === void 0 ? void 0 : element.current) !== null && _a !== void 0 ? _a : window;
|
|
7674
|
+
if (!(targetElement && targetElement.addEventListener))
|
|
7675
|
+
return;
|
|
7676
|
+
const listener = (event) => savedHandler.current(event);
|
|
7677
|
+
targetElement.addEventListener(eventName, listener, options);
|
|
7678
|
+
return () => {
|
|
7679
|
+
targetElement.removeEventListener(eventName, listener, options);
|
|
7680
|
+
};
|
|
7681
|
+
}, [eventName, element, options]);
|
|
7682
|
+
}
|
|
7683
|
+
globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
7684
|
+
function adopt(value) {
|
|
7685
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
7686
|
+
resolve(value);
|
|
7687
|
+
});
|
|
7688
|
+
}
|
|
7689
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
7690
|
+
function fulfilled(value) {
|
|
7691
|
+
try {
|
|
7692
|
+
step(generator.next(value));
|
|
7693
|
+
} catch (e) {
|
|
7694
|
+
reject(e);
|
|
7695
|
+
}
|
|
7696
|
+
}
|
|
7697
|
+
function rejected(value) {
|
|
7698
|
+
try {
|
|
7699
|
+
step(generator["throw"](value));
|
|
7700
|
+
} catch (e) {
|
|
7701
|
+
reject(e);
|
|
7702
|
+
}
|
|
7703
|
+
}
|
|
7704
|
+
function step(result) {
|
|
7705
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
7706
|
+
}
|
|
7707
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
7708
|
+
});
|
|
7709
|
+
};
|
|
7710
|
+
const useIsomorphicLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
7711
|
+
function useLocalStorage(key, initialValue) {
|
|
7712
|
+
const readValue = React.useCallback(() => {
|
|
7713
|
+
if (typeof window === "undefined") {
|
|
7714
|
+
return initialValue;
|
|
7715
|
+
}
|
|
7716
|
+
try {
|
|
7717
|
+
const item = window.localStorage.getItem(key);
|
|
7718
|
+
return item ? parseJSON(item) : initialValue;
|
|
7719
|
+
} catch (error) {
|
|
7720
|
+
console.warn(`Error reading localStorage key \u201C${key}\u201D:`, error);
|
|
7721
|
+
return initialValue;
|
|
7722
|
+
}
|
|
7723
|
+
}, [initialValue, key]);
|
|
7724
|
+
const [storedValue, setStoredValue] = React.useState(readValue);
|
|
7725
|
+
const setValue = useEventCallback((value) => {
|
|
7726
|
+
if (typeof window === "undefined") {
|
|
7727
|
+
console.warn(`Tried setting localStorage key \u201C${key}\u201D even though environment is not a client`);
|
|
7728
|
+
}
|
|
7729
|
+
try {
|
|
7730
|
+
const newValue = value instanceof Function ? value(storedValue) : value;
|
|
7731
|
+
window.localStorage.setItem(key, JSON.stringify(newValue));
|
|
7732
|
+
setStoredValue(newValue);
|
|
7733
|
+
window.dispatchEvent(new Event("local-storage"));
|
|
7734
|
+
} catch (error) {
|
|
7735
|
+
console.warn(`Error setting localStorage key \u201C${key}\u201D:`, error);
|
|
7736
|
+
}
|
|
7737
|
+
});
|
|
7738
|
+
React.useEffect(() => {
|
|
7739
|
+
setStoredValue(readValue());
|
|
7740
|
+
}, []);
|
|
7741
|
+
const handleStorageChange = React.useCallback((event) => {
|
|
7742
|
+
if ((event === null || event === void 0 ? void 0 : event.key) && event.key !== key) {
|
|
7743
|
+
return;
|
|
7744
|
+
}
|
|
7745
|
+
setStoredValue(readValue());
|
|
7746
|
+
}, [key, readValue]);
|
|
7747
|
+
useEventListener("storage", handleStorageChange);
|
|
7748
|
+
useEventListener("local-storage", handleStorageChange);
|
|
7749
|
+
return [storedValue, setValue];
|
|
7750
|
+
}
|
|
7751
|
+
function parseJSON(value) {
|
|
7752
|
+
try {
|
|
7753
|
+
return value === "undefined" ? void 0 : JSON.parse(value !== null && value !== void 0 ? value : "");
|
|
7754
|
+
} catch (_a) {
|
|
7755
|
+
console.log("parsing error on", { value });
|
|
7756
|
+
return void 0;
|
|
7757
|
+
}
|
|
7758
|
+
}
|
|
7759
|
+
const NS_STORE_KEY = "namespace-filter";
|
|
7760
|
+
const ALL_NS = "_all";
|
|
7761
|
+
const useNamespacesFilter = () => {
|
|
7762
|
+
const [value] = useLocalStorage(NS_STORE_KEY, ALL_NS);
|
|
7763
|
+
return {
|
|
7764
|
+
value
|
|
7765
|
+
};
|
|
7766
|
+
};
|
|
7767
|
+
const NamespacesFilter = () => {
|
|
7768
|
+
const kit = eagle.useUIKit();
|
|
7769
|
+
const { t } = useTranslation();
|
|
7770
|
+
const { data: data2 } = core.useList({
|
|
7771
|
+
resource: "namespaces",
|
|
7772
|
+
meta: {
|
|
7773
|
+
resourceBasePath: "/api/v1",
|
|
7774
|
+
kind: "Namespace"
|
|
7775
|
+
}
|
|
7776
|
+
});
|
|
7777
|
+
const [value, setValue] = useLocalStorage(NS_STORE_KEY, ALL_NS);
|
|
7778
|
+
return /* @__PURE__ */ jsxRuntime.exports.jsxs(
|
|
7779
|
+
kit.select,
|
|
7780
|
+
{
|
|
7781
|
+
input: {
|
|
7782
|
+
value,
|
|
7783
|
+
onChange(value2) {
|
|
7784
|
+
setValue(value2);
|
|
7785
|
+
}
|
|
7786
|
+
},
|
|
7787
|
+
children: [
|
|
7788
|
+
/* @__PURE__ */ jsxRuntime.exports.jsx(kit.option, { value: "_all", children: t("dovetail.all_namespaces") }, "_all"),
|
|
7789
|
+
data2 == null ? void 0 : data2.data.map((namespace2) => {
|
|
7790
|
+
const { name: name2 } = namespace2.metadata;
|
|
7791
|
+
return /* @__PURE__ */ jsxRuntime.exports.jsx(kit.option, { value: name2, children: name2 }, name2);
|
|
7792
|
+
})
|
|
7793
|
+
]
|
|
7794
|
+
}
|
|
7795
|
+
);
|
|
7796
|
+
};
|
|
7797
|
+
var ColumnKeys = /* @__PURE__ */ ((ColumnKeys2) => {
|
|
7798
|
+
ColumnKeys2["age"] = "age";
|
|
7799
|
+
ColumnKeys2["name"] = "name";
|
|
7800
|
+
ColumnKeys2["namespace"] = "namespace";
|
|
7801
|
+
ColumnKeys2["phase"] = "phase";
|
|
7802
|
+
ColumnKeys2["replicas"] = "replicas";
|
|
7803
|
+
ColumnKeys2["deploymentImage"] = "deploymentImage";
|
|
7804
|
+
ColumnKeys2["podImage"] = "podImage";
|
|
7805
|
+
return ColumnKeys2;
|
|
7806
|
+
})(ColumnKeys || {});
|
|
7807
|
+
const useEagleTable = (params) => {
|
|
7808
|
+
var _a;
|
|
7809
|
+
const { columns, tableProps, formatter, Dropdown = K8sDropdown } = params;
|
|
7810
|
+
const [selectedKeys, setSelectedKeys] = React.useState([]);
|
|
7811
|
+
const [currentPage, setCurrentPage] = React.useState((tableProps == null ? void 0 : tableProps.currentPage) || 1);
|
|
7812
|
+
const { value: nsFilter } = useNamespacesFilter();
|
|
7813
|
+
const useTableParams = React.useMemo(() => {
|
|
7814
|
+
const mergedParams = lodashEs.merge(params.useTableParams, {
|
|
7815
|
+
filters: {
|
|
7816
|
+
permanent: [
|
|
7817
|
+
{
|
|
7818
|
+
field: "metadata.namespace",
|
|
7819
|
+
operator: "eq",
|
|
7820
|
+
value: nsFilter === ALL_NS ? null : nsFilter
|
|
7821
|
+
}
|
|
7822
|
+
]
|
|
7823
|
+
}
|
|
7824
|
+
});
|
|
7825
|
+
return mergedParams;
|
|
7826
|
+
}, [params.useTableParams, nsFilter]);
|
|
7827
|
+
const table = core.useTable(useTableParams);
|
|
7828
|
+
const onPageChange = React.useCallback(
|
|
7829
|
+
(page) => {
|
|
7830
|
+
setCurrentPage(page);
|
|
7831
|
+
},
|
|
7832
|
+
[setCurrentPage]
|
|
7833
|
+
);
|
|
7834
|
+
const actionColumn = {
|
|
7835
|
+
key: "action",
|
|
7836
|
+
display: true,
|
|
7837
|
+
dataIndex: [],
|
|
7838
|
+
title: () => /* @__PURE__ */ jsxRuntime.exports.jsx(eagle.Icon, { src: iconsReact.SettingsGear16GradientGrayIcon }),
|
|
7839
|
+
render: (_2, record) => {
|
|
7840
|
+
return /* @__PURE__ */ jsxRuntime.exports.jsx(Dropdown, { data: record });
|
|
7841
|
+
}
|
|
7842
|
+
};
|
|
7843
|
+
const finalDataSource = (_a = table.tableQueryResult.data) == null ? void 0 : _a.data.map(formatter);
|
|
7844
|
+
const finalProps = {
|
|
7845
|
+
loading: table.tableQueryResult.isLoading,
|
|
7846
|
+
dataSource: finalDataSource || [],
|
|
7847
|
+
columns: [...columns, actionColumn],
|
|
7848
|
+
refetch: () => null,
|
|
7849
|
+
error: false,
|
|
7850
|
+
rowKey: "id",
|
|
7851
|
+
currentPage,
|
|
7852
|
+
currentSize: (tableProps == null ? void 0 : tableProps.currentSize) || 5,
|
|
7853
|
+
onPageChange,
|
|
7854
|
+
onSelect: (keys) => {
|
|
7855
|
+
setSelectedKeys(keys);
|
|
7856
|
+
}
|
|
7857
|
+
};
|
|
7858
|
+
return { tableProps: finalProps, selectedKeys, ...table };
|
|
7859
|
+
};
|
|
7860
|
+
const index_hex8jv = "";
|
|
7861
|
+
const BreadcrumbStyle = "b142d7q8";
|
|
7862
|
+
function Breadcrumb(props) {
|
|
7863
|
+
const {
|
|
7864
|
+
breadcrumbs
|
|
7865
|
+
} = core.useBreadcrumb();
|
|
7866
|
+
return /* @__PURE__ */ jsxRuntime.exports.jsx("ul", {
|
|
7867
|
+
className: cx_default(BreadcrumbStyle, props.className),
|
|
7868
|
+
children: breadcrumbs.map((breadcrumb) => {
|
|
7869
|
+
return /* @__PURE__ */ jsxRuntime.exports.jsx("li", {
|
|
7870
|
+
className: "breadcrumb-item",
|
|
7871
|
+
children: breadcrumb.href ? /* @__PURE__ */ jsxRuntime.exports.jsx(reactRouterDom.Link, {
|
|
7872
|
+
to: breadcrumb.href,
|
|
7873
|
+
children: breadcrumb.label
|
|
7874
|
+
}) : /* @__PURE__ */ jsxRuntime.exports.jsx("span", {
|
|
7875
|
+
children: breadcrumb.label
|
|
7876
|
+
})
|
|
7877
|
+
}, `breadcrumb-${breadcrumb.label}`);
|
|
7878
|
+
})
|
|
7879
|
+
});
|
|
7880
|
+
}
|
|
7881
|
+
function NameInputWidget(props) {
|
|
7882
|
+
const kit = eagle.useUIKit();
|
|
7883
|
+
const { action } = core.useResource();
|
|
7884
|
+
return /* @__PURE__ */ jsxRuntime.exports.jsx(kit.input, { ...props, disabled: action === "edit" });
|
|
7885
|
+
}
|
|
7886
|
+
const dnsSubDomainRules = [
|
|
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 '-' \u548C '.'\uFF0C\u4E14\u5FC5\u987B\u4EE5\u5B57\u6BCD\u6216\u6570\u5B57\u5F00\u5934\u548C\u7ED3\u675F"
|
|
7894
|
+
},
|
|
7895
|
+
{
|
|
7896
|
+
max: 253,
|
|
7897
|
+
message: "\u540D\u79F0\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7253\u4E2A\u5B57\u7B26"
|
|
7898
|
+
}
|
|
7899
|
+
];
|
|
7900
|
+
const rfc1123LabelRules = [
|
|
7901
|
+
{
|
|
7902
|
+
required: true,
|
|
7903
|
+
message: "\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"
|
|
7904
|
+
},
|
|
7905
|
+
{
|
|
7906
|
+
pattern: /^[a-z0-9]([-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\u6216\u6570\u5B57\u5F00\u5934\u548C\u7ED3\u675F"
|
|
7908
|
+
},
|
|
7909
|
+
{
|
|
7910
|
+
max: 63,
|
|
7911
|
+
message: "\u540D\u79F0\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC763\u4E2A\u5B57\u7B26"
|
|
7912
|
+
}
|
|
7913
|
+
];
|
|
7914
|
+
const rfc1035LabelRules = [
|
|
7915
|
+
{
|
|
7916
|
+
required: true,
|
|
7917
|
+
message: "\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"
|
|
7918
|
+
},
|
|
7919
|
+
{
|
|
7920
|
+
pattern: /^[a-z]([-a-z0-9]*[a-z0-9])?$/,
|
|
7921
|
+
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"
|
|
7922
|
+
},
|
|
7923
|
+
{
|
|
7924
|
+
max: 63,
|
|
7925
|
+
message: "\u540D\u79F0\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC763\u4E2A\u5B57\u7B26"
|
|
7926
|
+
}
|
|
7927
|
+
];
|
|
7928
|
+
function NamespaceSelectWidget(props) {
|
|
7929
|
+
const kit = eagle.useUIKit();
|
|
7930
|
+
const { action } = core.useResource();
|
|
7931
|
+
const { data: data2 } = core.useList({
|
|
7932
|
+
resource: "namespaces",
|
|
7933
|
+
meta: {
|
|
7934
|
+
resourceBasePath: "/api/v1",
|
|
7935
|
+
kind: "Namespace"
|
|
7936
|
+
}
|
|
7937
|
+
});
|
|
7938
|
+
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)) });
|
|
7939
|
+
}
|
|
7940
|
+
const namespaceRules = [
|
|
7941
|
+
{
|
|
7942
|
+
required: true,
|
|
7943
|
+
message: "Please input the namespace."
|
|
7944
|
+
}
|
|
7945
|
+
];
|
|
7946
|
+
function KeyValueInput(props) {
|
|
7947
|
+
const { children, item } = props;
|
|
7948
|
+
const kit = eagle.useUIKit();
|
|
7949
|
+
const onKeyChange = React.useCallback(
|
|
7950
|
+
(event) => {
|
|
7951
|
+
var _a;
|
|
7952
|
+
const key = event.target.value;
|
|
7953
|
+
(_a = props.onChange) == null ? void 0 : _a.call(props, {
|
|
7954
|
+
...item,
|
|
7955
|
+
key
|
|
7956
|
+
});
|
|
7957
|
+
},
|
|
7958
|
+
[item, props]
|
|
7959
|
+
);
|
|
7960
|
+
const onValueChange = React.useCallback(
|
|
7961
|
+
(event) => {
|
|
7962
|
+
var _a;
|
|
7963
|
+
console.log(event);
|
|
7964
|
+
const value = event.target.value;
|
|
7965
|
+
(_a = props.onChange) == null ? void 0 : _a.call(props, {
|
|
7966
|
+
...item,
|
|
7967
|
+
value
|
|
7968
|
+
});
|
|
7969
|
+
},
|
|
7970
|
+
[item, props]
|
|
7971
|
+
);
|
|
7972
|
+
return /* @__PURE__ */ jsxRuntime.exports.jsxs(kit.space, { children: [
|
|
7973
|
+
/* @__PURE__ */ jsxRuntime.exports.jsx(kit.input, { value: item.key, onChange: onKeyChange }),
|
|
7974
|
+
/* @__PURE__ */ jsxRuntime.exports.jsx(kit.textArea, { value: item.value, onChange: onValueChange }),
|
|
7975
|
+
children
|
|
7976
|
+
] });
|
|
7977
|
+
}
|
|
7978
|
+
function KeyValueListWidget(props) {
|
|
7979
|
+
const kit = eagle.useUIKit();
|
|
7980
|
+
const { value } = props;
|
|
7981
|
+
const items = React.useMemo(() => {
|
|
7982
|
+
return Object.entries(value || {}).map(([key, value2]) => ({
|
|
7983
|
+
key,
|
|
7984
|
+
value: value2
|
|
7985
|
+
}));
|
|
7986
|
+
}, [value]);
|
|
7987
|
+
const onChange = React.useCallback(
|
|
7988
|
+
(newItems) => {
|
|
7989
|
+
var _a;
|
|
7990
|
+
const newValue = newItems.reduce((result, item) => {
|
|
7991
|
+
result[item.key] = item.value;
|
|
7992
|
+
return result;
|
|
7993
|
+
}, {});
|
|
7994
|
+
(_a = props.onChange) == null ? void 0 : _a.call(props, newValue);
|
|
7995
|
+
},
|
|
7996
|
+
[props]
|
|
7997
|
+
);
|
|
7998
|
+
const onRemove = React.useCallback(
|
|
7999
|
+
(index) => {
|
|
8000
|
+
const result = [...items];
|
|
8001
|
+
result.splice(index, 1);
|
|
8002
|
+
onChange(result);
|
|
8003
|
+
},
|
|
8004
|
+
[onChange, items]
|
|
8005
|
+
);
|
|
8006
|
+
const onAdd = React.useCallback(() => {
|
|
8007
|
+
onChange([...items, { key: "", value: "" }]);
|
|
8008
|
+
}, [onChange, items]);
|
|
8009
|
+
return /* @__PURE__ */ jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment, { children: [
|
|
8010
|
+
items.map((item, index) => {
|
|
8011
|
+
return /* @__PURE__ */ jsxRuntime.exports.jsx(
|
|
8012
|
+
KeyValueInput,
|
|
8013
|
+
{
|
|
8014
|
+
item,
|
|
8015
|
+
onChange: (newItem) => {
|
|
8016
|
+
console.log(newItem);
|
|
8017
|
+
const temp = [...items];
|
|
8018
|
+
temp.splice(index, 1, newItem);
|
|
8019
|
+
onChange(temp);
|
|
8020
|
+
},
|
|
8021
|
+
children: /* @__PURE__ */ jsxRuntime.exports.jsx(
|
|
8022
|
+
kit.button,
|
|
8023
|
+
{
|
|
8024
|
+
onClick: () => {
|
|
8025
|
+
onRemove(index);
|
|
8026
|
+
},
|
|
8027
|
+
danger: true,
|
|
8028
|
+
children: "Remove"
|
|
8029
|
+
}
|
|
8030
|
+
)
|
|
8031
|
+
},
|
|
8032
|
+
index
|
|
8033
|
+
);
|
|
8034
|
+
}),
|
|
8035
|
+
/* @__PURE__ */ jsxRuntime.exports.jsx(kit.form.Item, { children: /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, { type: "primary", onClick: onAdd, children: "Add" }) })
|
|
8036
|
+
] });
|
|
8037
|
+
}
|
|
8038
|
+
function MetadataForm() {
|
|
8039
|
+
const kit = eagle.useUIKit();
|
|
8040
|
+
return /* @__PURE__ */ jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment, { children: [
|
|
8041
|
+
/* @__PURE__ */ jsxRuntime.exports.jsx(kit.form.Item, { label: "Name", name: ["metadata", "name"], rules: rfc1123LabelRules, children: /* @__PURE__ */ jsxRuntime.exports.jsx(NameInputWidget, {}) }),
|
|
8042
|
+
/* @__PURE__ */ jsxRuntime.exports.jsx(
|
|
8043
|
+
kit.form.Item,
|
|
8044
|
+
{
|
|
8045
|
+
label: "Namespace",
|
|
8046
|
+
name: ["metadata", "namespace"],
|
|
8047
|
+
rules: namespaceRules,
|
|
8048
|
+
children: /* @__PURE__ */ jsxRuntime.exports.jsx(NamespaceSelectWidget, {})
|
|
8049
|
+
}
|
|
8050
|
+
),
|
|
8051
|
+
/* @__PURE__ */ jsxRuntime.exports.jsx(kit.form.Item, { name: ["metadata", "labels"], label: "Labels", children: /* @__PURE__ */ jsxRuntime.exports.jsx(KeyValueListWidget, {}) }),
|
|
8052
|
+
/* @__PURE__ */ jsxRuntime.exports.jsx(kit.form.Item, { name: ["metadata", "annotations"], label: "Annotations", children: /* @__PURE__ */ jsxRuntime.exports.jsx(KeyValueListWidget, {}) })
|
|
8053
|
+
] });
|
|
8054
|
+
}
|
|
8055
|
+
function addId(arr, idKey) {
|
|
8056
|
+
return arr.map((e) => {
|
|
8057
|
+
return {
|
|
8058
|
+
id: e[idKey],
|
|
8059
|
+
...e
|
|
8060
|
+
};
|
|
8061
|
+
});
|
|
8062
|
+
}
|
|
7818
8063
|
const ConditionsTable = ({ conditions = [] }) => {
|
|
7819
8064
|
const kit = eagle.useUIKit();
|
|
7820
8065
|
const { t } = useTranslation();
|
|
@@ -7864,237 +8109,6 @@ var __publicField = (obj, key, value) => {
|
|
|
7864
8109
|
}
|
|
7865
8110
|
);
|
|
7866
8111
|
};
|
|
7867
|
-
const index_86mllf = "";
|
|
7868
|
-
const MoreTriggerStyle = "m1u1f5zp";
|
|
7869
|
-
const ImageNames = ({
|
|
7870
|
-
value
|
|
7871
|
-
}) => {
|
|
7872
|
-
const kit = eagle.useUIKit();
|
|
7873
|
-
const {
|
|
7874
|
-
t
|
|
7875
|
-
} = useTranslation();
|
|
7876
|
-
return /* @__PURE__ */ jsxRuntime.exports.jsxs("div", {
|
|
7877
|
-
children: [/* @__PURE__ */ jsxRuntime.exports.jsx("div", {
|
|
7878
|
-
children: value[0]
|
|
7879
|
-
}), value.length > 1 && /* @__PURE__ */ jsxRuntime.exports.jsx(kit.tooltip, {
|
|
7880
|
-
title: /* @__PURE__ */ jsxRuntime.exports.jsx(jsxRuntime.exports.Fragment, {
|
|
7881
|
-
children: value.slice(1).map((name2, index) => {
|
|
7882
|
-
return /* @__PURE__ */ jsxRuntime.exports.jsx("div", {
|
|
7883
|
-
children: name2
|
|
7884
|
-
}, index);
|
|
7885
|
-
})
|
|
7886
|
-
}),
|
|
7887
|
-
children: /* @__PURE__ */ jsxRuntime.exports.jsxs("div", {
|
|
7888
|
-
className: cx_default(eagle.Typo.Label.l4_regular, MoreTriggerStyle),
|
|
7889
|
-
children: ["+", value.length - 1, " ", t("dovetail.more")]
|
|
7890
|
-
})
|
|
7891
|
-
})]
|
|
7892
|
-
});
|
|
7893
|
-
};
|
|
7894
|
-
const StateTag = ({ state: state2 }) => {
|
|
7895
|
-
const kit = eagle.useUIKit();
|
|
7896
|
-
const colorMap = {
|
|
7897
|
-
running: "green",
|
|
7898
|
-
active: "green",
|
|
7899
|
-
succeeded: "blue",
|
|
7900
|
-
terminated: "red",
|
|
7901
|
-
pending: "gray"
|
|
7902
|
-
};
|
|
7903
|
-
return /* @__PURE__ */ jsxRuntime.exports.jsx(kit.tag, { color: colorMap[(state2 == null ? void 0 : state2.toLowerCase()) || ""] || "green", children: state2 || "Active" });
|
|
7904
|
-
};
|
|
7905
|
-
const index_1wf16rt = "";
|
|
7906
|
-
const MinusButtonStyle = "m8ychfk";
|
|
7907
|
-
const PlusButtonStyle = "p1o004do";
|
|
7908
|
-
const WorkloadReplicas = ({
|
|
7909
|
-
record
|
|
7910
|
-
}) => {
|
|
7911
|
-
const kit = eagle.useUIKit();
|
|
7912
|
-
const {
|
|
7913
|
-
resource
|
|
7914
|
-
} = core.useResource();
|
|
7915
|
-
const {
|
|
7916
|
-
mutate
|
|
7917
|
-
} = core.useUpdate();
|
|
7918
|
-
const readyReplicas = record.status && "readyReplicas" in record.status ? record.status.readyReplicas : 0;
|
|
7919
|
-
const replicas2 = record.status && "replicas" in record.status ? record.status.replicas : 0;
|
|
7920
|
-
const canScale = record.kind === "Deployment" || record.kind === "StatefulSet";
|
|
7921
|
-
const currentReplicas = lodashEs.get(record, "spec.replicas", 0);
|
|
7922
|
-
const scale = (delta) => {
|
|
7923
|
-
const v2 = record.scale(currentReplicas + delta);
|
|
7924
|
-
const id = v2.id;
|
|
7925
|
-
pruneBeforeEdit(v2);
|
|
7926
|
-
mutate({
|
|
7927
|
-
id,
|
|
7928
|
-
resource: (resource == null ? void 0 : resource.name) || "",
|
|
7929
|
-
values: v2
|
|
7930
|
-
});
|
|
7931
|
-
};
|
|
7932
|
-
return /* @__PURE__ */ jsxRuntime.exports.jsxs("span", {
|
|
7933
|
-
children: [canScale && /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, {
|
|
7934
|
-
className: MinusButtonStyle,
|
|
7935
|
-
type: "ordinary",
|
|
7936
|
-
size: "small",
|
|
7937
|
-
onClick: () => scale(-1),
|
|
7938
|
-
children: "-"
|
|
7939
|
-
}), readyReplicas, "/", replicas2, canScale && /* @__PURE__ */ jsxRuntime.exports.jsx(kit.button, {
|
|
7940
|
-
className: PlusButtonStyle,
|
|
7941
|
-
type: "ordinary",
|
|
7942
|
-
size: "small",
|
|
7943
|
-
onClick: () => scale(1),
|
|
7944
|
-
children: "+"
|
|
7945
|
-
})]
|
|
7946
|
-
});
|
|
7947
|
-
};
|
|
7948
|
-
const NameLink = (props) => {
|
|
7949
|
-
var _a;
|
|
7950
|
-
const { name: name2, id, resource } = props;
|
|
7951
|
-
const kit = eagle.useUIKit();
|
|
7952
|
-
const go = core.useGo();
|
|
7953
|
-
const navigation = core.useNavigation();
|
|
7954
|
-
const parsed = core.useParsed();
|
|
7955
|
-
const resourceName = resource || ((_a = parsed.resource) == null ? void 0 : _a.name) || "";
|
|
7956
|
-
return /* @__PURE__ */ jsxRuntime.exports.jsx(
|
|
7957
|
-
kit.button,
|
|
7958
|
-
{
|
|
7959
|
-
type: "link",
|
|
7960
|
-
onClick: () => {
|
|
7961
|
-
go({
|
|
7962
|
-
to: navigation.showUrl(resourceName, ""),
|
|
7963
|
-
query: {
|
|
7964
|
-
id
|
|
7965
|
-
}
|
|
7966
|
-
});
|
|
7967
|
-
},
|
|
7968
|
-
children: name2
|
|
7969
|
-
}
|
|
7970
|
-
);
|
|
7971
|
-
};
|
|
7972
|
-
const CommonSorter = (dataIndex) => (a, b2) => {
|
|
7973
|
-
const valA = lodash.exports.get(a, dataIndex);
|
|
7974
|
-
const valB = lodash.exports.get(b2, dataIndex);
|
|
7975
|
-
if (valA === valB)
|
|
7976
|
-
return 0;
|
|
7977
|
-
if (valA > valB)
|
|
7978
|
-
return 1;
|
|
7979
|
-
return -1;
|
|
7980
|
-
};
|
|
7981
|
-
const NameColumnRenderer = (i18n2, resource = "") => {
|
|
7982
|
-
const dataIndex = ["metadata", "name"];
|
|
7983
|
-
return {
|
|
7984
|
-
key: "name",
|
|
7985
|
-
display: true,
|
|
7986
|
-
dataIndex,
|
|
7987
|
-
title: i18n2.t("name"),
|
|
7988
|
-
sortable: true,
|
|
7989
|
-
sorter: CommonSorter(dataIndex),
|
|
7990
|
-
render: (v2, record) => {
|
|
7991
|
-
return /* @__PURE__ */ jsxRuntime.exports.jsx(NameLink, { name: v2, id: record.id, resource });
|
|
7992
|
-
}
|
|
7993
|
-
};
|
|
7994
|
-
};
|
|
7995
|
-
const NameSpaceColumnRenderer = (i18n2) => {
|
|
7996
|
-
const dataIndex = ["metadata", "namespace"];
|
|
7997
|
-
return {
|
|
7998
|
-
key: "namespace",
|
|
7999
|
-
display: true,
|
|
8000
|
-
dataIndex,
|
|
8001
|
-
title: i18n2.t("namespace"),
|
|
8002
|
-
sortable: true,
|
|
8003
|
-
sorter: CommonSorter(dataIndex)
|
|
8004
|
-
};
|
|
8005
|
-
};
|
|
8006
|
-
const PhaseColumnRenderer = (i18n2) => {
|
|
8007
|
-
const dataIndex = ["status", "phase"];
|
|
8008
|
-
return {
|
|
8009
|
-
key: "phase",
|
|
8010
|
-
display: true,
|
|
8011
|
-
dataIndex,
|
|
8012
|
-
title: i18n2.t("phase"),
|
|
8013
|
-
sortable: true,
|
|
8014
|
-
sorter: CommonSorter(dataIndex),
|
|
8015
|
-
render: (v2) => /* @__PURE__ */ jsxRuntime.exports.jsx(StateTag, { state: v2 })
|
|
8016
|
-
};
|
|
8017
|
-
};
|
|
8018
|
-
const WorkloadImageColumnRenderer = (i18n2) => {
|
|
8019
|
-
const dataIndex = ["imageNames"];
|
|
8020
|
-
return {
|
|
8021
|
-
key: "image",
|
|
8022
|
-
display: true,
|
|
8023
|
-
dataIndex,
|
|
8024
|
-
title: i18n2.t("image"),
|
|
8025
|
-
sortable: true,
|
|
8026
|
-
sorter: CommonSorter(dataIndex),
|
|
8027
|
-
render(value) {
|
|
8028
|
-
return /* @__PURE__ */ jsxRuntime.exports.jsx(ImageNames, { value });
|
|
8029
|
-
}
|
|
8030
|
-
};
|
|
8031
|
-
};
|
|
8032
|
-
const AgeColumnRenderer = (i18n2) => {
|
|
8033
|
-
const dataIndex = ["metadata", "creationTimestamp"];
|
|
8034
|
-
return {
|
|
8035
|
-
key: "creationTimestamp",
|
|
8036
|
-
display: true,
|
|
8037
|
-
dataIndex,
|
|
8038
|
-
title: i18n2.t("created_time"),
|
|
8039
|
-
sortable: true,
|
|
8040
|
-
sorter: (a, b2) => {
|
|
8041
|
-
const valA = new Date(lodash.exports.get(a, dataIndex));
|
|
8042
|
-
const valB = new Date(lodash.exports.get(b2, dataIndex));
|
|
8043
|
-
if (valA === valB)
|
|
8044
|
-
return 0;
|
|
8045
|
-
if (valA > valB)
|
|
8046
|
-
return 1;
|
|
8047
|
-
return -1;
|
|
8048
|
-
},
|
|
8049
|
-
render: (value) => {
|
|
8050
|
-
return /* @__PURE__ */ jsxRuntime.exports.jsx(Time, { date: new Date(value) });
|
|
8051
|
-
}
|
|
8052
|
-
};
|
|
8053
|
-
};
|
|
8054
|
-
const NodeNameColumnRenderer = (i18n2) => {
|
|
8055
|
-
const dataIndex = ["spec", "nodeName"];
|
|
8056
|
-
return {
|
|
8057
|
-
key: "node",
|
|
8058
|
-
display: true,
|
|
8059
|
-
dataIndex,
|
|
8060
|
-
title: i18n2.t("node_name"),
|
|
8061
|
-
sortable: true,
|
|
8062
|
-
sorter: CommonSorter(dataIndex)
|
|
8063
|
-
};
|
|
8064
|
-
};
|
|
8065
|
-
const RestartCountColumnRenderer = (i18n2) => {
|
|
8066
|
-
const dataIndex = ["restartCount"];
|
|
8067
|
-
return {
|
|
8068
|
-
key: "restartCount",
|
|
8069
|
-
display: true,
|
|
8070
|
-
dataIndex,
|
|
8071
|
-
title: i18n2.t("restarts"),
|
|
8072
|
-
sortable: true,
|
|
8073
|
-
sorter: CommonSorter(dataIndex)
|
|
8074
|
-
};
|
|
8075
|
-
};
|
|
8076
|
-
const CompletionsCountColumnRenderer = (i18n2) => {
|
|
8077
|
-
const dataIndex = ["completionsDisplay"];
|
|
8078
|
-
return {
|
|
8079
|
-
key: "completions",
|
|
8080
|
-
display: true,
|
|
8081
|
-
dataIndex,
|
|
8082
|
-
title: i18n2.t("completions"),
|
|
8083
|
-
sortable: true,
|
|
8084
|
-
sorter: CommonSorter(dataIndex)
|
|
8085
|
-
};
|
|
8086
|
-
};
|
|
8087
|
-
const DurationColumnRenderer = (i18n2) => {
|
|
8088
|
-
const dataIndex = ["durationDisplay"];
|
|
8089
|
-
return {
|
|
8090
|
-
key: "duration",
|
|
8091
|
-
display: true,
|
|
8092
|
-
dataIndex,
|
|
8093
|
-
title: i18n2.t("duration"),
|
|
8094
|
-
sortable: true,
|
|
8095
|
-
sorter: CommonSorter(dataIndex)
|
|
8096
|
-
};
|
|
8097
|
-
};
|
|
8098
8112
|
function getSecondsDiff(startDate, endDate) {
|
|
8099
8113
|
return Math.round(Math.abs(Date.parse(endDate) - Date.parse(startDate)) / 1e3);
|
|
8100
8114
|
}
|
|
@@ -8514,6 +8528,55 @@ var __publicField = (obj, key, value) => {
|
|
|
8514
8528
|
return `${(_b = (_a = this.rawYaml.status) == null ? void 0 : _a.containerStatuses) == null ? void 0 : _b.filter((c) => c.ready).length}/${(_c = this.rawYaml.spec) == null ? void 0 : _c.containers.length}`;
|
|
8515
8529
|
}
|
|
8516
8530
|
}
|
|
8531
|
+
class PodMetricsModel extends ResourceModel {
|
|
8532
|
+
constructor(data2) {
|
|
8533
|
+
super(data2);
|
|
8534
|
+
__publicField(this, "usage");
|
|
8535
|
+
this.data = data2;
|
|
8536
|
+
let cpuUsageNum = 0;
|
|
8537
|
+
let memoryUsageNum = 0;
|
|
8538
|
+
for (const container2 of data2.containers) {
|
|
8539
|
+
cpuUsageNum += parseSi(container2.usage.cpu || "0");
|
|
8540
|
+
memoryUsageNum += parseSi(container2.usage.memory || "0");
|
|
8541
|
+
}
|
|
8542
|
+
this.usage = {
|
|
8543
|
+
cpu: {
|
|
8544
|
+
value: cpuUsageNum,
|
|
8545
|
+
si: formatSi(1e3 * cpuUsageNum, {
|
|
8546
|
+
suffix: "m",
|
|
8547
|
+
maxPrecision: 0
|
|
8548
|
+
})
|
|
8549
|
+
},
|
|
8550
|
+
memory: {
|
|
8551
|
+
value: memoryUsageNum,
|
|
8552
|
+
si: formatSi(memoryUsageNum, {
|
|
8553
|
+
suffix: "i",
|
|
8554
|
+
maxPrecision: 0
|
|
8555
|
+
})
|
|
8556
|
+
}
|
|
8557
|
+
};
|
|
8558
|
+
}
|
|
8559
|
+
}
|
|
8560
|
+
class CronJobModel extends WorkloadModel {
|
|
8561
|
+
constructor(data2) {
|
|
8562
|
+
super(data2);
|
|
8563
|
+
this.data = data2;
|
|
8564
|
+
}
|
|
8565
|
+
suspend() {
|
|
8566
|
+
const newOne = lodashEs.cloneDeep(this.data);
|
|
8567
|
+
if (this.data.kind === "CronJob") {
|
|
8568
|
+
lodashEs.set(newOne, "spec.suspend", true);
|
|
8569
|
+
}
|
|
8570
|
+
return newOne;
|
|
8571
|
+
}
|
|
8572
|
+
resume() {
|
|
8573
|
+
const newOne = lodashEs.cloneDeep(this.data);
|
|
8574
|
+
if (this.data.kind === "CronJob") {
|
|
8575
|
+
lodashEs.set(newOne, "spec.suspend", false);
|
|
8576
|
+
}
|
|
8577
|
+
return newOne;
|
|
8578
|
+
}
|
|
8579
|
+
}
|
|
8517
8580
|
const ErrorContent_1t51xnx = "";
|
|
8518
8581
|
const ErrorWrapper = "eckm4od";
|
|
8519
8582
|
const ErrorContent = "e1hl982n";
|
|
@@ -11725,14 +11788,18 @@ var __publicField = (obj, key, value) => {
|
|
|
11725
11788
|
default: MonacoYamlDiffEditor
|
|
11726
11789
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
11727
11790
|
exports2.ALL_NS = ALL_NS;
|
|
11791
|
+
exports2.AgeColumnRenderer = AgeColumnRenderer;
|
|
11728
11792
|
exports2.BASE_INIT_VALUE = BASE_INIT_VALUE;
|
|
11729
11793
|
exports2.Breadcrumb = Breadcrumb;
|
|
11730
11794
|
exports2.CRONJOB_INIT_VALUE = CRONJOB_INIT_VALUE;
|
|
11731
11795
|
exports2.ColumnKeys = ColumnKeys;
|
|
11796
|
+
exports2.CommonSorter = CommonSorter;
|
|
11797
|
+
exports2.CompletionsCountColumnRenderer = CompletionsCountColumnRenderer;
|
|
11732
11798
|
exports2.ConditionsField = ConditionsField;
|
|
11733
11799
|
exports2.ConditionsTable = ConditionsTable;
|
|
11734
11800
|
exports2.CreateButton = CreateButton;
|
|
11735
11801
|
exports2.CronJobDropdown = CronJobDropdown;
|
|
11802
|
+
exports2.CronJobModel = CronJobModel;
|
|
11736
11803
|
exports2.CronjobJobsTable = CronjobJobsTable;
|
|
11737
11804
|
exports2.DAEMONSET_INIT_VALUE = DAEMONSET_INIT_VALUE;
|
|
11738
11805
|
exports2.DEPLOYMENT_INIT_VALUE = DEPLOYMENT_INIT_VALUE;
|
|
@@ -11741,10 +11808,12 @@ var __publicField = (obj, key, value) => {
|
|
|
11741
11808
|
exports2.DeleteManyButton = DeleteManyButton;
|
|
11742
11809
|
exports2.Dovetail = Dovetail;
|
|
11743
11810
|
exports2.DrawerShow = DrawerShow;
|
|
11811
|
+
exports2.DurationColumnRenderer = DurationColumnRenderer;
|
|
11744
11812
|
exports2.EditButton = EditButton;
|
|
11745
11813
|
exports2.ImageField = ImageField;
|
|
11746
11814
|
exports2.ImageNames = ImageNames;
|
|
11747
11815
|
exports2.JOB_INIT_VALUE = JOB_INIT_VALUE;
|
|
11816
|
+
exports2.JobModel = JobModel;
|
|
11748
11817
|
exports2.JobsField = JobsField;
|
|
11749
11818
|
exports2.KeyValue = KeyValue;
|
|
11750
11819
|
exports2.KeyValueListWidget = KeyValueListWidget;
|
|
@@ -11752,17 +11821,26 @@ var __publicField = (obj, key, value) => {
|
|
|
11752
11821
|
exports2.Menu = Menu;
|
|
11753
11822
|
exports2.MetadataForm = MetadataForm;
|
|
11754
11823
|
exports2.NS_STORE_KEY = NS_STORE_KEY;
|
|
11824
|
+
exports2.NameColumnRenderer = NameColumnRenderer;
|
|
11755
11825
|
exports2.NameInputWidget = NameInputWidget;
|
|
11826
|
+
exports2.NameSpaceColumnRenderer = NameSpaceColumnRenderer;
|
|
11756
11827
|
exports2.NamespaceSelectWidget = NamespaceSelectWidget;
|
|
11757
11828
|
exports2.NamespacesFilter = NamespacesFilter;
|
|
11829
|
+
exports2.NodeNameColumnRenderer = NodeNameColumnRenderer;
|
|
11758
11830
|
exports2.POD_INIT_VALUE = POD_INIT_VALUE;
|
|
11759
11831
|
exports2.PageShow = PageShow;
|
|
11832
|
+
exports2.PhaseColumnRenderer = PhaseColumnRenderer;
|
|
11760
11833
|
exports2.PodContainersTable = PodContainersTable;
|
|
11834
|
+
exports2.PodMetricsModel = PodMetricsModel;
|
|
11835
|
+
exports2.PodModel = PodModel;
|
|
11761
11836
|
exports2.PodsField = PodsField;
|
|
11762
11837
|
exports2.RESOURCE_GROUP = RESOURCE_GROUP;
|
|
11763
11838
|
exports2.ReplicaField = ReplicaField;
|
|
11839
|
+
exports2.ReplicasColumnRenderer = ReplicasColumnRenderer;
|
|
11764
11840
|
exports2.ResourceCRUD = ResourceCRUD;
|
|
11841
|
+
exports2.ResourceModel = ResourceModel;
|
|
11765
11842
|
exports2.ResourceUsageBar = ResourceUsageBar;
|
|
11843
|
+
exports2.RestartCountColumnRenderer = RestartCountColumnRenderer;
|
|
11766
11844
|
exports2.STATEFULSET_INIT_VALUE = STATEFULSET_INIT_VALUE;
|
|
11767
11845
|
exports2.SecretDataField = SecretDataField;
|
|
11768
11846
|
exports2.Separator = Separator;
|
|
@@ -11772,6 +11850,8 @@ var __publicField = (obj, key, value) => {
|
|
|
11772
11850
|
exports2.TIMESTAMP_LABEL = TIMESTAMP_LABEL;
|
|
11773
11851
|
exports2.Tags = Tags;
|
|
11774
11852
|
exports2.WorkloadDropdown = WorkloadDropdown;
|
|
11853
|
+
exports2.WorkloadImageColumnRenderer = WorkloadImageColumnRenderer;
|
|
11854
|
+
exports2.WorkloadModel = WorkloadModel;
|
|
11775
11855
|
exports2.WorkloadPodsTable = WorkloadPodsTable;
|
|
11776
11856
|
exports2.WorkloadReplicas = WorkloadReplicas;
|
|
11777
11857
|
exports2.YamlEditorComponent = YamlEditorComponent;
|