update routesMap

This commit is contained in:
Qiuxia Fan 2022-03-23 13:00:31 +08:00
parent 92f142d9e1
commit 4fe4f83111
2 changed files with 14 additions and 56 deletions

View File

@ -73,7 +73,6 @@ export const dashboardStore = defineStore({
sessionStorage.setItem("dashboards", JSON.stringify(list));
},
setCurrentDashboard(item: DashboardItem) {
console.log(item);
this.currentDashboard = item;
},
addControl(type: string) {

View File

@ -32,25 +32,25 @@ const route = useRoute();
const { t } = useI18n();
const appStore = useAppStoreWithOut();
const dashboardStore = useDashboardStore();
const routeNames = [
"GeneralServices",
"Database",
"MeshServices",
"ControlPanel",
"DataPanel",
"Linux",
"SkyWalkingServer",
"Satellite",
"Functions",
"Browser",
"Kubernetes",
];
const routesMap: { [key: string]: string } = {
GeneralServices: "GENERAL",
Database: "VIRTUAL_DATABASE",
MESH: "MESH",
ControlPanel: "MESH_CP",
DataPanel: "MESH_DP",
Linux: "OS_LINUX",
SkyWalkingServer: "SO11Y_OAP",
Satellite: "SO11Y_SATELLITE",
Functions: "FAAS",
Browser: "BROWSER",
Kubernetes: "K8S",
};
const layer = ref<string>("GENERAL");
getDashboard();
async function getDashboard() {
setLayer(String(route.name));
layer.value = routesMap[String(route.name)];
dashboardStore.setLayer(layer.value);
dashboardStore.setEntity(EntityType[1].value);
dashboardStore.setMode(false);
@ -69,47 +69,6 @@ async function getDashboard() {
const item = dashboardStore.dashboards[index];
dashboardStore.setCurrentDashboard(item);
}
function setLayer(n: string) {
switch (n) {
case routeNames[0]:
layer.value = "GENERAL";
break;
case routeNames[1]:
layer.value = "VIRTUAL_DATABASE";
break;
case routeNames[2]:
layer.value = "MESH";
break;
case routeNames[3]:
layer.value = "MESH_CP";
break;
case routeNames[4]:
layer.value = "MESH_DP";
break;
case routeNames[5]:
layer.value = "OS_LINUX";
break;
case routeNames[6]:
layer.value = "SO11Y_OAP";
break;
case routeNames[7]:
layer.value = "SO11Y_SATELLITE";
break;
case routeNames[8]:
layer.value = "FAAS";
break;
case routeNames[9]:
layer.value = "BROWSER";
break;
case routeNames[10]:
layer.value = "K8S";
break;
default:
layer.value = "GENERAL";
break;
}
}
</script>
<style lang="scss" scoped>
.no-root {