@cloudtower/eagle 0.33.16 → 0.33.17

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.
@@ -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$2 = 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 index$1 = require('../../core/message/index.js');
12
+ var index$3 = require('../../core/Button/index.js');
13
+ var index$4 = require('../../core/Icon/index.js');
14
+ var index$6 = require('../../core/Loading/index.js');
15
+ var index$5 = 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$5.Typo.Label.l1_regular_title, "title") }, errorText || t("common.obtain_data_error")), !refetch ? null : /* @__PURE__ */ React__default.default.createElement(
25
+ index$3,
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
+ index$1.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$2,
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$3,
66
+ {
67
+ type: "default",
68
+ prefixIcon: /* @__PURE__ */ React__default.default.createElement(
69
+ index$4,
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$3,
80
+ {
81
+ type: "text",
82
+ onClick: () => {
83
+ popModal();
84
+ }
85
+ },
86
+ t("common.cancel")
87
+ ), /* @__PURE__ */ React__default.default.createElement(
88
+ index$3,
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$5.Typo.Display.d1s_bold_title) }, t("common.download_kubeconfig")), /* @__PURE__ */ React__default.default.createElement("div", { className: core.cx(KubeConfigModal_style.KubeConfigTipStyle, index$5.Typo.Label.l1_regular) }, customDesc || t("common.download_kubeconfig_tip")), loading ? /* @__PURE__ */ React__default.default.createElement(index$6, { 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;
package/dist/cjs/index.js CHANGED
@@ -138,7 +138,8 @@ var index$1C = require('./coreX/SummaryTable/index.js');
138
138
  var index$1D = require('./coreX/SwitchWithText/index.js');
139
139
  var index$1E = require('./coreX/TabMenu/index.js');
140
140
  var index$1F = require('./coreX/UnitWithChart/index.js');
141
- var index$1G = require('./coreX/CheckPointList/index.js');
141
+ var index$1G = require('./coreX/KubeConfigModal/index.js');
142
+ var index$1H = require('./coreX/CheckPointList/index.js');
142
143
  var getCalendarTitle = require('./coreX/common/getCalendarTitle.js');
143
144
  var AbsoluteDate = require('./coreX/DateRangePicker/AbsoluteDate.js');
144
145
  var Calendar = require('./coreX/DateRangePicker/Calendar.js');
@@ -149,7 +150,7 @@ var RejectDialog = require('./coreX/Dialogs/RejectDialog/RejectDialog.js');
149
150
  var RejectDialog_type = require('./coreX/Dialogs/RejectDialog/RejectDialog.type.js');
150
151
  var SmallDialog = require('./coreX/Dialogs/SmallDialog.js');
151
152
  var InfoRowList = require('./coreX/InfoRowList/InfoRowList.js');
152
- var index$1H = require('./coreX/Show/index.js');
153
+ var index$1I = require('./coreX/Show/index.js');
153
154
  var animation = require('./styles/token/animation.js');
154
155
  var color = require('./styles/token/color.js');
155
156
  var zIndices = require('./styles/token/zIndices.js');
@@ -568,8 +569,9 @@ exports.SwitchWithText = index$1D;
568
569
  exports.TabMenu = index$1E;
569
570
  exports.UnitWithChart = index$1F.default;
570
571
  exports.UnitWrapper = index$1F.UnitWrapper;
571
- exports.CheckPointItem = index$1G.CheckPointItem;
572
- exports.CheckPointList = index$1G.CheckPointList;
572
+ exports.KubeConfigModal = index$1G;
573
+ exports.CheckPointItem = index$1H.CheckPointItem;
574
+ exports.CheckPointList = index$1H.CheckPointList;
573
575
  exports.getCalendarTitle = getCalendarTitle.getCalendarTitle;
574
576
  exports.AbsoluteDate = AbsoluteDate;
575
577
  exports.DateRangePickerCalendar = Calendar;
@@ -580,7 +582,7 @@ exports.RejectDialog = RejectDialog.RejectDialog;
580
582
  exports.RejectDialogType = RejectDialog_type.RejectDialogType;
581
583
  exports.SmallDialog = SmallDialog.SmallDialog;
582
584
  exports.InfoRowList = InfoRowList.InfoRowList;
583
- exports.Show = index$1H.Show;
585
+ exports.Show = index$1I.Show;
584
586
  exports.Animation = animation.Animation;
585
587
  exports.Keyframes = animation.Keyframes;
586
588
  exports.Color = color.Color;