fix endpoint and instance list

This commit is contained in:
Qiuxia Fan 2022-03-14 14:23:00 +08:00
parent a7f05d35ad
commit 46e3680024
7 changed files with 149 additions and 76 deletions

View File

@ -21,6 +21,21 @@ export const All = {
isRoot: true, isRoot: true,
children: [ children: [
{ {
x: 0,
y: 0,
w: 24,
h: 45,
i: "0",
type: "Tab",
widget: {},
graph: {},
standard: {},
metrics: [],
metricTypes: [],
children: [
{
x: 0,
y: 0,
w: 8, w: 8,
h: 12, h: 12,
i: "0", i: "0",
@ -39,6 +54,8 @@ export const All = {
}, },
}, },
{ {
x: 0,
y: 0,
w: 8, w: 8,
h: 12, h: 12,
i: "1", i: "1",
@ -59,6 +76,8 @@ export const All = {
}, },
}, },
{ {
x: 0,
y: 0,
w: 8, w: 8,
h: 12, h: 12,
i: "3", i: "3",
@ -80,6 +99,8 @@ export const All = {
}, },
], ],
}, },
],
},
}; };
export const ServiceLayout = { export const ServiceLayout = {
@ -92,7 +113,7 @@ export const ServiceLayout = {
x: 0, x: 0,
y: 0, y: 0,
w: 24, w: 24,
h: 36, h: 45,
i: "0", i: "0",
type: "Tab", type: "Tab",
widget: {}, widget: {},
@ -332,6 +353,52 @@ export const ServiceLayout = {
}, },
], ],
}, },
{
name: "Endpoints",
children: [
{
x: 0,
y: 0,
w: 16,
h: 12,
i: "0",
metrics: ["endpoint_sla"],
metricTypes: ["readMetricsValues"],
type: "Widget",
widget: {},
graph: {
type: "EndpointList",
dashboardName: "123",
fontSize: 12,
},
standard: {},
},
],
},
{
name: "Service Instances",
children: [
{
x: 0,
y: 0,
w: 16,
h: 12,
i: "0",
metrics: ["service_instance_sla"],
metricTypes: ["readMetricsValues"],
type: "Widget",
widget: {},
graph: {
type: "InstanceList",
dashboardName: "123",
fontSize: 12,
},
standard: {
unit: "ms",
},
},
],
},
{ {
name: "Topology", name: "Topology",
children: [ children: [

View File

@ -226,7 +226,6 @@ export function useQueryPodsMetrics(
}; };
const variables: string[] = [`$duration: Duration!`]; const variables: string[] = [`$duration: Duration!`];
const { currentService } = selectorStore; const { currentService } = selectorStore;
const fragmentList = pods.map( const fragmentList = pods.map(
( (
d: (Instance | Endpoint | Service) & { normal: boolean }, d: (Instance | Endpoint | Service) & { normal: boolean },

View File

@ -120,6 +120,7 @@ export default defineComponent({
} }
function applyConfig() { function applyConfig() {
console.log(dashboardStore.selectedGrid);
dashboardStore.setConfigs(dashboardStore.selectedGrid); dashboardStore.setConfigs(dashboardStore.selectedGrid);
dashboardStore.setConfigPanel(false); dashboardStore.setConfigPanel(false);
} }

View File

@ -257,7 +257,7 @@ export default defineComponent({
} }
.tab-name { .tab-name {
max-width: 80px; max-width: 130px;
height: 20px; height: 20px;
line-height: 20px; line-height: 20px;
outline: none; outline: none;

View File

@ -16,6 +16,7 @@ limitations under the License. -->
<template> <template>
<div <div
class="chart-card" class="chart-card"
:class="{ center: config.textAlign === 'center' }"
:style="{ fontSize: `${config.fontSize}px`, textAlign: config.textAlign }" :style="{ fontSize: `${config.fontSize}px`, textAlign: config.textAlign }"
> >
{{ {{
@ -52,12 +53,15 @@ const singleVal = computed(() => props.data[key.value]);
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.chart-card { .chart-card {
box-sizing: border-box;
color: #333; color: #333;
height: 100%;
}
.center {
box-sizing: border-box;
display: -webkit-box; display: -webkit-box;
-webkit-box-orient: horizontal; -webkit-box-orient: horizontal;
-webkit-box-pack: center; -webkit-box-pack: center;
-webkit-box-align: center; -webkit-box-align: center;
height: 100%;
} }
</style> </style>

View File

@ -18,13 +18,13 @@ limitations under the License. -->
<el-input <el-input
v-model="searchText" v-model="searchText"
placeholder="Please input endpoint name" placeholder="Please input endpoint name"
class="input-with-search"
size="small" size="small"
@change="searchList" @change="searchList"
class="inputs"
> >
<template #append> <template #append>
<el-button size="small" @click="searchList"> <el-button size="small" @click="searchList">
<Icon size="lg" iconName="search" /> <Icon size="sm" iconName="search" />
</el-button> </el-button>
</template> </template>
</el-input> </el-input>
@ -66,6 +66,7 @@ limitations under the License. -->
<el-pagination <el-pagination
class="pagination" class="pagination"
background background
small
layout="prev, pager, next" layout="prev, pager, next"
:page-size="pageSize" :page-size="pageSize"
:total="selectorStore.pods.length" :total="selectorStore.pods.length"
@ -134,7 +135,7 @@ async function queryEndpointMetrics(currentPods: Endpoint[]) {
if (metrics.length && metrics[0]) { if (metrics.length && metrics[0]) {
const params = await useQueryPodsMetrics( const params = await useQueryPodsMetrics(
currentPods, currentPods,
dashboardStore.selectedGrid, props.config,
EntityType[2].value EntityType[2].value
); );
const json = await dashboardStore.fetchMetricValue(params); const json = await dashboardStore.fetchMetricValue(params);
@ -143,11 +144,7 @@ async function queryEndpointMetrics(currentPods: Endpoint[]) {
ElMessage.error(json.errors); ElMessage.error(json.errors);
return; return;
} }
endpoints.value = usePodsSource( endpoints.value = usePodsSource(currentPods, json, props.config);
currentPods,
json,
dashboardStore.selectedGrid
);
return; return;
} }
endpoints.value = currentPods; endpoints.value = currentPods;
@ -177,4 +174,8 @@ watch(
.chart { .chart {
height: 39px; height: 39px;
} }
.inputs {
width: 300px;
}
</style> </style>

View File

@ -18,13 +18,13 @@ limitations under the License. -->
<el-input <el-input
v-model="searchText" v-model="searchText"
placeholder="Please input instance name" placeholder="Please input instance name"
class="input-with-search"
size="small" size="small"
@change="searchList" @change="searchList"
class="inputs"
> >
<template #append> <template #append>
<el-button size="small" @click="searchList"> <el-button size="small" @click="searchList">
<Icon size="lg" iconName="search" /> <Icon size="sm" iconName="search" />
</el-button> </el-button>
</template> </template>
</el-input> </el-input>
@ -66,6 +66,7 @@ limitations under the License. -->
<el-pagination <el-pagination
class="pagination" class="pagination"
background background
small
layout="prev, pager, next" layout="prev, pager, next"
:page-size="pageSize" :page-size="pageSize"
:total="searchInstances.length" :total="searchInstances.length"
@ -138,7 +139,7 @@ async function queryInstanceMetrics(currentInstances: Instance[]) {
if (metrics.length && metrics[0]) { if (metrics.length && metrics[0]) {
const params = await useQueryPodsMetrics( const params = await useQueryPodsMetrics(
currentInstances, currentInstances,
dashboardStore.selectedGrid, props.config,
EntityType[3].value EntityType[3].value
); );
const json = await dashboardStore.fetchMetricValue(params); const json = await dashboardStore.fetchMetricValue(params);
@ -147,11 +148,7 @@ async function queryInstanceMetrics(currentInstances: Instance[]) {
ElMessage.error(json.errors); ElMessage.error(json.errors);
return; return;
} }
instances.value = usePodsSource( instances.value = usePodsSource(currentInstances, json, props.config);
currentInstances,
json,
dashboardStore.selectedGrid
);
return; return;
} }
instances.value = currentInstances; instances.value = currentInstances;
@ -182,4 +179,8 @@ watch(
.chart { .chart {
height: 40px; height: 40px;
} }
.inputs {
width: 300px;
}
</style> </style>