@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
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- modal start -->
|
|
3
|
+
<modal
|
|
4
|
+
:title="title"
|
|
5
|
+
modifier-classes="is-normal"
|
|
6
|
+
:open="open"
|
|
7
|
+
@closemodal="closeModal"
|
|
8
|
+
>
|
|
9
|
+
<!-- freedom content start -->
|
|
10
|
+
<div class="action-message pt-35 pb-35 has-text-centered">
|
|
11
|
+
<h5 class="is-message">{{ message }} {{ itemName ? "" : "?" }}</h5>
|
|
12
|
+
<p class="is-description">{{ itemName }} {{ itemName ? "?" : "" }}</p>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<!-- freedom content end -->
|
|
16
|
+
|
|
17
|
+
<!-- modal footer start -->
|
|
18
|
+
<template #modal-footer-controls>
|
|
19
|
+
<ac-button
|
|
20
|
+
@click.stop="closeModal"
|
|
21
|
+
title="Cancel"
|
|
22
|
+
modifier-classes="is-outlined"
|
|
23
|
+
/>
|
|
24
|
+
<ac-button
|
|
25
|
+
modifier-classes="is-danger"
|
|
26
|
+
:is-loader-active="isDeleteActive"
|
|
27
|
+
title="Yes"
|
|
28
|
+
@click.stop="confirm(true)"
|
|
29
|
+
/>
|
|
30
|
+
</template>
|
|
31
|
+
</modal>
|
|
32
|
+
<!-- modal end -->
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script>
|
|
36
|
+
import { defineComponent, defineAsyncComponent } from "vue";
|
|
37
|
+
export default defineComponent({
|
|
38
|
+
components: {
|
|
39
|
+
Modal: defineAsyncComponent(() =>
|
|
40
|
+
import("../modal/Modal.vue").then((module) => module.default)
|
|
41
|
+
),
|
|
42
|
+
AcButton: defineAsyncComponent(() =>
|
|
43
|
+
import("../button/Button.vue").then((module) => module.default)
|
|
44
|
+
),
|
|
45
|
+
},
|
|
46
|
+
props: {
|
|
47
|
+
open: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false,
|
|
50
|
+
},
|
|
51
|
+
title: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: "",
|
|
54
|
+
},
|
|
55
|
+
message: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: "",
|
|
58
|
+
},
|
|
59
|
+
itemName: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: "",
|
|
62
|
+
},
|
|
63
|
+
isLoading: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: false,
|
|
66
|
+
},
|
|
67
|
+
isDeleteActive: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: false,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
emits: ["closemodal", "delete-confirmation-modal$confirm"],
|
|
73
|
+
methods: {
|
|
74
|
+
confirm(response) {
|
|
75
|
+
this.$emit("delete-confirmation-modal$confirm", response);
|
|
76
|
+
},
|
|
77
|
+
closeModal() {
|
|
78
|
+
this.confirm(false);
|
|
79
|
+
this.$emit("closemodal", true);
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
</script>
|
|
@@ -10,14 +10,16 @@
|
|
|
10
10
|
<ac-button
|
|
11
11
|
modifier-classes="is-square is-primary"
|
|
12
12
|
icon-class="copy"
|
|
13
|
-
v-clipboard:copy="
|
|
13
|
+
v-clipboard:copy="
|
|
14
|
+
`${editorTitle}: ${JSON.stringify(parsedContent, null, 4)}`
|
|
15
|
+
"
|
|
14
16
|
v-clipboard:success="onCopy"
|
|
15
17
|
v-clipboard:error="onError"
|
|
16
18
|
/>
|
|
17
19
|
</header-item>
|
|
18
20
|
</template>
|
|
19
21
|
<editor
|
|
20
|
-
:value="JSON.stringify(parsedContent, null, 4)"
|
|
22
|
+
:model-value="JSON.stringify(parsedContent, null, 4)"
|
|
21
23
|
:read-only="true"
|
|
22
24
|
language="json"
|
|
23
25
|
:show-minimap="false"
|
|
@@ -28,36 +30,43 @@
|
|
|
28
30
|
<script>
|
|
29
31
|
import { defineComponent, defineAsyncComponent } from "vue";
|
|
30
32
|
import { useToast } from "vue-toastification";
|
|
33
|
+
import Preloader from "../../v2/preloader/Preloader.vue";
|
|
34
|
+
import Banner from "../../v2/banner/Banner.vue";
|
|
31
35
|
|
|
32
36
|
export default defineComponent({
|
|
33
37
|
props: {
|
|
34
38
|
open: {
|
|
35
39
|
type: Boolean,
|
|
36
|
-
default: false
|
|
40
|
+
default: false
|
|
37
41
|
},
|
|
38
42
|
editorTitle: {
|
|
39
43
|
type: String,
|
|
40
|
-
default: ""
|
|
44
|
+
default: ""
|
|
41
45
|
},
|
|
42
46
|
editorContent: {
|
|
43
47
|
type: null,
|
|
44
|
-
default: () => ({})
|
|
45
|
-
}
|
|
48
|
+
default: () => ({})
|
|
49
|
+
}
|
|
46
50
|
},
|
|
47
51
|
emits: ["closemodal"],
|
|
48
52
|
components: {
|
|
49
53
|
Modal: defineAsyncComponent(() =>
|
|
50
|
-
import("../modal/Modal.vue").then(
|
|
51
|
-
),
|
|
52
|
-
Editor: defineAsyncComponent(() =>
|
|
53
|
-
import("../editor/Editor.vue").then((module) => module.default)
|
|
54
|
+
import("../modal/Modal.vue").then(module => module.default)
|
|
54
55
|
),
|
|
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
|
+
}),
|
|
55
64
|
AcButton: defineAsyncComponent(() =>
|
|
56
|
-
import("../button/Button.vue").then(
|
|
65
|
+
import("../button/Button.vue").then(module => module.default)
|
|
57
66
|
),
|
|
58
67
|
HeaderItem: defineAsyncComponent(() =>
|
|
59
|
-
import("../../v2/header/HeaderItem.vue").then(
|
|
60
|
-
)
|
|
68
|
+
import("../../v2/header/HeaderItem.vue").then(module => module.default)
|
|
69
|
+
)
|
|
61
70
|
},
|
|
62
71
|
computed: {
|
|
63
72
|
parsedContent() {
|
|
@@ -66,7 +75,7 @@ export default defineComponent({
|
|
|
66
75
|
} catch (e) {
|
|
67
76
|
return this.editorContent;
|
|
68
77
|
}
|
|
69
|
-
}
|
|
78
|
+
}
|
|
70
79
|
},
|
|
71
80
|
setup() {
|
|
72
81
|
const toast = useToast();
|
|
@@ -81,7 +90,7 @@ export default defineComponent({
|
|
|
81
90
|
},
|
|
82
91
|
closeModal() {
|
|
83
92
|
this.$emit("closemodal", true);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
86
95
|
});
|
|
87
96
|
</script>
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="app-drawer-wrapper">
|
|
3
|
-
<div
|
|
2
|
+
<div class="app-drawer-wrapper is-flex">
|
|
3
|
+
<div
|
|
4
|
+
class="drawer-icon is-flex is-justify-content-center is-align-items-center"
|
|
5
|
+
>
|
|
4
6
|
<svg
|
|
5
7
|
class="gb_We"
|
|
6
8
|
focusable="false"
|
|
7
9
|
viewBox="0 0 24 24"
|
|
10
|
+
style="width: 22px;margin-top: 2px;"
|
|
8
11
|
:style="{ fill: 'white' }"
|
|
9
12
|
>
|
|
10
13
|
<path
|
|
@@ -46,13 +49,15 @@ export default defineComponent({
|
|
|
46
49
|
props: {
|
|
47
50
|
apps: {
|
|
48
51
|
type: Array,
|
|
49
|
-
default: () => []
|
|
50
|
-
}
|
|
52
|
+
default: () => []
|
|
53
|
+
}
|
|
51
54
|
},
|
|
52
55
|
components: {
|
|
53
56
|
NavbarItemContent: defineAsyncComponent(() =>
|
|
54
|
-
import("../../v2/navbar/NavbarItemContent.vue").then(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
import("../../v2/navbar/NavbarItemContent.vue").then(
|
|
58
|
+
module => module.default
|
|
59
|
+
)
|
|
60
|
+
)
|
|
61
|
+
}
|
|
57
62
|
});
|
|
58
63
|
</script>
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<button
|
|
4
|
+
v-if="themeMode"
|
|
5
|
+
class="button ac-nav-button"
|
|
6
|
+
@click="toggleTheme"
|
|
7
|
+
:title="themeModes[themeMode].displayName"
|
|
8
|
+
>
|
|
9
|
+
<i :class="`fa ${themeModes[themeMode].iconClass} width-15`" />
|
|
10
|
+
</button>
|
|
11
|
+
<div class="ac-menu-content theme-choice">
|
|
12
|
+
<ul class="is-flex is-flex-direction-row is-justify-content-space-around">
|
|
13
|
+
<li
|
|
14
|
+
v-for="theme of Object.keys(themeModes)"
|
|
15
|
+
:title="themeModes[theme].displayName"
|
|
16
|
+
@click="themeMode = theme"
|
|
17
|
+
:class="{ 'is-active': themeMode === theme }"
|
|
18
|
+
:key="theme"
|
|
19
|
+
>
|
|
20
|
+
<i :class="['fa', themeModes[theme].iconClass]" />
|
|
21
|
+
</li>
|
|
22
|
+
</ul>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
<script>
|
|
27
|
+
import { defineComponent } from "vue";
|
|
28
|
+
|
|
29
|
+
export default defineComponent({
|
|
30
|
+
data() {
|
|
31
|
+
return {
|
|
32
|
+
themeMode: "",
|
|
33
|
+
themeModes: {
|
|
34
|
+
system: {
|
|
35
|
+
displayName: "System Theme",
|
|
36
|
+
iconClass: "fa-desktop",
|
|
37
|
+
},
|
|
38
|
+
light: {
|
|
39
|
+
displayName: "Light Theme",
|
|
40
|
+
iconClass: "fa-sun-o",
|
|
41
|
+
},
|
|
42
|
+
dark: {
|
|
43
|
+
displayName: "Dark Theme",
|
|
44
|
+
iconClass: "fa-moon-o",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
emits: ["set:theme"],
|
|
51
|
+
|
|
52
|
+
mounted() {
|
|
53
|
+
// get theme mode from localStorage or set default one
|
|
54
|
+
this.themeMode = localStorage.getItem("themeMode") || "light";
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
unmounted() {
|
|
58
|
+
this.removeColorSchemeEventListener();
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
watch: {
|
|
62
|
+
themeMode: {
|
|
63
|
+
handler(n) {
|
|
64
|
+
this.onThemeModeChange(n);
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
methods: {
|
|
70
|
+
// handle theme mode button click
|
|
71
|
+
toggleTheme() {
|
|
72
|
+
if (this.themeMode === "light") this.themeMode = "dark";
|
|
73
|
+
else if (this.themeMode === "dark") this.themeMode = "system";
|
|
74
|
+
else if (this.themeMode === "system") this.themeMode = "light";
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
// triggered when theme mode is updated
|
|
78
|
+
onThemeModeChange(n) {
|
|
79
|
+
localStorage.setItem("themeMode", n);
|
|
80
|
+
|
|
81
|
+
let theme = n;
|
|
82
|
+
if (n === "system") {
|
|
83
|
+
const isDarkMode =
|
|
84
|
+
window.matchMedia &&
|
|
85
|
+
window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
86
|
+
this.addColorSchemeEventListener();
|
|
87
|
+
theme = isDarkMode ? "dark" : "light";
|
|
88
|
+
} else {
|
|
89
|
+
this.removeColorSchemeEventListener();
|
|
90
|
+
}
|
|
91
|
+
this.$emit("set:theme", theme);
|
|
92
|
+
this.handleDarkThemeClass(theme);
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
// add proper css class to update the ui theme
|
|
96
|
+
handleDarkThemeClass(currentTheme) {
|
|
97
|
+
if (currentTheme === "light") {
|
|
98
|
+
document.documentElement.classList.remove("is-dark-theme");
|
|
99
|
+
} else {
|
|
100
|
+
document.documentElement.classList.add("is-dark-theme");
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
// add system theme listener event
|
|
105
|
+
addColorSchemeEventListener() {
|
|
106
|
+
window
|
|
107
|
+
.matchMedia("(prefers-color-scheme: dark)")
|
|
108
|
+
.addEventListener("change", this.handleSystemThemeChange);
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
// remove system theme listener event
|
|
112
|
+
removeColorSchemeEventListener() {
|
|
113
|
+
window
|
|
114
|
+
.matchMedia("(prefers-color-scheme: dark)")
|
|
115
|
+
.removeEventListener("change", this.handleSystemThemeChange);
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
handleSystemThemeChange() {
|
|
119
|
+
this.onThemeModeChange(this.themeMode);
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
</script>
|
|
@@ -7,31 +7,111 @@
|
|
|
7
7
|
<img :src="user.avatar_url" alt="User Photo" />
|
|
8
8
|
</div>
|
|
9
9
|
</button>
|
|
10
|
-
<navbar-item-content>
|
|
11
|
-
<div v-if="user.username" class="user-profile-wrapper">
|
|
10
|
+
<navbar-item-content class="navbar-dropdown-wrapper">
|
|
11
|
+
<div v-if="user.username" class="user-profile-wrapper" @mouseleave="onMouseLeave()">
|
|
12
12
|
<div class="profile-area">
|
|
13
13
|
<div class="profile-photo">
|
|
14
|
-
<img :src="user.avatar_url" alt="User Photo" />
|
|
14
|
+
<img :src="user.avatar_url" alt="User Photo" class="width-50 height-50" />
|
|
15
15
|
<button class="camera-icon"></button>
|
|
16
16
|
</div>
|
|
17
|
-
<div class="profile-info">
|
|
18
|
-
<
|
|
17
|
+
<div class="profile-info" style="width: calc(100% - 60px);">
|
|
18
|
+
<a
|
|
19
|
+
:href="`${serverDomain}/${user.username}`"
|
|
20
|
+
:title="user.username.toUpperCase()"
|
|
21
|
+
class="line-break-anywhere is-ellipsis-1"
|
|
22
|
+
>{{ user.username.toUpperCase() }}</a
|
|
23
|
+
>
|
|
19
24
|
<a :href="`mailto:${user.email}`"> {{ user.email }}</a>
|
|
20
25
|
</div>
|
|
21
26
|
</div>
|
|
22
|
-
<ul>
|
|
23
|
-
<li>
|
|
27
|
+
<transition-group name="list" tag="ul">
|
|
28
|
+
<li key="settings">
|
|
24
29
|
<a :href="`${serverDomain}/user/settings/`">Settings</a>
|
|
25
30
|
</li>
|
|
26
|
-
<
|
|
27
|
-
<
|
|
28
|
-
<a :href="`${serverDomain}/admin`"> Site Administration </a>
|
|
29
|
-
</li>
|
|
30
|
-
</template>
|
|
31
|
-
<li>
|
|
32
|
-
<a :href="`${serverDomain}/user/logout`"> Sign out </a>
|
|
31
|
+
<li v-if="user.is_admin" key="site-admin">
|
|
32
|
+
<a :href="`${accountsDomain}/admin`">Site Administration</a>
|
|
33
33
|
</li>
|
|
34
|
-
|
|
34
|
+
<li v-if="showAccountSwitcher" :class="`is-${dropDownStatus}`" key="switcher">
|
|
35
|
+
<a class="
|
|
36
|
+
ac-dropdown-button
|
|
37
|
+
is-fullwidth
|
|
38
|
+
is-flex
|
|
39
|
+
is-justify-content-space-between
|
|
40
|
+
is-align-items-center
|
|
41
|
+
"
|
|
42
|
+
@click="toggleList()"
|
|
43
|
+
>
|
|
44
|
+
<span>Switch Account</span>
|
|
45
|
+
<span
|
|
46
|
+
><i
|
|
47
|
+
:class="`fa fa-angle-${
|
|
48
|
+
dropDownStatus === 'open' ? 'up' : 'down'
|
|
49
|
+
}`"
|
|
50
|
+
></i
|
|
51
|
+
></span>
|
|
52
|
+
</a>
|
|
53
|
+
<transition-group name="list" tag="ul"
|
|
54
|
+
class="ac-vscrollbar"
|
|
55
|
+
ref="dropdownItems"
|
|
56
|
+
:style="{ maxHeight: dropDownSectionHeight }"
|
|
57
|
+
>
|
|
58
|
+
<li
|
|
59
|
+
v-for="(org, idx) in formattedOrganizations"
|
|
60
|
+
:key="org.username"
|
|
61
|
+
>
|
|
62
|
+
<a
|
|
63
|
+
class="is-flex is-align-items-center"
|
|
64
|
+
@click="onOrganizationClick(org.username)"
|
|
65
|
+
>
|
|
66
|
+
<div class="width-30 height-30 image">
|
|
67
|
+
<img
|
|
68
|
+
:src="org.avatar_url"
|
|
69
|
+
class="ac-user-profile is-rounded"
|
|
70
|
+
alt="icon"
|
|
71
|
+
/>
|
|
72
|
+
</div>
|
|
73
|
+
<div
|
|
74
|
+
class="
|
|
75
|
+
is-flex
|
|
76
|
+
is-align-items-center
|
|
77
|
+
is-justify-content-space-between
|
|
78
|
+
is-fullwidth
|
|
79
|
+
ml-10
|
|
80
|
+
"
|
|
81
|
+
>
|
|
82
|
+
<div class="org-info">
|
|
83
|
+
<strong :title="org.username" class="line-break-anywhere is-ellipsis-1">{{ org.username }}</strong>
|
|
84
|
+
<p>
|
|
85
|
+
{{
|
|
86
|
+
org.isPersonalAccount
|
|
87
|
+
? "Personal Account"
|
|
88
|
+
: "Organization"
|
|
89
|
+
}}
|
|
90
|
+
</p>
|
|
91
|
+
</div>
|
|
92
|
+
<span
|
|
93
|
+
v-if="idx === 0"
|
|
94
|
+
class="
|
|
95
|
+
material-icons-outlined
|
|
96
|
+
font-size-18
|
|
97
|
+
ml-10
|
|
98
|
+
is-pulled-right
|
|
99
|
+
"
|
|
100
|
+
>
|
|
101
|
+
check
|
|
102
|
+
</span>
|
|
103
|
+
</div>
|
|
104
|
+
</a>
|
|
105
|
+
</li>
|
|
106
|
+
</transition-group>
|
|
107
|
+
</li>
|
|
108
|
+
<li key="dashboard">
|
|
109
|
+
<a :href="`${serverDomain}/dashboard`"> Dashboard </a>
|
|
110
|
+
</li>
|
|
111
|
+
<li key="signout">
|
|
112
|
+
<a :href="`${accountsDomain}/user/logout`"> Sign out </a>
|
|
113
|
+
</li>
|
|
114
|
+
</transition-group>
|
|
35
115
|
</div>
|
|
36
116
|
</navbar-item-content>
|
|
37
117
|
</navbar-item>
|
|
@@ -42,6 +122,7 @@ import { defineComponent, defineAsyncComponent } from "vue";
|
|
|
42
122
|
|
|
43
123
|
export default defineComponent({
|
|
44
124
|
props: {
|
|
125
|
+
// active user info
|
|
45
126
|
user: {
|
|
46
127
|
type: Object,
|
|
47
128
|
default: () => ({}),
|
|
@@ -50,6 +131,19 @@ export default defineComponent({
|
|
|
50
131
|
type: String,
|
|
51
132
|
default: "",
|
|
52
133
|
},
|
|
134
|
+
accountsDomain: {
|
|
135
|
+
type: String,
|
|
136
|
+
default: "",
|
|
137
|
+
},
|
|
138
|
+
showAccountSwitcher: {
|
|
139
|
+
type: Boolean,
|
|
140
|
+
default: false,
|
|
141
|
+
},
|
|
142
|
+
// all available organization list including personal account
|
|
143
|
+
organizations: {
|
|
144
|
+
type: Array,
|
|
145
|
+
default: () => [],
|
|
146
|
+
},
|
|
53
147
|
},
|
|
54
148
|
|
|
55
149
|
components: {
|
|
@@ -60,5 +154,71 @@ export default defineComponent({
|
|
|
60
154
|
import("../../v2/navbar/NavbarItemContent.vue").then((module) => module.default)
|
|
61
155
|
),
|
|
62
156
|
},
|
|
157
|
+
|
|
158
|
+
computed: {
|
|
159
|
+
formattedOrganizations() {
|
|
160
|
+
let activeUser;
|
|
161
|
+
const filteredList = this.organizations.filter((item) => {
|
|
162
|
+
if (item.username === this.user.username) {
|
|
163
|
+
activeUser = item;
|
|
164
|
+
} else {
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
return false;
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
filteredList.unshift(activeUser);
|
|
171
|
+
|
|
172
|
+
return filteredList || [];
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
data() {
|
|
177
|
+
return {
|
|
178
|
+
dropDownStatus: "close",
|
|
179
|
+
dropDownSectionHeight: null,
|
|
180
|
+
};
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
methods: {
|
|
184
|
+
toggleList() {
|
|
185
|
+
this.dropDownStatus = this.dropDownStatus === "open" ? "close" : "open";
|
|
186
|
+
this.$nextTick(() => {
|
|
187
|
+
this.$refs["dropdownItems"].$el.scrollTo(0, 0);
|
|
188
|
+
});
|
|
189
|
+
},
|
|
190
|
+
onOrganizationClick(orgName) {
|
|
191
|
+
this.$refs["dropdownItems"].$el.scrollTo(0, 0);
|
|
192
|
+
this.$emit("activeorg$set", orgName);
|
|
193
|
+
},
|
|
194
|
+
onMouseLeave() {
|
|
195
|
+
this.dropDownStatus = "close";
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
watch: {
|
|
200
|
+
dropDownStatus: {
|
|
201
|
+
immediate: true,
|
|
202
|
+
handler(n) {
|
|
203
|
+
if (n === "open") {
|
|
204
|
+
this.$nextTick(() => {
|
|
205
|
+
const dropDownUl = this.$refs["dropdownItems"];
|
|
206
|
+
if (dropDownUl)
|
|
207
|
+
this.dropDownSectionHeight = `${dropDownUl.scrollHeight}px`;
|
|
208
|
+
});
|
|
209
|
+
} else {
|
|
210
|
+
this.dropDownSectionHeight = null;
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
},
|
|
63
215
|
});
|
|
64
|
-
</script>
|
|
216
|
+
</script>
|
|
217
|
+
<style lang="scss" scoped>
|
|
218
|
+
.ac-vscrollbar {
|
|
219
|
+
overflow: auto !important;
|
|
220
|
+
}
|
|
221
|
+
.line-break-anywhere {
|
|
222
|
+
line-break: anywhere;
|
|
223
|
+
}
|
|
224
|
+
</style>
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="sidebarCollapsed" class="is-cluster-logo">
|
|
3
|
+
<img
|
|
4
|
+
width="40"
|
|
5
|
+
:src="getProviderIcon(selectedCluster && selectedCluster.provider)"
|
|
6
|
+
onerror="this.onerror=null;this.src='https://cdn.appscode.com/images/cloud-provider-icons/Generic.png';"
|
|
7
|
+
alt="provider-icon"
|
|
8
|
+
/>
|
|
9
|
+
</div>
|
|
10
|
+
<multiselect
|
|
11
|
+
v-else
|
|
12
|
+
v-model="selectedCluster"
|
|
13
|
+
placeholder="Selected Cluster"
|
|
14
|
+
label="name"
|
|
15
|
+
track-by="name"
|
|
16
|
+
:options="clusterOptions"
|
|
17
|
+
:allow-empty="false"
|
|
18
|
+
deselect-label=""
|
|
19
|
+
select-label=""
|
|
20
|
+
selected-label=""
|
|
21
|
+
>
|
|
22
|
+
<template #singleLabel="props">
|
|
23
|
+
<div class="is-flex is-align-items-center">
|
|
24
|
+
<img
|
|
25
|
+
:src="getProviderIcon(props.option.provider)"
|
|
26
|
+
onerror="this.onerror=null;this.src='https://cdn.appscode.com/images/cloud-provider-icons/Generic.png';"
|
|
27
|
+
alt="No cluster selected"
|
|
28
|
+
/><span
|
|
29
|
+
><span>{{ props.option.displayName }}</span></span
|
|
30
|
+
>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
<template #option="props">
|
|
34
|
+
<div class="is-flex is-align-items-center">
|
|
35
|
+
<img
|
|
36
|
+
class="mr-15"
|
|
37
|
+
:src="getProviderIcon(props.option.provider)"
|
|
38
|
+
onerror="this.onerror=null;this.src='https://cdn.appscode.com/images/cloud-provider-icons/Generic.png';"
|
|
39
|
+
alt="No cluster selected"
|
|
40
|
+
/>
|
|
41
|
+
<div>
|
|
42
|
+
<p>{{ props.option.displayName }}</p>
|
|
43
|
+
<p class="location">{{ props.option.location }}</p>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
</multiselect>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<script>
|
|
51
|
+
import { defineComponent, defineAsyncComponent } from 'vue'
|
|
52
|
+
export default defineComponent({
|
|
53
|
+
components: {
|
|
54
|
+
Multiselect: defineAsyncComponent(() =>
|
|
55
|
+
import('vue-multiselect').then((module) => module.default)
|
|
56
|
+
),
|
|
57
|
+
},
|
|
58
|
+
props: {
|
|
59
|
+
sidebarCollapsed: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: false,
|
|
62
|
+
},
|
|
63
|
+
mouseHover: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: false,
|
|
66
|
+
},
|
|
67
|
+
clusterOptions: {
|
|
68
|
+
type: Array,
|
|
69
|
+
default: () => [],
|
|
70
|
+
},
|
|
71
|
+
modelValue: {
|
|
72
|
+
type: String,
|
|
73
|
+
default: '',
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
emits: ['update:modelValue'],
|
|
78
|
+
|
|
79
|
+
data() {
|
|
80
|
+
return {
|
|
81
|
+
selectedCluster: null,
|
|
82
|
+
selectedClusterName: null,
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
watch: {
|
|
87
|
+
modelValue: {
|
|
88
|
+
immediate: true,
|
|
89
|
+
handler(n) {
|
|
90
|
+
this.selectedClusterName = n
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
selectedCluster: {
|
|
94
|
+
deep: true,
|
|
95
|
+
handler(n) {
|
|
96
|
+
if (this.selectedClusterName !== n.name) {
|
|
97
|
+
this.selectedClusterName = n.name
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
selectedClusterName(n) {
|
|
102
|
+
if (n !== this.selectedCluster.name) {
|
|
103
|
+
this.clusterOptions.forEach((item) => {
|
|
104
|
+
if (this.selectedClusterName === item.name) {
|
|
105
|
+
this.selectedCluster = item
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
this.$emit('update:modelValue', n)
|
|
111
|
+
},
|
|
112
|
+
clusterOptions: {
|
|
113
|
+
deep: true,
|
|
114
|
+
immediate: true,
|
|
115
|
+
async handler(list) {
|
|
116
|
+
if (list) {
|
|
117
|
+
list.forEach((item) => {
|
|
118
|
+
if (this.selectedClusterName === item.name) {
|
|
119
|
+
this.selectedCluster = item
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
methods: {
|
|
128
|
+
getProviderIcon(provider) {
|
|
129
|
+
return `https://cdn.appscode.com/images/cloud-provider-icons/${provider}.png`
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
})
|
|
133
|
+
</script>
|