update list

This commit is contained in:
Qiuxia Fan 2022-03-24 15:17:16 +08:00
parent e64c75f257
commit 1a1494bab7
5 changed files with 23 additions and 21 deletions

View File

@ -203,6 +203,9 @@ async function importTemplates(event: any) {
dashboardFile.value = null;
}
function exportTemplates() {
if (!multipleSelection.value.length) {
return;
}
const arr = multipleSelection.value.sort(
(a: DashboardItem, b: DashboardItem) => {
return a.name.localeCompare(b.name);

View File

@ -13,10 +13,10 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. -->
<template>
<div v-if="states.isList && states.dashboardList.length" class="ds-name">
<div v-if="states.isList" class="ds-name">
<div>{{ t("dashboards") }}</div>
<Selector
:value="states.dashboardName"
:value="states.dashboardName || ''"
:options="states.dashboardList"
size="small"
placeholder="Please select a dashboard name"

View File

@ -120,9 +120,8 @@ const pageSize = 5;
const total = 10;
const searchText = ref<string>("");
if (props.needQuery) {
queryEndpoints(total);
}
queryEndpoints(total);
async function queryEndpoints(limit?: number) {
chartLoading.value = true;
const resp = await selectorStore.getEndpoints({
@ -136,13 +135,13 @@ async function queryEndpoints(limit?: number) {
return;
}
endpoints.value = selectorStore.pods.splice(0, pageSize);
if (props.config.isEdit || !endpoints.value.length) {
if (!endpoints.value.length || props.config.isEdit) {
return;
}
queryEndpointMetrics(endpoints.value);
await queryEndpointMetrics(endpoints.value);
}
async function queryEndpointMetrics(currentPods: Endpoint[]) {
const { metrics } = props.config;
const metrics = props.config.metrics.filter((d: string) => d);
if (metrics.length && metrics[0]) {
const params = await useQueryPodsMetrics(
@ -188,9 +187,10 @@ async function searchList() {
watch(
() => [props.config.metricTypes, props.config.metrics],
() => {
if (dashboardStore.showConfig) {
queryEndpointMetrics(endpoints.value);
if (!endpoints.value.length) {
return;
}
queryEndpointMetrics(endpoints.value);
}
);
watch(

View File

@ -137,9 +137,7 @@ const searchInstances = ref<Instance[]>([]); // all instances
const pageSize = 5;
const searchText = ref<string>("");
if (props.needQuery) {
queryInstance();
}
queryInstance();
async function queryInstance() {
chartLoading.value = true;
const resp = await selectorStore.getServiceInstances();
@ -153,7 +151,7 @@ async function queryInstance() {
}
searchInstances.value = selectorStore.pods;
instances.value = searchInstances.value.splice(0, pageSize);
if (props.config.isEdit) {
if (!instances.value.length || props.config.isEdit) {
return;
}
queryInstanceMetrics(instances.value);
@ -211,9 +209,10 @@ function searchList() {
watch(
() => [props.config.metricTypes, props.config.metrics],
() => {
if (dashboardStore.showConfig) {
queryInstanceMetrics(instances.value);
if (!instances.value.length) {
return;
}
queryInstanceMetrics(instances.value);
}
);
watch(

View File

@ -143,7 +143,7 @@ async function queryServices() {
ElMessage.error(resp.errors);
}
setServices(selectorStore.services);
if (props.config.isEdit) {
if (!services.value.length || props.config.isEdit) {
return;
}
queryServiceMetrics(services.value);
@ -232,8 +232,7 @@ function objectSpanMethod(param: any): any {
colspan: 0,
};
}
console.log(groups.value);
return { rowspan: 5, colspan: 1 };
return { rowspan: groups.value[param.row.group], colspan: 1 };
}
function changePage(pageIndex: number) {
services.value = sortServices.value.filter((d: Service, index: number) => {
@ -254,9 +253,10 @@ function searchList() {
watch(
() => [props.config.metricTypes, props.config.metrics],
() => {
if (dashboardStore.showConfig) {
queryServiceMetrics(services.value);
if (!services.value.length) {
return;
}
queryServiceMetrics(services.value);
}
);
</script>