query data due to changing duration

This commit is contained in:
Qiuxia Fan 2022-03-20 18:57:18 +08:00
parent f45755e952
commit b9b50df3d6
10 changed files with 70 additions and 10 deletions

View File

@ -98,9 +98,9 @@ export const dashboardStore = defineStore({
showDepth: true, showDepth: true,
depth: depth:
this.entity === EntityType[1].value this.entity === EntityType[1].value
? 2
: this.entity === EntityType[0].value
? 1 ? 1
: this.entity === EntityType[0].value
? 2
: 3, : 3,
}; };
} }

View File

@ -108,11 +108,7 @@ export default defineComponent({
const dashboardStore = useDashboardStore(); const dashboardStore = useDashboardStore();
const selectorStore = useSelectorStore(); const selectorStore = useSelectorStore();
if ( if (props.needQuery || !dashboardStore.currentDashboard.id) {
dashboardStore.entity === EntityType[1].value ||
props.needQuery ||
!dashboardStore.currentDashboard.id
) {
queryMetrics(); queryMetrics();
} }
@ -184,6 +180,14 @@ export default defineComponent({
queryMetrics(); queryMetrics();
} }
); );
watch(
() => appStore.durationTime,
() => {
if (dashboardStore.entity === EntityType[1].value) {
queryMetrics();
}
}
);
return { return {
state, state,

View File

@ -186,7 +186,6 @@ export const ServiceTools = [
export const InstanceTools = [ export const InstanceTools = [
{ name: "playlist_add", content: "Add Widget", id: "addWidget" }, { name: "playlist_add", content: "Add Widget", id: "addWidget" },
{ name: "all_inbox", content: "Add Tab", id: "addTab" }, { name: "all_inbox", content: "Add Tab", id: "addTab" },
{ name: "device_hub", content: "Add Topology", id: "addTopology" },
{ name: "merge", content: "Add Trace", id: "addTrace" }, { name: "merge", content: "Add Trace", id: "addTrace" },
{ name: "assignment", content: "Add Log", id: "addLog" }, { name: "assignment", content: "Add Log", id: "addLog" },
{ name: "save", content: "Apply", id: "apply" }, { name: "save", content: "Apply", id: "apply" },

View File

@ -35,7 +35,11 @@ limitations under the License. -->
<template #default="scope"> <template #default="scope">
<router-link <router-link
class="link" class="link"
:to="`/dashboard/${dashboardStore.layerId}/${EntityType[2].value}/${selectorStore.currentService.id}/${scope.row.id}/${config.dashboardName}`" :to="`/dashboard/${dashboardStore.layerId}/${
EntityType[2].value
}/${selectorStore.currentService.id}/${
scope.row.id
}/${config.dashboardName.split(' ').join('-')}`"
:style="{ fontSize: `${config.fontSize}px` }" :style="{ fontSize: `${config.fontSize}px` }"
> >
{{ scope.row.label }} {{ scope.row.label }}

View File

@ -35,7 +35,11 @@ limitations under the License. -->
<template #default="scope"> <template #default="scope">
<router-link <router-link
class="link" class="link"
:to="`/dashboard/${dashboardStore.layerId}/${EntityType[3].value}/${selectorStore.currentService.id}/${scope.row.id}/${config.dashboardName}`" :to="`/dashboard/${dashboardStore.layerId}/${
EntityType[3].value
}/${selectorStore.currentService.id}/${
scope.row.id
}/${config.dashboardName.split(' ').join('-')}`"
:style="{ fontSize: `${config.fontSize}px` }" :style="{ fontSize: `${config.fontSize}px` }"
> >
{{ scope.row.label }} {{ scope.row.label }}

View File

@ -299,6 +299,14 @@ watch(
init(); init();
} }
); );
watch(
() => appStore.durationTime,
() => {
if (dashboardStore.entity === EntityType[1].value) {
init();
}
}
);
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.inputs { .inputs {

View File

@ -56,9 +56,14 @@ import { useProfileStore } from "@/store/modules/profile";
import { useSelectorStore } from "@/store/modules/selectors"; import { useSelectorStore } from "@/store/modules/selectors";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import NewTask from "./components/NewTask.vue"; import NewTask from "./components/NewTask.vue";
import { useDashboardStore } from "@/store/modules/dashboard";
import { useAppStoreWithOut } from "@/store/modules/app";
import { EntityType } from "../../data";
const profileStore = useProfileStore(); const profileStore = useProfileStore();
const appStore = useAppStoreWithOut();
const selectorStore = useSelectorStore(); const selectorStore = useSelectorStore();
const dashboardStore = useDashboardStore();
const { t } = useI18n(); const { t } = useI18n();
// const service = ref<any>({}); // const service = ref<any>({});
const endpointName = ref<string>(""); const endpointName = ref<string>("");
@ -104,6 +109,14 @@ watch(
searchTasks(); searchTasks();
} }
); );
watch(
() => appStore.durationTime,
() => {
if (dashboardStore.entity === EntityType[1].value) {
searchTasks();
}
}
);
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.header { .header {

View File

@ -84,6 +84,7 @@ import { ElMessage } from "element-plus";
import Settings from "./Settings.vue"; import Settings from "./Settings.vue";
import { Option } from "@/types/app"; import { Option } from "@/types/app";
import { Service } from "@/types/selector"; import { Service } from "@/types/selector";
import { useAppStoreWithOut } from "@/store/modules/app";
/*global Nullable, defineProps */ /*global Nullable, defineProps */
const props = defineProps({ const props = defineProps({
@ -96,6 +97,7 @@ const { t } = useI18n();
const selectorStore = useSelectorStore(); const selectorStore = useSelectorStore();
const topologyStore = useTopologyStore(); const topologyStore = useTopologyStore();
const dashboardStore = useDashboardStore(); const dashboardStore = useDashboardStore();
const appStore = useAppStoreWithOut();
const height = ref<number>(100); const height = ref<number>(100);
const width = ref<number>(100); const width = ref<number>(100);
const loading = ref<boolean>(false); const loading = ref<boolean>(false);
@ -479,6 +481,14 @@ watch(
freshNodes(); freshNodes();
} }
); );
watch(
() => appStore.durationTime,
() => {
if (dashboardStore.entity === EntityType[1].value) {
init();
}
}
);
</script> </script>
<style lang="scss"> <style lang="scss">
.topo-svg { .topo-svg {

View File

@ -80,6 +80,7 @@ import { Option } from "@/types/app";
import { useTopologyStore } from "@/store/modules/topology"; import { useTopologyStore } from "@/store/modules/topology";
import { useDashboardStore } from "@/store/modules/dashboard"; import { useDashboardStore } from "@/store/modules/dashboard";
import { useSelectorStore } from "@/store/modules/selectors"; import { useSelectorStore } from "@/store/modules/selectors";
import { useAppStoreWithOut } from "@/store/modules/app";
import { EntityType, DepthList } from "../../../data"; import { EntityType, DepthList } from "../../../data";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import Sankey from "./Sankey.vue"; import Sankey from "./Sankey.vue";
@ -97,6 +98,7 @@ const { t } = useI18n();
const dashboardStore = useDashboardStore(); const dashboardStore = useDashboardStore();
const selectorStore = useSelectorStore(); const selectorStore = useSelectorStore();
const topologyStore = useTopologyStore(); const topologyStore = useTopologyStore();
const appStore = useAppStoreWithOut();
const loading = ref<boolean>(false); const loading = ref<boolean>(false);
const height = ref<number>(100); const height = ref<number>(100);
const width = ref<number>(100); const width = ref<number>(100);
@ -225,6 +227,14 @@ watch(
topologyStore.setLink(null); topologyStore.setLink(null);
} }
); );
watch(
() => appStore.durationTime,
() => {
loadTopology(selectorStore.currentPod.id);
topologyStore.setNode(null);
topologyStore.setLink(null);
}
);
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.sankey { .sankey {

View File

@ -227,6 +227,14 @@ watch(
init(); init();
} }
); );
watch(
() => appStore.durationTime,
() => {
if (dashboardStore.entity === EntityType[1].value) {
init();
}
}
);
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.inputs { .inputs {