@appscode/design-system 1.0.43-alpha.16 → 1.0.43-alpha.162
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/_default.scss +269 -4
- package/base/utilities/_derived-variables.scss +0 -1
- package/base/utilities/_initial-variables.scss +17 -176
- package/base/utilities/_mixin.scss +1 -17
- package/base/utilities/_typography.scss +14 -4
- package/base/utilities/dark-theme.scss +25 -0
- package/components/_ac-alert-box.scss +13 -5
- package/components/_ac-card.scss +44 -8
- 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 +14 -4
- package/components/_ac-table.scss +5 -3
- package/components/_ac-tabs.scss +39 -3
- package/components/_ac-terminal.scss +270 -0
- package/components/_app-drawer.scss +2 -2
- package/components/_breadcumb.scss +2 -0
- package/components/_buttons.scss +39 -7
- 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 +108 -7
- 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 +15 -3
- package/components/ac-toaster/_ac-toasted.scss +1 -1
- package/components/bbum/_card-team.scss +15 -7
- package/components/bbum/_information-center.scss +15 -1
- package/components/bbum/_mobile-desktop.scss +1 -1
- package/components/bbum/_sign-up-notification.scss +3 -3
- package/components/bbum/_single-post-preview.scss +1 -1
- package/components/bbum/_user-profile.scss +97 -90
- package/components/ui-builder/_ui-builder.scss +19 -2
- package/components/ui-builder/_vue-open-api.scss +104 -0
- package/main.scss +4 -0
- package/package.json +2 -7
- package/plugins/theme.js +4 -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/PaymentCards.vue +11 -2
- package/vue-components/v2/content/ContentTable.vue +12 -7
- package/vue-components/v2/editor/Editor.vue +36 -5
- package/vue-components/v2/editor/FilteredFileEditor.vue +188 -0
- package/vue-components/v2/editor/MonacoEditor.vue +125 -0
- package/vue-components/v2/editor/ResourceKeyValueEditor.vue +209 -0
- 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 +38 -13
- package/vue-components/v2/modals/DeleteConfirmationModal.vue +77 -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 +120 -0
- package/vue-components/v2/navbar/User.vue +202 -19
- 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/table/Table.vue +44 -8
- package/vue-components/v2/table/TableRow.vue +17 -8
- package/vue-components/v2/table/table-cell/CellValue.vue +31 -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 +166 -0
- package/vue-components/v3/editor/MonacoEditor.vue +131 -0
- package/vue-components/v3/editor/ResourceKeyValueEditor.vue +124 -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/modal/Modal.vue +39 -16
- package/vue-components/v3/modals/DeleteConfirmationModal.vue +83 -0
- package/vue-components/v3/modals/JsonShowModal.vue +25 -16
- package/vue-components/v3/navbar/Appdrawer.vue +12 -7
- package/vue-components/v3/navbar/ThemeMode.vue +123 -0
- package/vue-components/v3/navbar/User.vue +176 -16
- 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 +34 -11
- package/vue-components/v3/table/TableContainer.vue +34 -0
- package/vue-components/v3/table/TableRow.vue +1 -1
- 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
|
@@ -23,12 +23,41 @@
|
|
|
23
23
|
:key="idx"
|
|
24
24
|
:class="{
|
|
25
25
|
sorting: headerSortables[idx] && headerSortables[idx].enabled,
|
|
26
|
-
'sorting-desc':
|
|
27
|
-
|
|
26
|
+
'sorting-desc':
|
|
27
|
+
headerSortables[idx] && headerSortables[idx].mode === 'desc',
|
|
28
|
+
'sorting-asc':
|
|
29
|
+
headerSortables[idx] && headerSortables[idx].mode === 'asc',
|
|
30
|
+
'has-text-centered':
|
|
31
|
+
typeof tableHeader === 'string'
|
|
32
|
+
? false
|
|
33
|
+
: tableHeader.textAlign === 'center',
|
|
34
|
+
'has-text-left':
|
|
35
|
+
typeof tableHeader === 'string'
|
|
36
|
+
? false
|
|
37
|
+
: tableHeader.textAlign === 'left',
|
|
38
|
+
'has-text-right':
|
|
39
|
+
typeof tableHeader === 'string'
|
|
40
|
+
? false
|
|
41
|
+
: tableHeader.textAlign === 'right',
|
|
28
42
|
}"
|
|
29
|
-
@click.prevent="
|
|
43
|
+
@click.prevent="
|
|
44
|
+
headerSortables[idx] &&
|
|
45
|
+
headerSortables[idx].enabled &&
|
|
46
|
+
emitSortEvent(idx)
|
|
47
|
+
"
|
|
30
48
|
>
|
|
31
49
|
{{ headerLabels[idx] }}
|
|
50
|
+
<span
|
|
51
|
+
v-if="
|
|
52
|
+
tableHeader.dashboard &&
|
|
53
|
+
tableHeader.dashboard.status &&
|
|
54
|
+
tableHeader.dashboard.status !== 'Success'
|
|
55
|
+
"
|
|
56
|
+
class="icon has-text-danger"
|
|
57
|
+
:title="tableHeader.dashboard && tableHeader.dashboard.message"
|
|
58
|
+
>
|
|
59
|
+
<i class="fa fa-exclamation-triangle" />
|
|
60
|
+
</span>
|
|
32
61
|
</th>
|
|
33
62
|
<th
|
|
34
63
|
ref="action-section"
|
|
@@ -146,7 +175,7 @@ export default {
|
|
|
146
175
|
},
|
|
147
176
|
headerLabels() {
|
|
148
177
|
return this.tableHeaders.map((th) =>
|
|
149
|
-
typeof th === "string" ? th : th.
|
|
178
|
+
typeof th === "string" ? th : th.name || "Label"
|
|
150
179
|
);
|
|
151
180
|
},
|
|
152
181
|
},
|
|
@@ -157,8 +186,15 @@ export default {
|
|
|
157
186
|
handler(n) {
|
|
158
187
|
if (this.headerSortables.length === n.length) {
|
|
159
188
|
n.forEach((th, idx) => {
|
|
160
|
-
if (
|
|
161
|
-
this.headerSortables[idx].enabled
|
|
189
|
+
if (
|
|
190
|
+
this.headerSortables[idx].enabled !==
|
|
191
|
+
!!(th && th.sort && th.sort.enable)
|
|
192
|
+
) {
|
|
193
|
+
this.headerSortables[idx].enabled = !!(
|
|
194
|
+
th &&
|
|
195
|
+
th.sort &&
|
|
196
|
+
th.sort.enable
|
|
197
|
+
);
|
|
162
198
|
this.headerSortables[idx].mode = "";
|
|
163
199
|
}
|
|
164
200
|
});
|
|
@@ -171,7 +207,7 @@ export default {
|
|
|
171
207
|
};
|
|
172
208
|
} else {
|
|
173
209
|
return {
|
|
174
|
-
enabled: !!th.
|
|
210
|
+
enabled: !!(th && th.sort && th.sort.enable),
|
|
175
211
|
mode: "",
|
|
176
212
|
};
|
|
177
213
|
}
|
|
@@ -198,7 +234,7 @@ export default {
|
|
|
198
234
|
emitSortEvent(index) {
|
|
199
235
|
const emitValue = {
|
|
200
236
|
index,
|
|
201
|
-
label: this.tableHeaders[index].
|
|
237
|
+
label: this.tableHeaders[index].name,
|
|
202
238
|
mode: "",
|
|
203
239
|
};
|
|
204
240
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
custom
|
|
7
7
|
v-slot="{ navigate }"
|
|
8
8
|
>
|
|
9
|
-
<tr @click="navigate">
|
|
9
|
+
<tr class="is-link" @click="navigate">
|
|
10
10
|
<slot />
|
|
11
11
|
<fake-table-cell
|
|
12
12
|
v-if="fakeCellWidth > 0"
|
|
@@ -14,9 +14,14 @@
|
|
|
14
14
|
/>
|
|
15
15
|
</tr>
|
|
16
16
|
</router-link>
|
|
17
|
+
|
|
17
18
|
<tr
|
|
18
19
|
v-else
|
|
19
|
-
:class="{
|
|
20
|
+
:class="{
|
|
21
|
+
'is-selected': isSelected,
|
|
22
|
+
'is-hoverless': !isSelected,
|
|
23
|
+
'is-disabled': isDisabled
|
|
24
|
+
}"
|
|
20
25
|
@click.prevent="$emit('rowselect', true)"
|
|
21
26
|
>
|
|
22
27
|
<slot />
|
|
@@ -32,21 +37,25 @@ export default {
|
|
|
32
37
|
props: {
|
|
33
38
|
link: {
|
|
34
39
|
type: String,
|
|
35
|
-
default: ""
|
|
40
|
+
default: ""
|
|
36
41
|
},
|
|
37
42
|
isSelected: {
|
|
38
43
|
type: Boolean,
|
|
39
|
-
default: false
|
|
44
|
+
default: false
|
|
45
|
+
},
|
|
46
|
+
isDisabled: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false
|
|
40
49
|
},
|
|
41
50
|
fakeCellWidth: {
|
|
42
51
|
type: Number,
|
|
43
|
-
default: 0
|
|
44
|
-
}
|
|
52
|
+
default: 0
|
|
53
|
+
}
|
|
45
54
|
},
|
|
46
55
|
|
|
47
56
|
components: {
|
|
48
57
|
TableCell: () => import("./TableCell.vue"),
|
|
49
|
-
FakeTableCell: () => import("./FakeTableCell.vue")
|
|
50
|
-
}
|
|
58
|
+
FakeTableCell: () => import("./FakeTableCell.vue")
|
|
59
|
+
}
|
|
51
60
|
};
|
|
52
61
|
</script>
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div v-if="isLoaderActive" ref="cellLoaderDiv" :style="{ maxWidth: '300px' }">
|
|
3
|
-
<content-loader
|
|
3
|
+
<content-loader
|
|
4
|
+
:height="10"
|
|
5
|
+
:width="computedCellWidth || 300"
|
|
6
|
+
:primaryColor="primaryColor"
|
|
7
|
+
:secondaryColor="secondaryColor"
|
|
8
|
+
/>
|
|
4
9
|
</div>
|
|
5
|
-
<div v-else
|
|
10
|
+
<div v-else ref="cellDiv">
|
|
6
11
|
<object-cell
|
|
7
12
|
v-if="valueType === 'object'"
|
|
8
13
|
:obj="value"
|
|
@@ -16,7 +21,7 @@
|
|
|
16
21
|
:max-character-length="maxCharacterLength"
|
|
17
22
|
/>
|
|
18
23
|
<template v-else>
|
|
19
|
-
<span class="is-ellipsis-1" :title="
|
|
24
|
+
<span class="is-ellipsis-1" :title="tooltip">{{
|
|
20
25
|
value || (value === 0 ? 0 : "-")
|
|
21
26
|
}}</span>
|
|
22
27
|
</template>
|
|
@@ -24,6 +29,13 @@
|
|
|
24
29
|
</template>
|
|
25
30
|
|
|
26
31
|
<script>
|
|
32
|
+
import {
|
|
33
|
+
loaderLightThemePrimaryColor,
|
|
34
|
+
loaderDarkThemePrimaryColor,
|
|
35
|
+
loaderLightThemeSecondaryColor,
|
|
36
|
+
loaderDarkThemeSecondaryColor,
|
|
37
|
+
} from "@appscode/design-system/plugins/theme";
|
|
38
|
+
|
|
27
39
|
export default {
|
|
28
40
|
props: {
|
|
29
41
|
isLoaderActive: {
|
|
@@ -38,6 +50,10 @@ export default {
|
|
|
38
50
|
type: null,
|
|
39
51
|
default: "",
|
|
40
52
|
},
|
|
53
|
+
tooltip: {
|
|
54
|
+
type: String,
|
|
55
|
+
defualt: "",
|
|
56
|
+
},
|
|
41
57
|
},
|
|
42
58
|
components: {
|
|
43
59
|
ContentLoader: () =>
|
|
@@ -49,13 +65,24 @@ export default {
|
|
|
49
65
|
computed: {
|
|
50
66
|
valueType() {
|
|
51
67
|
if (typeof this.value === "object") {
|
|
52
|
-
if (
|
|
68
|
+
if (this.value === null) return "null";
|
|
69
|
+
else if (Array.isArray(this.value)) return "array";
|
|
53
70
|
else return "object";
|
|
54
71
|
} else return typeof this.value;
|
|
55
72
|
},
|
|
56
73
|
maxCharacterLength() {
|
|
57
74
|
return Math.ceil(this.computedCellWidth / 8);
|
|
58
75
|
},
|
|
76
|
+
primaryColor() {
|
|
77
|
+
return document.documentElement.classList.contains("is-dark-theme")
|
|
78
|
+
? loaderDarkThemePrimaryColor
|
|
79
|
+
: loaderLightThemePrimaryColor;
|
|
80
|
+
},
|
|
81
|
+
secondaryColor() {
|
|
82
|
+
return document.documentElement.classList.contains("is-dark-theme")
|
|
83
|
+
? loaderDarkThemeSecondaryColor
|
|
84
|
+
: loaderLightThemeSecondaryColor;
|
|
85
|
+
},
|
|
59
86
|
},
|
|
60
87
|
|
|
61
88
|
data() {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span
|
|
3
|
+
:class="{
|
|
4
|
+
'is-flex': cellDescriptor.type !== 'object',
|
|
5
|
+
'is-align-items-center': cellValue.icon,
|
|
6
|
+
'is-justify-content-center': cellDescriptor.textAlign === 'center',
|
|
7
|
+
'is-justify-content-left': cellDescriptor.textAlign === 'left',
|
|
8
|
+
'is-justify-content-right': cellDescriptor.textAlign === 'right'
|
|
9
|
+
}"
|
|
10
|
+
>
|
|
11
|
+
<span v-if="cellValue.icon" class="icon p-0 mr-10">
|
|
12
|
+
<img width="15" :src="cellValue.icon" />
|
|
13
|
+
</span>
|
|
14
|
+
<router-link v-if="cellValue.link" :to="getCellLink(cellValue)">
|
|
15
|
+
{{ cellValue.data }}
|
|
16
|
+
</router-link>
|
|
17
|
+
<tag v-else-if="cellValue.color" :class="`is-${cellValue.color}`">
|
|
18
|
+
{{ cellValue.data }}
|
|
19
|
+
</tag>
|
|
20
|
+
<cell-value
|
|
21
|
+
v-else
|
|
22
|
+
:cell-title="cellDescriptor.name"
|
|
23
|
+
:value="cellValue.data || '-'"
|
|
24
|
+
:tooltip="cellValue.tooltip || JSON.stringify(cellValue.data)"
|
|
25
|
+
/>
|
|
26
|
+
</span>
|
|
27
|
+
</template>
|
|
28
|
+
<script>
|
|
29
|
+
export default {
|
|
30
|
+
components: {
|
|
31
|
+
Tag: () => import("../../tag/Tag.vue"),
|
|
32
|
+
CellValue: () => import("../table-cell/CellValue.vue")
|
|
33
|
+
},
|
|
34
|
+
props: {
|
|
35
|
+
cellDescriptor: {
|
|
36
|
+
type: Object,
|
|
37
|
+
default: () => ({})
|
|
38
|
+
},
|
|
39
|
+
cellValue: {
|
|
40
|
+
type: Object,
|
|
41
|
+
default: () => ({})
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
methods: {
|
|
45
|
+
getCellLink(cell) {
|
|
46
|
+
const inject = (str, obj) => str.replace(/\${(.*?)}/g, (x, g) => obj[g]);
|
|
47
|
+
const { user, cluster } = this.$route.params;
|
|
48
|
+
const link = inject(cell.link || "", {
|
|
49
|
+
username: user,
|
|
50
|
+
clustername: cluster
|
|
51
|
+
});
|
|
52
|
+
return link;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
</script>
|
|
@@ -68,7 +68,10 @@ export default {
|
|
|
68
68
|
},
|
|
69
69
|
printableStringObjs() {
|
|
70
70
|
return this.objKeys.map((key) => {
|
|
71
|
-
|
|
71
|
+
let value = this.obj[key];
|
|
72
|
+
if (typeof value === "object" && value !== null) {
|
|
73
|
+
value = JSON.stringify(value);
|
|
74
|
+
}
|
|
72
75
|
const keyValue = `${key}: ${value}`;
|
|
73
76
|
const exceededLength = keyValue.length > 30;
|
|
74
77
|
const print = exceededLength ? key : keyValue;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
:class="`${modifierClasses}${isLoaderActive ? ' is-loading' : ''}`"
|
|
5
5
|
:disabled="disabled ? true : null"
|
|
6
6
|
@click="handleClick"
|
|
7
|
+
:title="tooltip"
|
|
7
8
|
>
|
|
8
9
|
<span v-if="iconClass || iconImage" class="icon is-small">
|
|
9
10
|
<img
|
|
@@ -28,6 +29,10 @@ export default defineComponent({
|
|
|
28
29
|
type: String,
|
|
29
30
|
default: "",
|
|
30
31
|
},
|
|
32
|
+
tooltip: {
|
|
33
|
+
type: String,
|
|
34
|
+
defualt: undefined
|
|
35
|
+
},
|
|
31
36
|
// for loader
|
|
32
37
|
isLoaderActive: {
|
|
33
38
|
type: Boolean,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<content-layout>
|
|
3
3
|
<template #content-header>
|
|
4
4
|
<content-header
|
|
5
|
+
v-if="!hideHeader"
|
|
5
6
|
:header-title="tableTitle"
|
|
6
7
|
:header-sub-title="tableSubTitle"
|
|
7
8
|
:class="{ 'pl-0 pr-0': removeTableHeaderPadding }"
|
|
@@ -38,6 +39,10 @@ export default defineComponent({
|
|
|
38
39
|
type: Boolean,
|
|
39
40
|
default: true,
|
|
40
41
|
},
|
|
42
|
+
hideHeader: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false
|
|
45
|
+
}
|
|
41
46
|
},
|
|
42
47
|
components: {
|
|
43
48
|
ContentLayout: defineAsyncComponent(() =>
|
|
@@ -7,7 +7,6 @@
|
|
|
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`"
|
|
@@ -16,10 +15,12 @@
|
|
|
16
15
|
:language="language"
|
|
17
16
|
:options="{
|
|
18
17
|
minimap: {
|
|
19
|
-
enabled: calcShowMinimap
|
|
18
|
+
enabled: calcShowMinimap
|
|
20
19
|
},
|
|
20
|
+
theme: theme,
|
|
21
21
|
readOnly: readOnly,
|
|
22
|
-
|
|
22
|
+
wordWrap: wordWrap,
|
|
23
|
+
scrollBeyondLastLine: false
|
|
23
24
|
}"
|
|
24
25
|
/>
|
|
25
26
|
<monaco-editor
|
|
@@ -30,10 +31,12 @@
|
|
|
30
31
|
:language="language"
|
|
31
32
|
:options="{
|
|
32
33
|
minimap: {
|
|
33
|
-
enabled: calcShowMinimap
|
|
34
|
+
enabled: calcShowMinimap
|
|
34
35
|
},
|
|
36
|
+
theme: theme,
|
|
35
37
|
readOnly: true,
|
|
36
|
-
|
|
38
|
+
wordWrap: wordWrap,
|
|
39
|
+
scrollBeyondLastLine: false
|
|
37
40
|
}"
|
|
38
41
|
:original="originalEditorContent"
|
|
39
42
|
:diff-editor="true"
|
|
@@ -43,55 +46,65 @@
|
|
|
43
46
|
|
|
44
47
|
<script>
|
|
45
48
|
import { defineComponent, defineAsyncComponent, h } from "vue";
|
|
49
|
+
import Preloader from "../../v2/preloader/Preloader.vue";
|
|
50
|
+
import Banner from "../../v2/banner/Banner.vue";
|
|
46
51
|
export default defineComponent({
|
|
47
52
|
props: {
|
|
48
|
-
|
|
53
|
+
modelValue: {
|
|
49
54
|
type: String,
|
|
50
|
-
default: ""
|
|
55
|
+
default: ""
|
|
51
56
|
},
|
|
52
57
|
originalValue: {
|
|
53
58
|
type: String,
|
|
54
|
-
default: ""
|
|
59
|
+
default: ""
|
|
55
60
|
},
|
|
56
61
|
readOnly: {
|
|
57
62
|
type: Boolean,
|
|
58
|
-
default: false
|
|
63
|
+
default: false
|
|
59
64
|
},
|
|
60
65
|
language: {
|
|
61
66
|
type: String,
|
|
62
|
-
default: "yaml"
|
|
67
|
+
default: "yaml"
|
|
63
68
|
},
|
|
64
69
|
showMinimap: {
|
|
65
70
|
type: Boolean,
|
|
66
|
-
default: true
|
|
71
|
+
default: true
|
|
67
72
|
},
|
|
68
73
|
editorHeight: {
|
|
69
74
|
type: Number,
|
|
70
|
-
default: 40
|
|
75
|
+
default: 40
|
|
71
76
|
},
|
|
77
|
+
editorTheme: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: ""
|
|
80
|
+
},
|
|
81
|
+
wordWrap: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: "off"
|
|
84
|
+
}
|
|
72
85
|
},
|
|
73
86
|
|
|
74
87
|
emits: ["update:modelValue"],
|
|
75
88
|
|
|
76
89
|
components: {
|
|
77
90
|
EditorTabs: defineAsyncComponent(() =>
|
|
78
|
-
import("../tabs/EditorTabs.vue").then(
|
|
79
|
-
),
|
|
80
|
-
MonacoEditor: defineAsyncComponent(() =>
|
|
81
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
82
|
-
// @ts-ignore
|
|
83
|
-
import("vue-monaco").then((module) => {
|
|
84
|
-
module.default.render = () => h("div");
|
|
85
|
-
return module.default;
|
|
86
|
-
})
|
|
91
|
+
import("../tabs/EditorTabs.vue").then(module => module.default)
|
|
87
92
|
),
|
|
93
|
+
MonacoEditor: defineAsyncComponent({
|
|
94
|
+
loader: () => import("./MonacoEditor.vue").then(module => module.default),
|
|
95
|
+
|
|
96
|
+
loadingComponent: Preloader,
|
|
97
|
+
delay: 200,
|
|
98
|
+
errorComponent: Banner,
|
|
99
|
+
timeout: 100000
|
|
100
|
+
})
|
|
88
101
|
},
|
|
89
102
|
|
|
90
103
|
data() {
|
|
91
104
|
return {
|
|
92
105
|
activeTab: "edit",
|
|
93
106
|
editorContent: "",
|
|
94
|
-
originalEditorContent: ""
|
|
107
|
+
originalEditorContent: ""
|
|
95
108
|
};
|
|
96
109
|
},
|
|
97
110
|
|
|
@@ -100,16 +113,24 @@ export default defineComponent({
|
|
|
100
113
|
const noOfLines = this.editorContent.split("\n").length;
|
|
101
114
|
return this.showMinimap && noOfLines * 2 > this.editorHeight;
|
|
102
115
|
},
|
|
116
|
+
theme() {
|
|
117
|
+
return (
|
|
118
|
+
this.editorTheme ||
|
|
119
|
+
(document.documentElement.classList.contains("is-dark-theme")
|
|
120
|
+
? "vs-dark"
|
|
121
|
+
: "vs")
|
|
122
|
+
);
|
|
123
|
+
}
|
|
103
124
|
},
|
|
104
125
|
|
|
105
126
|
watch: {
|
|
106
|
-
|
|
127
|
+
modelValue: {
|
|
107
128
|
immediate: true,
|
|
108
129
|
handler(n) {
|
|
109
130
|
if (this.editorContent !== n) {
|
|
110
131
|
this.editorContent = n;
|
|
111
132
|
}
|
|
112
|
-
}
|
|
133
|
+
}
|
|
113
134
|
},
|
|
114
135
|
originalValue: {
|
|
115
136
|
immediate: true,
|
|
@@ -117,21 +138,20 @@ export default defineComponent({
|
|
|
117
138
|
if (this.originalEditorContent !== n) {
|
|
118
139
|
this.originalEditorContent = n;
|
|
119
140
|
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
122
143
|
},
|
|
123
144
|
|
|
124
145
|
methods: {
|
|
125
146
|
onChange(e) {
|
|
126
147
|
if (typeof e === "string") this.editorContent = e;
|
|
127
148
|
},
|
|
128
|
-
onEditorMount() {
|
|
129
|
-
const editor = this.$refs.monacoEditor.getEditor();
|
|
149
|
+
onEditorMount(editor) {
|
|
130
150
|
// add event listeners
|
|
131
151
|
editor.onDidBlurEditorText(() => {
|
|
132
152
|
this.$emit("update:modelValue", this.editorContent);
|
|
133
153
|
});
|
|
134
|
-
}
|
|
135
|
-
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
136
156
|
});
|
|
137
157
|
</script>
|
|
@@ -0,0 +1,166 @@
|
|
|
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-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
|
+
>
|
|
17
|
+
<a @click.prevent="setActivePreview(previewYaml.uid)">
|
|
18
|
+
<span>
|
|
19
|
+
<img
|
|
20
|
+
src="~@appscode/design-system-images/icons/file-icon.svg"
|
|
21
|
+
alt=""
|
|
22
|
+
/>
|
|
23
|
+
</span>
|
|
24
|
+
<span>{{ previewYaml.name }}</span>
|
|
25
|
+
</a>
|
|
26
|
+
</li>
|
|
27
|
+
</ul>
|
|
28
|
+
<sidebar-loader v-else />
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
<div class="right-content">
|
|
32
|
+
<div class="right-content">
|
|
33
|
+
<resource-loader v-if="isPreviewLoading" />
|
|
34
|
+
<editor
|
|
35
|
+
v-else-if="!isPreviewLoading && !hideValue"
|
|
36
|
+
v-model="activeFile.content"
|
|
37
|
+
:original-value="originalValue"
|
|
38
|
+
:language="activeFile.format"
|
|
39
|
+
:read-only="isEditorReadOnly"
|
|
40
|
+
:editor-height="editorHeight"
|
|
41
|
+
:show-minimap="showMinimap"
|
|
42
|
+
/>
|
|
43
|
+
<span v-else> *************** </span>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</template>
|
|
50
|
+
<script>
|
|
51
|
+
import { defineComponent, defineAsyncComponent } from "vue";
|
|
52
|
+
import Preloader from "../../v2/preloader/Preloader.vue";
|
|
53
|
+
import Banner from "../../v2/banner/Banner.vue";
|
|
54
|
+
export default defineComponent({
|
|
55
|
+
components: {
|
|
56
|
+
Editor: defineAsyncComponent({
|
|
57
|
+
loader: () =>
|
|
58
|
+
import("../editor/Editor.vue").then(module => module.default),
|
|
59
|
+
loadingComponent: Preloader,
|
|
60
|
+
delay: 200,
|
|
61
|
+
errorComponent: Banner,
|
|
62
|
+
timeout: 100000
|
|
63
|
+
}),
|
|
64
|
+
ResourceLoader: defineAsyncComponent(() =>
|
|
65
|
+
import("../loaders/ResourceLoader.vue")
|
|
66
|
+
),
|
|
67
|
+
SidebarLoader: defineAsyncComponent(() =>
|
|
68
|
+
import("../loaders/SidebarLoader.vue")
|
|
69
|
+
)
|
|
70
|
+
},
|
|
71
|
+
props: {
|
|
72
|
+
searchText: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: ""
|
|
75
|
+
},
|
|
76
|
+
toggleHideValue: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
default: true
|
|
79
|
+
},
|
|
80
|
+
isPreviewLoading: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
default: false
|
|
83
|
+
},
|
|
84
|
+
isEditorReadOnly: {
|
|
85
|
+
type: Boolean,
|
|
86
|
+
default: false
|
|
87
|
+
},
|
|
88
|
+
previewYamls: {
|
|
89
|
+
type: Array,
|
|
90
|
+
default: () => {
|
|
91
|
+
[];
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
showMinimap: {
|
|
95
|
+
type: Boolean,
|
|
96
|
+
default: false
|
|
97
|
+
},
|
|
98
|
+
editorHeight: {
|
|
99
|
+
type: Number,
|
|
100
|
+
default: 60
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
emits: ["setActiveKey"],
|
|
104
|
+
data() {
|
|
105
|
+
return {
|
|
106
|
+
activeKey: "",
|
|
107
|
+
hideValue: ""
|
|
108
|
+
};
|
|
109
|
+
},
|
|
110
|
+
computed: {
|
|
111
|
+
activeFile() {
|
|
112
|
+
const activeFile = this.filteredYamls.find(
|
|
113
|
+
element => element.uid === this.activeKey
|
|
114
|
+
);
|
|
115
|
+
return activeFile || { content: "", format: "yaml" };
|
|
116
|
+
},
|
|
117
|
+
originalValue() {
|
|
118
|
+
const activeFile = this.filteredYamls.find(
|
|
119
|
+
element => element.uid === this.activeKey
|
|
120
|
+
);
|
|
121
|
+
return (activeFile && activeFile.initContent) || "";
|
|
122
|
+
},
|
|
123
|
+
filteredYamls() {
|
|
124
|
+
if (this.searchText) {
|
|
125
|
+
return this.previewYamls.filter(
|
|
126
|
+
element => JSON.stringify(element).search(this.searchText) > -1
|
|
127
|
+
);
|
|
128
|
+
} else return this.previewYamls;
|
|
129
|
+
},
|
|
130
|
+
isKeyAvailable() {
|
|
131
|
+
const val = this.previewYamls.find(element => {
|
|
132
|
+
return element.uid === this.activeKey;
|
|
133
|
+
});
|
|
134
|
+
return val === undefined ? false : true;
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
methods: {
|
|
138
|
+
initActivePreview() {
|
|
139
|
+
if (!this.isKeyAvailable) {
|
|
140
|
+
this.activeKey = this.previewYamls[0].uid;
|
|
141
|
+
this.hideValue = this.activeFile.isSecret;
|
|
142
|
+
this.$emit("setActiveKey", this.activeKey);
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
setActivePreview(uid) {
|
|
146
|
+
this.activeKey = uid;
|
|
147
|
+
this.hideValue = this.activeFile.isSecret;
|
|
148
|
+
this.$emit("setActiveKey", this.activeKey);
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
watch: {
|
|
152
|
+
previewYamls: {
|
|
153
|
+
deep: true,
|
|
154
|
+
immediate: true,
|
|
155
|
+
handler(n) {
|
|
156
|
+
if (n.length) {
|
|
157
|
+
this.initActivePreview();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
toggleHideValue(n) {
|
|
162
|
+
this.hideValue = n;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
</script>
|