This commit is contained in:
Fine 2022-08-22 14:58:13 +08:00
parent 447936e0bb
commit eb58ff1d62
3 changed files with 17 additions and 5 deletions

View File

@ -113,7 +113,7 @@ export const networkProfilingStore = defineStore({
if (res.data.errors) { if (res.data.errors) {
return res.data; return res.data;
} }
this.getTaskList({ await this.getTaskList({
...param, ...param,
targets: ["NETWORK"], targets: ["NETWORK"],
}); });

View File

@ -15,17 +15,20 @@ limitations under the License. -->
<template> <template>
<div class="flex-h content"> <div class="flex-h content">
<Tasks /> <Tasks />
<div class="vis-graph ml-5" v-show="networkProfilingStore.nodes.length"> <div class="vis-graph ml-5" v-if="networkProfilingStore.nodes.length">
<process-topology /> <process-topology />
</div> </div>
<div class="text" v-else>{{ t("noData") }}</div>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { useI18n } from "vue-i18n";
import Tasks from "./components/Tasks.vue"; import Tasks from "./components/Tasks.vue";
import ProcessTopology from "./components/ProcessTopology.vue"; import ProcessTopology from "./components/ProcessTopology.vue";
import { useNetworkProfilingStore } from "@/store/modules/network-profiling"; import { useNetworkProfilingStore } from "@/store/modules/network-profiling";
const networkProfilingStore = useNetworkProfilingStore(); const networkProfilingStore = useNetworkProfilingStore();
const { t } = useI18n();
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.content { .content {
@ -41,4 +44,10 @@ const networkProfilingStore = useNetworkProfilingStore();
position: relative; position: relative;
width: calc(100% - 300px); width: calc(100% - 300px);
} }
.text {
width: calc(100% - 300px);
text-align: center;
margin-top: 30px;
}
</style> </style>

View File

@ -133,7 +133,6 @@ async function getTopology() {
fixedTriggerDuration > 1800 fixedTriggerDuration > 1800
? taskStartTime + fixedTriggerDuration * 1000 - 30 * 60 * 1000 ? taskStartTime + fixedTriggerDuration * 1000 - 30 * 60 * 1000
: taskStartTime; : taskStartTime;
const resp = await networkProfilingStore.getProcessTopology({ const resp = await networkProfilingStore.getProcessTopology({
serviceInstanceId, serviceInstanceId,
duration: { duration: {
@ -169,10 +168,14 @@ async function createTask() {
if (!serviceInstanceId) { if (!serviceInstanceId) {
return; return;
} }
networkProfilingStore.createNetworkTask({ const res = await networkProfilingStore.createNetworkTask({
serviceId, serviceId,
serviceInstanceId, serviceInstanceId,
}); });
if (res.errors) {
ElMessage.error(res.errors);
}
await getTopology();
} }
function enableInterval() { function enableInterval() {
enableTasks.value = !enableTasks.value; enableTasks.value = !enableTasks.value;
@ -202,7 +205,7 @@ async function fetchTasks() {
enableTasks.value = false; enableTasks.value = false;
return intervalFn.value && clearInterval(intervalFn.value); return intervalFn.value && clearInterval(intervalFn.value);
} }
getTopology(); await getTopology();
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>