This commit is contained in:
Qiuxia Fan 2022-04-01 21:00:41 +08:00
parent 1e3152ad1d
commit b854b86ab4

View File

@ -15,7 +15,7 @@ limitations under the License. -->
<template> <template>
<div class="dashboard-tool flex-h"> <div class="dashboard-tool flex-h">
<div class="flex-h"> <div class="flex-h">
<div class="selectors-item" v-if="states.key !== 10"> <div class="selectors-item" v-if="key !== 10">
<span class="label">$Service</span> <span class="label">$Service</span>
<Selector <Selector
v-model="states.currentService" v-model="states.currentService"
@ -26,7 +26,7 @@ limitations under the License. -->
class="selectors" class="selectors"
/> />
</div> </div>
<div class="selectors-item" v-if="states.key === 3 || states.key === 4"> <div class="selectors-item" v-if="key === 3 || key === 4">
<span class="label"> <span class="label">
{{ {{
["EndpointRelation", "Endpoint"].includes(dashboardStore.entity) ["EndpointRelation", "Endpoint"].includes(dashboardStore.entity)
@ -47,7 +47,7 @@ limitations under the License. -->
" "
/> />
</div> </div>
<div class="selectors-item" v-if="states.key === 2 || states.key === 4"> <div class="selectors-item" v-if="key === 2 || key === 4">
<span class="label">$DestinationService</span> <span class="label">$DestinationService</span>
<Selector <Selector
v-model="states.currentDestService" v-model="states.currentDestService"
@ -58,7 +58,7 @@ limitations under the License. -->
class="selectors" class="selectors"
/> />
</div> </div>
<div class="selectors-item" v-if="states.key === 4"> <div class="selectors-item" v-if="key === 4">
<span class="label"> <span class="label">
{{ {{
dashboardStore.entity === "EndpointRelation" dashboardStore.entity === "EndpointRelation"
@ -120,7 +120,7 @@ limitations under the License. -->
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { reactive, ref } from "vue"; import { reactive, ref, computed } from "vue";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import { useDashboardStore } from "@/store/modules/dashboard"; import { useDashboardStore } from "@/store/modules/dashboard";
import { useAppStoreWithOut } from "@/store/modules/app"; import { useAppStoreWithOut } from "@/store/modules/app";
@ -165,6 +165,13 @@ const states = reactive<{
currentDestService: "", currentDestService: "",
currentDestPod: "", currentDestPod: "",
}); });
const key = computed(() => {
const type = EntityType.filter(
(d: Option) => d.value === dashboardStore.entity
)[0];
return (type && type.key) || 0;
});
setCurrentDashboard(); setCurrentDashboard();
appStore.setEventStack([initSelector]); appStore.setEventStack([initSelector]);
@ -184,10 +191,6 @@ function setCurrentDashboard() {
dashboardStore.setLayer(params.layerId); dashboardStore.setLayer(params.layerId);
dashboardStore.setEntity(params.entity); dashboardStore.setEntity(params.entity);
} }
const type = EntityType.filter(
(d: Option) => d.value === dashboardStore.entity
)[0];
states.key = (type && type.key) || 0;
} }
async function setSelector() { async function setSelector() {