@appscode/design-system 1.0.43-alpha.19 → 1.0.43-alpha.190
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/base/utilities/_all.scss +6 -0
- package/base/utilities/_default.scss +269 -4
- package/base/utilities/_derived-variables.scss +0 -1
- package/base/utilities/_initial-variables.scss +17 -13
- package/base/utilities/_mixin.scss +1 -17
- package/base/utilities/_typography.scss +14 -4
- package/base/utilities/dark-theme.scss +9 -146
- package/components/_ac-accordion.scss +8 -4
- package/components/_ac-alert-box.scss +15 -7
- package/components/_ac-card.scss +33 -6
- package/components/_ac-code-highlight.scss +5 -1
- package/components/_ac-content-layout.scss +2 -2
- package/components/_ac-input.scss +63 -23
- package/components/_ac-multi-select.scss +187 -5
- package/components/_ac-options.scss +24 -9
- package/components/_ac-select-box.scss +13 -3
- package/components/_ac-table.scss +7 -5
- package/components/_ac-tabs.scss +42 -5
- package/components/_ac-terminal.scss +270 -0
- package/components/_all.scss +35 -0
- package/components/_app-drawer.scss +2 -2
- package/components/_breadcumb.scss +2 -0
- package/components/_buttons.scss +45 -36
- package/components/_card-body-wrapper.scss +2 -2
- package/components/_dashboard-header.scss +32 -0
- package/components/_direct-deploy.scss +69 -0
- package/components/_go-to-top.scss +1 -1
- package/components/_graph.scss +45 -0
- package/components/_image-upload.scss +5 -3
- package/components/_left-sidebar-menu.scss +193 -39
- package/components/_monaco-editor.scss +1 -1
- package/components/_navbar.scss +125 -8
- package/components/_overview-info.scss +4 -4
- package/components/_pagination.scss +8 -0
- package/components/_payment-card.scss +10 -1
- package/components/_preview-modal.scss +15 -4
- package/components/_pricing-table.scss +1 -1
- package/components/_progress-bar.scss +4 -4
- package/components/_subscription-card.scss +12 -5
- package/components/_table-of-content.scss +1 -1
- package/components/_tfa.scss +69 -0
- package/components/_transitions.scss +261 -0
- package/components/_wizard.scss +16 -3
- package/components/ac-toaster/_ac-toasted.scss +1 -1
- package/components/bbum/_card-team.scss +1 -1
- package/components/bbum/_information-center.scss +15 -1
- package/components/bbum/_sign-up-notification.scss +1 -1
- package/components/bbum/_single-post-preview.scss +1 -1
- package/components/bbum/_user-profile.scss +91 -90
- package/components/ui-builder/_ui-builder.scss +43 -3
- package/components/ui-builder/_vue-open-api.scss +104 -0
- package/layouts/_all.scss +2 -0
- package/layouts/_code-preview.scss +5 -2
- package/main.scss +4 -54
- package/package.json +2 -7
- package/plugins/theme.js +4 -0
- package/plugins/time-convert.js +49 -0
- package/plugins/vue-toaster.js +3 -0
- package/vue-components/v2/banner/Banner.vue +2 -2
- package/vue-components/v2/breadcrumbs/Breadcrumb.vue +97 -0
- package/vue-components/v2/button/Button.vue +5 -0
- package/vue-components/v2/button/DownloadBtn.vue +45 -0
- package/vue-components/v2/card/Card.vue +1 -0
- package/vue-components/v2/card/PaymentCards.vue +11 -2
- package/vue-components/v2/content/ContentTable.vue +12 -7
- package/vue-components/v2/editor/Editor.vue +38 -5
- package/vue-components/v2/editor/FilteredFileEditor.vue +189 -0
- package/vue-components/v2/editor/MonacoEditor.vue +125 -0
- package/vue-components/v2/editor/ResourceKeyValueEditor.vue +209 -0
- package/vue-components/v2/form-fields/Input.vue +1 -1
- package/vue-components/v2/loaders/ResourceLoader.vue +101 -0
- package/vue-components/v2/loaders/SidebarLoader.vue +43 -0
- package/vue-components/v2/modal/Modal.vue +35 -4
- package/vue-components/v2/modals/DeleteConfirmationModal.vue +79 -0
- package/vue-components/v2/modals/JsonShowModal.vue +12 -2
- package/vue-components/v2/navbar/Appdrawer.vue +10 -9
- package/vue-components/v2/navbar/ThemeMode.vue +50 -44
- package/vue-components/v2/navbar/User.vue +202 -19
- package/vue-components/v2/notification/Notification.vue +101 -0
- package/vue-components/v2/notification/NotificationItem.vue +44 -0
- package/vue-components/v2/preloader/Preloader.vue +5 -5
- package/vue-components/v2/sidebar/ClusterSwitcher.vue +126 -0
- package/vue-components/v2/sidebar/SidebarItem.vue +23 -1
- package/vue-components/v2/sidebar/SidebarItemWithDropDown.vue +19 -20
- package/vue-components/v2/tab/TabItem.vue +1 -1
- package/vue-components/v2/table/Table.vue +44 -8
- package/vue-components/v2/table/TableRow.vue +12 -2
- package/vue-components/v2/table/table-cell/CellValue.vue +33 -4
- package/vue-components/v2/table/table-cell/GenericCell.vue +56 -0
- package/vue-components/v2/table/table-cell/ObjectCell.vue +4 -1
- package/vue-components/v2/tabs/EditorTabs.vue +1 -1
- package/vue-components/v3/button/Button.vue +5 -0
- package/vue-components/v3/content/ContentTable.vue +5 -0
- package/vue-components/v3/editor/Editor.vue +50 -30
- package/vue-components/v3/editor/FilteredFileEditor.vue +184 -0
- package/vue-components/v3/editor/MonacoEditor.vue +131 -0
- package/vue-components/v3/editor/ResourceKeyValueEditor.vue +125 -0
- package/vue-components/v3/form/Form.vue +63 -0
- package/vue-components/v3/form-fields/Input.vue +10 -10
- package/vue-components/v3/header/HeaderItem.vue +5 -0
- package/vue-components/v3/header/HeaderItems.vue +5 -0
- package/vue-components/v3/loaders/ResourceLoader.vue +83 -0
- package/vue-components/v3/loaders/SidebarLoader.vue +34 -0
- package/vue-components/v3/long-running-tasks/LongRunningTaskItem.vue +92 -0
- package/vue-components/v3/modal/Modal.vue +40 -16
- package/vue-components/v3/modals/DeleteConfirmationModal.vue +83 -0
- package/vue-components/v3/modals/JsonShowModal.vue +25 -16
- package/vue-components/v3/modals/LongRunningTasksModal.vue +337 -0
- package/vue-components/v3/navbar/Appdrawer.vue +12 -7
- package/vue-components/v3/navbar/ThemeMode.vue +49 -47
- package/vue-components/v3/navbar/User.vue +190 -16
- package/vue-components/v3/notification/Notification.vue +98 -0
- package/vue-components/v3/notification/NotificationItem.vue +52 -0
- package/vue-components/v3/sidebar/ClusterSwitcher.vue +133 -0
- package/vue-components/v3/sidebar/SidebarItemWithDropDown.vue +120 -0
- package/vue-components/v3/table/MultiInfoTable.vue +143 -0
- package/vue-components/v3/table/Table.vue +35 -12
- package/vue-components/v3/table/TableContainer.vue +34 -0
- package/vue-components/v3/table/TableRow.vue +10 -2
- package/vue-components/v3/table/table-cell/CellValue.vue +26 -3
- package/vue-components/v3/table/table-cell/GenericCell.vue +62 -0
- package/vue-components/v3/table/table-cell/ObjectCell.vue +5 -1
- package/vue-components/v3/tabs/EditorTabs.vue +1 -1
- package/vue-components/v3/terminal/LongRunningTaskTerminal.vue +148 -0
|
@@ -7,19 +7,22 @@
|
|
|
7
7
|
/>
|
|
8
8
|
<monaco-editor
|
|
9
9
|
v-if="activeTab === 'edit'"
|
|
10
|
-
ref="monacoEditor"
|
|
11
10
|
@editorDidMount="onEditorMount"
|
|
12
11
|
key="edit"
|
|
13
12
|
:class="`vh-${editorHeight} is-clipped`"
|
|
14
|
-
|
|
13
|
+
:value="editorContent"
|
|
14
|
+
@change="onChange"
|
|
15
15
|
:language="language"
|
|
16
16
|
:options="{
|
|
17
17
|
minimap: {
|
|
18
18
|
enabled: calcShowMinimap,
|
|
19
19
|
},
|
|
20
|
+
theme: theme,
|
|
20
21
|
readOnly: readOnly,
|
|
22
|
+
wordWrap: wordWrap,
|
|
21
23
|
scrollBeyondLastLine: false,
|
|
22
24
|
}"
|
|
25
|
+
data-testid="monaco-editor-edit-section"
|
|
23
26
|
/>
|
|
24
27
|
<monaco-editor
|
|
25
28
|
v-if="activeTab === 'preview'"
|
|
@@ -31,16 +34,21 @@
|
|
|
31
34
|
minimap: {
|
|
32
35
|
enabled: calcShowMinimap,
|
|
33
36
|
},
|
|
37
|
+
theme: theme,
|
|
34
38
|
readOnly: true,
|
|
39
|
+
wordWrap: wordWrap,
|
|
35
40
|
scrollBeyondLastLine: false,
|
|
36
41
|
}"
|
|
37
42
|
:original="originalEditorContent"
|
|
38
43
|
:diff-editor="true"
|
|
44
|
+
data-testid="monaco-editor-preview-section"
|
|
39
45
|
/>
|
|
40
46
|
</div>
|
|
41
47
|
</template>
|
|
42
48
|
|
|
43
49
|
<script>
|
|
50
|
+
import Preloader from "../preloader/Preloader.vue";
|
|
51
|
+
import Banner from "../banner/Banner.vue";
|
|
44
52
|
export default {
|
|
45
53
|
props: {
|
|
46
54
|
value: {
|
|
@@ -67,10 +75,25 @@ export default {
|
|
|
67
75
|
type: Number,
|
|
68
76
|
default: 40,
|
|
69
77
|
},
|
|
78
|
+
editorTheme: {
|
|
79
|
+
type: String,
|
|
80
|
+
default: "",
|
|
81
|
+
},
|
|
82
|
+
wordWrap: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: "off",
|
|
85
|
+
},
|
|
70
86
|
},
|
|
87
|
+
|
|
71
88
|
components: {
|
|
72
89
|
EditorTabs: () => import("../tabs/EditorTabs.vue"),
|
|
73
|
-
MonacoEditor: () =>
|
|
90
|
+
MonacoEditor: () => ({
|
|
91
|
+
component: import("./MonacoEditor.vue"),
|
|
92
|
+
loading: Preloader,
|
|
93
|
+
delay: 200,
|
|
94
|
+
error: Banner,
|
|
95
|
+
timeout: 100000,
|
|
96
|
+
}),
|
|
74
97
|
},
|
|
75
98
|
|
|
76
99
|
data() {
|
|
@@ -86,6 +109,14 @@ export default {
|
|
|
86
109
|
const noOfLines = this.editorContent.split("\n").length;
|
|
87
110
|
return this.showMinimap && noOfLines * 2 > this.editorHeight;
|
|
88
111
|
},
|
|
112
|
+
theme() {
|
|
113
|
+
return (
|
|
114
|
+
this.editorTheme ||
|
|
115
|
+
(document.documentElement.classList.contains("is-dark-theme")
|
|
116
|
+
? "vs-dark"
|
|
117
|
+
: "vs")
|
|
118
|
+
);
|
|
119
|
+
},
|
|
89
120
|
},
|
|
90
121
|
|
|
91
122
|
watch: {
|
|
@@ -108,8 +139,10 @@ export default {
|
|
|
108
139
|
},
|
|
109
140
|
|
|
110
141
|
methods: {
|
|
111
|
-
|
|
112
|
-
|
|
142
|
+
onChange(e) {
|
|
143
|
+
if (typeof e === "string") this.editorContent = e;
|
|
144
|
+
},
|
|
145
|
+
onEditorMount(editor) {
|
|
113
146
|
// add event listeners
|
|
114
147
|
editor.onDidBlurEditorText(() => {
|
|
115
148
|
this.$emit("input", this.editorContent);
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ac-preview is-active is-not-fixed">
|
|
3
|
+
<div class="ac-preview-inner">
|
|
4
|
+
<!-- preview body start -->
|
|
5
|
+
<div class="ac-preview-body mt-0 pt-15 pl-20">
|
|
6
|
+
<div
|
|
7
|
+
v-if="isPreviewLoading || (!isPreviewLoading && previewYamls)"
|
|
8
|
+
class="left-content"
|
|
9
|
+
>
|
|
10
|
+
<div class="ac-files pt-0">
|
|
11
|
+
<ul v-if="!isPreviewLoading">
|
|
12
|
+
<li
|
|
13
|
+
v-for="(previewYaml, idx) in filteredYamls"
|
|
14
|
+
:key="previewYaml.name + idx"
|
|
15
|
+
:class="{ 'is-active': activeKey === previewYaml.uid }"
|
|
16
|
+
data-testid="filtered-file-editor-file-name"
|
|
17
|
+
>
|
|
18
|
+
<a @click.prevent="setActivePreview(previewYaml.uid)">
|
|
19
|
+
<span>
|
|
20
|
+
<img
|
|
21
|
+
src="~@appscode/design-system-images/icons/file-icon.svg"
|
|
22
|
+
alt=""
|
|
23
|
+
/>
|
|
24
|
+
</span>
|
|
25
|
+
<span>{{ previewYaml.name }}</span>
|
|
26
|
+
</a>
|
|
27
|
+
</li>
|
|
28
|
+
</ul>
|
|
29
|
+
<sidebar-loader
|
|
30
|
+
v-else
|
|
31
|
+
:primaryLoaderColor="primaryLoaderColor"
|
|
32
|
+
:secondaryLoaderColor="secondaryLoaderColor"
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
<div class="right-content" data-testid="filtered-file-editor-content">
|
|
37
|
+
<div class="right-content">
|
|
38
|
+
<resource-loader
|
|
39
|
+
v-if="isPreviewLoading"
|
|
40
|
+
:primaryLoaderColor="primaryLoaderColor"
|
|
41
|
+
:secondaryLoaderColor="secondaryLoaderColor"
|
|
42
|
+
/>
|
|
43
|
+
<editor
|
|
44
|
+
v-else-if="!isPreviewLoading && !hideValue"
|
|
45
|
+
v-model="activeFile.content"
|
|
46
|
+
:original-value="originalValue"
|
|
47
|
+
:language="activeFile.format"
|
|
48
|
+
:read-only="isEditorReadOnly"
|
|
49
|
+
:editor-height="editorHeight"
|
|
50
|
+
:show-minimap="showMinimap"
|
|
51
|
+
:editor-theme="editorTheme"
|
|
52
|
+
:key="editorTheme"
|
|
53
|
+
/>
|
|
54
|
+
<span v-else> *************** </span>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</template>
|
|
61
|
+
<script>
|
|
62
|
+
import Preloader from "../preloader/Preloader.vue";
|
|
63
|
+
import Banner from "../banner/Banner.vue";
|
|
64
|
+
export default {
|
|
65
|
+
components: {
|
|
66
|
+
Editor: () => ({
|
|
67
|
+
component: import("./Editor.vue"),
|
|
68
|
+
loading: Preloader,
|
|
69
|
+
delay: 200,
|
|
70
|
+
error: Banner,
|
|
71
|
+
timeout: 100000,
|
|
72
|
+
}),
|
|
73
|
+
ResourceLoader: () => import("./../loaders/ResourceLoader.vue"),
|
|
74
|
+
SidebarLoader: () => import("./../loaders/SidebarLoader.vue"),
|
|
75
|
+
},
|
|
76
|
+
props: {
|
|
77
|
+
searchText: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: "",
|
|
80
|
+
},
|
|
81
|
+
toggleHideValue: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
default: true,
|
|
84
|
+
},
|
|
85
|
+
isPreviewLoading: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: false,
|
|
88
|
+
},
|
|
89
|
+
isEditorReadOnly: {
|
|
90
|
+
type: Boolean,
|
|
91
|
+
default: false,
|
|
92
|
+
},
|
|
93
|
+
previewYamls: {
|
|
94
|
+
type: Array,
|
|
95
|
+
default: () => {
|
|
96
|
+
[];
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
showMinimap: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
default: false,
|
|
102
|
+
},
|
|
103
|
+
editorHeight: {
|
|
104
|
+
type: Number,
|
|
105
|
+
default: 60,
|
|
106
|
+
},
|
|
107
|
+
loaderColor: {
|
|
108
|
+
type: Object,
|
|
109
|
+
default: () => {
|
|
110
|
+
return {};
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
theme: {
|
|
114
|
+
type: String,
|
|
115
|
+
default: "light",
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
data() {
|
|
119
|
+
return {
|
|
120
|
+
activeKey: "",
|
|
121
|
+
hideValue: "",
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
computed: {
|
|
125
|
+
activeFile() {
|
|
126
|
+
const activeFile = this.filteredYamls.find(
|
|
127
|
+
(element) => element.uid === this.activeKey
|
|
128
|
+
);
|
|
129
|
+
return activeFile || { content: "", format: "yaml" };
|
|
130
|
+
},
|
|
131
|
+
originalValue() {
|
|
132
|
+
const activeFile = this.filteredYamls.find(
|
|
133
|
+
(element) => element.uid === this.activeKey
|
|
134
|
+
);
|
|
135
|
+
return (activeFile && activeFile.initContent) || "";
|
|
136
|
+
},
|
|
137
|
+
editorTheme() {
|
|
138
|
+
return this.theme === "dark" ? "vs-dark" : "vs";
|
|
139
|
+
},
|
|
140
|
+
primaryLoaderColor() {
|
|
141
|
+
return this.loaderColor.primaryLoaderColor;
|
|
142
|
+
},
|
|
143
|
+
secondaryLoaderColor() {
|
|
144
|
+
return this.loaderColor.secondaryLoaderColor;
|
|
145
|
+
},
|
|
146
|
+
filteredYamls() {
|
|
147
|
+
if (this.searchText) {
|
|
148
|
+
return this.previewYamls.filter(
|
|
149
|
+
(element) => JSON.stringify(element).search(this.searchText) > -1
|
|
150
|
+
);
|
|
151
|
+
} else return this.previewYamls;
|
|
152
|
+
},
|
|
153
|
+
isKeyAvailable() {
|
|
154
|
+
const val = this.previewYamls.find((element) => {
|
|
155
|
+
return element.uid === this.activeKey;
|
|
156
|
+
});
|
|
157
|
+
return val === undefined ? false : true;
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
methods: {
|
|
161
|
+
initActivePreview() {
|
|
162
|
+
if (!this.isKeyAvailable) {
|
|
163
|
+
this.activeKey = this.previewYamls[0].uid;
|
|
164
|
+
this.hideValue = this.activeFile.isSecret;
|
|
165
|
+
this.$emit("setActiveKey", this.activeKey);
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
setActivePreview(uid) {
|
|
169
|
+
this.activeKey = uid;
|
|
170
|
+
this.hideValue = this.activeFile.isSecret;
|
|
171
|
+
this.$emit("setActiveKey", this.activeKey);
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
watch: {
|
|
175
|
+
previewYamls: {
|
|
176
|
+
deep: true,
|
|
177
|
+
immediate: true,
|
|
178
|
+
handler(n) {
|
|
179
|
+
if (n.length) {
|
|
180
|
+
this.initActivePreview();
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
toggleHideValue(n) {
|
|
185
|
+
this.hideValue = n;
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
</script>
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="monaco-editor-vue2" :style="style"></div>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
import * as monaco from "monaco-editor";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
name: "MonacoEditor",
|
|
10
|
+
props: {
|
|
11
|
+
diffEditor: { type: Boolean, default: false },
|
|
12
|
+
width: { type: [String, Number], default: "100%" },
|
|
13
|
+
height: { type: [String, Number], default: "100%" },
|
|
14
|
+
original: String,
|
|
15
|
+
value: String,
|
|
16
|
+
language: { type: String, default: "javascript" },
|
|
17
|
+
theme: { type: String, default: "vs" },
|
|
18
|
+
options: {
|
|
19
|
+
type: Object,
|
|
20
|
+
default() {
|
|
21
|
+
return {};
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
computed: {
|
|
26
|
+
style() {
|
|
27
|
+
const fixedWidth = this.width.toString().includes("%")
|
|
28
|
+
? this.width
|
|
29
|
+
: `${this.width}px`;
|
|
30
|
+
const fixedHeight = this.height.toString().includes("%")
|
|
31
|
+
? this.height
|
|
32
|
+
: `${this.height}px`;
|
|
33
|
+
return {
|
|
34
|
+
width: fixedWidth,
|
|
35
|
+
height: fixedHeight,
|
|
36
|
+
"text-align": "left",
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
mounted() {
|
|
41
|
+
this.initMonaco();
|
|
42
|
+
},
|
|
43
|
+
beforeDestroy() {
|
|
44
|
+
this.editor && this.editor.dispose();
|
|
45
|
+
},
|
|
46
|
+
methods: {
|
|
47
|
+
initMonaco() {
|
|
48
|
+
this.$emit("editorWillMount", this.monaco);
|
|
49
|
+
const { value, language, theme, options } = this;
|
|
50
|
+
this.editor = monaco.editor[
|
|
51
|
+
this.diffEditor ? "createDiffEditor" : "create"
|
|
52
|
+
](this.$el, {
|
|
53
|
+
value: value,
|
|
54
|
+
language: language,
|
|
55
|
+
theme: theme,
|
|
56
|
+
...options,
|
|
57
|
+
});
|
|
58
|
+
this.diffEditor && this._setModel(this.value, this.original);
|
|
59
|
+
|
|
60
|
+
// @event `change`
|
|
61
|
+
const editor = this._getEditor();
|
|
62
|
+
editor.onDidChangeModelContent((event) => {
|
|
63
|
+
const value = editor.getValue();
|
|
64
|
+
if (this.value !== value) {
|
|
65
|
+
this.$emit("change", value, event);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
this.$emit("editorDidMount", this.editor);
|
|
70
|
+
},
|
|
71
|
+
_setModel(value, original) {
|
|
72
|
+
const { language } = this;
|
|
73
|
+
const originalModel = monaco.editor.createModel(original, language);
|
|
74
|
+
const modifiedModel = monaco.editor.createModel(value, language);
|
|
75
|
+
this.editor.setModel({
|
|
76
|
+
original: originalModel,
|
|
77
|
+
modified: modifiedModel,
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
_setValue(value) {
|
|
81
|
+
let editor = this._getEditor();
|
|
82
|
+
if (editor) return editor.setValue(value);
|
|
83
|
+
},
|
|
84
|
+
_getValue() {
|
|
85
|
+
let editor = this._getEditor();
|
|
86
|
+
if (!editor) return "";
|
|
87
|
+
return editor.getValue();
|
|
88
|
+
},
|
|
89
|
+
_getEditor() {
|
|
90
|
+
if (!this.editor) return null;
|
|
91
|
+
return this.diffEditor ? this.editor.getModifiedEditor() : this.editor;
|
|
92
|
+
},
|
|
93
|
+
_setOriginal() {
|
|
94
|
+
const { original } = this.editor.getModel();
|
|
95
|
+
original.setValue(this.original);
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
watch: {
|
|
99
|
+
options: {
|
|
100
|
+
deep: true,
|
|
101
|
+
handler(options) {
|
|
102
|
+
this.editor.updateOptions(options);
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
value() {
|
|
106
|
+
this.value !== this._getValue() && this._setValue(this.value);
|
|
107
|
+
},
|
|
108
|
+
original() {
|
|
109
|
+
this._setOriginal();
|
|
110
|
+
},
|
|
111
|
+
language() {
|
|
112
|
+
if (!this.editor) return;
|
|
113
|
+
if (this.diffEditor) {
|
|
114
|
+
const { original, modified } = this.editor.getModel();
|
|
115
|
+
monaco.editor.setModelLanguage(original, this.language);
|
|
116
|
+
monaco.editor.setModelLanguage(modified, this.language);
|
|
117
|
+
} else
|
|
118
|
+
monaco.editor.setModelLanguage(this.editor.getModel(), this.language);
|
|
119
|
+
},
|
|
120
|
+
theme() {
|
|
121
|
+
monaco.editor.setTheme(this.theme);
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
</script>
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<content-table
|
|
3
|
+
:table-title="title"
|
|
4
|
+
:searchable="isSearchable"
|
|
5
|
+
:hide-header="hideHeader"
|
|
6
|
+
>
|
|
7
|
+
<template #content-controls>
|
|
8
|
+
<header-item v-if="showHideBtn">
|
|
9
|
+
<ac-button
|
|
10
|
+
modifier-classes="is-square is-primary"
|
|
11
|
+
:icon-class="toggleHideValue ? 'eye-slash' : 'eye'"
|
|
12
|
+
@click.prevent="toggleHideValue = !toggleHideValue"
|
|
13
|
+
/>
|
|
14
|
+
</header-item>
|
|
15
|
+
<header-item v-if="showCopyBtn">
|
|
16
|
+
<ac-button
|
|
17
|
+
modifier-classes="is-square is-primary"
|
|
18
|
+
icon-class="copy"
|
|
19
|
+
v-clipboard:copy="decode(activeFile)"
|
|
20
|
+
v-clipboard:success="onCopy"
|
|
21
|
+
v-clipboard:error="onError"
|
|
22
|
+
/>
|
|
23
|
+
</header-item>
|
|
24
|
+
<header-item v-if="showDownloadBtn">
|
|
25
|
+
<download-btn
|
|
26
|
+
:file-data="decode(activeFile)"
|
|
27
|
+
:file-name="activeFile.name"
|
|
28
|
+
/>
|
|
29
|
+
</header-item>
|
|
30
|
+
<header-item v-if="showUpdateBtn && !isEditorReadOnly">
|
|
31
|
+
<ac-button
|
|
32
|
+
modifier-classes="is-square is-primary"
|
|
33
|
+
icon-class="floppy-o"
|
|
34
|
+
:class="{ 'is-loading': isUpdateActive }"
|
|
35
|
+
@click.prevent="$emit('updateData', activeKey, activeFile)"
|
|
36
|
+
/>
|
|
37
|
+
</header-item>
|
|
38
|
+
<header-item v-if="showDeleteBtn">
|
|
39
|
+
<ac-button
|
|
40
|
+
modifier-classes="is-square is-danger"
|
|
41
|
+
icon-class="trash"
|
|
42
|
+
@click.prevent="showDeleteDataModal = true"
|
|
43
|
+
/>
|
|
44
|
+
<delete-confirmation-modal
|
|
45
|
+
title="Delete Resource"
|
|
46
|
+
message="Do you want to delete "
|
|
47
|
+
:item-name="activeFile.name"
|
|
48
|
+
:open="showDeleteDataModal"
|
|
49
|
+
:is-delete-active="deleteModalStatus === 'loading'"
|
|
50
|
+
@delete-confirmation-modal$confirm="confirmDelete"
|
|
51
|
+
@closemodal="showDeleteDataModal = false"
|
|
52
|
+
/>
|
|
53
|
+
</header-item>
|
|
54
|
+
<slot name="content-action" />
|
|
55
|
+
</template>
|
|
56
|
+
<template #content="{ searchText }">
|
|
57
|
+
<filtered-file-editor
|
|
58
|
+
:search-text="searchText"
|
|
59
|
+
:toggle-hide-value="toggleHideValue"
|
|
60
|
+
:is-preview-loading="isPreviewLoading"
|
|
61
|
+
:is-editor-read-only="isEditorReadOnly"
|
|
62
|
+
:preview-yamls="previewYamls"
|
|
63
|
+
:show-minimap="showMinimap"
|
|
64
|
+
:editor-height="editorHeight"
|
|
65
|
+
:loader-color="loaderColor"
|
|
66
|
+
:theme="theme"
|
|
67
|
+
:key="theme"
|
|
68
|
+
@setActiveKey="setActiveKey"
|
|
69
|
+
/>
|
|
70
|
+
</template>
|
|
71
|
+
</content-table>
|
|
72
|
+
</template>
|
|
73
|
+
<script>
|
|
74
|
+
export default {
|
|
75
|
+
components: {
|
|
76
|
+
AcButton: () => import("./../button/Button.vue"),
|
|
77
|
+
Editor: () => import("./../editor/Editor.vue"),
|
|
78
|
+
ContentTable: () => import("./../content/ContentTable.vue"),
|
|
79
|
+
HeaderItem: () => import("./../header/HeaderItem.vue"),
|
|
80
|
+
DownloadBtn: () => import("./../button/DownloadBtn.vue"),
|
|
81
|
+
DeleteConfirmationModal: () =>
|
|
82
|
+
import("./../modals/DeleteConfirmationModal.vue"),
|
|
83
|
+
FilteredFileEditor: () => import("./FilteredFileEditor.vue")
|
|
84
|
+
},
|
|
85
|
+
props: {
|
|
86
|
+
title: {
|
|
87
|
+
type: String,
|
|
88
|
+
default: "Title"
|
|
89
|
+
},
|
|
90
|
+
isSearchable: {
|
|
91
|
+
type: Boolean,
|
|
92
|
+
default: false
|
|
93
|
+
},
|
|
94
|
+
isPreviewLoading: {
|
|
95
|
+
type: Boolean,
|
|
96
|
+
default: false
|
|
97
|
+
},
|
|
98
|
+
isEditorReadOnly: {
|
|
99
|
+
type: Boolean,
|
|
100
|
+
default: false
|
|
101
|
+
},
|
|
102
|
+
previewYamls: {
|
|
103
|
+
type: Array,
|
|
104
|
+
default: () => {
|
|
105
|
+
[];
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
visibleBtn: {
|
|
109
|
+
type: Object,
|
|
110
|
+
default: () => {
|
|
111
|
+
return {};
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
showMinimap: {
|
|
115
|
+
type: Boolean,
|
|
116
|
+
default: false
|
|
117
|
+
},
|
|
118
|
+
isUpdateActive: {
|
|
119
|
+
type: Boolean,
|
|
120
|
+
default: false
|
|
121
|
+
},
|
|
122
|
+
deleteModalStatus: {
|
|
123
|
+
type: String,
|
|
124
|
+
default: "closed"
|
|
125
|
+
},
|
|
126
|
+
editorHeight: {
|
|
127
|
+
type: Number,
|
|
128
|
+
default: 60
|
|
129
|
+
},
|
|
130
|
+
hideHeader: {
|
|
131
|
+
type: Boolean,
|
|
132
|
+
default: false
|
|
133
|
+
},
|
|
134
|
+
loaderColor: {
|
|
135
|
+
type: Object,
|
|
136
|
+
default: () => {
|
|
137
|
+
return {};
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
theme: {
|
|
141
|
+
type: String,
|
|
142
|
+
default: "light"
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
data() {
|
|
146
|
+
return {
|
|
147
|
+
activeKey: 0,
|
|
148
|
+
toggleHideValue: "",
|
|
149
|
+
showDeleteDataModal: false
|
|
150
|
+
};
|
|
151
|
+
},
|
|
152
|
+
computed: {
|
|
153
|
+
activeFile() {
|
|
154
|
+
const activeFile = this.previewYamls.find(
|
|
155
|
+
element => element.uid === this.activeKey
|
|
156
|
+
);
|
|
157
|
+
return activeFile || { content: "", format: "yaml" };
|
|
158
|
+
},
|
|
159
|
+
showCopyBtn() {
|
|
160
|
+
if (this.visibleBtn.showCopyBtn) return true;
|
|
161
|
+
else return false;
|
|
162
|
+
},
|
|
163
|
+
showHideBtn() {
|
|
164
|
+
if (this.visibleBtn.showHideBtn) return true;
|
|
165
|
+
else return false;
|
|
166
|
+
},
|
|
167
|
+
showUpdateBtn() {
|
|
168
|
+
if (this.visibleBtn.showUpdateBtn) return true;
|
|
169
|
+
else return false;
|
|
170
|
+
},
|
|
171
|
+
showDownloadBtn() {
|
|
172
|
+
if (this.visibleBtn.showDownloadBtn) return true;
|
|
173
|
+
else return false;
|
|
174
|
+
},
|
|
175
|
+
showDeleteBtn() {
|
|
176
|
+
if (this.visibleBtn.showDeleteBtn) return true;
|
|
177
|
+
else return false;
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
methods: {
|
|
181
|
+
onCopy() {
|
|
182
|
+
this.$toasted.global.success("Value copied successfully").goAway(1000);
|
|
183
|
+
},
|
|
184
|
+
onError() {
|
|
185
|
+
this.$toasted.global.error("Copying failed").goAway(1000);
|
|
186
|
+
},
|
|
187
|
+
decode(str) {
|
|
188
|
+
if (str) return str.content;
|
|
189
|
+
else return "";
|
|
190
|
+
},
|
|
191
|
+
encode(str) {
|
|
192
|
+
if (str) return str.content;
|
|
193
|
+
else return "";
|
|
194
|
+
},
|
|
195
|
+
confirmDelete(flag) {
|
|
196
|
+
if (flag) this.$emit("deleteResource", this.activeKey);
|
|
197
|
+
},
|
|
198
|
+
setActiveKey(key) {
|
|
199
|
+
this.activeKey = key;
|
|
200
|
+
this.toggleHideValue = this.activeFile.isSecret;
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
watch: {
|
|
204
|
+
deleteModalStatus(n) {
|
|
205
|
+
if (n === "closed") this.showDeleteDataModal = false;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
</script>
|