@appscode/design-system 1.0.43-alpha.99 → 1.1.0-alpha.1
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 +7 -0
- package/base/utilities/_customize-bulma.scss +191 -0
- package/base/utilities/_default.scss +58 -124
- package/base/utilities/_derived-variables.scss +6 -0
- package/base/utilities/_grid.scss +29 -0
- package/base/utilities/_initial-variables.scss +13 -9
- package/base/utilities/_typography.scss +6 -12
- package/base/utilities/dark-theme.scss +1 -0
- package/components/_ac-accordion.scss +14 -5
- package/components/_ac-alert-box.scss +32 -6
- package/components/_ac-card.scss +17 -5
- package/components/_ac-drag.scss +2 -0
- package/components/_ac-input.scss +19 -11
- package/components/_ac-modal.scss +1 -1
- package/components/_ac-multi-select.scss +60 -4
- package/components/_ac-report.scss +53 -0
- package/components/_ac-table.scss +60 -2
- package/components/_ac-tabs.scss +16 -2
- package/components/_ac-tags.scss +85 -0
- package/components/_ac-terminal.scss +1 -3
- package/components/_all.scss +28 -0
- package/components/_buttons.scss +14 -33
- package/components/_dashboard-header.scss +32 -0
- package/components/_left-sidebar-menu.scss +9 -9
- package/components/_navbar.scss +89 -4
- package/components/_preview-modal.scss +14 -1
- package/components/_transitions.scss +261 -0
- package/components/_wizard.scss +1 -0
- package/components/bbum/_all.scss +9 -0
- package/components/bbum/_single-post-preview.scss +1 -1
- package/components/ui-builder/_ui-builder.scss +58 -0
- package/components/ui-builder/_vue-open-api.scss +6 -0
- package/layouts/_all.scss +2 -0
- package/layouts/_code-preview.scss +5 -2
- package/main.scss +5 -56
- package/package.json +4 -2
- package/plugins/caching.ts +243 -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/content/ContentTable.vue +12 -7
- package/vue-components/v2/editor/Editor.vue +37 -24
- 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 +30 -5
- package/vue-components/v2/modals/DeleteConfirmationModal.vue +79 -0
- package/vue-components/v2/modals/JsonShowModal.vue +12 -2
- package/vue-components/v2/navbar/User.vue +229 -17
- package/vue-components/v2/notification/Notification.vue +101 -0
- package/vue-components/v2/notification/NotificationItem.vue +44 -0
- package/vue-components/v2/pagination/Pagination.vue +16 -3
- package/vue-components/v2/preloader/Preloader.vue +1 -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 +49 -8
- package/vue-components/v2/table/TableRow.vue +12 -2
- package/vue-components/v2/table/table-cell/CellValue.vue +29 -9
- 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/v3/button/Button.vue +6 -1
- package/vue-components/v3/content/ContentHeader.vue +2 -1
- package/vue-components/v3/content/ContentTable.vue +20 -2
- package/vue-components/v3/editor/Editor.vue +36 -33
- package/vue-components/v3/editor/FilteredFileEditor.vue +186 -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 +11 -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 +30 -7
- package/vue-components/v3/modals/DeleteConfirmationModal.vue +85 -0
- package/vue-components/v3/modals/JsonShowModal.vue +25 -16
- package/vue-components/v3/modals/LongRunningTasksModal.vue +400 -0
- package/vue-components/v3/navbar/ThemeMode.vue +41 -49
- package/vue-components/v3/navbar/User.vue +242 -18
- package/vue-components/v3/notification/AlertBox.vue +61 -0
- package/vue-components/v3/notification/Notification.vue +98 -0
- package/vue-components/v3/notification/NotificationItem.vue +52 -0
- package/vue-components/v3/pagination/Pagination.vue +16 -3
- package/vue-components/v3/sidebar/SidebarItemWithDropDown.vue +120 -0
- package/vue-components/v3/tab/TabItem.vue +1 -1
- package/vue-components/v3/table/MultiInfoTable.vue +143 -0
- package/vue-components/v3/table/Table.vue +52 -13
- package/vue-components/v3/table/TableContainer.vue +34 -0
- package/vue-components/v3/table/TableRow.vue +93 -6
- package/vue-components/v3/table/table-cell/CellValue.vue +23 -7
- package/vue-components/v3/table/table-cell/GenericCell.vue +75 -0
- package/vue-components/v3/table/table-cell/ObjectCell.vue +7 -2
- package/vue-components/v3/terminal/LongRunningTaskTerminal.vue +148 -0
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
custom
|
|
7
7
|
v-slot="{ navigate }"
|
|
8
8
|
>
|
|
9
|
-
<tr class="is-link" @click="navigate">
|
|
9
|
+
<tr class="is-link" @click="navigate" data-testid="ac-table-row">
|
|
10
10
|
<slot />
|
|
11
11
|
<fake-table-cell
|
|
12
12
|
v-if="fakeCellWidth > 0"
|
|
@@ -14,9 +14,15 @@
|
|
|
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
|
+
}"
|
|
25
|
+
data-testid="ac-table-row"
|
|
20
26
|
@click.prevent="$emit('rowselect', true)"
|
|
21
27
|
>
|
|
22
28
|
<slot />
|
|
@@ -38,6 +44,10 @@ export default {
|
|
|
38
44
|
type: Boolean,
|
|
39
45
|
default: false,
|
|
40
46
|
},
|
|
47
|
+
isDisabled: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false,
|
|
50
|
+
},
|
|
41
51
|
fakeCellWidth: {
|
|
42
52
|
type: Number,
|
|
43
53
|
default: 0,
|
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div v-if="isLoaderActive" ref="cellLoaderDiv" :style="{ maxWidth: '300px' }">
|
|
3
|
-
<content-loader
|
|
4
|
-
|
|
3
|
+
<content-loader
|
|
4
|
+
:height="10"
|
|
5
|
+
:width="computedCellWidth || 300"
|
|
6
|
+
:primaryColor="primaryColor"
|
|
7
|
+
:secondaryColor="secondaryColor"
|
|
8
|
+
/>
|
|
5
9
|
</div>
|
|
6
|
-
<div v-else
|
|
10
|
+
<div v-else ref="cellDiv">
|
|
7
11
|
<object-cell
|
|
8
12
|
v-if="valueType === 'object'"
|
|
9
13
|
:obj="value"
|
|
10
14
|
:cell-title="cellTitle"
|
|
11
15
|
:max-character-length="maxCharacterLength"
|
|
16
|
+
data-testid="object-cell-value"
|
|
12
17
|
/>
|
|
13
18
|
<array-cell
|
|
14
19
|
v-else-if="valueType === 'array'"
|
|
15
20
|
:items="value"
|
|
16
21
|
:cell-title="cellTitle"
|
|
17
22
|
:max-character-length="maxCharacterLength"
|
|
23
|
+
data-testid="array-cell-value"
|
|
18
24
|
/>
|
|
19
25
|
<template v-else>
|
|
20
|
-
<span class="is-ellipsis-1" :title="value">{{
|
|
26
|
+
<span class="is-ellipsis-1" :title="tooltip" data-testid="cell-value">{{
|
|
21
27
|
value || (value === 0 ? 0 : "-")
|
|
22
28
|
}}</span>
|
|
23
29
|
</template>
|
|
@@ -25,7 +31,12 @@
|
|
|
25
31
|
</template>
|
|
26
32
|
|
|
27
33
|
<script>
|
|
28
|
-
import {
|
|
34
|
+
import {
|
|
35
|
+
loaderLightThemePrimaryColor,
|
|
36
|
+
loaderDarkThemePrimaryColor,
|
|
37
|
+
loaderLightThemeSecondaryColor,
|
|
38
|
+
loaderDarkThemeSecondaryColor,
|
|
39
|
+
} from "@appscode/design-system/plugins/theme";
|
|
29
40
|
|
|
30
41
|
export default {
|
|
31
42
|
props: {
|
|
@@ -41,6 +52,10 @@ export default {
|
|
|
41
52
|
type: null,
|
|
42
53
|
default: "",
|
|
43
54
|
},
|
|
55
|
+
tooltip: {
|
|
56
|
+
type: String,
|
|
57
|
+
defualt: "",
|
|
58
|
+
},
|
|
44
59
|
},
|
|
45
60
|
components: {
|
|
46
61
|
ContentLoader: () =>
|
|
@@ -52,7 +67,8 @@ export default {
|
|
|
52
67
|
computed: {
|
|
53
68
|
valueType() {
|
|
54
69
|
if (typeof this.value === "object") {
|
|
55
|
-
if (
|
|
70
|
+
if (this.value === null) return "null";
|
|
71
|
+
else if (Array.isArray(this.value)) return "array";
|
|
56
72
|
else return "object";
|
|
57
73
|
} else return typeof this.value;
|
|
58
74
|
},
|
|
@@ -60,11 +76,15 @@ export default {
|
|
|
60
76
|
return Math.ceil(this.computedCellWidth / 8);
|
|
61
77
|
},
|
|
62
78
|
primaryColor() {
|
|
63
|
-
return document.documentElement.classList.contains("is-dark-theme")
|
|
79
|
+
return document.documentElement.classList.contains("is-dark-theme")
|
|
80
|
+
? loaderDarkThemePrimaryColor
|
|
81
|
+
: loaderLightThemePrimaryColor;
|
|
64
82
|
},
|
|
65
83
|
secondaryColor() {
|
|
66
|
-
return document.documentElement.classList.contains("is-dark-theme")
|
|
67
|
-
|
|
84
|
+
return document.documentElement.classList.contains("is-dark-theme")
|
|
85
|
+
? loaderDarkThemeSecondaryColor
|
|
86
|
+
: loaderLightThemeSecondaryColor;
|
|
87
|
+
},
|
|
68
88
|
},
|
|
69
89
|
|
|
70
90
|
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,12 +4,13 @@
|
|
|
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
|
|
10
11
|
v-if="iconImage"
|
|
11
12
|
:src="iconImage"
|
|
12
|
-
alt="
|
|
13
|
+
alt="icon"
|
|
13
14
|
:width="iconImageWidth"
|
|
14
15
|
/>
|
|
15
16
|
<i v-else :class="`fa fa-${iconClass}`" aria-hidden="true" />
|
|
@@ -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,
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
<div class="ac-cheader-left">
|
|
5
5
|
<!-- title -->
|
|
6
6
|
<div class="ac-content-title">
|
|
7
|
-
<h6>
|
|
7
|
+
<h6 class="is-flex">
|
|
8
8
|
<slot name="header-icon" />
|
|
9
9
|
{{ headerTitle }}
|
|
10
|
+
<slot name="title-right-actions" />
|
|
10
11
|
</h6>
|
|
11
12
|
<p v-if="headerSubTitle">{{ headerSubTitle }}</p>
|
|
12
13
|
</div>
|
|
@@ -2,18 +2,26 @@
|
|
|
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 }"
|
|
8
9
|
>
|
|
10
|
+
<template #title-right-actions>
|
|
11
|
+
<slot name="title-right-actions" />
|
|
12
|
+
</template>
|
|
9
13
|
<slot name="content-left-controls" />
|
|
10
14
|
<header-item>
|
|
11
|
-
<search-bar v-if="searchable" @search="
|
|
15
|
+
<search-bar v-if="searchable" @search="updateSearchText" />
|
|
12
16
|
</header-item>
|
|
13
17
|
<slot name="content-right-controls" />
|
|
14
18
|
</content-header>
|
|
15
19
|
</template>
|
|
16
|
-
<slot
|
|
20
|
+
<slot
|
|
21
|
+
name="content"
|
|
22
|
+
:search-text="searchText"
|
|
23
|
+
:update-search-text="updateSearchText"
|
|
24
|
+
/>
|
|
17
25
|
</content-layout>
|
|
18
26
|
</template>
|
|
19
27
|
|
|
@@ -38,6 +46,10 @@ export default defineComponent({
|
|
|
38
46
|
type: Boolean,
|
|
39
47
|
default: true,
|
|
40
48
|
},
|
|
49
|
+
hideHeader: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false,
|
|
52
|
+
},
|
|
41
53
|
},
|
|
42
54
|
components: {
|
|
43
55
|
ContentLayout: defineAsyncComponent(() =>
|
|
@@ -61,5 +73,11 @@ export default defineComponent({
|
|
|
61
73
|
searchText: "",
|
|
62
74
|
};
|
|
63
75
|
},
|
|
76
|
+
|
|
77
|
+
methods: {
|
|
78
|
+
updateSearchText(text) {
|
|
79
|
+
this.searchText = text;
|
|
80
|
+
},
|
|
81
|
+
},
|
|
64
82
|
});
|
|
65
83
|
</script>
|
|
@@ -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,13 +15,14 @@
|
|
|
16
15
|
:language="language"
|
|
17
16
|
:options="{
|
|
18
17
|
minimap: {
|
|
19
|
-
enabled: calcShowMinimap
|
|
18
|
+
enabled: calcShowMinimap,
|
|
20
19
|
},
|
|
21
20
|
theme: theme,
|
|
22
21
|
readOnly: readOnly,
|
|
23
22
|
wordWrap: wordWrap,
|
|
24
|
-
scrollBeyondLastLine: false
|
|
23
|
+
scrollBeyondLastLine: false,
|
|
25
24
|
}"
|
|
25
|
+
data-testid="monaco-editor-edit-section"
|
|
26
26
|
/>
|
|
27
27
|
<monaco-editor
|
|
28
28
|
v-if="activeTab === 'preview'"
|
|
@@ -32,54 +32,57 @@
|
|
|
32
32
|
:language="language"
|
|
33
33
|
:options="{
|
|
34
34
|
minimap: {
|
|
35
|
-
enabled: calcShowMinimap
|
|
35
|
+
enabled: calcShowMinimap,
|
|
36
36
|
},
|
|
37
37
|
theme: theme,
|
|
38
38
|
readOnly: true,
|
|
39
39
|
wordWrap: wordWrap,
|
|
40
|
-
scrollBeyondLastLine: false
|
|
40
|
+
scrollBeyondLastLine: false,
|
|
41
41
|
}"
|
|
42
42
|
:original="originalEditorContent"
|
|
43
43
|
:diff-editor="true"
|
|
44
|
+
data-testid="monaco-editor-preview-section"
|
|
44
45
|
/>
|
|
45
46
|
</div>
|
|
46
47
|
</template>
|
|
47
48
|
|
|
48
49
|
<script>
|
|
49
50
|
import { defineComponent, defineAsyncComponent, h } from "vue";
|
|
51
|
+
import Preloader from "../../v2/preloader/Preloader.vue";
|
|
52
|
+
import Banner from "../../v2/banner/Banner.vue";
|
|
50
53
|
export default defineComponent({
|
|
51
54
|
props: {
|
|
52
|
-
|
|
55
|
+
modelValue: {
|
|
53
56
|
type: String,
|
|
54
|
-
default: ""
|
|
57
|
+
default: "",
|
|
55
58
|
},
|
|
56
59
|
originalValue: {
|
|
57
60
|
type: String,
|
|
58
|
-
default: ""
|
|
61
|
+
default: "",
|
|
59
62
|
},
|
|
60
63
|
readOnly: {
|
|
61
64
|
type: Boolean,
|
|
62
|
-
default: false
|
|
65
|
+
default: false,
|
|
63
66
|
},
|
|
64
67
|
language: {
|
|
65
68
|
type: String,
|
|
66
|
-
default: "yaml"
|
|
69
|
+
default: "yaml",
|
|
67
70
|
},
|
|
68
71
|
showMinimap: {
|
|
69
72
|
type: Boolean,
|
|
70
|
-
default: true
|
|
73
|
+
default: true,
|
|
71
74
|
},
|
|
72
75
|
editorHeight: {
|
|
73
76
|
type: Number,
|
|
74
|
-
default: 40
|
|
77
|
+
default: 40,
|
|
75
78
|
},
|
|
76
79
|
editorTheme: {
|
|
77
80
|
type: String,
|
|
78
|
-
default: ""
|
|
81
|
+
default: "",
|
|
79
82
|
},
|
|
80
83
|
wordWrap: {
|
|
81
84
|
type: String,
|
|
82
|
-
default: "off"
|
|
85
|
+
default: "off",
|
|
83
86
|
},
|
|
84
87
|
},
|
|
85
88
|
|
|
@@ -87,23 +90,24 @@ export default defineComponent({
|
|
|
87
90
|
|
|
88
91
|
components: {
|
|
89
92
|
EditorTabs: defineAsyncComponent(() =>
|
|
90
|
-
import("../tabs/EditorTabs.vue").then(module => module.default)
|
|
93
|
+
import("../tabs/EditorTabs.vue").then((module) => module.default)
|
|
91
94
|
),
|
|
92
|
-
MonacoEditor: defineAsyncComponent(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
MonacoEditor: defineAsyncComponent({
|
|
96
|
+
loader: () =>
|
|
97
|
+
import("./MonacoEditor.vue").then((module) => module.default),
|
|
98
|
+
|
|
99
|
+
loadingComponent: Preloader,
|
|
100
|
+
delay: 200,
|
|
101
|
+
errorComponent: Banner,
|
|
102
|
+
timeout: 100000,
|
|
103
|
+
}),
|
|
100
104
|
},
|
|
101
105
|
|
|
102
106
|
data() {
|
|
103
107
|
return {
|
|
104
108
|
activeTab: "edit",
|
|
105
109
|
editorContent: "",
|
|
106
|
-
originalEditorContent: ""
|
|
110
|
+
originalEditorContent: "",
|
|
107
111
|
};
|
|
108
112
|
},
|
|
109
113
|
|
|
@@ -119,17 +123,17 @@ export default defineComponent({
|
|
|
119
123
|
? "vs-dark"
|
|
120
124
|
: "vs")
|
|
121
125
|
);
|
|
122
|
-
}
|
|
126
|
+
},
|
|
123
127
|
},
|
|
124
128
|
|
|
125
129
|
watch: {
|
|
126
|
-
|
|
130
|
+
modelValue: {
|
|
127
131
|
immediate: true,
|
|
128
132
|
handler(n) {
|
|
129
133
|
if (this.editorContent !== n) {
|
|
130
134
|
this.editorContent = n;
|
|
131
135
|
}
|
|
132
|
-
}
|
|
136
|
+
},
|
|
133
137
|
},
|
|
134
138
|
originalValue: {
|
|
135
139
|
immediate: true,
|
|
@@ -137,21 +141,20 @@ export default defineComponent({
|
|
|
137
141
|
if (this.originalEditorContent !== n) {
|
|
138
142
|
this.originalEditorContent = n;
|
|
139
143
|
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
144
|
+
},
|
|
145
|
+
},
|
|
142
146
|
},
|
|
143
147
|
|
|
144
148
|
methods: {
|
|
145
149
|
onChange(e) {
|
|
146
150
|
if (typeof e === "string") this.editorContent = e;
|
|
147
151
|
},
|
|
148
|
-
onEditorMount() {
|
|
149
|
-
const editor = this.$refs.monacoEditor.getEditor();
|
|
152
|
+
onEditorMount(editor) {
|
|
150
153
|
// add event listeners
|
|
151
154
|
editor.onDidBlurEditorText(() => {
|
|
152
155
|
this.$emit("update:modelValue", this.editorContent);
|
|
153
156
|
});
|
|
154
|
-
}
|
|
155
|
-
}
|
|
157
|
+
},
|
|
158
|
+
},
|
|
156
159
|
});
|
|
157
160
|
</script>
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ac-preview is-active is-not-fixed">
|
|
3
|
+
<div class="ac-preview-inner">
|
|
4
|
+
<!-- preview body start -->
|
|
5
|
+
<div
|
|
6
|
+
class="ac-preview-body mt-0 pt-20"
|
|
7
|
+
:class="{
|
|
8
|
+
'is-justify-content-center': isYamlsEmpty && !isPreviewLoading,
|
|
9
|
+
}"
|
|
10
|
+
>
|
|
11
|
+
<strong v-if="isYamlsEmpty && !isPreviewLoading">
|
|
12
|
+
No Data Available
|
|
13
|
+
<i class="pl-5 fa fa-exclamation-circle" aria-hidden="true"></i>
|
|
14
|
+
</strong>
|
|
15
|
+
<template v-else>
|
|
16
|
+
<div v-if="!isPreviewLoading && previewYamls" class="left-content">
|
|
17
|
+
<div class="ac-files ac-hscrollbar pt-0">
|
|
18
|
+
<ul v-if="!isPreviewLoading">
|
|
19
|
+
<li
|
|
20
|
+
v-for="(previewYaml, idx) in filteredYamls"
|
|
21
|
+
:key="previewYaml.name + idx"
|
|
22
|
+
:class="{ 'is-active': activeKey === previewYaml.uid }"
|
|
23
|
+
:title="previewYaml.name"
|
|
24
|
+
data-testid="filtered-file-editor-file-name"
|
|
25
|
+
>
|
|
26
|
+
<a @click.prevent="setActivePreview(previewYaml.uid)">
|
|
27
|
+
<span>
|
|
28
|
+
<img
|
|
29
|
+
src="~@appscode/design-system-images/icons/file-icon.svg"
|
|
30
|
+
alt=""
|
|
31
|
+
/>
|
|
32
|
+
</span>
|
|
33
|
+
<span>{{ previewYaml.name }}</span>
|
|
34
|
+
</a>
|
|
35
|
+
</li>
|
|
36
|
+
</ul>
|
|
37
|
+
<sidebar-loader v-else />
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
<div class="right-content" data-testid="filtered-file-editor-content">
|
|
41
|
+
<resource-loader v-if="isPreviewLoading" />
|
|
42
|
+
<strong v-else-if="isYamlsNotSelected"
|
|
43
|
+
>Selecet a data from sidebar</strong
|
|
44
|
+
>
|
|
45
|
+
<strong v-else-if="hideValue"> *************** </strong>
|
|
46
|
+
<editor
|
|
47
|
+
v-else
|
|
48
|
+
v-model="activeFile.content"
|
|
49
|
+
:original-value="originalValue"
|
|
50
|
+
:language="activeFile.format"
|
|
51
|
+
:read-only="isEditorReadOnly"
|
|
52
|
+
:editor-height="editorHeight"
|
|
53
|
+
:show-minimap="showMinimap"
|
|
54
|
+
/>
|
|
55
|
+
</div>
|
|
56
|
+
</template>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</template>
|
|
61
|
+
<script>
|
|
62
|
+
import { defineComponent, defineAsyncComponent } from "vue";
|
|
63
|
+
import Preloader from "../../v2/preloader/Preloader.vue";
|
|
64
|
+
import Banner from "../../v2/banner/Banner.vue";
|
|
65
|
+
export default defineComponent({
|
|
66
|
+
components: {
|
|
67
|
+
Editor: defineAsyncComponent({
|
|
68
|
+
loader: () =>
|
|
69
|
+
import("../editor/Editor.vue").then((module) => module.default),
|
|
70
|
+
loadingComponent: Preloader,
|
|
71
|
+
delay: 200,
|
|
72
|
+
errorComponent: Banner,
|
|
73
|
+
timeout: 100000,
|
|
74
|
+
}),
|
|
75
|
+
ResourceLoader: defineAsyncComponent(() =>
|
|
76
|
+
import("../loaders/ResourceLoader.vue")
|
|
77
|
+
),
|
|
78
|
+
SidebarLoader: defineAsyncComponent(() =>
|
|
79
|
+
import("../loaders/SidebarLoader.vue")
|
|
80
|
+
),
|
|
81
|
+
},
|
|
82
|
+
props: {
|
|
83
|
+
searchText: {
|
|
84
|
+
type: String,
|
|
85
|
+
default: "",
|
|
86
|
+
},
|
|
87
|
+
toggleHideValue: {
|
|
88
|
+
type: Boolean,
|
|
89
|
+
default: true,
|
|
90
|
+
},
|
|
91
|
+
isPreviewLoading: {
|
|
92
|
+
type: Boolean,
|
|
93
|
+
default: false,
|
|
94
|
+
},
|
|
95
|
+
isEditorReadOnly: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
default: false,
|
|
98
|
+
},
|
|
99
|
+
previewYamls: {
|
|
100
|
+
type: Array,
|
|
101
|
+
default: () => {
|
|
102
|
+
[];
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
showMinimap: {
|
|
106
|
+
type: Boolean,
|
|
107
|
+
default: false,
|
|
108
|
+
},
|
|
109
|
+
editorHeight: {
|
|
110
|
+
type: Number,
|
|
111
|
+
default: 60,
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
emits: ["setActiveKey"],
|
|
115
|
+
data() {
|
|
116
|
+
return {
|
|
117
|
+
activeKey: "",
|
|
118
|
+
hideValue: "",
|
|
119
|
+
};
|
|
120
|
+
},
|
|
121
|
+
computed: {
|
|
122
|
+
activeFile() {
|
|
123
|
+
const activeFile = this.filteredYamls.find(
|
|
124
|
+
(element) => element.uid === this.activeKey
|
|
125
|
+
);
|
|
126
|
+
return activeFile || { content: "", format: "yaml" };
|
|
127
|
+
},
|
|
128
|
+
originalValue() {
|
|
129
|
+
const activeFile = this.filteredYamls.find(
|
|
130
|
+
(element) => element.uid === this.activeKey
|
|
131
|
+
);
|
|
132
|
+
return (activeFile && activeFile.initContent) || "";
|
|
133
|
+
},
|
|
134
|
+
filteredYamls() {
|
|
135
|
+
if (this.searchText) {
|
|
136
|
+
return this.previewYamls.filter(
|
|
137
|
+
(element) => JSON.stringify(element).search(this.searchText) > -1
|
|
138
|
+
);
|
|
139
|
+
} else return this.previewYamls;
|
|
140
|
+
},
|
|
141
|
+
isKeyAvailable() {
|
|
142
|
+
const val = this.previewYamls.find((element) => {
|
|
143
|
+
return element.uid === this.activeKey;
|
|
144
|
+
});
|
|
145
|
+
return val === undefined ? false : true;
|
|
146
|
+
},
|
|
147
|
+
isYamlsEmpty() {
|
|
148
|
+
return this.filteredYamls.length === 0;
|
|
149
|
+
},
|
|
150
|
+
isYamlsNotSelected() {
|
|
151
|
+
const val = this.filteredYamls.find((element) => {
|
|
152
|
+
return element.uid === this.activeKey;
|
|
153
|
+
});
|
|
154
|
+
return val === undefined;
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
methods: {
|
|
158
|
+
initActivePreview() {
|
|
159
|
+
if (!this.isKeyAvailable) {
|
|
160
|
+
this.activeKey = this.previewYamls[0].uid;
|
|
161
|
+
this.hideValue = this.activeFile.isSecret;
|
|
162
|
+
this.$emit("setActiveKey", this.activeKey);
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
setActivePreview(uid) {
|
|
166
|
+
this.activeKey = uid;
|
|
167
|
+
this.hideValue = this.activeFile.isSecret;
|
|
168
|
+
this.$emit("setActiveKey", this.activeKey);
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
watch: {
|
|
172
|
+
previewYamls: {
|
|
173
|
+
deep: true,
|
|
174
|
+
immediate: true,
|
|
175
|
+
handler(n) {
|
|
176
|
+
if (n.length) {
|
|
177
|
+
this.initActivePreview();
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
toggleHideValue(n) {
|
|
182
|
+
this.hideValue = n;
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
});
|
|
186
|
+
</script>
|