@cloudtower/eagle 0.34.0 → 0.34.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/UIKitProvider/index.js +13 -18
- package/dist/cjs/core/Banner/banner.style.js +11 -0
- package/dist/cjs/core/Banner/index.js +32 -0
- package/dist/cjs/core/BasicCTError/BasicCTError.style.js +5 -0
- package/dist/cjs/core/BasicCTError/index.js +40 -0
- package/dist/cjs/core/ConfigProvider/index.js +8 -2
- package/dist/cjs/core/Fields/FieldsDateTimeRange/index.js +20 -3
- package/dist/cjs/core/ImmersiveDialog/index.js +188 -0
- package/dist/cjs/core/ImmersiveDialog/styles.js +31 -0
- package/dist/cjs/core/LineChart/LineChartLegend.js +7 -5
- package/dist/cjs/core/LineChart/TooltipFormatter.js +7 -6
- package/dist/cjs/core/MediumDialog/MediumDialog.js +54 -0
- package/dist/cjs/core/SmallDialog/SmallDialog.js +144 -0
- package/dist/cjs/core/SmallDialog/SmallDialog.style.js +11 -0
- package/dist/cjs/core/TableForm/AddRowButton.js +2 -2
- package/dist/cjs/core/TableForm/index.js +21 -6
- package/dist/cjs/core/Timeline/index.js +13 -7
- package/dist/cjs/core/WizardDialog/index.js +170 -0
- package/dist/cjs/core/WizardDialog/styles.js +11 -0
- package/dist/cjs/core/index.js +9 -9
- package/dist/cjs/core/message/index.js +5 -215
- package/dist/cjs/core/message/message.js +222 -0
- package/dist/cjs/core/message/useMessage.js +12 -0
- package/dist/cjs/core/message-group/index.js +2 -2
- package/dist/cjs/coreX/DateRangePicker/AbsoluteDate.js +2 -1
- package/dist/cjs/coreX/DateRangePicker/Calendar.js +78 -58
- package/dist/cjs/coreX/DateRangePicker/index.js +13 -1
- package/dist/cjs/coreX/DateRangePicker/utils.js +5 -0
- package/dist/cjs/coreX/Dialogs/DeleteDialog/DeleteDialog.js +5 -3
- package/dist/cjs/coreX/Dialogs/RejectDialog/RejectDialog.js +1 -1
- package/dist/cjs/coreX/KubeConfigModal/KubeConfigModal.style.js +29 -0
- package/dist/cjs/coreX/KubeConfigModal/index.js +102 -0
- package/dist/cjs/coreX/KubeConfigModal/utils.js +25 -0
- package/dist/cjs/hooks/useCTErrorMsg.js +25 -0
- package/dist/cjs/index.js +225 -197
- package/dist/cjs/legacy-antd.js +81 -81
- package/dist/cjs/stats1.html +1 -1
- package/dist/cjs/utils/cterror.js +64 -0
- package/dist/cjs/utils/unit.js +19 -0
- package/dist/components.css +3147 -3859
- package/dist/esm/UIKitProvider/index.js +3 -6
- package/dist/esm/core/Banner/banner.style.js +6 -0
- package/dist/esm/core/Banner/index.js +25 -0
- package/dist/esm/core/BasicCTError/BasicCTError.style.js +3 -0
- package/dist/esm/core/BasicCTError/index.js +34 -0
- package/dist/esm/core/ConfigProvider/index.js +9 -4
- package/dist/esm/core/Fields/FieldsDateTimeRange/index.js +20 -3
- package/dist/esm/core/ImmersiveDialog/index.js +182 -0
- package/dist/esm/core/ImmersiveDialog/styles.js +16 -0
- package/dist/esm/core/LineChart/LineChartLegend.js +4 -2
- package/dist/esm/core/LineChart/TooltipFormatter.js +7 -6
- package/dist/esm/core/MediumDialog/MediumDialog.js +48 -0
- package/dist/esm/core/SmallDialog/SmallDialog.js +137 -0
- package/dist/esm/core/SmallDialog/SmallDialog.style.js +6 -0
- package/dist/esm/core/TableForm/AddRowButton.js +2 -2
- package/dist/esm/core/TableForm/index.js +21 -6
- package/dist/esm/core/Timeline/index.js +13 -7
- package/dist/esm/core/WizardDialog/index.js +164 -0
- package/dist/esm/core/WizardDialog/styles.js +6 -0
- package/dist/esm/core/message/index.js +4 -184
- package/dist/esm/core/message/message.js +186 -0
- package/dist/esm/core/message/useMessage.js +9 -0
- package/dist/esm/core/message-group/index.js +1 -1
- package/dist/esm/coreX/DateRangePicker/AbsoluteDate.js +2 -1
- package/dist/esm/coreX/DateRangePicker/Calendar.js +79 -59
- package/dist/esm/coreX/DateRangePicker/index.js +13 -1
- package/dist/esm/coreX/DateRangePicker/utils.js +3 -0
- package/dist/esm/coreX/Dialogs/DeleteDialog/DeleteDialog.js +5 -3
- package/dist/esm/coreX/Dialogs/RejectDialog/RejectDialog.js +1 -1
- package/dist/esm/coreX/KubeConfigModal/KubeConfigModal.style.js +20 -0
- package/dist/esm/coreX/KubeConfigModal/index.js +96 -0
- package/dist/esm/coreX/KubeConfigModal/utils.js +22 -0
- package/dist/esm/hooks/useCTErrorMsg.js +23 -0
- package/dist/esm/index.js +14 -5
- package/dist/esm/legacy-antd.js +1 -1
- package/dist/esm/stats1.html +1 -1
- package/dist/esm/utils/cterror.js +58 -0
- package/dist/esm/utils/unit.js +17 -0
- package/dist/linaria.merged.scss +3157 -2720
- package/dist/src/UIKitProvider/index.d.ts +1 -3
- package/dist/src/core/Antd5Flex/index.d.ts +2 -0
- package/dist/src/core/Antd5Tree/Antd5Tree.d.ts +1 -0
- package/dist/src/core/Antd5Tree/Antd5Tree.type.d.ts +4 -0
- package/dist/src/core/Antd5Tree/index.d.ts +2 -0
- package/dist/src/core/Banner/banner.style.d.ts +4 -0
- package/dist/src/core/Banner/banner.types.d.ts +28 -0
- package/dist/src/core/Banner/index.d.ts +3 -0
- package/dist/src/core/BasicCTError/BasicCTError.style.d.ts +1 -0
- package/dist/src/core/BasicCTError/BasicCTError.type.d.ts +56 -0
- package/dist/src/core/BasicCTError/index.d.ts +3 -0
- package/dist/src/core/ConfigProvider/index.d.ts +6 -1
- package/dist/src/core/ImmersiveDialog/index.d.ts +3 -0
- package/dist/src/core/ImmersiveDialog/styles.d.ts +14 -0
- package/dist/src/core/ImmersiveDialog/type.d.ts +37 -0
- package/dist/src/core/Input/index.d.ts +2 -4
- package/dist/src/core/Input/input.type.d.ts +4 -0
- package/dist/src/core/LineChart/type.d.ts +1 -0
- package/dist/src/core/MediumDialog/MediumDialog.d.ts +3 -0
- package/dist/src/core/MediumDialog/index.d.ts +1 -0
- package/dist/src/core/SmallDialog/SmallDialog.d.ts +3 -0
- package/dist/src/core/SmallDialog/SmallDialog.style.d.ts +4 -0
- package/dist/src/{coreX/Dialogs/SmallDialog.d.ts → core/SmallDialog/SmallDialog.type.d.ts} +12 -4
- package/dist/src/core/SmallDialog/index.d.ts +3 -0
- package/dist/src/core/TableForm/types.d.ts +7 -2
- package/dist/src/core/Timeline/Timeline.type.d.ts +27 -7
- package/dist/src/core/Timeline/index.d.ts +5 -1
- package/dist/src/core/WizardDialog/index.d.ts +3 -0
- package/dist/src/core/WizardDialog/styles.d.ts +4 -0
- package/dist/src/core/WizardDialog/type.d.ts +31 -0
- package/dist/src/core/index.d.ts +10 -14
- package/dist/src/core/message/index.d.ts +4 -53
- package/dist/src/core/message/message.d.ts +53 -0
- package/dist/src/core/message/useMessage.d.ts +4 -0
- package/dist/src/coreX/DateRangePicker/__tests__/utils.test.d.ts +1 -0
- package/dist/src/coreX/DateRangePicker/dateRangePicker.type.d.ts +10 -2
- package/dist/src/coreX/DateRangePicker/utils.d.ts +7 -0
- package/dist/src/coreX/Dialogs/DeleteDialog/DeleteDialog.type.d.ts +2 -0
- package/dist/src/coreX/Dialogs/index.d.ts +0 -1
- package/dist/src/coreX/KubeConfigModal/KubeConfigModal.style.d.ts +9 -0
- package/dist/src/coreX/KubeConfigModal/KubeConfigModal.type.d.ts +21 -0
- package/dist/src/coreX/KubeConfigModal/index.d.ts +4 -0
- package/dist/src/coreX/KubeConfigModal/utils.d.ts +2 -0
- package/dist/src/coreX/index.d.ts +2 -0
- package/dist/src/hooks/__tests__/useCTErrorMsg.test.d.ts +1 -0
- package/dist/src/hooks/index.d.ts +1 -0
- package/dist/src/hooks/useCTErrorMsg.d.ts +7 -0
- package/dist/src/utils/__test__/cterror.test.d.ts +1 -0
- package/dist/src/utils/__test__/unit.spec.d.ts +1 -0
- package/dist/src/utils/cterror.d.ts +29 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/type.d.ts +32 -0
- package/dist/src/utils/unit.d.ts +14 -0
- package/dist/stories/docs/core/Antd5Tree.stories.d.ts +44 -0
- package/dist/stories/docs/core/Banner.stories.d.ts +53 -0
- package/dist/stories/docs/core/BasicCTError.stories.d.ts +47 -0
- package/dist/stories/docs/core/FieldsDateTimeRange.stories.d.ts +1 -0
- package/dist/stories/docs/core/ImmersiveDialog.stories.d.ts +96 -0
- package/dist/stories/docs/core/Input.simple.stories.d.ts +1 -3
- package/dist/stories/docs/core/LineChart.stories.d.ts +1 -0
- package/dist/stories/docs/core/MediumDialog.stories.d.ts +35 -0
- package/dist/stories/docs/core/Modal.stories.d.ts +0 -2
- package/dist/stories/docs/core/SmallDialog.stories.d.ts +37 -0
- package/dist/stories/docs/core/Timeline.stories.d.ts +4 -1
- package/dist/stories/docs/core/WizardDialog.stories.d.ts +109 -0
- package/dist/stories/docs/coreX/DateRangePicker.stories.d.ts +1 -0
- package/dist/stories/docs/coreX/Dialogs/DeleteDialog.stories.d.ts +5 -0
- package/dist/stories/docs/coreX/KubeConfigModal.stories.d.ts +83 -0
- package/dist/style.css +2867 -2469
- package/package.json +8 -7
- package/dist/cjs/coreX/Dialogs/SmallDialog.js +0 -86
- package/dist/esm/coreX/Dialogs/SmallDialog.js +0 -80
|
@@ -51,6 +51,7 @@ const TimeRange = (props) => {
|
|
|
51
51
|
mode = ["relative", "absolute"],
|
|
52
52
|
minDate,
|
|
53
53
|
maxDate,
|
|
54
|
+
maxRange,
|
|
54
55
|
onTypeChange,
|
|
55
56
|
onRelativeTimeChange,
|
|
56
57
|
onAbsoluteTimeOk,
|
|
@@ -110,13 +111,22 @@ const TimeRange = (props) => {
|
|
|
110
111
|
range: range || [null, null],
|
|
111
112
|
minDate,
|
|
112
113
|
maxDate,
|
|
114
|
+
maxRange,
|
|
113
115
|
onChange: (range2) => onAbsoluteTimeChange == null ? void 0 : onAbsoluteTimeChange(range2),
|
|
114
116
|
onOk: (range2) => onAbsoluteTimeOk == null ? void 0 : onAbsoluteTimeOk(range2)
|
|
115
117
|
}
|
|
116
118
|
))
|
|
117
119
|
}
|
|
118
120
|
].filter((item) => mode.includes(item.key));
|
|
119
|
-
return /* @__PURE__ */ React__default.default.createElement(
|
|
121
|
+
return /* @__PURE__ */ React__default.default.createElement(
|
|
122
|
+
index$2,
|
|
123
|
+
{
|
|
124
|
+
selectedKey: type,
|
|
125
|
+
tabs,
|
|
126
|
+
onChange: onTypeChange,
|
|
127
|
+
size: "small"
|
|
128
|
+
}
|
|
129
|
+
);
|
|
120
130
|
}
|
|
121
131
|
};
|
|
122
132
|
const TimePickerHistory = (props) => {
|
|
@@ -153,6 +163,7 @@ const DateRangePicker = (props) => {
|
|
|
153
163
|
mode = ["relative", "absolute"],
|
|
154
164
|
minDate,
|
|
155
165
|
maxDate,
|
|
166
|
+
maxRange,
|
|
156
167
|
onChange,
|
|
157
168
|
relativeTimeSelectOptions
|
|
158
169
|
} = props;
|
|
@@ -287,6 +298,7 @@ const DateRangePicker = (props) => {
|
|
|
287
298
|
mode,
|
|
288
299
|
minDate,
|
|
289
300
|
maxDate,
|
|
301
|
+
maxRange,
|
|
290
302
|
onTypeChange: setType,
|
|
291
303
|
onRelativeTimeChange: (time) => {
|
|
292
304
|
handleChange("relative", time);
|
|
@@ -4,7 +4,7 @@ var core = require('@linaria/core');
|
|
|
4
4
|
var index = require('../../../core/Typo/index.js');
|
|
5
5
|
var useParrotTranslation = require('../../../hooks/useParrotTranslation.js');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var SmallDialog = require('
|
|
7
|
+
var SmallDialog = require('../../../core/SmallDialog/SmallDialog.js');
|
|
8
8
|
|
|
9
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
|
|
@@ -24,7 +24,8 @@ const DeleteDialog = props => {
|
|
|
24
24
|
okText = t("common.delete"),
|
|
25
25
|
onOk,
|
|
26
26
|
onCancel,
|
|
27
|
-
className
|
|
27
|
+
className,
|
|
28
|
+
confirmLoading
|
|
28
29
|
} = props;
|
|
29
30
|
return /* @__PURE__ */React__default.default.createElement(SmallDialog.SmallDialog, {
|
|
30
31
|
title,
|
|
@@ -36,7 +37,8 @@ const DeleteDialog = props => {
|
|
|
36
37
|
cancelText,
|
|
37
38
|
okButtonProps: {
|
|
38
39
|
danger: true
|
|
39
|
-
}
|
|
40
|
+
},
|
|
41
|
+
confirmLoading
|
|
40
42
|
}, description && /* @__PURE__ */React__default.default.createElement("div", {
|
|
41
43
|
className: core.cx(ContentStyle, index.Typo.Label.l2_regular)
|
|
42
44
|
}, description), secondaryDesc && /* @__PURE__ */React__default.default.createElement("div", {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var core = require('@linaria/core');
|
|
4
4
|
var index = require('../../../core/Typo/index.js');
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var SmallDialog = require('
|
|
6
|
+
var SmallDialog = require('../../../core/SmallDialog/SmallDialog.js');
|
|
7
7
|
var RejectDialog_type = require('./RejectDialog.type.js');
|
|
8
8
|
|
|
9
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('@linaria/react');
|
|
4
|
+
|
|
5
|
+
const KubeConfigModalStyle = "E_kr6am0s";
|
|
6
|
+
const KubeConfigWrapperStyle = "E_k1h3cl5q";
|
|
7
|
+
const KubeConfigTitleStyle = "E_k1a6j97w";
|
|
8
|
+
const KubeConfigTipStyle = "E_k1uim1fg";
|
|
9
|
+
const KubeConfigContentStyle = "E_kobelzt";
|
|
10
|
+
const KubeConfigFooterStyle = "E_kxzv3id";
|
|
11
|
+
const ErrorWrapper = /*#__PURE__*/react.styled('div')({
|
|
12
|
+
name: "ErrorWrapper",
|
|
13
|
+
class: "E_eld9lt",
|
|
14
|
+
propsAsIs: false
|
|
15
|
+
});
|
|
16
|
+
const ErrorContentWrapper = /*#__PURE__*/react.styled('div')({
|
|
17
|
+
name: "ErrorContentWrapper",
|
|
18
|
+
class: "E_e1505fqc",
|
|
19
|
+
propsAsIs: false
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
exports.ErrorContentWrapper = ErrorContentWrapper;
|
|
23
|
+
exports.ErrorWrapper = ErrorWrapper;
|
|
24
|
+
exports.KubeConfigContentStyle = KubeConfigContentStyle;
|
|
25
|
+
exports.KubeConfigFooterStyle = KubeConfigFooterStyle;
|
|
26
|
+
exports.KubeConfigModalStyle = KubeConfigModalStyle;
|
|
27
|
+
exports.KubeConfigTipStyle = KubeConfigTipStyle;
|
|
28
|
+
exports.KubeConfigTitleStyle = KubeConfigTitleStyle;
|
|
29
|
+
exports.KubeConfigWrapperStyle = KubeConfigWrapperStyle;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var index$1 = require('../../core/Modal/index.js');
|
|
5
|
+
var iconsReact = require('@cloudtower/icons-react');
|
|
6
|
+
var useParrotTranslation = require('../../hooks/useParrotTranslation.js');
|
|
7
|
+
var core = require('@linaria/core');
|
|
8
|
+
var utils = require('./utils.js');
|
|
9
|
+
var KubeConfigModal_style = require('./KubeConfigModal.style.js');
|
|
10
|
+
var index = require('../../core/KitStoreProvider/index.js');
|
|
11
|
+
var message = require('../../core/message/message.js');
|
|
12
|
+
var index$2 = require('../../core/Button/index.js');
|
|
13
|
+
var index$3 = require('../../core/Icon/index.js');
|
|
14
|
+
var index$5 = require('../../core/Loading/index.js');
|
|
15
|
+
var index$4 = require('../../core/Typo/index.js');
|
|
16
|
+
|
|
17
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
+
|
|
19
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
20
|
+
|
|
21
|
+
const ErrorContent = (props) => {
|
|
22
|
+
const { refetch, errorText } = props;
|
|
23
|
+
const { t } = useParrotTranslation();
|
|
24
|
+
return /* @__PURE__ */ React__default.default.createElement(KubeConfigModal_style.ErrorWrapper, { className: props.className, style: props.style }, /* @__PURE__ */ React__default.default.createElement(KubeConfigModal_style.ErrorContentWrapper, null, /* @__PURE__ */ React__default.default.createElement("p", { className: core.cx(index$4.Typo.Label.l1_regular_title, "title") }, errorText || t("common.obtain_data_error")), !refetch ? null : /* @__PURE__ */ React__default.default.createElement(
|
|
25
|
+
index$2,
|
|
26
|
+
{
|
|
27
|
+
size: "small",
|
|
28
|
+
type: "ordinary",
|
|
29
|
+
onClick: (e) => {
|
|
30
|
+
e.stopPropagation();
|
|
31
|
+
refetch == null ? void 0 : refetch();
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
t("common.retry")
|
|
35
|
+
)));
|
|
36
|
+
};
|
|
37
|
+
const KubeConfigModal = ({
|
|
38
|
+
downloadName,
|
|
39
|
+
customDesc,
|
|
40
|
+
loading,
|
|
41
|
+
data,
|
|
42
|
+
error,
|
|
43
|
+
refetch
|
|
44
|
+
}) => {
|
|
45
|
+
const { t } = useParrotTranslation();
|
|
46
|
+
const popModal = index.usePopModal();
|
|
47
|
+
const onCopy = React.useCallback(() => {
|
|
48
|
+
utils.copy(data);
|
|
49
|
+
message.default.success(t("common.copy_kubeconfig_success"));
|
|
50
|
+
}, [data, t]);
|
|
51
|
+
const onDownload = React.useCallback(() => {
|
|
52
|
+
utils.download(`${downloadName}.yaml`, data);
|
|
53
|
+
popModal();
|
|
54
|
+
}, [data, popModal, downloadName]);
|
|
55
|
+
return /* @__PURE__ */ React__default.default.createElement(
|
|
56
|
+
index$1,
|
|
57
|
+
{
|
|
58
|
+
visible: true,
|
|
59
|
+
fullscreen: true,
|
|
60
|
+
className: KubeConfigModal_style.KubeConfigModalStyle,
|
|
61
|
+
onCancel: () => {
|
|
62
|
+
popModal();
|
|
63
|
+
},
|
|
64
|
+
footer: /* @__PURE__ */ React__default.default.createElement("div", { className: KubeConfigModal_style.KubeConfigFooterStyle }, /* @__PURE__ */ React__default.default.createElement(
|
|
65
|
+
index$2,
|
|
66
|
+
{
|
|
67
|
+
type: "default",
|
|
68
|
+
prefixIcon: /* @__PURE__ */ React__default.default.createElement(
|
|
69
|
+
index$3,
|
|
70
|
+
{
|
|
71
|
+
src: iconsReact.ClipboardCopy16GradientGrayIcon,
|
|
72
|
+
hoverSrc: iconsReact.ClipboardCopy16GradientBlueIcon
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
onClick: onCopy
|
|
76
|
+
},
|
|
77
|
+
t("common.copy")
|
|
78
|
+
), /* @__PURE__ */ React__default.default.createElement("div", null, /* @__PURE__ */ React__default.default.createElement(
|
|
79
|
+
index$2,
|
|
80
|
+
{
|
|
81
|
+
type: "text",
|
|
82
|
+
onClick: () => {
|
|
83
|
+
popModal();
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
t("common.cancel")
|
|
87
|
+
), /* @__PURE__ */ React__default.default.createElement(
|
|
88
|
+
index$2,
|
|
89
|
+
{
|
|
90
|
+
type: "primary",
|
|
91
|
+
onClick: onDownload,
|
|
92
|
+
disabled: loading || !!error
|
|
93
|
+
},
|
|
94
|
+
t("common.download")
|
|
95
|
+
)))
|
|
96
|
+
},
|
|
97
|
+
/* @__PURE__ */ React__default.default.createElement("div", { className: KubeConfigModal_style.KubeConfigWrapperStyle }, /* @__PURE__ */ React__default.default.createElement("div", { className: core.cx(KubeConfigModal_style.KubeConfigTitleStyle, index$4.Typo.Display.d1s_bold_title) }, t("common.download_kubeconfig")), /* @__PURE__ */ React__default.default.createElement("div", { className: core.cx(KubeConfigModal_style.KubeConfigTipStyle, index$4.Typo.Label.l1_regular) }, customDesc || t("common.download_kubeconfig_tip")), loading ? /* @__PURE__ */ React__default.default.createElement(index$5, { fullView: true }) : error ? /* @__PURE__ */ React__default.default.createElement("div", { className: KubeConfigModal_style.KubeConfigContentStyle }, /* @__PURE__ */ React__default.default.createElement(ErrorContent, { refetch, errorText: error })) : /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, /* @__PURE__ */ React__default.default.createElement("div", { className: KubeConfigModal_style.KubeConfigContentStyle }, data)))
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
var KubeConfigModal$1 = KubeConfigModal;
|
|
101
|
+
|
|
102
|
+
module.exports = KubeConfigModal$1;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function download(filename, content) {
|
|
4
|
+
const element = document.createElement("a");
|
|
5
|
+
element.setAttribute(
|
|
6
|
+
"href",
|
|
7
|
+
"data:text/plain;charset=utf-8," + encodeURIComponent(content)
|
|
8
|
+
);
|
|
9
|
+
element.setAttribute("download", filename);
|
|
10
|
+
element.style.display = "none";
|
|
11
|
+
document.body.appendChild(element);
|
|
12
|
+
element.click();
|
|
13
|
+
document.body.removeChild(element);
|
|
14
|
+
}
|
|
15
|
+
function copy(content) {
|
|
16
|
+
const textarea = document.createElement("textarea");
|
|
17
|
+
textarea.value = content;
|
|
18
|
+
document.body.appendChild(textarea);
|
|
19
|
+
textarea.select();
|
|
20
|
+
document.execCommand("Copy");
|
|
21
|
+
document.body.removeChild(textarea);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
exports.copy = copy;
|
|
25
|
+
exports.download = download;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var useParrotTranslation = require('./useParrotTranslation.js');
|
|
4
|
+
var cterror = require('../utils/cterror.js');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var _ = require('lodash');
|
|
7
|
+
var index = require('../core/ConfigProvider/index.js');
|
|
8
|
+
|
|
9
|
+
const useCTErrorMsg = (error, options) => {
|
|
10
|
+
const { t } = useParrotTranslation();
|
|
11
|
+
const globalConfig = index.useConfig();
|
|
12
|
+
const err = cterror.parseCTError(error);
|
|
13
|
+
const ns = (options == null ? void 0 : options.CTErrorI18nNs) || (globalConfig == null ? void 0 : globalConfig.CTErrorI18nNs) || "CTError";
|
|
14
|
+
const errMsg = React.useMemo(() => {
|
|
15
|
+
return err.map((e) => {
|
|
16
|
+
if ("code" in e) {
|
|
17
|
+
return t(`${ns}.${e.code}`, _.merge(options == null ? void 0 : options.tOptions, e.params));
|
|
18
|
+
}
|
|
19
|
+
return e.message;
|
|
20
|
+
});
|
|
21
|
+
}, [err, t, ns, options == null ? void 0 : options.tOptions]);
|
|
22
|
+
return errMsg;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
exports.useCTErrorMsg = useCTErrorMsg;
|