@appscode/design-system 0.0.21-alpha.2 → 0.4.27
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 +319 -110
- package/base/utilities/_derived-variables.scss +8 -15
- package/base/utilities/_grid.scss +29 -0
- package/base/utilities/_initial-variables.scss +111 -72
- package/base/utilities/_mixin.scss +90 -10
- package/base/utilities/_typography.scss +29 -19
- package/base/utilities/dark-theme.scss +26 -0
- package/components/_ac-accordion.scss +15 -5
- package/components/_ac-alert-box.scss +109 -26
- package/components/_ac-card.scss +71 -24
- package/components/_ac-code-highlight.scss +7 -1
- package/components/_ac-content-layout.scss +5 -5
- package/components/_ac-drag.scss +8 -6
- package/components/_ac-input.scss +196 -38
- package/components/_ac-modal.scss +6 -5
- package/components/_ac-multi-select.scss +281 -23
- package/components/_ac-options.scss +31 -16
- package/components/_ac-report.scss +53 -0
- package/components/_ac-select-box.scss +15 -5
- package/components/_ac-table.scss +160 -39
- package/components/_ac-tabs.scss +86 -23
- package/components/_ac-tags.scss +87 -2
- package/components/_ac-terminal.scss +270 -0
- package/components/_all.scss +28 -0
- package/components/_app-drawer.scss +134 -0
- package/components/_breadcumb.scss +8 -3
- package/components/_buttons.scss +96 -62
- package/components/_card-body-wrapper.scss +3 -3
- package/components/_dashboard-header.scss +33 -1
- 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 +6 -4
- package/components/_left-sidebar-menu.scss +212 -52
- package/components/_monaco-editor.scss +1 -1
- package/components/_navbar.scss +193 -31
- package/components/_overview-info.scss +4 -4
- package/components/_overview-page.scss +1 -2
- package/components/_pagination.scss +45 -7
- package/components/_payment-card.scss +28 -12
- package/components/_preloader.scss +1 -1
- package/components/_preview-modal.scss +22 -9
- package/components/_pricing-table.scss +1 -1
- package/components/_progress-bar.scss +5 -5
- package/components/_subscription-card.scss +15 -8
- package/components/_table-of-content.scss +1 -1
- package/components/_tfa.scss +69 -0
- package/components/_transitions.scss +261 -0
- package/components/_widget-menu.scss +9 -9
- package/components/_wizard.scss +33 -20
- package/components/ac-toaster/_ac-toasted.scss +40 -8
- package/components/bbum/_all.scss +9 -0
- package/components/bbum/_card-team.scss +18 -10
- package/components/bbum/_information-center.scss +19 -5
- package/components/bbum/_mobile-desktop.scss +6 -6
- package/components/bbum/_post.scss +5 -4
- package/components/bbum/_sign-up-notification.scss +6 -6
- package/components/bbum/_single-post-preview.scss +10 -10
- package/components/bbum/_user-profile.scss +97 -90
- package/components/ui-builder/_ui-builder.scss +98 -21
- package/components/ui-builder/_vue-open-api.scss +104 -0
- package/layouts/_404.scss +159 -0
- package/layouts/_all.scss +2 -0
- package/layouts/_code-preview.scss +19 -8
- package/main.scss +6 -53
- package/package.json +4 -7
- package/plugins/caching.ts +243 -0
- package/plugins/theme.js +142 -0
- package/plugins/time-convert.js +49 -0
- package/plugins/vue-toaster.js +10 -6
- 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 +10 -1
- package/vue-components/v2/button/DownloadBtn.vue +45 -0
- package/vue-components/v2/card/Card.vue +1 -0
- package/vue-components/v2/card/CardContent.vue +5 -0
- package/vue-components/v2/card/CardHeader.vue +12 -0
- package/vue-components/v2/card/OverviewCard.vue +10 -0
- package/vue-components/v2/card/OverviewCards.vue +5 -0
- package/vue-components/v2/card/PaymentCard.vue +69 -0
- package/vue-components/v2/card/PaymentCardOptionButtons.vue +35 -0
- package/vue-components/v2/card/PaymentCards.vue +44 -0
- package/vue-components/v2/content/ContentHeader.vue +9 -5
- 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/Form.vue +12 -7
- package/vue-components/v2/form-fields/Input.vue +1 -1
- package/vue-components/v2/header/Header.vue +0 -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 +40 -7
- package/vue-components/v2/modals/DeleteConfirmationModal.vue +79 -0
- package/vue-components/v2/modals/JsonShowModal.vue +12 -3
- 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 +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 +24 -4
- 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 +24 -2
- package/vue-components/v2/sidebar/SidebarItemWithDropDown.vue +19 -20
- package/vue-components/v2/tab/TabItem.vue +1 -1
- package/vue-components/v2/table/FakeTableCell.vue +36 -0
- package/vue-components/v2/table/InfoTable.vue +13 -3
- package/vue-components/v2/table/NarrowTable.vue +0 -2
- package/vue-components/v2/table/Table.vue +170 -10
- package/vue-components/v2/table/TableRow.vue +29 -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 +78 -0
- package/vue-components/v3/content/ContentHeader.vue +55 -0
- package/vue-components/v3/content/ContentTable.vue +83 -0
- package/vue-components/v3/dropdown/DropdownDivider.vue +3 -0
- package/vue-components/v3/dropdown/DropdownItem.vue +5 -0
- package/vue-components/v3/dropdown/DropdownMenu.vue +111 -0
- package/vue-components/v3/editor/Editor.vue +160 -0
- 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 +22 -0
- package/vue-components/v3/header/Header.vue +45 -0
- 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 +158 -0
- package/vue-components/v3/modals/DeleteConfirmationModal.vue +85 -0
- package/vue-components/v3/modals/JsonShowModal.vue +96 -0
- package/vue-components/v3/modals/LongRunningTasksModal.vue +373 -0
- package/vue-components/v3/navbar/Appdrawer.vue +63 -0
- package/vue-components/v3/navbar/ThemeMode.vue +120 -0
- package/vue-components/v3/navbar/User.vue +288 -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 +172 -0
- package/vue-components/v3/searchbars/SearchBar.vue +47 -0
- package/vue-components/v3/sidebar/ClusterSwitcher.vue +133 -0
- package/vue-components/v3/sidebar/SidebarItemWithDropDown.vue +120 -0
- package/vue-components/v3/tab/TabItem.vue +17 -0
- package/vue-components/v3/table/FakeTableCell.vue +39 -0
- package/vue-components/v3/table/InfoTable.vue +105 -0
- package/vue-components/v3/table/MultiInfoTable.vue +143 -0
- package/vue-components/v3/table/Table.vue +272 -0
- package/vue-components/v3/table/TableCell.vue +28 -0
- package/vue-components/v3/table/TableContainer.vue +34 -0
- package/vue-components/v3/table/TableRow.vue +147 -0
- package/vue-components/v3/table/table-cell/ArrayCell.vue +111 -0
- package/vue-components/v3/table/table-cell/CellValue.vue +133 -0
- package/vue-components/v3/table/table-cell/GenericCell.vue +75 -0
- package/vue-components/v3/table/table-cell/ObjectCell.vue +110 -0
- package/vue-components/v3/table/table-cell/ValueWithModal.vue +43 -0
- package/vue-components/v3/tabs/EditorTabs.vue +36 -0
- package/vue-components/v3/tag/Tag.vue +17 -0
- package/vue-components/v3/terminal/LongRunningTaskTerminal.vue +148 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ac-content-header" :class="{ 'b-b-1': !removeBorderBottom }">
|
|
3
|
+
<!-- header left start -->
|
|
4
|
+
<div class="ac-cheader-left">
|
|
5
|
+
<!-- title -->
|
|
6
|
+
<div class="ac-content-title">
|
|
7
|
+
<h6 class="is-flex">
|
|
8
|
+
<slot name="header-icon" />
|
|
9
|
+
{{ headerTitle }}
|
|
10
|
+
<slot name="title-right-actions" />
|
|
11
|
+
</h6>
|
|
12
|
+
<p v-if="headerSubTitle">{{ headerSubTitle }}</p>
|
|
13
|
+
</div>
|
|
14
|
+
<!-- title -->
|
|
15
|
+
</div>
|
|
16
|
+
<!-- header left end -->
|
|
17
|
+
|
|
18
|
+
<!-- header right start -->
|
|
19
|
+
<div class="ac-cheader-right">
|
|
20
|
+
<!-- your feedom content start here -->
|
|
21
|
+
<header-items>
|
|
22
|
+
<slot />
|
|
23
|
+
</header-items>
|
|
24
|
+
<!-- your feedom content end here -->
|
|
25
|
+
</div>
|
|
26
|
+
<!-- header right end -->
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script>
|
|
31
|
+
import { defineComponent, defineAsyncComponent } from "vue";
|
|
32
|
+
|
|
33
|
+
export default defineComponent({
|
|
34
|
+
props: {
|
|
35
|
+
headerTitle: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: "Content Header",
|
|
38
|
+
},
|
|
39
|
+
headerSubTitle: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: "",
|
|
42
|
+
},
|
|
43
|
+
removeBorderBottom: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: false,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
components: {
|
|
50
|
+
HeaderItems: defineAsyncComponent(() =>
|
|
51
|
+
import("../../v2/header/HeaderItems.vue").then((module) => module.default)
|
|
52
|
+
),
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
</script>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<content-layout>
|
|
3
|
+
<template #content-header>
|
|
4
|
+
<content-header
|
|
5
|
+
v-if="!hideHeader"
|
|
6
|
+
:header-title="tableTitle"
|
|
7
|
+
:header-sub-title="tableSubTitle"
|
|
8
|
+
:class="{ 'pl-0 pr-0': removeTableHeaderPadding }"
|
|
9
|
+
>
|
|
10
|
+
<template #title-right-actions>
|
|
11
|
+
<slot name="title-right-actions" />
|
|
12
|
+
</template>
|
|
13
|
+
<slot name="content-left-controls" />
|
|
14
|
+
<header-item>
|
|
15
|
+
<search-bar v-if="searchable" @search="updateSearchText" />
|
|
16
|
+
</header-item>
|
|
17
|
+
<slot name="content-right-controls" />
|
|
18
|
+
</content-header>
|
|
19
|
+
</template>
|
|
20
|
+
<slot
|
|
21
|
+
name="content"
|
|
22
|
+
:search-text="searchText"
|
|
23
|
+
:update-search-text="updateSearchText"
|
|
24
|
+
/>
|
|
25
|
+
</content-layout>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script>
|
|
29
|
+
import { defineComponent, defineAsyncComponent } from "vue";
|
|
30
|
+
|
|
31
|
+
export default defineComponent({
|
|
32
|
+
props: {
|
|
33
|
+
removeTableHeaderPadding: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false,
|
|
36
|
+
},
|
|
37
|
+
tableTitle: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: "Table",
|
|
40
|
+
},
|
|
41
|
+
tableSubTitle: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: "",
|
|
44
|
+
},
|
|
45
|
+
searchable: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: true,
|
|
48
|
+
},
|
|
49
|
+
hideHeader: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
components: {
|
|
55
|
+
ContentLayout: defineAsyncComponent(() =>
|
|
56
|
+
import("../../v2/content/ContentLayout.vue").then(
|
|
57
|
+
(module) => module.default
|
|
58
|
+
)
|
|
59
|
+
),
|
|
60
|
+
ContentHeader: defineAsyncComponent(() =>
|
|
61
|
+
import("./ContentHeader.vue").then((module) => module.default)
|
|
62
|
+
),
|
|
63
|
+
HeaderItem: defineAsyncComponent(() =>
|
|
64
|
+
import("../../v2/header/HeaderItem.vue").then((module) => module.default)
|
|
65
|
+
),
|
|
66
|
+
SearchBar: defineAsyncComponent(() =>
|
|
67
|
+
import("../searchbars/SearchBar.vue").then((module) => module.default)
|
|
68
|
+
),
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
data() {
|
|
72
|
+
return {
|
|
73
|
+
searchText: "",
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
methods: {
|
|
78
|
+
updateSearchText(text) {
|
|
79
|
+
this.searchText = text;
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
</script>
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="dropdown"
|
|
4
|
+
class="dropdown"
|
|
5
|
+
:class="{
|
|
6
|
+
'is-active': isDropdownActive,
|
|
7
|
+
'dropdown-show-animation': dropdownShowAnimation,
|
|
8
|
+
'dropdown-hide-animation': dropdownHideAnimation,
|
|
9
|
+
}"
|
|
10
|
+
>
|
|
11
|
+
<div class="dropdown-trigger">
|
|
12
|
+
<slot name="dropdown-trigger" />
|
|
13
|
+
</div>
|
|
14
|
+
<div id="dropdown-menu" class="dropdown-menu" role="menu">
|
|
15
|
+
<div class="dropdown-content">
|
|
16
|
+
<slot />
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script lang="ts">
|
|
23
|
+
//@ts-ignore
|
|
24
|
+
import { defineComponent, onUnmounted, Ref, ref, toRefs, watch } from "vue";
|
|
25
|
+
|
|
26
|
+
export default defineComponent({
|
|
27
|
+
props: {
|
|
28
|
+
isActive: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
emits: ["update:is-active"],
|
|
34
|
+
|
|
35
|
+
setup(props, { emit }) {
|
|
36
|
+
const { isActive } = toRefs(props);
|
|
37
|
+
watch(isActive, (n) => {
|
|
38
|
+
if (ignoreClick.value) {
|
|
39
|
+
// ignore new value
|
|
40
|
+
// emit old value
|
|
41
|
+
emit("update:is-active", isDropdownActive.value);
|
|
42
|
+
} else {
|
|
43
|
+
if (n) {
|
|
44
|
+
animateDropdown("show");
|
|
45
|
+
isDropdownActive.value = true;
|
|
46
|
+
} else {
|
|
47
|
+
animateDropdown("hide");
|
|
48
|
+
setTimeout(() => {
|
|
49
|
+
isDropdownActive.value = false;
|
|
50
|
+
}, 200);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const dropdown: Ref<HTMLElement | null> = ref(null);
|
|
56
|
+
const isDropdownActive = ref(isActive.value);
|
|
57
|
+
|
|
58
|
+
// attach click event listener on window, and close the dropdown
|
|
59
|
+
function deactivateDropdown(e: Event) {
|
|
60
|
+
const { target } = e;
|
|
61
|
+
if (
|
|
62
|
+
isDropdownActive.value &&
|
|
63
|
+
dropdown.value &&
|
|
64
|
+
dropdown.value !== target &&
|
|
65
|
+
!dropdown.value.contains(target as Node)
|
|
66
|
+
) {
|
|
67
|
+
if (!ignoreClick.value) {
|
|
68
|
+
animateDropdown("hide");
|
|
69
|
+
setTimeout(() => {
|
|
70
|
+
isDropdownActive.value = false;
|
|
71
|
+
emit("update:is-active", false);
|
|
72
|
+
}, 200);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
window.addEventListener("click", deactivateDropdown);
|
|
77
|
+
onUnmounted(() => {
|
|
78
|
+
window.removeEventListener("click", deactivateDropdown);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// for animation
|
|
82
|
+
const dropdownShowAnimation = ref(false);
|
|
83
|
+
const dropdownHideAnimation = ref(false);
|
|
84
|
+
const ignoreClick = ref(false);
|
|
85
|
+
function animateDropdown(type: string) {
|
|
86
|
+
ignoreClick.value = true;
|
|
87
|
+
if (type === "show") {
|
|
88
|
+
dropdownShowAnimation.value = true;
|
|
89
|
+
// remove class after 200 miliseconds
|
|
90
|
+
setTimeout(() => {
|
|
91
|
+
dropdownShowAnimation.value = false;
|
|
92
|
+
ignoreClick.value = false;
|
|
93
|
+
}, 200);
|
|
94
|
+
} else {
|
|
95
|
+
dropdownHideAnimation.value = true;
|
|
96
|
+
setTimeout(() => {
|
|
97
|
+
dropdownHideAnimation.value = false;
|
|
98
|
+
ignoreClick.value = false;
|
|
99
|
+
}, 200);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return {
|
|
104
|
+
dropdown,
|
|
105
|
+
isDropdownActive,
|
|
106
|
+
dropdownShowAnimation,
|
|
107
|
+
dropdownHideAnimation,
|
|
108
|
+
};
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
</script>
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<editor-tabs
|
|
4
|
+
v-if="!readOnly"
|
|
5
|
+
@tabchange="activeTab = $event"
|
|
6
|
+
:active-tab="activeTab"
|
|
7
|
+
/>
|
|
8
|
+
<monaco-editor
|
|
9
|
+
v-if="activeTab === 'edit'"
|
|
10
|
+
@editorDidMount="onEditorMount"
|
|
11
|
+
key="edit"
|
|
12
|
+
:class="`vh-${editorHeight} is-clipped`"
|
|
13
|
+
:value="editorContent"
|
|
14
|
+
@change="onChange"
|
|
15
|
+
:language="language"
|
|
16
|
+
:options="{
|
|
17
|
+
minimap: {
|
|
18
|
+
enabled: calcShowMinimap,
|
|
19
|
+
},
|
|
20
|
+
theme: theme,
|
|
21
|
+
readOnly: readOnly,
|
|
22
|
+
wordWrap: wordWrap,
|
|
23
|
+
scrollBeyondLastLine: false,
|
|
24
|
+
}"
|
|
25
|
+
data-testid="monaco-editor-edit-section"
|
|
26
|
+
/>
|
|
27
|
+
<monaco-editor
|
|
28
|
+
v-if="activeTab === 'preview'"
|
|
29
|
+
key="preview"
|
|
30
|
+
:class="`vh-${editorHeight} is-clipped`"
|
|
31
|
+
:value="editorContent"
|
|
32
|
+
:language="language"
|
|
33
|
+
:options="{
|
|
34
|
+
minimap: {
|
|
35
|
+
enabled: calcShowMinimap,
|
|
36
|
+
},
|
|
37
|
+
theme: theme,
|
|
38
|
+
readOnly: true,
|
|
39
|
+
wordWrap: wordWrap,
|
|
40
|
+
scrollBeyondLastLine: false,
|
|
41
|
+
}"
|
|
42
|
+
:original="originalEditorContent"
|
|
43
|
+
:diff-editor="true"
|
|
44
|
+
data-testid="monaco-editor-preview-section"
|
|
45
|
+
/>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<script>
|
|
50
|
+
import { defineComponent, defineAsyncComponent, h } from "vue";
|
|
51
|
+
import Preloader from "../../v2/preloader/Preloader.vue";
|
|
52
|
+
import Banner from "../../v2/banner/Banner.vue";
|
|
53
|
+
export default defineComponent({
|
|
54
|
+
props: {
|
|
55
|
+
modelValue: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: "",
|
|
58
|
+
},
|
|
59
|
+
originalValue: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: "",
|
|
62
|
+
},
|
|
63
|
+
readOnly: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: false,
|
|
66
|
+
},
|
|
67
|
+
language: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: "yaml",
|
|
70
|
+
},
|
|
71
|
+
showMinimap: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: true,
|
|
74
|
+
},
|
|
75
|
+
editorHeight: {
|
|
76
|
+
type: Number,
|
|
77
|
+
default: 40,
|
|
78
|
+
},
|
|
79
|
+
editorTheme: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: "",
|
|
82
|
+
},
|
|
83
|
+
wordWrap: {
|
|
84
|
+
type: String,
|
|
85
|
+
default: "off",
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
emits: ["update:modelValue"],
|
|
90
|
+
|
|
91
|
+
components: {
|
|
92
|
+
EditorTabs: defineAsyncComponent(() =>
|
|
93
|
+
import("../tabs/EditorTabs.vue").then((module) => module.default)
|
|
94
|
+
),
|
|
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
|
+
}),
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
data() {
|
|
107
|
+
return {
|
|
108
|
+
activeTab: "edit",
|
|
109
|
+
editorContent: "",
|
|
110
|
+
originalEditorContent: "",
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
computed: {
|
|
115
|
+
calcShowMinimap() {
|
|
116
|
+
const noOfLines = this.editorContent.split("\n").length;
|
|
117
|
+
return this.showMinimap && noOfLines * 2 > this.editorHeight;
|
|
118
|
+
},
|
|
119
|
+
theme() {
|
|
120
|
+
return (
|
|
121
|
+
this.editorTheme ||
|
|
122
|
+
(document.documentElement.classList.contains("is-dark-theme")
|
|
123
|
+
? "vs-dark"
|
|
124
|
+
: "vs")
|
|
125
|
+
);
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
watch: {
|
|
130
|
+
modelValue: {
|
|
131
|
+
immediate: true,
|
|
132
|
+
handler(n) {
|
|
133
|
+
if (this.editorContent !== n) {
|
|
134
|
+
this.editorContent = n;
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
originalValue: {
|
|
139
|
+
immediate: true,
|
|
140
|
+
handler(n) {
|
|
141
|
+
if (this.originalEditorContent !== n) {
|
|
142
|
+
this.originalEditorContent = n;
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
methods: {
|
|
149
|
+
onChange(e) {
|
|
150
|
+
if (typeof e === "string") this.editorContent = e;
|
|
151
|
+
},
|
|
152
|
+
onEditorMount(editor) {
|
|
153
|
+
// add event listeners
|
|
154
|
+
editor.onDidBlurEditorText(() => {
|
|
155
|
+
this.$emit("update:modelValue", this.editorContent);
|
|
156
|
+
});
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
});
|
|
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>
|