add loading

This commit is contained in:
Fine 2022-08-22 18:21:02 +08:00
parent 059bd9fedb
commit c29ce4e187
2 changed files with 12 additions and 2 deletions

View File

@ -35,6 +35,7 @@ interface NetworkProfilingState {
selectedMetric: Nullable<LayoutConfig>;
activeMetricIndex: string;
aliveNetwork: boolean;
loadNodes: boolean;
}
export const networkProfilingStore = defineStore({
@ -51,6 +52,7 @@ export const networkProfilingStore = defineStore({
selectedMetric: null,
activeMetricIndex: "",
aliveNetwork: false,
loadNodes: false,
}),
actions: {
setSelectedNetworkTask(task: EBPFTaskList) {
@ -160,9 +162,11 @@ export const networkProfilingStore = defineStore({
duration: any;
serviceInstanceId: string;
}) {
this.loadNodes = true;
const res: AxiosResponse = await graphql
.query("getProcessTopology")
.params(params);
this.loadNodes = false;
if (res.data.errors) {
this.nodes = [];
this.calls = [];

View File

@ -15,10 +15,16 @@ limitations under the License. -->
<template>
<div class="flex-h content">
<Tasks />
<div class="vis-graph ml-5" v-if="networkProfilingStore.nodes.length">
<div
class="vis-graph ml-5"
v-if="networkProfilingStore.nodes.length"
v-loading="networkProfilingStore.loadNodes"
>
<process-topology />
</div>
<div class="text" v-else>{{ t("noData") }}</div>
<div class="text" v-else v-loading="networkProfilingStore.loadNodes">
{{ t("noData") }}
</div>
</div>
</template>
<script lang="ts" setup>