@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,120 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<button
|
|
4
|
+
v-if="themeMode"
|
|
5
|
+
class="button ac-nav-button"
|
|
6
|
+
style="color: #ffffff; font-size: 15px;"
|
|
7
|
+
@click="toggleTheme"
|
|
8
|
+
:title="themeModes[themeMode].displayName"
|
|
9
|
+
>
|
|
10
|
+
<i :class="`fa ${themeModes[themeMode].iconClass}`" />
|
|
11
|
+
</button>
|
|
12
|
+
<div class="ac-menu-content theme-choice">
|
|
13
|
+
<ul class="is-flex is-flex-direction-row is-justify-content-space-around">
|
|
14
|
+
<li
|
|
15
|
+
v-for="theme of Object.keys(themeModes)"
|
|
16
|
+
:title="themeModes[theme].displayName"
|
|
17
|
+
@click="themeMode = theme"
|
|
18
|
+
:class="{'is-active': themeMode === theme}"
|
|
19
|
+
:key="theme"
|
|
20
|
+
>
|
|
21
|
+
<i :class="['fa', themeModes[theme].iconClass]" />
|
|
22
|
+
</li>
|
|
23
|
+
</ul>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
<script>
|
|
28
|
+
export default {
|
|
29
|
+
data() {
|
|
30
|
+
return {
|
|
31
|
+
themeMode: "",
|
|
32
|
+
themeModes: {
|
|
33
|
+
system: {
|
|
34
|
+
displayName: "System Theme",
|
|
35
|
+
iconClass: "fa-desktop",
|
|
36
|
+
},
|
|
37
|
+
light: {
|
|
38
|
+
displayName: "Light Theme",
|
|
39
|
+
iconClass: "fa-sun-o",
|
|
40
|
+
},
|
|
41
|
+
dark: {
|
|
42
|
+
displayName: "Dark Theme",
|
|
43
|
+
iconClass: "fa-moon-o",
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
mounted() {
|
|
50
|
+
// get theme mode from localStorage or set default one
|
|
51
|
+
this.themeMode = localStorage.getItem("themeMode") || "light";
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
destroyed() {
|
|
55
|
+
this.removeColorSchemeEventListener();
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
watch: {
|
|
59
|
+
themeMode: {
|
|
60
|
+
handler(n) {
|
|
61
|
+
this.onThemeModeChange(n);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
methods: {
|
|
67
|
+
// handle theme mode button click
|
|
68
|
+
toggleTheme() {
|
|
69
|
+
if (this.themeMode === "light") this.themeMode = "dark";
|
|
70
|
+
else if (this.themeMode === "dark") this.themeMode = "system";
|
|
71
|
+
else if (this.themeMode === "system") this.themeMode = "light";
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
// triggered when theme mode is updated
|
|
75
|
+
onThemeModeChange(n) {
|
|
76
|
+
localStorage.setItem("themeMode", n);
|
|
77
|
+
|
|
78
|
+
let theme = n;
|
|
79
|
+
if (n === "system") {
|
|
80
|
+
const isDarkMode =
|
|
81
|
+
window.matchMedia &&
|
|
82
|
+
window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
83
|
+
this.addColorSchemeEventListener();
|
|
84
|
+
theme = isDarkMode ? "dark" : "light";
|
|
85
|
+
} else {
|
|
86
|
+
this.removeColorSchemeEventListener();
|
|
87
|
+
}
|
|
88
|
+
this.$emit("set:theme", theme);
|
|
89
|
+
this.handleDarkThemeClass(theme);
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
// add proper css class to update the ui theme
|
|
93
|
+
handleDarkThemeClass(currentTheme) {
|
|
94
|
+
if (currentTheme === "light") {
|
|
95
|
+
document.documentElement.classList.remove("is-dark-theme");
|
|
96
|
+
} else {
|
|
97
|
+
document.documentElement.classList.add("is-dark-theme");
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
// add system theme listener event
|
|
102
|
+
addColorSchemeEventListener() {
|
|
103
|
+
window
|
|
104
|
+
.matchMedia("(prefers-color-scheme: dark)")
|
|
105
|
+
.addEventListener("change", this.handleSystemThemeChange);
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
// remove system theme listener event
|
|
109
|
+
removeColorSchemeEventListener() {
|
|
110
|
+
window
|
|
111
|
+
.matchMedia("(prefers-color-scheme: dark)")
|
|
112
|
+
.removeEventListener("change", this.handleSystemThemeChange);
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
handleSystemThemeChange() {
|
|
116
|
+
this.onThemeModeChange(this.themeMode);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
</script>
|
|
@@ -7,31 +7,130 @@
|
|
|
7
7
|
<img :src="user.avatar_url" alt="User Photo" />
|
|
8
8
|
</div>
|
|
9
9
|
</button>
|
|
10
|
-
<navbar-item-content>
|
|
11
|
-
<div
|
|
10
|
+
<navbar-item-content class="navbar-dropdown-wrapper">
|
|
11
|
+
<div
|
|
12
|
+
v-if="user.username"
|
|
13
|
+
class="user-profile-wrapper"
|
|
14
|
+
@mouseleave="onMouseLeave()"
|
|
15
|
+
>
|
|
12
16
|
<div class="profile-area">
|
|
13
17
|
<div class="profile-photo">
|
|
14
|
-
<img
|
|
18
|
+
<img
|
|
19
|
+
:src="user.avatar_url"
|
|
20
|
+
alt="User Photo"
|
|
21
|
+
class="width-50 height-50"
|
|
22
|
+
/>
|
|
15
23
|
<button class="camera-icon"></button>
|
|
16
24
|
</div>
|
|
17
|
-
<div class="profile-info">
|
|
18
|
-
<
|
|
25
|
+
<div class="profile-info" style="width: calc(100% - 60px)">
|
|
26
|
+
<a
|
|
27
|
+
:href="`${serverDomain}/${user.username}`"
|
|
28
|
+
:title="user.username.toUpperCase()"
|
|
29
|
+
class="line-break-anywhere is-ellipsis-1"
|
|
30
|
+
>{{ user.username.toUpperCase() }}</a
|
|
31
|
+
>
|
|
19
32
|
<a :href="`mailto:${user.email}`"> {{ user.email }}</a>
|
|
20
33
|
</div>
|
|
21
34
|
</div>
|
|
22
|
-
<ul>
|
|
23
|
-
<li>
|
|
35
|
+
<transition-group name="list" tag="ul">
|
|
36
|
+
<li key="settings">
|
|
24
37
|
<a :href="`${serverDomain}/user/settings/`">Settings</a>
|
|
25
38
|
</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>
|
|
39
|
+
<li v-if="isLoggedinUserAdmin" key="site-admin">
|
|
40
|
+
<a :href="`${accountsDomain}/admin`">Site Administration</a>
|
|
33
41
|
</li>
|
|
34
|
-
|
|
42
|
+
<li
|
|
43
|
+
v-if="showAccountSwitcher"
|
|
44
|
+
:class="`is-${dropDownStatus}`"
|
|
45
|
+
key="switcher"
|
|
46
|
+
>
|
|
47
|
+
<a
|
|
48
|
+
class="
|
|
49
|
+
ac-dropdown-button
|
|
50
|
+
is-fullwidth
|
|
51
|
+
is-flex
|
|
52
|
+
is-justify-content-space-between
|
|
53
|
+
is-align-items-center
|
|
54
|
+
"
|
|
55
|
+
@click="toggleList()"
|
|
56
|
+
>
|
|
57
|
+
<span>Switch Account</span>
|
|
58
|
+
<span
|
|
59
|
+
><i
|
|
60
|
+
:class="
|
|
61
|
+
`fa fa-angle-${dropDownStatus === 'open' ? 'up' : 'down'}`
|
|
62
|
+
"
|
|
63
|
+
></i
|
|
64
|
+
></span>
|
|
65
|
+
</a>
|
|
66
|
+
<transition-group
|
|
67
|
+
name="list"
|
|
68
|
+
tag="ul"
|
|
69
|
+
class="ac-vscrollbar"
|
|
70
|
+
ref="dropdownItems"
|
|
71
|
+
:style="{ maxHeight: dropDownSectionHeight }"
|
|
72
|
+
>
|
|
73
|
+
<li
|
|
74
|
+
v-for="(org, idx) in formattedOrganizations"
|
|
75
|
+
:key="org.username"
|
|
76
|
+
>
|
|
77
|
+
<a
|
|
78
|
+
class="is-flex is-align-items-center"
|
|
79
|
+
@click="onOrganizationClick(org.username)"
|
|
80
|
+
>
|
|
81
|
+
<div class="width-30 height-30 image">
|
|
82
|
+
<img
|
|
83
|
+
:src="org.avatar_url"
|
|
84
|
+
class="ac-user-profile is-rounded"
|
|
85
|
+
alt="icon"
|
|
86
|
+
/>
|
|
87
|
+
</div>
|
|
88
|
+
<div
|
|
89
|
+
class="
|
|
90
|
+
is-flex
|
|
91
|
+
is-align-items-center
|
|
92
|
+
is-justify-content-space-between
|
|
93
|
+
is-fullwidth
|
|
94
|
+
ml-10
|
|
95
|
+
"
|
|
96
|
+
>
|
|
97
|
+
<div class="org-info">
|
|
98
|
+
<strong
|
|
99
|
+
:title="org.username"
|
|
100
|
+
class="line-break-anywhere is-ellipsis-1"
|
|
101
|
+
>{{ org.username }}</strong
|
|
102
|
+
>
|
|
103
|
+
<p>
|
|
104
|
+
{{
|
|
105
|
+
org.isPersonalAccount
|
|
106
|
+
? "Personal Account"
|
|
107
|
+
: "Organization"
|
|
108
|
+
}}
|
|
109
|
+
</p>
|
|
110
|
+
</div>
|
|
111
|
+
<span
|
|
112
|
+
v-if="idx === 0"
|
|
113
|
+
class="
|
|
114
|
+
material-icons-outlined
|
|
115
|
+
font-size-18
|
|
116
|
+
ml-10
|
|
117
|
+
is-pulled-right
|
|
118
|
+
"
|
|
119
|
+
>
|
|
120
|
+
check
|
|
121
|
+
</span>
|
|
122
|
+
</div>
|
|
123
|
+
</a>
|
|
124
|
+
</li>
|
|
125
|
+
</transition-group>
|
|
126
|
+
</li>
|
|
127
|
+
<li key="dashboard">
|
|
128
|
+
<a :href="`${serverDomain}/dashboard`"> Dashboard </a>
|
|
129
|
+
</li>
|
|
130
|
+
<li key="signout">
|
|
131
|
+
<a :href="`${accountsDomain}/user/logout`"> Sign out </a>
|
|
132
|
+
</li>
|
|
133
|
+
</transition-group>
|
|
35
134
|
</div>
|
|
36
135
|
</navbar-item-content>
|
|
37
136
|
</navbar-item>
|
|
@@ -40,19 +139,103 @@
|
|
|
40
139
|
<script>
|
|
41
140
|
export default {
|
|
42
141
|
props: {
|
|
142
|
+
// active user info
|
|
43
143
|
user: {
|
|
44
144
|
type: Object,
|
|
45
|
-
default: () => ({})
|
|
145
|
+
default: () => ({})
|
|
46
146
|
},
|
|
47
147
|
serverDomain: {
|
|
48
148
|
type: String,
|
|
49
|
-
default: ""
|
|
149
|
+
default: ""
|
|
150
|
+
},
|
|
151
|
+
accountsDomain: {
|
|
152
|
+
type: String,
|
|
153
|
+
default: ""
|
|
50
154
|
},
|
|
155
|
+
showAccountSwitcher: {
|
|
156
|
+
type: Boolean,
|
|
157
|
+
default: false
|
|
158
|
+
},
|
|
159
|
+
// all available organization list including personal account
|
|
160
|
+
organizations: {
|
|
161
|
+
type: Array,
|
|
162
|
+
default: () => []
|
|
163
|
+
},
|
|
164
|
+
isLoggedinUserAdmin: {
|
|
165
|
+
type: Boolean,
|
|
166
|
+
default: false
|
|
167
|
+
}
|
|
51
168
|
},
|
|
52
169
|
|
|
53
170
|
components: {
|
|
54
171
|
NavbarItem: () => import("./NavbarItem.vue"),
|
|
55
|
-
NavbarItemContent: () => import("./NavbarItemContent.vue")
|
|
172
|
+
NavbarItemContent: () => import("./NavbarItemContent.vue")
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
computed: {
|
|
176
|
+
formattedOrganizations() {
|
|
177
|
+
let activeUser;
|
|
178
|
+
const filteredList = this.organizations.filter(item => {
|
|
179
|
+
if (item.username === this.user.username) {
|
|
180
|
+
activeUser = item;
|
|
181
|
+
} else {
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
return false;
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
filteredList.unshift(activeUser);
|
|
188
|
+
|
|
189
|
+
return filteredList || [];
|
|
190
|
+
}
|
|
56
191
|
},
|
|
192
|
+
|
|
193
|
+
data() {
|
|
194
|
+
return {
|
|
195
|
+
dropDownStatus: "close",
|
|
196
|
+
dropDownSectionHeight: null
|
|
197
|
+
};
|
|
198
|
+
},
|
|
199
|
+
|
|
200
|
+
methods: {
|
|
201
|
+
toggleList() {
|
|
202
|
+
this.dropDownStatus = this.dropDownStatus === "open" ? "close" : "open";
|
|
203
|
+
this.$nextTick(() => {
|
|
204
|
+
this.$refs["dropdownItems"].$el.scrollTo(0, 0);
|
|
205
|
+
});
|
|
206
|
+
},
|
|
207
|
+
onOrganizationClick(orgName) {
|
|
208
|
+
this.$refs["dropdownItems"].$el.scrollTo(0, 0);
|
|
209
|
+
this.$emit("activeorg$set", orgName);
|
|
210
|
+
},
|
|
211
|
+
onMouseLeave() {
|
|
212
|
+
this.dropDownStatus = "close";
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
|
|
216
|
+
watch: {
|
|
217
|
+
dropDownStatus: {
|
|
218
|
+
immediate: true,
|
|
219
|
+
handler(n) {
|
|
220
|
+
if (n === "open") {
|
|
221
|
+
this.$nextTick(() => {
|
|
222
|
+
const dropDownUl = this.$refs["dropdownItems"];
|
|
223
|
+
if (dropDownUl)
|
|
224
|
+
this.dropDownSectionHeight = `${dropDownUl.scrollHeight}px`;
|
|
225
|
+
});
|
|
226
|
+
} else {
|
|
227
|
+
this.dropDownSectionHeight = null;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
57
232
|
};
|
|
58
|
-
</script>
|
|
233
|
+
</script>
|
|
234
|
+
<style lang="scss" scoped>
|
|
235
|
+
.ac-vscrollbar {
|
|
236
|
+
overflow: auto !important;
|
|
237
|
+
}
|
|
238
|
+
.line-break-anywhere {
|
|
239
|
+
line-break: anywhere;
|
|
240
|
+
}
|
|
241
|
+
</style>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
class="is-flex is-justify-content-center is-align-items-center is-flex-direction-column"
|
|
3
|
+
class="is-flex is-justify-content-center is-align-items-center is-flex-direction-column ac-preloader"
|
|
4
4
|
style="height: calc(100vh - 200px);"
|
|
5
5
|
>
|
|
6
6
|
<span v-if="showSpinner" class="spinner"></span>
|
|
@@ -15,12 +15,12 @@ export default {
|
|
|
15
15
|
props: {
|
|
16
16
|
showSpinner: {
|
|
17
17
|
type: Boolean,
|
|
18
|
-
default: true
|
|
18
|
+
default: true
|
|
19
19
|
},
|
|
20
20
|
message: {
|
|
21
21
|
type: String,
|
|
22
|
-
default: "
|
|
23
|
-
}
|
|
24
|
-
}
|
|
22
|
+
default: "Loading ..."
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
25
|
};
|
|
26
26
|
</script>
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="is-cluster-logo" v-if="sidebarCollapsed">
|
|
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
|
+
deselectLabel=""
|
|
19
|
+
selectLabel=""
|
|
20
|
+
selectedLabel=""
|
|
21
|
+
>
|
|
22
|
+
<template slot="singleLabel" slot-scope="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 slot="option" slot-scope="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
|
+
export default {
|
|
52
|
+
props: {
|
|
53
|
+
sidebarCollapsed: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: false,
|
|
56
|
+
},
|
|
57
|
+
mouseHover: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: false,
|
|
60
|
+
},
|
|
61
|
+
clusterOptions: {
|
|
62
|
+
type: Array,
|
|
63
|
+
default: [],
|
|
64
|
+
},
|
|
65
|
+
value: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: "",
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
components: {
|
|
72
|
+
Multiselect: () => import("vue-multiselect"),
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
data() {
|
|
76
|
+
return {
|
|
77
|
+
selectedCluster: null,
|
|
78
|
+
selectedClusterName: "",
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
methods: {
|
|
83
|
+
getProviderIcon(provider) {
|
|
84
|
+
return `https://cdn.appscode.com/images/cloud-provider-icons/${provider}.png`;
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
watch: {
|
|
89
|
+
value: {
|
|
90
|
+
immediate: true,
|
|
91
|
+
handler(n) {
|
|
92
|
+
this.selectedClusterName = n;
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
selectedCluster: {
|
|
96
|
+
deep: true,
|
|
97
|
+
handler(n) {
|
|
98
|
+
this.selectedClusterName = n.name;
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
selectedClusterName(n) {
|
|
102
|
+
if (this.selectedCluster && n !== this.selectedCluster.name) {
|
|
103
|
+
this.clusterOptions.forEach((item) => {
|
|
104
|
+
if (this.selectedClusterName === item.name) {
|
|
105
|
+
this.selectedCluster = item;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
this.$emit("input", n);
|
|
110
|
+
},
|
|
111
|
+
clusterOptions: {
|
|
112
|
+
deep: true,
|
|
113
|
+
immediate: true,
|
|
114
|
+
async handler(list) {
|
|
115
|
+
if (list) {
|
|
116
|
+
list.forEach(async (item) => {
|
|
117
|
+
if(item.name === this.selectedClusterName) {
|
|
118
|
+
this.selectedCluster = item;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<li>
|
|
2
|
+
<li ref="sidebarItem">
|
|
3
3
|
<router-link
|
|
4
4
|
:id="id"
|
|
5
5
|
:title="title"
|
|
@@ -38,5 +38,27 @@ export default {
|
|
|
38
38
|
default: "@/assets/images/icons/basic.svg",
|
|
39
39
|
},
|
|
40
40
|
},
|
|
41
|
+
watch: {
|
|
42
|
+
isActive: {
|
|
43
|
+
immediate: true,
|
|
44
|
+
handler(n) {
|
|
45
|
+
if (n) {
|
|
46
|
+
this.$nextTick(() => {
|
|
47
|
+
setTimeout(() => {
|
|
48
|
+
const top = (this.$refs.sidebarItem && this.$refs.sidebarItem.getBoundingClientRect().top) || 0;
|
|
49
|
+
// preventing scroll to options that are already visible
|
|
50
|
+
if (top > window.innerHeight - 200) {
|
|
51
|
+
// scroll to selected option item
|
|
52
|
+
this.$refs.sidebarItem.scrollIntoView({
|
|
53
|
+
behavior: 'smooth',
|
|
54
|
+
block: "center"
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}, 500);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
41
63
|
};
|
|
42
64
|
</script>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
</span>
|
|
11
11
|
</a>
|
|
12
12
|
|
|
13
|
-
<ul
|
|
13
|
+
<ul ref="sectionItems" :style="{ maxHeight: dropDownSectionHeight }">
|
|
14
14
|
<slot />
|
|
15
15
|
</ul>
|
|
16
16
|
</li>
|
|
@@ -23,10 +23,6 @@ export default {
|
|
|
23
23
|
type: Boolean,
|
|
24
24
|
default: false,
|
|
25
25
|
},
|
|
26
|
-
isLoaderActive: {
|
|
27
|
-
type: Boolean,
|
|
28
|
-
default: false,
|
|
29
|
-
},
|
|
30
26
|
title: {
|
|
31
27
|
type: String,
|
|
32
28
|
default: "Sidebar Item",
|
|
@@ -41,27 +37,32 @@ export default {
|
|
|
41
37
|
return {
|
|
42
38
|
dropDownStatus: "close",
|
|
43
39
|
dropDownSectionHeight: null,
|
|
40
|
+
isCompMounted: false,
|
|
44
41
|
};
|
|
45
42
|
},
|
|
46
43
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
mounted() {
|
|
45
|
+
this.isCompMounted = true;
|
|
46
|
+
setTimeout(() => {
|
|
47
|
+
// for expanding dropdown
|
|
48
|
+
if (this.isDropDownOpen) {
|
|
49
|
+
this.setDropdownMaxHeight("open");
|
|
50
|
+
} else {
|
|
51
|
+
this.setDropdownMaxHeight("close");
|
|
54
52
|
}
|
|
55
|
-
},
|
|
53
|
+
}, 700);
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
watch: {
|
|
56
57
|
title(n, o) {
|
|
57
|
-
if (n &&
|
|
58
|
+
if (n && this.isCompMounted) {
|
|
58
59
|
this.$nextTick(() => {
|
|
59
60
|
// for expanding dropdown
|
|
60
61
|
this.setDropdownMaxHeight("open");
|
|
61
62
|
});
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
if (o &&
|
|
65
|
+
if (o && this.isCompMounted) {
|
|
65
66
|
this.$nextTick(() => {
|
|
66
67
|
// for expanding dropdown
|
|
67
68
|
this.setDropdownMaxHeight("close");
|
|
@@ -84,7 +85,7 @@ export default {
|
|
|
84
85
|
this.$emit("dropDownItemChange");
|
|
85
86
|
|
|
86
87
|
this.$nextTick(() => {
|
|
87
|
-
const dropDownUl = this.$refs[
|
|
88
|
+
const dropDownUl = this.$refs["sectionItems"];
|
|
88
89
|
if (dropDownUl)
|
|
89
90
|
this.dropDownSectionHeight = `${dropDownUl.scrollHeight}px`;
|
|
90
91
|
});
|
|
@@ -99,11 +100,9 @@ export default {
|
|
|
99
100
|
methods: {
|
|
100
101
|
setDropdownMaxHeight(mode) {
|
|
101
102
|
if (mode === "open") {
|
|
102
|
-
this
|
|
103
|
-
this.$refs[this.title][0].scrollHeight
|
|
104
|
-
}px`;
|
|
103
|
+
this.dropDownSectionHeight = `${this.$refs["sectionItems"].scrollHeight}px`;
|
|
105
104
|
} else {
|
|
106
|
-
this
|
|
105
|
+
this.dropDownSectionHeight = null;
|
|
107
106
|
}
|
|
108
107
|
},
|
|
109
108
|
toggleDropDownStatus() {
|