fix list widgets

This commit is contained in:
Qiuxia Fan 2022-06-15 17:29:42 +08:00
parent 30efdbc09e
commit 5940dccdb6
3 changed files with 15 additions and 6 deletions

View File

@ -46,6 +46,7 @@ limitations under the License. -->
:intervalTime="intervalTime"
:colMetrics="colMetrics"
:config="config"
v-if="colMetrics.length"
/>
</el-table>
</div>
@ -96,7 +97,9 @@ const dashboardStore = useDashboardStore();
const chartLoading = ref<boolean>(false);
const endpoints = ref<Endpoint[]>([]);
const searchText = ref<string>("");
const colMetrics = computed(() => props.config.metrics.map((d: string) => d));
const colMetrics = computed(() =>
(props.config.metrics || []).filter((d: string) => d)
);
if (props.needQuery) {
queryEndpoints();
@ -119,7 +122,7 @@ async function queryEndpointMetrics(currentPods: Endpoint[]) {
if (!currentPods.length) {
return;
}
const metrics = (props.config.metrics || []).filter((d: string) => d);
const metrics = props.config.metrics || [];
const metricTypes = props.config.metricTypes || [];
if (metrics.length && metrics[0] && metricTypes.length && metricTypes[0]) {
const params = await useQueryPodsMetrics(

View File

@ -43,6 +43,7 @@ limitations under the License. -->
</template>
</el-table-column>
<ColumnGraph
v-if="colMetrics.length"
:intervalTime="intervalTime"
:colMetrics="colMetrics"
:config="config"
@ -126,7 +127,9 @@ const chartLoading = ref<boolean>(false);
const instances = ref<Instance[]>([]); // current instances
const pageSize = 10;
const searchText = ref<string>("");
const colMetrics = computed(() => props.config.metrics.map((d: string) => d));
const colMetrics = computed(() =>
(props.config.metrics || []).filter((d: string) => d)
);
if (props.needQuery) {
queryInstance();
}
@ -151,7 +154,8 @@ async function queryInstanceMetrics(currentInstances: Instance[]) {
if (!currentInstances.length) {
return;
}
const { metrics, metricTypes } = props.config;
const metrics = props.config.metrics || [];
const metricTypes = props.config.metricTypes || [];
if (metrics.length && metrics[0] && metricTypes.length && metricTypes[0]) {
const params = await useQueryPodsMetrics(

View File

@ -58,6 +58,7 @@ limitations under the License. -->
:intervalTime="intervalTime"
:colMetrics="colMetrics"
:config="config"
v-if="colMetrics.length"
/>
</el-table>
</div>
@ -117,7 +118,7 @@ const searchText = ref<string>("");
const groups = ref<any>({});
const sortServices = ref<(Service & { merge: boolean })[]>([]);
const colMetrics = computed(() =>
props.config.metrics.filter((d: string) => d)
(props.config.metrics || []).filter((d: string) => d)
);
queryServices();
@ -195,7 +196,8 @@ async function queryServiceMetrics(currentServices: Service[]) {
if (!currentServices.length) {
return;
}
const { metrics, metricTypes } = props.config;
const metrics = props.config.metrics || [];
const metricTypes = props.config.metricTypes || [];
if (metrics.length && metrics[0] && metricTypes.length && metricTypes[0]) {
const params = await useQueryPodsMetrics(