@appscode/design-system 2.17.85 → 2.17.87
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
|
@@ -21,7 +21,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
21
21
|
isOfflineInstaller: false,
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
const
|
|
24
|
+
const baseAppList = [
|
|
25
25
|
{
|
|
26
26
|
name: "id",
|
|
27
27
|
icon_url: "https://cdn.appscode.com/images/products/platform/platform.svg",
|
|
@@ -73,15 +73,21 @@ const appList = [
|
|
|
73
73
|
},
|
|
74
74
|
];
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
76
|
+
const appList = computed(() => {
|
|
77
|
+
const list = [...baseAppList];
|
|
78
|
+
|
|
79
|
+
if (props.activeOrgType !== 3) {
|
|
80
|
+
list.splice(1, 0, {
|
|
81
|
+
name: "console",
|
|
82
|
+
icon_url: "https://cdn.appscode.com/images/products/console/console_512x512.svg",
|
|
83
|
+
title: "Console",
|
|
84
|
+
port: "5990",
|
|
85
|
+
sub_title: "Manage your kubernetes clusters",
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return list;
|
|
90
|
+
});
|
|
85
91
|
|
|
86
92
|
const NavbarItem = defineAsyncComponent(() => import("./NavbarItem.vue"));
|
|
87
93
|
const NavbarItemContent = defineAsyncComponent(() => import("./NavbarItemContent.vue"));
|
|
@@ -91,7 +97,7 @@ function handleIsActiveChange(isActive: string) {
|
|
|
91
97
|
showDrawer.value = !!isActive?.length;
|
|
92
98
|
}
|
|
93
99
|
|
|
94
|
-
const getUrl = (product: (typeof
|
|
100
|
+
const getUrl = (product: (typeof baseAppList)[0]) => {
|
|
95
101
|
if (props.baseUrl.search("bb.test") !== -1) {
|
|
96
102
|
return `http://bb.test:${product.port}/${product.name}/`;
|
|
97
103
|
} else if (props.baseUrl.search("localhost") !== -1) {
|
|
@@ -101,32 +107,36 @@ const getUrl = (product: (typeof appList)[0]) => {
|
|
|
101
107
|
return `${props.baseUrl}/${product.name}/`;
|
|
102
108
|
};
|
|
103
109
|
|
|
104
|
-
const appListWithUrl =
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
+
const appListWithUrl = computed(() =>
|
|
111
|
+
appList.value.map((el) => {
|
|
112
|
+
return {
|
|
113
|
+
...el,
|
|
114
|
+
url: getUrl(el),
|
|
115
|
+
};
|
|
116
|
+
}),
|
|
117
|
+
);
|
|
110
118
|
|
|
111
119
|
const isSelfHosted = computed(() => {
|
|
112
120
|
const list = ["https://appscode.ninja", "https://appscode.com", "http://bb.test:8080"];
|
|
113
121
|
return !list.includes(props.baseUrl);
|
|
114
122
|
});
|
|
115
123
|
|
|
116
|
-
const filteredAppList =
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if (
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
124
|
+
const filteredAppList = computed(() =>
|
|
125
|
+
appListWithUrl.value.filter((element) => {
|
|
126
|
+
// remove own app from dropdown
|
|
127
|
+
if (element.name === props.currentApp) return false;
|
|
128
|
+
|
|
129
|
+
// remove billing selfhost & learn from selfhost mode
|
|
130
|
+
// but always keep billing when this is an offline installer
|
|
131
|
+
const selfHostList = ["billing", "selfhost", "learn"];
|
|
132
|
+
if (isSelfHosted.value && selfHostList.includes(element.name)) {
|
|
133
|
+
if (element.name === "billing" && props.isOfflineInstaller && props.activeOrgType === 6) return true;
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return true;
|
|
138
|
+
}),
|
|
139
|
+
);
|
|
130
140
|
|
|
131
141
|
const handleClick = (name: string) => {
|
|
132
142
|
if (name === "grafana") setCookie("gorg", props.activeOrganization, { domain: props.rootDomain });
|
|
@@ -29,9 +29,30 @@ const themeModes = ref<ThemeModes>({
|
|
|
29
29
|
|
|
30
30
|
const emit = defineEmits(["set:theme"]);
|
|
31
31
|
|
|
32
|
+
// localStorage throws when the origin's quota is full, and when storage is
|
|
33
|
+
// unreachable altogether (private browsing, sandboxed iframe, blocked site
|
|
34
|
+
// data, server-side render). Remembering the theme is a convenience, so a
|
|
35
|
+
// failure must never stop the theme from being read or applied.
|
|
36
|
+
const readThemeMode = (): string | null => {
|
|
37
|
+
try {
|
|
38
|
+
return localStorage.getItem("themeMode");
|
|
39
|
+
} catch {
|
|
40
|
+
// no stored preference available
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const persistThemeMode = (mode: string) => {
|
|
46
|
+
try {
|
|
47
|
+
localStorage.setItem("themeMode", mode);
|
|
48
|
+
} catch {
|
|
49
|
+
// not remembered across reloads, but it still applies for this session
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
32
53
|
onMounted(() => {
|
|
33
54
|
// get theme mode from localStorage or set default one
|
|
34
|
-
themeMode.value =
|
|
55
|
+
themeMode.value = readThemeMode() || "light";
|
|
35
56
|
});
|
|
36
57
|
|
|
37
58
|
onUnmounted(() => {
|
|
@@ -39,7 +60,7 @@ onUnmounted(() => {
|
|
|
39
60
|
});
|
|
40
61
|
|
|
41
62
|
const onThemeModeChange = (n: string) => {
|
|
42
|
-
|
|
63
|
+
persistThemeMode(n);
|
|
43
64
|
|
|
44
65
|
let theme = n;
|
|
45
66
|
if (n === "system") {
|