@appscode/design-system 2.2.37 → 2.2.39

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appscode/design-system",
3
- "version": "2.2.37",
3
+ "version": "2.2.39",
4
4
  "description": "A design system for Appscode websites and dashboards made using Bulma",
5
5
  "main": "main.scss",
6
6
  "scripts": {
@@ -1,90 +1,28 @@
1
- <template>
2
- <div
3
- ref="multiselectDivId"
4
- class="multi-select-wrapper"
5
- :class="{
6
- multiselectCustomClass,
7
- 'has-refresh-button': hasRefreshBtn,
8
- 'is-disable': disabled || isLoaderActive,
9
- 'has-clear-button': allowEmpty && model,
10
- }"
11
- data-testid="cluster-status-select-header"
12
- >
13
- <label
14
- v-if="label.length"
15
- :class="{ 'show-label': isLabelHoisted }"
16
- data-testid="ac-multiselect-label"
17
- @click.prevent="onClickLabel"
18
- >
19
- {{ isLabelHoisted ? label : `Select ${label}` }}
20
- <span v-if="showStar" class="is-required has-text-danger"> * </span>
21
- </label>
22
- <button v-if="allowEmpty && model" class="button ac-button is-clear is-transparent" @click.prevent="model = ''">
23
- <i class="fa fa-times" />
24
- </button>
25
- <button
26
- v-if="hasRefreshBtn"
27
- class="button ac-button is-primary is-refresh is-transparent"
28
- :class="{ spin: isLoaderActive }"
29
- @click.prevent="$emit('refresh-btn-click')"
30
- >
31
- <i class="fa fa-refresh" />
32
- </button>
33
- <multiselect
34
- ref="multiselectElement"
35
- v-model="model"
36
- :track-by="trackBy"
37
- :label="showBy"
38
- :class="multiselectCustomClass"
39
- :options="options"
40
- :placeholder="placeholderText"
41
- :disabled="disabled || isLoaderActive"
42
- :allow-empty="false"
43
- :show-labels="false"
44
- :close-on-select="true"
45
- :open-direction="openDirection"
46
- :group-values="groupValues"
47
- :group-label="groupLabel"
48
- :group-select="groupSelect"
49
- data-testid="simple-select-box"
50
- @open="openDropDown"
51
- @close="closeDropDown"
52
- @select="onSelect"
53
- @remove="onRemove"
54
- >
55
- <template #noResult>
56
- <span> {{ noResultText }} </span>
57
- </template>
58
- </multiselect>
59
- <p v-show="errorMsg" class="is-danger">
60
- {{ errorMsg }}
61
- </p>
62
- </div>
63
- </template>
64
1
  <script setup lang="ts">
65
2
  import { computed, ref } from "vue";
3
+ import type { ComponentPublicInstance } from "vue";
66
4
  import Multiselect from "vue-multiselect";
67
5
 
68
6
  interface Props {
69
- errorMsg: string;
70
- placeholderText: string;
71
- disabled: boolean;
72
- label: string;
73
- allowEmpty: boolean;
74
- options: unknown[];
75
- trackBy: string;
76
- showBy: string;
77
- closeOnSelect: boolean;
78
- hasRefreshBtn: boolean;
79
- isLoaderActive: boolean;
80
- noResultText: string;
81
- showStar: boolean;
82
- wrapperDivCustomClass: string;
83
- multiselectCustomClass: string;
84
- openDirection: "top" | "bottom";
85
- groupLabel: string;
86
- groupValues: string;
87
- groupSelect: boolean;
7
+ errorMsg?: string;
8
+ placeholderText?: string;
9
+ disabled?: boolean;
10
+ label?: string;
11
+ allowEmpty?: boolean;
12
+ options?: unknown[];
13
+ trackBy?: string;
14
+ showBy?: string;
15
+ closeOnSelect?: boolean;
16
+ hasRefreshBtn?: boolean;
17
+ isLoaderActive?: boolean;
18
+ noResultText?: string;
19
+ showStar?: boolean;
20
+ wrapperDivCustomClass?: string;
21
+ multiselectCustomClass?: string;
22
+ openDirection?: "top" | "bottom";
23
+ groupLabel?: string;
24
+ groupValues?: string;
25
+ groupSelect?: boolean;
88
26
  }
89
27
 
