@dovetail-v2/refine 0.2.4-alpha.0 → 0.2.4
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-7de94ad2.js → MonacoYamlDiffEditor-e0b05820.js} +24 -1
- package/dist/{MonacoYamlEditor-bc70e03e.js → MonacoYamlEditor-96d9a48c.js} +9 -2
- package/dist/{index-44cc930a.js → index-d8439125.js} +1919 -273
- package/dist/refine.js +257 -247
- package/dist/refine.umd.cjs +20793 -0
- package/dist/style.css +838 -883
- package/{dist → lib}/components/PodShellModal/PodShell.d.ts +5 -3
- package/lib/components/PodShellModal/index.d.ts +10 -0
- package/{dist → lib}/components/Shell/index.d.ts +5 -1
- package/{dist → lib}/components/index.d.ts +1 -0
- package/{dist → lib}/utils/index.d.ts +1 -0
- package/package.json +4 -4
- package/dist/MonacoYamlDiffEditor-7a07db88.cjs +0 -59
- package/dist/MonacoYamlEditor-bc33cd45.cjs +0 -206
- package/dist/PodShell-43c7028e.cjs +0 -216
- package/dist/PodShell-ba204cde.js +0 -216
- package/dist/common-1eb43414.cjs +0 -982
- package/dist/common-feae5742.js +0 -983
- package/dist/components/PodShellModal/index.d.ts +0 -10
- package/dist/components/Shell/Connecting.d.ts +0 -2
- package/dist/components/Shell/common.d.ts +0 -5
- package/dist/index-31874f77.cjs +0 -496
- package/dist/index-40deb620.js +0 -497
- package/dist/index-ee8ac828.cjs +0 -18959
- package/dist/refine.cjs +0 -279
- package/dist/shell.cjs +0 -17
- package/dist/shell.d.ts +0 -2
- package/dist/shell.js +0 -17
- /package/{dist → lib}/App.d.ts +0 -0
- /package/{dist → lib}/Dovetail.d.ts +0 -0
- /package/{dist → lib}/components/Breadcrumb/index.d.ts +0 -0
- /package/{dist → lib}/components/ConditionsTable/ConditionsTable.d.ts +0 -0
- /package/{dist → lib}/components/ConditionsTable/index.d.ts +0 -0
- /package/{dist → lib}/components/CreateButton/index.d.ts +0 -0
- /package/{dist → lib}/components/CronjobJobsTable/index.d.ts +0 -0
- /package/{dist → lib}/components/DeleteButton/index.d.ts +0 -0
- /package/{dist → lib}/components/DeleteManyButton/index.d.ts +0 -0
- /package/{dist → lib}/components/DrawerShow/DrawerShow.d.ts +0 -0
- /package/{dist → lib}/components/DrawerShow/index.d.ts +0 -0
- /package/{dist → lib}/components/DropdownMenuItems/EditAnnotationDropdownMenuItem.d.ts +0 -0
- /package/{dist → lib}/components/DropdownMenuItems/EditLabelDropdownMenuItem.d.ts +0 -0
- /package/{dist → lib}/components/DropdownMenuItems/EditNodeTaintDropdownMenuItem.d.ts +0 -0
- /package/{dist → lib}/components/DropdownMenuItems/index.d.ts +0 -0
- /package/{dist → lib}/components/Dropdowns/CronJobDropdown/index.d.ts +0 -0
- /package/{dist → lib}/components/Dropdowns/K8sDropdown/index.d.ts +0 -0
- /package/{dist → lib}/components/Dropdowns/PodDropdown/index.d.ts +0 -0
- /package/{dist → lib}/components/Dropdowns/ReplicasDropdown/index.d.ts +0 -0
- /package/{dist → lib}/components/Dropdowns/WorkloadDropdown/index.d.ts +0 -0
- /package/{dist → lib}/components/DurationTime/index.d.ts +0 -0
- /package/{dist → lib}/components/EditButton/index.d.ts +0 -0
- /package/{dist → lib}/components/EditField/index.d.ts +0 -0
- /package/{dist → lib}/components/EditMetadataForm/EditAnnotationForm.d.ts +0 -0
- /package/{dist → lib}/components/EditMetadataForm/EditLabelForm.d.ts +0 -0
- /package/{dist → lib}/components/EditMetadataForm/EditNodeTaintForm.d.ts +0 -0
- /package/{dist → lib}/components/EditMetadataForm/KeyValueTableForm.d.ts +0 -0
- /package/{dist → lib}/components/EditMetadataForm/LabelFormatPopover.d.ts +0 -0
- /package/{dist → lib}/components/EditMetadataForm/index.d.ts +0 -0
- /package/{dist → lib}/components/ErrorContent/index.d.ts +0 -0
- /package/{dist → lib}/components/EventsTable/EventsTable.d.ts +0 -0
- /package/{dist → lib}/components/EventsTable/index.d.ts +0 -0
- /package/{dist → lib}/components/Form/FormModal.d.ts +0 -0
- /package/{dist → lib}/components/Form/FormModeSegmentControl.d.ts +0 -0
- /package/{dist → lib}/components/Form/RefineFormContainer.d.ts +0 -0
- /package/{dist → lib}/components/Form/RefineFormContent.d.ts +0 -0
- /package/{dist → lib}/components/Form/RefineFormPage.d.ts +0 -0
- /package/{dist → lib}/components/Form/YamlForm.d.ts +0 -0
- /package/{dist → lib}/components/Form/YamlFormContainer.d.ts +0 -0
- /package/{dist → lib}/components/Form/index.d.ts +0 -0
- /package/{dist → lib}/components/Form/type.d.ts +0 -0
- /package/{dist → lib}/components/Form/useFieldsConfig.d.ts +0 -0
- /package/{dist → lib}/components/Form/useReactHookForm.d.ts +0 -0
- /package/{dist → lib}/components/Form/useRefineForm.d.ts +0 -0
- /package/{dist → lib}/components/Form/useYamlForm.d.ts +0 -0
- /package/{dist → lib}/components/FormErrorAlert/index.d.ts +0 -0
- /package/{dist → lib}/components/FormLayout/index.d.ts +0 -0
- /package/{dist → lib}/components/FormWidgets/KeyValueListWidget.d.ts +0 -0
- /package/{dist → lib}/components/FormWidgets/MetadataForm.d.ts +0 -0
- /package/{dist → lib}/components/FormWidgets/NameInputWidget.d.ts +0 -0
- /package/{dist → lib}/components/FormWidgets/NamespaceSelectWidget.d.ts +0 -0
- /package/{dist → lib}/components/FormWidgets/index.d.ts +0 -0
- /package/{dist → lib}/components/FormWidgets/widget.d.ts +0 -0
- /package/{dist → lib}/components/ImageNames/index.d.ts +0 -0
- /package/{dist → lib}/components/IngressRulesComponent/index.d.ts +0 -0
- /package/{dist → lib}/components/IngressRulesTable/IngressRulesTable.d.ts +0 -0
- /package/{dist → lib}/components/IngressRulesTable/index.d.ts +0 -0
- /package/{dist → lib}/components/InternalBaseTable/TableWidgets.d.ts +0 -0
- /package/{dist → lib}/components/InternalBaseTable/index.d.ts +0 -0
- /package/{dist → lib}/components/KeyValue/KeyValue.d.ts +0 -0
- /package/{dist → lib}/components/KeyValue/KeyValueAnnotation.d.ts +0 -0
- /package/{dist → lib}/components/KeyValue/KeyValueSecret.d.ts +0 -0
- /package/{dist → lib}/components/KeyValue/index.d.ts +0 -0
- /package/{dist → lib}/components/Layout/index.d.ts +0 -0
- /package/{dist → lib}/components/LinkFallback/index.d.ts +0 -0
- /package/{dist → lib}/components/ListPage/index.d.ts +0 -0
- /package/{dist → lib}/components/Menu/index.d.ts +0 -0
- /package/{dist → lib}/components/NamespacesFilter/index.d.ts +0 -0
- /package/{dist → lib}/components/NetworkPolicyRulesViewer/NetworkPolicyRulesViewer.d.ts +0 -0
- /package/{dist → lib}/components/NetworkPolicyRulesViewer/index.d.ts +0 -0
- /package/{dist → lib}/components/NodeTaintsTable/NodeTaintsTable.d.ts +0 -0
- /package/{dist → lib}/components/NodeTaintsTable/index.d.ts +0 -0
- /package/{dist → lib}/components/PVCDistributeStorage/index.d.ts +0 -0
- /package/{dist → lib}/components/PageShow/PageShow.d.ts +0 -0
- /package/{dist → lib}/components/PageShow/index.d.ts +0 -0
- /package/{dist → lib}/components/PodContainersTable/PodContainersTable.d.ts +0 -0
- /package/{dist → lib}/components/PodContainersTable/index.d.ts +0 -0
- /package/{dist → lib}/components/PodLog/index.d.ts +0 -0
- /package/{dist → lib}/components/PodSelectorTable/index.d.ts +0 -0
- /package/{dist → lib}/components/PortsTable/index.d.ts +0 -0
- /package/{dist → lib}/components/ReferenceLink/index.d.ts +0 -0
- /package/{dist → lib}/components/ResourceCRUD/ResourceCRUD.d.ts +0 -0
- /package/{dist → lib}/components/ResourceCRUD/create/index.d.ts +0 -0
- /package/{dist → lib}/components/ResourceCRUD/index.d.ts +0 -0
- /package/{dist → lib}/components/ResourceCRUD/list/index.d.ts +0 -0
- /package/{dist → lib}/components/ResourceCRUD/show/index.d.ts +0 -0
- /package/{dist → lib}/components/ResourceFiledDisplays.d.ts +0 -0
- /package/{dist → lib}/components/ResourceLink/index.d.ts +0 -0
- /package/{dist → lib}/components/ResourceSelect/index.d.ts +0 -0
- /package/{dist → lib}/components/ResourceTable/index.d.ts +0 -0
- /package/{dist → lib}/components/ResourceUsageBar/index.d.ts +0 -0
- /package/{dist → lib}/components/Separator/index.d.ts +0 -0
- /package/{dist → lib}/components/ServiceComponents/index.d.ts +0 -0
- /package/{dist → lib}/components/Shell/ShellToolbar.d.ts +0 -0
- /package/{dist → lib}/components/ShowContent/ShowContent.d.ts +0 -0
- /package/{dist → lib}/components/ShowContent/fields.d.ts +0 -0
- /package/{dist → lib}/components/ShowContent/groups.d.ts +0 -0
- /package/{dist → lib}/components/ShowContent/index.d.ts +0 -0
- /package/{dist → lib}/components/ShowContent/tabs.d.ts +0 -0
- /package/{dist → lib}/components/StateTag/StateTag.d.ts +0 -0
- /package/{dist → lib}/components/StateTag/index.d.ts +0 -0
- /package/{dist → lib}/components/Table/index.d.ts +0 -0
- /package/{dist → lib}/components/TableToolbar/index.d.ts +0 -0
- /package/{dist → lib}/components/Tabs/index.d.ts +0 -0
- /package/{dist → lib}/components/Tags/index.d.ts +0 -0
- /package/{dist → lib}/components/TextTags/index.d.ts +0 -0
- /package/{dist → lib}/components/Time/index.d.ts +0 -0
- /package/{dist → lib}/components/ValueDisplay/index.d.ts +0 -0
- /package/{dist → lib}/components/WorkloadPodsTable/WorkloadPodsTable.d.ts +0 -0
- /package/{dist → lib}/components/WorkloadPodsTable/index.d.ts +0 -0
- /package/{dist → lib}/components/WorkloadReplicas/index.d.ts +0 -0
- /package/{dist → lib}/components/YamlEditor/MonacoYamlDiffEditor.d.ts +0 -0
- /package/{dist → lib}/components/YamlEditor/MonacoYamlEditor.d.ts +0 -0
- /package/{dist → lib}/components/YamlEditor/YamlEditorComponent.d.ts +0 -0
- /package/{dist → lib}/components/YamlEditor/index.d.ts +0 -0
- /package/{dist → lib}/components/YamlEditor/style.d.ts +0 -0
- /package/{dist → lib}/components/YamlEditor/yaml.worker.d.ts +0 -0
- /package/{dist → lib}/constants/auth.d.ts +0 -0
- /package/{dist → lib}/constants/index.d.ts +0 -0
- /package/{dist → lib}/constants/k8s.d.ts +0 -0
- /package/{dist → lib}/constants/state.d.ts +0 -0
- /package/{dist → lib}/contexts/component.d.ts +0 -0
- /package/{dist → lib}/contexts/configs.d.ts +0 -0
- /package/{dist → lib}/contexts/constants.d.ts +0 -0
- /package/{dist → lib}/contexts/global-store.d.ts +0 -0
- /package/{dist → lib}/contexts/index.d.ts +0 -0
- /package/{dist → lib}/hooks/index.d.ts +0 -0
- /package/{dist → lib}/hooks/useDeleteModal/index.d.ts +0 -0
- /package/{dist → lib}/hooks/useDeleteModal/useDeleteManyModal.d.ts +0 -0
- /package/{dist → lib}/hooks/useDeleteModal/useDeleteModal.d.ts +0 -0
- /package/{dist → lib}/hooks/useDeleteModal/useDeleteModalOnly.d.ts +0 -0
- /package/{dist → lib}/hooks/useDeleteModal/useFailedModal.d.ts +0 -0
- /package/{dist → lib}/hooks/useDownloadYAML.d.ts +0 -0
- /package/{dist → lib}/hooks/useEagleTable/columns.d.ts +0 -0
- /package/{dist → lib}/hooks/useEagleTable/index.d.ts +0 -0
- /package/{dist → lib}/hooks/useEagleTable/useEagleTable.d.ts +0 -0
- /package/{dist → lib}/hooks/useEdit.d.ts +0 -0
- /package/{dist → lib}/hooks/useGlobalStore.d.ts +0 -0
- /package/{dist → lib}/hooks/useK8sYamlEditor.d.ts +0 -0
- /package/{dist → lib}/hooks/useNamespaceRefineFilter.d.ts +0 -0
- /package/{dist → lib}/hooks/useOpenForm.d.ts +0 -0
- /package/{dist → lib}/hooks/usePathMap.d.ts +0 -0
- /package/{dist → lib}/hooks/useSchema.d.ts +0 -0
- /package/{dist → lib}/hooks/useSubmitForm.d.ts +0 -0
- /package/{dist → lib}/hooks/useTableData.d.ts +0 -0
- /package/{dist → lib}/i18n.d.ts +0 -0
- /package/{dist → lib}/index.d.ts +0 -0
- /package/{dist → lib}/locales/en-US/index.d.ts +0 -0
- /package/{dist → lib}/locales/index.d.ts +0 -0
- /package/{dist → lib}/locales/zh-CN/index.d.ts +0 -0
- /package/{dist → lib}/main.d.ts +0 -0
- /package/{dist → lib}/models/cronjob-model.d.ts +0 -0
- /package/{dist → lib}/models/daemonset-model.d.ts +0 -0
- /package/{dist → lib}/models/deployment-model.d.ts +0 -0
- /package/{dist → lib}/models/event-model.d.ts +0 -0
- /package/{dist → lib}/models/index.d.ts +0 -0
- /package/{dist → lib}/models/ingress-model.d.ts +0 -0
- /package/{dist → lib}/models/job-model.d.ts +0 -0
- /package/{dist → lib}/models/network-policy-model.d.ts +0 -0
- /package/{dist → lib}/models/node-model.d.ts +0 -0
- /package/{dist → lib}/models/persistent-volume-claim.d.ts +0 -0
- /package/{dist → lib}/models/persistent-volume.d.ts +0 -0
- /package/{dist → lib}/models/pod-metrics-model.d.ts +0 -0
- /package/{dist → lib}/models/pod-model.d.ts +0 -0
- /package/{dist → lib}/models/resource-model.d.ts +0 -0
- /package/{dist → lib}/models/service-model.d.ts +0 -0
- /package/{dist → lib}/models/statefulset-model.d.ts +0 -0
- /package/{dist → lib}/models/storage-class.d.ts +0 -0
- /package/{dist → lib}/models/types/index.d.ts +0 -0
- /package/{dist → lib}/models/types/metric.d.ts +0 -0
- /package/{dist → lib}/models/workload-base-model.d.ts +0 -0
- /package/{dist → lib}/models/workload-model.d.ts +0 -0
- /package/{dist → lib}/pages/configmaps/index.d.ts +0 -0
- /package/{dist → lib}/pages/cronjobs/create/index.d.ts +0 -0
- /package/{dist → lib}/pages/cronjobs/index.d.ts +0 -0
- /package/{dist → lib}/pages/cronjobs/list/index.d.ts +0 -0
- /package/{dist → lib}/pages/cronjobs/show/index.d.ts +0 -0
- /package/{dist → lib}/pages/daemonsets/create/index.d.ts +0 -0
- /package/{dist → lib}/pages/daemonsets/index.d.ts +0 -0
- /package/{dist → lib}/pages/daemonsets/list/index.d.ts +0 -0
- /package/{dist → lib}/pages/daemonsets/show/index.d.ts +0 -0
- /package/{dist → lib}/pages/deployments/index.d.ts +0 -0
- /package/{dist → lib}/pages/deployments/list/index.d.ts +0 -0
- /package/{dist → lib}/pages/deployments/show/index.d.ts +0 -0
- /package/{dist → lib}/pages/ingresses/index.d.ts +0 -0
- /package/{dist → lib}/pages/jobs/index.d.ts +0 -0
- /package/{dist → lib}/pages/networkPolicies/index.d.ts +0 -0
- /package/{dist → lib}/pages/nodes/index.d.ts +0 -0
- /package/{dist → lib}/pages/nodes/list/index.d.ts +0 -0
- /package/{dist → lib}/pages/nodes/show/index.d.ts +0 -0
- /package/{dist → lib}/pages/persistentvolumeclaims/index.d.ts +0 -0
- /package/{dist → lib}/pages/persistentvolumes/index.d.ts +0 -0
- /package/{dist → lib}/pages/pods/create/index.d.ts +0 -0
- /package/{dist → lib}/pages/pods/index.d.ts +0 -0
- /package/{dist → lib}/pages/pods/list/index.d.ts +0 -0
- /package/{dist → lib}/pages/pods/show/index.d.ts +0 -0
- /package/{dist → lib}/pages/secrets/index.d.ts +0 -0
- /package/{dist → lib}/pages/services/index.d.ts +0 -0
- /package/{dist → lib}/pages/statefulsets/index.d.ts +0 -0
- /package/{dist → lib}/pages/storageclasses/form/index.d.ts +0 -0
- /package/{dist → lib}/pages/storageclasses/index.d.ts +0 -0
- /package/{dist → lib}/plugins/index.d.ts +0 -0
- /package/{dist → lib}/plugins/model-plugin.d.ts +0 -0
- /package/{dist → lib}/plugins/relation-plugin.d.ts +0 -0
- /package/{dist → lib}/plugins/type.d.ts +0 -0
- /package/{dist → lib}/providers/index.d.ts +0 -0
- /package/{dist → lib}/providers/router-provider/index.d.ts +0 -0
- /package/{dist → lib}/styles/button.d.ts +0 -0
- /package/{dist → lib}/styles/modal.d.ts +0 -0
- /package/{dist → lib}/styles/tag.d.ts +0 -0
- /package/{dist → lib}/types/globalStore.d.ts +0 -0
- /package/{dist → lib}/types/index.d.ts +0 -0
- /package/{dist → lib}/types/resource.d.ts +0 -0
- /package/{dist → lib}/utils/addId.d.ts +0 -0
- /package/{dist → lib}/utils/download.d.ts +0 -0
- /package/{dist → lib}/utils/error.d.ts +0 -0
- /package/{dist → lib}/utils/form.d.ts +0 -0
- /package/{dist → lib}/utils/k8s.d.ts +0 -0
- /package/{dist → lib}/utils/labels.d.ts +0 -0
- /package/{dist → lib}/utils/match-selector.d.ts +0 -0
- /package/{dist → lib}/utils/object.d.ts +0 -0
- /package/{dist → lib}/utils/openapi.d.ts +0 -0
- /package/{dist → lib}/utils/schema-store.d.ts +0 -0
- /package/{dist → lib}/utils/schema.d.ts +0 -0
- /package/{dist → lib}/utils/selector.d.ts +0 -0
- /package/{dist → lib}/utils/shell.d.ts +0 -0
- /package/{dist → lib}/utils/storage.d.ts +0 -0
- /package/{dist → lib}/utils/string.d.ts +0 -0
- /package/{dist → lib}/utils/time.d.ts +0 -0
- /package/{dist → lib}/utils/unit.d.ts +0 -0
- /package/{dist → lib}/utils/validation.d.ts +0 -0
- /package/{dist → lib}/utils/yaml.d.ts +0 -0
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import { S as SocketStatus, j as jsxRuntimeExports } from "./common-feae5742.js";
|
|
2
|
-
import { Select, AntdOption } from "@cloudtower/eagle";
|
|
3
|
-
import React__default, { useMemo, useRef, useState, useCallback, useEffect, useImperativeHandle } from "react";
|
|
4
|
-
import { S as Shell } from "./index-40deb620.js";
|
|
5
|
-
import { Buffer } from "buffer";
|
|
6
|
-
import "@xterm/addon-canvas";
|
|
7
|
-
import "@xterm/addon-fit";
|
|
8
|
-
import "@xterm/addon-search";
|
|
9
|
-
import "@xterm/addon-web-links";
|
|
10
|
-
import "@xterm/addon-webgl";
|
|
11
|
-
import "@xterm/xterm";
|
|
12
|
-
import "copy-to-clipboard";
|
|
13
|
-
import "lodash-es";
|
|
14
|
-
import "@cloudtower/icons-react";
|
|
15
|
-
function addParam(url, key, val) {
|
|
16
|
-
let out = url + (url.includes("?") ? "&" : "?");
|
|
17
|
-
if (!Array.isArray(val)) {
|
|
18
|
-
val = [val];
|
|
19
|
-
}
|
|
20
|
-
out += val.map((v) => {
|
|
21
|
-
if (v === null) {
|
|
22
|
-
return `${encodeURIComponent(key)}`;
|
|
23
|
-
} else {
|
|
24
|
-
return `${encodeURIComponent(key)}=${encodeURIComponent(v)}`;
|
|
25
|
-
}
|
|
26
|
-
}).join("&");
|
|
27
|
-
return out;
|
|
28
|
-
}
|
|
29
|
-
function addParams(url, params) {
|
|
30
|
-
if (params && typeof params === "object") {
|
|
31
|
-
Object.keys(params).forEach((key) => {
|
|
32
|
-
url = addParam(url, key, params[key]);
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
return url;
|
|
36
|
-
}
|
|
37
|
-
function base64Encode(str, alphabet = "normal") {
|
|
38
|
-
let buf;
|
|
39
|
-
if (str === null || typeof str === "undefined") {
|
|
40
|
-
return str;
|
|
41
|
-
}
|
|
42
|
-
if (typeof Buffer.from === "function" && Buffer.from !== Uint8Array.from) {
|
|
43
|
-
buf = Buffer.from(str);
|
|
44
|
-
} else {
|
|
45
|
-
buf = new Buffer(str);
|
|
46
|
-
}
|
|
47
|
-
if (alphabet === "url") {
|
|
48
|
-
const m = {
|
|
49
|
-
"+": "-",
|
|
50
|
-
"/": "_"
|
|
51
|
-
};
|
|
52
|
-
return buf.toString("base64").replace(/[+/]|=+$/g, (char) => m[char] || "");
|
|
53
|
-
}
|
|
54
|
-
return buf.toString("base64");
|
|
55
|
-
}
|
|
56
|
-
function base64DecodeToBuffer(str) {
|
|
57
|
-
if (str === null || typeof str === "undefined") {
|
|
58
|
-
return str;
|
|
59
|
-
}
|
|
60
|
-
if (typeof Buffer.from === "function" && Buffer.from !== Uint8Array.from) {
|
|
61
|
-
return Buffer.from(str, "base64");
|
|
62
|
-
} else {
|
|
63
|
-
return new Buffer(str, "base64");
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
function base64Decode(str) {
|
|
67
|
-
return !str ? str : base64DecodeToBuffer(str.replace(/[-_]/g, (char) => char === "-" ? "+" : "/")).toString();
|
|
68
|
-
}
|
|
69
|
-
var OS = /* @__PURE__ */ ((OS2) => {
|
|
70
|
-
OS2["Linux"] = "linux";
|
|
71
|
-
OS2["Windows"] = "windows";
|
|
72
|
-
return OS2;
|
|
73
|
-
})(OS || {});
|
|
74
|
-
const BACKUP_SHELLS = [
|
|
75
|
-
"windows",
|
|
76
|
-
"linux"
|
|
77
|
-
/* Linux */
|
|
78
|
-
];
|
|
79
|
-
const COMMANDS = {
|
|
80
|
-
[
|
|
81
|
-
"linux"
|
|
82
|
-
/* Linux */
|
|
83
|
-
]: [
|
|
84
|
-
"/bin/sh",
|
|
85
|
-
"-c",
|
|
86
|
-
'TERM=xterm-256color; export TERM; [ -x /bin/bash ] && ([ -x /usr/bin/script ] && /usr/bin/script -q -c "/bin/bash" /dev/null || exec /bin/bash) || exec /bin/sh'
|
|
87
|
-
],
|
|
88
|
-
[
|
|
89
|
-
"windows"
|
|
90
|
-
/* Windows */
|
|
91
|
-
]: ["cmd"]
|
|
92
|
-
};
|
|
93
|
-
const PodShell = React__default.forwardRef(
|
|
94
|
-
function PodShell2(props, ref) {
|
|
95
|
-
const { pod, basePath, onSocketStatusChange } = props;
|
|
96
|
-
const id = pod.id;
|
|
97
|
-
const [namespace, name] = useMemo(() => id.split("/"), [id]);
|
|
98
|
-
const shellRef = useRef(null);
|
|
99
|
-
const errorMsgRef = useRef("");
|
|
100
|
-
const [osIndex, setOsIndex] = useState(0);
|
|
101
|
-
const [container, setContainer] = useState("");
|
|
102
|
-
const containers = useMemo(() => {
|
|
103
|
-
var _a, _b;
|
|
104
|
-
return (((_a = pod == null ? void 0 : pod._rawYaml.status) == null ? void 0 : _a.containerStatuses) || []).concat(((_b = pod == null ? void 0 : pod._rawYaml.status) == null ? void 0 : _b.initContainerStatuses) || []).map((containerStatus) => containerStatus.name);
|
|
105
|
-
}, [pod]);
|
|
106
|
-
const url = useMemo(() => {
|
|
107
|
-
const os = BACKUP_SHELLS[osIndex];
|
|
108
|
-
const protocol = location.protocol.includes("https") ? "wss" : "ws";
|
|
109
|
-
const url2 = container && os ? addParams(
|
|
110
|
-
`${protocol}://${location.host}${basePath}/api/v1/namespaces/${namespace}/pods/${name}/exec`,
|
|
111
|
-
{
|
|
112
|
-
container,
|
|
113
|
-
stdout: "true",
|
|
114
|
-
stdin: "true",
|
|
115
|
-
stderr: "true",
|
|
116
|
-
tty: "true",
|
|
117
|
-
command: COMMANDS[
|
|
118
|
-
os || "linux"
|
|
119
|
-
/* Linux */
|
|
120
|
-
]
|
|
121
|
-
}
|
|
122
|
-
) : "";
|
|
123
|
-
return url2;
|
|
124
|
-
}, [container, name, namespace, osIndex, basePath]);
|
|
125
|
-
const onSocketClose = useCallback(
|
|
126
|
-
(socket, term) => {
|
|
127
|
-
var _a, _b;
|
|
128
|
-
if (errorMsgRef.current) {
|
|
129
|
-
if (osIndex + 1 < BACKUP_SHELLS.length) {
|
|
130
|
-
setOsIndex(osIndex + 1);
|
|
131
|
-
} else {
|
|
132
|
-
term == null ? void 0 : term.writeln(`\x1B[38;2;255;82;82m${errorMsgRef.current}`);
|
|
133
|
-
(_a = shellRef.current) == null ? void 0 : _a.setSocketStatus(SocketStatus.Disconnected);
|
|
134
|
-
errorMsgRef.current = "";
|
|
135
|
-
}
|
|
136
|
-
} else {
|
|
137
|
-
(_b = shellRef.current) == null ? void 0 : _b.setSocketStatus(SocketStatus.Disconnected);
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
[osIndex]
|
|
141
|
-
);
|
|
142
|
-
const onSocketMessage = useCallback(
|
|
143
|
-
(e, socket, term) => {
|
|
144
|
-
const type = e.data.substr(0, 1);
|
|
145
|
-
const msg = base64Decode(e.data.substr(1));
|
|
146
|
-
if (`${type}` === "1") {
|
|
147
|
-
term == null ? void 0 : term.write(msg);
|
|
148
|
-
} else {
|
|
149
|
-
if (`${type}` === "3") {
|
|
150
|
-
errorMsgRef.current = msg;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
[]
|
|
155
|
-
);
|
|
156
|
-
const fit = useCallback(({ rows, cols }) => {
|
|
157
|
-
var _a;
|
|
158
|
-
const message = `${"4"}${base64Encode(
|
|
159
|
-
JSON.stringify({
|
|
160
|
-
Width: Math.floor(cols),
|
|
161
|
-
Height: Math.floor(rows)
|
|
162
|
-
})
|
|
163
|
-
)}`;
|
|
164
|
-
(_a = shellRef.current) == null ? void 0 : _a.send(message);
|
|
165
|
-
}, []);
|
|
166
|
-
const encode = useCallback((input) => `${"0"}${base64Encode(input)}`, []);
|
|
167
|
-
useEffect(() => {
|
|
168
|
-
if (!container && containers.length) {
|
|
169
|
-
setContainer(containers[0]);
|
|
170
|
-
}
|
|
171
|
-
}, [containers, container]);
|
|
172
|
-
useImperativeHandle(
|
|
173
|
-
ref,
|
|
174
|
-
() => ({
|
|
175
|
-
getAllTerminalContents: () => {
|
|
176
|
-
var _a;
|
|
177
|
-
return ((_a = shellRef.current) == null ? void 0 : _a.getAllTerminalContents()) || [];
|
|
178
|
-
}
|
|
179
|
-
}),
|
|
180
|
-
[]
|
|
181
|
-
);
|
|
182
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
183
|
-
Shell,
|
|
184
|
-
{
|
|
185
|
-
ref: shellRef,
|
|
186
|
-
url,
|
|
187
|
-
protocols: "base64.channel.k8s.io",
|
|
188
|
-
encode,
|
|
189
|
-
fit,
|
|
190
|
-
toolbarLeftSlot: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
191
|
-
Select,
|
|
192
|
-
{
|
|
193
|
-
input: {
|
|
194
|
-
value: container,
|
|
195
|
-
onChange(value) {
|
|
196
|
-
setContainer(value);
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
style: {
|
|
200
|
-
width: "256px"
|
|
201
|
-
},
|
|
202
|
-
size: "small",
|
|
203
|
-
children: containers.map((containerName) => /* @__PURE__ */ jsxRuntimeExports.jsx(AntdOption, { value: containerName, label: containerName, children: containerName }, containerName))
|
|
204
|
-
}
|
|
205
|
-
),
|
|
206
|
-
onSocketMessage,
|
|
207
|
-
onSocketClose,
|
|
208
|
-
onSocketStatusChange
|
|
209
|
-
}
|
|
210
|
-
);
|
|
211
|
-
}
|
|
212
|
-
);
|
|
213
|
-
export {
|
|
214
|
-
OS,
|
|
215
|
-
PodShell
|
|
216
|
-
};
|