feat: open dashboards with selector ids of link url

This commit is contained in:
Qiuxia Fan
2022-01-24 18:31:33 +08:00
parent 21fb053bda
commit e314f45874
13 changed files with 177 additions and 47 deletions

View File

@@ -37,9 +37,8 @@ limitations under the License. -->
<el-table-column label="Service Instances">
<template #default="scope">
<router-link
target="_blank"
class="link"
:to="`/dashboard/${scope.row.layer}/serviceInstance/${selectorStore.currentService.value}/${scope.row.value}/${config.dashboardName}`"
:to="`/dashboard/${scope.row.layer}/ServiceInstance/${selectorStore.currentService.id}/${scope.row.id}/${config.dashboardName}`"
:style="{ fontSize: `${config.fontSize}px` }"
>
{{ scope.row.label }}
@@ -96,7 +95,7 @@ defineProps({
const selectorStore = useSelectorStore();
const dashboardStore = useDashboardStore();
const chartLoading = ref<boolean>(false);
const instances = ref<(Instance | any)[]>([]); // current instances
const instances = ref<Instance[]>([]); // current instances
const searchInstances = ref<Instance[]>([]); // all instances
const pageSize = 5;
const searchText = ref<string>("");
@@ -112,7 +111,7 @@ async function queryInstance() {
ElMessage.error(resp.errors);
return;
}
searchInstances.value = selectorStore.instances;
searchInstances.value = selectorStore.pods;
const currentInstances = searchInstances.value.splice(0, pageSize);
queryInstanceMetrics(currentInstances);
@@ -147,8 +146,8 @@ function changePage(pageIndex: number) {
instances.value = searchInstances.value.splice(pageIndex - 1, pageSize);
}
function searchList() {
searchInstances.value = selectorStore.instances.filter(
(d: { label: string }) => d.label.includes(searchText.value)
searchInstances.value = selectorStore.pods.filter((d: { label: string }) =>
d.label.includes(searchText.value)
);
instances.value = searchInstances.value.splice(0, pageSize);
}