feat: add router for dashboard

This commit is contained in:
Qiuxia Fan
2021-12-16 11:26:34 +08:00
parent f4c1c81c09
commit 54f80fddb3
7 changed files with 61 additions and 15 deletions

View File

@@ -0,0 +1 @@
<template>dashboard edit</template>

View File

@@ -57,7 +57,7 @@ limitations under the License. -->
</el-option>
</el-select>
</div>
<div class="item" v-show="state.entity === 'Service'">
<div class="item" v-show="state.entity === EntityType[0].value">
<div class="label">Service</div>
<el-select
size="small"
@@ -74,7 +74,7 @@ limitations under the License. -->
</el-option>
</el-select>
</div>
<div class="item" v-show="state.entity === 'Endpoint'">
<div class="item" v-show="state.entity === EntityType[2].value">
<div class="label">Service / Endpoint</div>
<el-cascader
v-model="state.serviceEndpoint"
@@ -85,7 +85,7 @@ limitations under the License. -->
:style="{ width: '600px' }"
></el-cascader>
</div>
<div class="item" v-show="state.entity === 'ServiceInstance'">
<div class="item" v-show="state.entity === EntityType[3].value">
<div class="label">Service / Instance</div>
<el-cascader
v-model="state.serviceInstance"
@@ -96,7 +96,7 @@ limitations under the License. -->
:style="{ width: '600px' }"
></el-cascader>
</div>
<div class="item" v-show="state.entity === 'ServiceRelation'">
<div class="item" v-show="state.entity === EntityType[4].value">
<div class="label">Destination Service</div>
<el-select
size="small"
@@ -113,7 +113,7 @@ limitations under the License. -->
</el-option>
</el-select>
</div>
<div class="item" v-show="state.entity === 'EndpointRelation'">
<div class="item" v-show="state.entity === EntityType[5].value">
<span class="label">Destination Service / Endpoint</span>
<el-cascader
v-model="state.destServiceEndpoint"
@@ -123,7 +123,7 @@ limitations under the License. -->
:style="{ width: '600px' }"
></el-cascader>
</div>
<div class="item" v-show="state.entity === 'ServiceInstanceRelation'">
<div class="item" v-show="state.entity === EntityType[6].value">
<span class="label">Destination Service / Instance</span>
<el-cascader
v-model="state.destServiceInstance"
@@ -142,6 +142,7 @@ limitations under the License. -->
</template>
<script lang="ts" setup>
import { reactive } from "vue";
import router from "@/router";
import {
ElSelect,
ElOption,
@@ -171,7 +172,19 @@ const handleChange = (value: any) => {
console.log(value);
};
const onCreate = () => {
console.log(state);
let path = `/dashboard/edit/${state.entity}/`;
switch (state.entity) {
case EntityType[0].value:
path += state.service;
break;
case EntityType[2].value:
path += `${state.service}/${state.serviceEndpoint}`;
break;
case EntityType[3].value:
path += `${state.service}/${state.serviceInstance}`;
break;
}
router.push(path);
};
selectorStore.fetchServices("general");
</script>

View File

@@ -15,13 +15,13 @@
* limitations under the License.
*/
export const EntityType = [
{ value: "Service", label: "Service" },
{ value: "All", label: "All" },
{ value: "Endpoint", label: "Service Endpoint" },
{ value: "ServiceInstance", label: "Service Instance" },
{ value: "ServiceRelation", label: "Service Relation" },
{ value: "ServiceInstanceRelation", label: "Service Instance Relation" },
{ value: "EndpointRelation", label: "Endpoint Relation" },
{ value: "service", label: "Service" },
{ value: "all", label: "All" },
{ value: "endpoint", label: "Service Endpoint" },
{ value: "serviceInstance", label: "Service Instance" },
{ value: "serviceRelation", label: "Service Relation" },
{ value: "serviceInstanceRelation", label: "Service Instance Relation" },
{ value: "endpointRelation", label: "Endpoint Relation" },
];
export const SelectOpt = [
{