90
28
  const props = withDefaults(defineProps<Props>(), {
@@ -111,7 +49,7 @@ const props = withDefaults(defineProps<Props>(), {
111
49
 
112
50
  const emit = defineEmits(["select", "remove", "refresh-btn-click"]);
113
51
 
114
- const multiselectElement = ref<HTMLInputElement | null>(null);
52
+ const multiselectElement = ref<ComponentPublicInstance | null>(null);
115
53
  const multiselectDivId = ref<HTMLInputElement | null>(null);
116
54
 
117
55
  const model = defineModel<unknown>({ required: true });
@@ -122,8 +60,9 @@ const isLabelHoisted = computed(() => {
122
60
  });
123
61
 
124
62
  const onClickLabel = () => {
63
+ openDropDown();
125
64
  if (multiselectElement.value) {
126
- multiselectDivId.value?.focus();
65
+ multiselectElement.value.$el.focus();
127
66
  }
128
67
  };
129
68
 
@@ -145,3 +84,67 @@ const onRemove = (removedOption: unknown, id: string) => emit("remove", removedO
145
84
 
146
85
  const onSelect = (selectedOption: unknown, id: string) => emit("select", selectedOption, id);
147
86
  </script>
87
+
88
+ <template>
89
+ <div
90
+ ref="multiselectDivId"
91
+ class="multi-select-wrapper"
92
+ :class="{
93
+ multiselectCustomClass,
94
+ 'has-refresh-button': hasRefreshBtn,
95
+ 'is-disable': disabled || isLoaderActive,
96
+ 'has-clear-button': allowEmpty && model,
97
+ }"
98
+ data-testid="cluster-status-select-header"
99
+ >
100
+ <label
101
+ v-if="label.length"
102
+ :class="{ 'show-label': isLabelHoisted }"
103
+ data-testid="ac-multiselect-label"
104
+ @click.prevent="onClickLabel"
105
+ >
106
+ {{ isLabelHoisted ? label : `Select ${label}` }}
107
+ <span v-if="showStar" class="is-required has-text-danger"> * </span>
108
+ </label>
109
+ <button v-if="allowEmpty && model" class="button ac-button is-clear is-transparent" @click.prevent="model = ''">
110
+ <i class="fa fa-times" />
111
+ </button>
112
+ <button
113
+ v-if="hasRefreshBtn"
114
+ class="button ac-button is-primary is-refresh is-transparent"
115
+ :class="{ spin: isLoaderActive }"
116
+ @click.prevent="$emit('refresh-btn-click')"
117
+ >
118
+ <i class="fa fa-refresh" />
119
+ </button>
120
+ <multiselect
121
+ ref="multiselectElement"
122
+ v-model="model"
123
+ :track-by="trackBy"
124
+ :label="showBy"
125
+ :class="multiselectCustomClass"
126
+ :options="options"
127
+ :placeholder="placeholderText"
128
+ :disabled="disabled || isLoaderActive"
129
+ :allow-empty="false"
130
+ :show-labels="false"
131
+ :close-on-select="true"
132
+ :open-direction="openDirection"
133
+ :group-values="groupValues"
134
+ :group-label="groupLabel"
135
+ :group-select="groupSelect"
136
+ data-testid="simple-select-box"
137
+ @open="openDropDown"
138
+ @close="closeDropDown"
139
+ @select="onSelect"
140
+ @remove="onRemove"
141
+ >
142
+ <template #noResult>
143
+ <span> {{ noResultText }} </span>
144
+ </template>
145
+ </multiselect>
146
+ <p v-show="errorMsg" class="is-danger">
147
+ {{ errorMsg }}
148
+ </p>
149
+ </div>
150
+ </template>
@@ -1,20 +1,61 @@
1
1
  <script setup lang="ts">
2
- import { defineAsyncComponent, ref } from "vue";
3
- interface app {
4
- url: string;
5
- icon_url: string;
6
- title: string;
7
- sub_title: string;
8
- }
2
+ import { computed, defineAsyncComponent, ref } from "vue";
9
3
 
10
4
  interface Props {
11
- apps?: Array<app>;
5
+ currentApp: "console" | "db" | "platform" | "billing" | "selfhost" | "learn" | "grafana";
6
+ baseUrl: string;
12
7
  }
13
8
 
14
- withDefaults(defineProps<Props>(), {
15
- apps: () => [],
9
+ const props = withDefaults(defineProps<Props>(), {
10
+ currentApp: "platform",
11
+ baseUrl: "https://appscode.com",
16
12
  });
17
13
 
14
+ const appList = [
15
+ {
16
+ name: "console",
17
+ icon_url: "https://cdn.appscode.com/images/products/console/console_512x512.svg",
18
+ title: "Console",
19
+ port: "5990",
20
+ sub_title: "Manage your kubernetes clusters",
21
+ },
22
+ {
23
+ name: "db",
24
+ icon_url: "https://cdn.appscode.com/images/products/kubedb/kubedb-512x512_1.svg",
25
+ title: "KubeDB",
26
+ port: "5996",
27
+ sub_title: "Manage your databases",
28
+ },
29
+ {
30
+ name: "grafana",
31
+ icon_url: "https://cdn.appscode.com/images/products/others/logos/grafana.svg",
32
+ title: "Grafana",
33
+ port: "3005",
34
+ sub_title: "Analyze your activities",
35
+ },
36
+ {
37
+ name: "selfhost",
38
+ icon_url: "https://cdn.appscode.com/images/products/selfhost/logos/selfhost.svg",
39
+ title: "SelfHost",
40
+ port: "5993",
41
+ sub_title: "Host AppsCode on your own cluster",
42
+ },
43
+ {
44
+ name: "billing",
45
+ icon_url: "https://cdn.appscode.com/images/products/billing/logos/billing.svg",
46
+ title: "Billing",
47
+ port: "5995",
48
+ sub_title: "Manage your contracts, licenses & billings",
49
+ },
50
+ {
51
+ name: "learn",
52
+ icon_url: "https://cdn.appscode.com/images/products/learn/logos/learn.svg",
53
+ title: "Learn",
54
+ port: "5988",
55
+ sub_title: "Be an Expert in Cloud Native technologies",
56
+ },
57
+ ];
58
+
18
59
  const NavbarItem = defineAsyncComponent(() => import("./NavbarItem.vue"));
19
60
  const NavbarItemContent = defineAsyncComponent(() => import("./NavbarItemContent.vue"));
20
61
  const showDrawer = ref(false);
@@ -22,6 +63,39 @@ const showDrawer = ref(false);
22
63
  function handleIsActiveChange(isActive: string) {
23
64
  showDrawer.value = !!isActive?.length;
24
65
  }
66
+
67
+ const getUrl = (product: (typeof appList)[0]) => {
68
+ if (props.baseUrl.search("bb.test") !== -1) {
69
+ return `http://bb.test:${product.port}/${product.name}`;
70
+ } else if (props.baseUrl.search("localhost") !== -1) {
71
+ return `http://localhost:${product.port}/${product.name}`;
72
+ }
73
+
74
+ return `${props.baseUrl}/${product.name}`;
75
+ };
76
+
77
+ const appListWithUrl = appList.map((el) => {
78
+ return {
79
+ ...el,
80
+ url: getUrl(el),
81
+ };
82
+ });
83
+
84
+ const isSelfHosted = computed(() => {
85
+ const list = ["https://appscode.ninja", "https://appscode.com", "http://bb.test:8080"];
86
+ return !list.includes(props.baseUrl);
87
+ });
88
+
89
+ const filteredAppList = appListWithUrl.filter((element) => {
90
+ // remove own app from dropdown
91
+ if (element.name === props.currentApp) return false;
92
+
93
+ // remove billing selfhost & learn from selfhost mode
94
+ let selfHostList = ["billing", "selfhost", "learn"];
95
+ if (isSelfHosted.value && selfHostList.includes(element.name)) return false;
96
+
97
+ return true;
98
+ });
25
99
  </script>
26
100
 
27
101
  <template>
@@ -63,7 +137,7 @@ function handleIsActiveChange(isActive: string) {
63
137
  <div v-if="showDrawer">
64
138
  <navbar-item-content class="navbar-dropdown-wrapper" style="right: -30px">
65
139
  <ul class="ac-scrollbar p-0 app-drawer">
66
- <li v-for="app in apps" :key="app.url">
140
+ <li v-for="app in filteredAppList" :key="app.url">
67
141
  <a :href="app.url">
68
142
  <article class="media">
69
143
  <figure class="media-left">
@@ -1,175 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed, defineAsyncComponent, ref } from "vue";
3
-
4
- interface Props {
5
- currentApp: "console" | "db" | "platform" | "billing" | "selfhost" | "learn" | "grafana";
6
- baseUrl: string;
7
- }
8
-
9
- const props = withDefaults(defineProps<Props>(), {
10
- currentApp: "platform",
11
- baseUrl: "https://appscode.com",
12
- });
13
-
14
- const appList = [
15
- {
16
- name: "console",
17
- icon_url: "https://cdn.appscode.com/images/products/console/console_512x512.svg",
18
- title: "Console",
19
- port: "5990",
20
- sub_title: "Manage your kubernetes clusters",
21
- },
22
- {
23
- name: "db",
24
- icon_url: "https://cdn.appscode.com/images/products/kubedb/kubedb-512x512_1.svg",
25
- title: "KubeDB",
26
- port: "5996",
27
- sub_title: "Manage your databases",
28
- },
29
- {
30
- name: "grafana",
31
- icon_url: "https://cdn.appscode.com/images/products/others/logos/grafana.svg",
32
- title: "Grafana",
33
- port: "3005",
34
- sub_title: "Analyze your activities",
35
- },
36
- {
37
- name: "selfhost",
38
- icon_url: "https://cdn.appscode.com/images/products/selfhost/logos/selfhost.svg",
39
- title: "SelfHost",
40
- port: "5993",
41
- sub_title: "Host AppsCode on your own cluster",
42
- },
43
- {
44
- name: "billing",
45
- icon_url: "https://cdn.appscode.com/images/products/billing/logos/billing.svg",
46
- title: "Billing",
47
- sub_title: "Manage your contracts, licenses & billings",
48
- },
49
- {
50
- name: "learn",
51
- icon_url: "https://cdn.appscode.com/images/products/learn/logos/learn.svg",
52
- title: "Learn",
53
- sub_title: "Be an Expert in Cloud Native technologies",
54
- },
55
- ];
56
-
57
- const NavbarItem = defineAsyncComponent(() => import("./NavbarItem.vue"));
58
- const NavbarItemContent = defineAsyncComponent(() => import("./NavbarItemContent.vue"));
59
- const showDrawer = ref(false);
60
-
61
- function handleIsActiveChange(isActive: string) {
62
- showDrawer.value = !!isActive?.length;
63
- }
64
-
65
- const getUrl = (product: (typeof appList)[0]) => {
66
- if (props.baseUrl.search("bb.test") !== -1) {
67
- return `http://bb.test:${product.port}/${product.name}`;
68
- } else if (props.baseUrl.search("localhost") !== -1) {
69
- return `http://localhost:${product.port}/${product.name}`;
70
- }
71
-
72
- return `${props.baseUrl}/${product.name}`;
73
- };
74
-
75
- const appListWithUrl = appList.map((el) => {
76
- return {
77
- ...el,
78
- url: getUrl(el),
79
- };
80
- });
81
-
82
- const isSelfHosted = computed(() => {
83
- const list = ["https://appscode.ninja", "https://appscode.com", "http://bb.test:8080"];
84
- return !list.includes(props.baseUrl);
85
- });
86
-
87
- const filteredAppList = appListWithUrl.filter((element) => {
88
- // remove own app from dropdown
89
- if (element.name === props.currentApp) return false;
90
-
91
- // remove billing selfhost & learn from selfhost mode
92
- let selfHostList = ["billing", "selfhost", "learn"];
93
- if (isSelfHosted.value && selfHostList.includes(element.name)) return false;
94
-
95
- return true;
96
- });
97
- </script>
98
-
99
- <template>
100
- <navbar-item @on-is-active-change="handleIsActiveChange">
101
- <template #navbar-item>
102
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
103
- <path
104
- d="M6.66667 2H2V6.66667H6.66667V2Z"
105
- stroke="#061B2D"
106
- stroke-width="1.5"
107
- stroke-linecap="round"
108
- stroke-linejoin="round"
109
- />
110
- <path
111
- d="M14 2H9.33337V6.66667H14V2Z"
112
- stroke="#061B2D"
113
- stroke-width="1.5"
114
- stroke-linecap="round"
115
- stroke-linejoin="round"
116
- />
117
- <path
118
- d="M14 9.33334H9.33337V14H14V9.33334Z"
119
- stroke="#061B2D"
120
- stroke-width="1.5"
121
- stroke-linecap="round"
122
- stroke-linejoin="round"
123
- />
124
- <path
125
- d="M6.66667 9.33334H2V14H6.66667V9.33334Z"
126
- stroke="#061B2D"
127
- stroke-width="1.5"
128
- stroke-linecap="round"
129
- stroke-linejoin="round"
130
- />
131
- </svg>
132
- </template>
133
- <template #navbar-content>
134
- <transition>
135
- <div v-if="showDrawer">
136
- <navbar-item-content class="navbar-dropdown-wrapper" style="right: -30px">
137
- <ul class="ac-scrollbar p-0 app-drawer">
138
- <li v-for="app in filteredAppList" :key="app.url">
139
- <a :href="app.url">
140
- <article class="media">
141
- <figure class="media-left">
142
- <p class="image">
143
- <img :src="app.icon_url" />
144
- </p>
145
- </figure>
146
- <div class="media-content">
147
- <div class="content">
148
- <p>
149
- <strong>{{ app.title }}</strong>
150
- <span>{{ app.sub_title }}</span>
151
- </p>
152
- </div>
153
- </div>
154
- </article>
155
- </a>
156
- </li>
157
- </ul>
158
- </navbar-item-content>
159
- </div>
160
- </transition>
161
- </template>
162
- </navbar-item>
163
- </template>
164
-
165
- <style scoped>
166
- .v-enter-active,
167
- .v-leave-active {
168
- transition: opacity 0.5s ease;
169
- }
170
-
171
- .v-enter-from,
172
- .v-leave-to {
173
- opacity: 0;
174
- }
175
- </style>