@appscode/design-system 2.2.37 → 2.2.38

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.38",
4
4
  "description": "A design system for Appscode websites and dashboards made using Bulma",
5
5
  "main": "main.scss",
6
6
  "scripts": {
@@ -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>