From 895bed9ab21b20549cad744e82999355252cddf2 Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Tue, 15 Feb 2022 15:18:38 +0800 Subject: [PATCH] feat: add Settings in pod topology --- src/store/modules/topology.ts | 11 +++ .../dashboard/related/topology/Index.vue | 10 +-- .../topology/{ => components}/Graph.vue | 12 +-- .../topology/components/PodTopology.vue | 84 +++++++++++++++++++ .../topology/{ => components}/Sankey.vue | 2 +- .../topology/{ => components}/Settings.vue | 68 ++++++++------- 6 files changed, 143 insertions(+), 44 deletions(-) rename src/views/dashboard/related/topology/{ => components}/Graph.vue (97%) create mode 100644 src/views/dashboard/related/topology/components/PodTopology.vue rename src/views/dashboard/related/topology/{ => components}/Sankey.vue (98%) rename src/views/dashboard/related/topology/{ => components}/Settings.vue (82%) diff --git a/src/store/modules/topology.ts b/src/store/modules/topology.ts index cb7b6466..df5e05f8 100644 --- a/src/store/modules/topology.ts +++ b/src/store/modules/topology.ts @@ -110,6 +110,17 @@ export const topologyStore = defineStore({ } return prev; }, []); + for (const call of calls) { + for (const node of nodes) { + if (call.source === node.id) { + call.sourceObj = node; + } + if (call.target === node.id) { + call.targetObj = node; + } + } + call.value = call.value || 1; + } this.calls = calls; this.nodes = nodes; }, diff --git a/src/views/dashboard/related/topology/Index.vue b/src/views/dashboard/related/topology/Index.vue index 673f8926..83ef1905 100644 --- a/src/views/dashboard/related/topology/Index.vue +++ b/src/views/dashboard/related/topology/Index.vue @@ -13,15 +13,13 @@ 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. --> diff --git a/src/views/dashboard/related/topology/Graph.vue b/src/views/dashboard/related/topology/components/Graph.vue similarity index 97% rename from src/views/dashboard/related/topology/Graph.vue rename to src/views/dashboard/related/topology/components/Graph.vue index a2814fc3..b8c9fc0b 100644 --- a/src/views/dashboard/related/topology/Graph.vue +++ b/src/views/dashboard/related/topology/components/Graph.vue @@ -53,16 +53,16 @@ import { ref, onMounted, onBeforeUnmount, reactive } from "vue"; import { useI18n } from "vue-i18n"; import * as d3 from "d3"; import d3tip from "d3-tip"; -import zoom from "./utils/zoom"; -import { simulationInit, simulationSkip } from "./utils/simulation"; -import nodeElement from "./utils/nodeElement"; -import { linkElement, anchorElement, arrowMarker } from "./utils/linkElement"; -import topoLegend from "./utils/legend"; +import zoom from "../utils/zoom"; +import { simulationInit, simulationSkip } from "../utils/simulation"; +import nodeElement from "../utils/nodeElement"; +import { linkElement, anchorElement, arrowMarker } from "../utils/linkElement"; +import topoLegend from "../utils/legend"; import { Node, Call } from "@/types/topology"; import { useSelectorStore } from "@/store/modules/selectors"; import { useTopologyStore } from "@/store/modules/topology"; import { useDashboardStore } from "@/store/modules/dashboard"; -import { EntityType } from "../../data"; +import { EntityType } from "../../../data"; import router from "@/router"; import { ElMessage } from "element-plus"; import Settings from "./Settings.vue"; diff --git a/src/views/dashboard/related/topology/components/PodTopology.vue b/src/views/dashboard/related/topology/components/PodTopology.vue new file mode 100644 index 00000000..7846027d --- /dev/null +++ b/src/views/dashboard/related/topology/components/PodTopology.vue @@ -0,0 +1,84 @@ + + + + diff --git a/src/views/dashboard/related/topology/Sankey.vue b/src/views/dashboard/related/topology/components/Sankey.vue similarity index 98% rename from src/views/dashboard/related/topology/Sankey.vue rename to src/views/dashboard/related/topology/components/Sankey.vue index 5a577095..2a099efe 100644 --- a/src/views/dashboard/related/topology/Sankey.vue +++ b/src/views/dashboard/related/topology/components/Sankey.vue @@ -20,7 +20,7 @@ limitations under the License. --> import { ref, computed, onMounted } from "vue"; import { useTopologyStore } from "@/store/modules/topology"; import { useDashboardStore } from "@/store/modules/dashboard"; -import { EntityType } from "../../data"; +import { EntityType } from "../../../data"; import { ElMessage } from "element-plus"; const topologyStore = useTopologyStore(); diff --git a/src/views/dashboard/related/topology/Settings.vue b/src/views/dashboard/related/topology/components/Settings.vue similarity index 82% rename from src/views/dashboard/related/topology/Settings.vue rename to src/views/dashboard/related/topology/components/Settings.vue index c90eb084..5b39e04e 100644 --- a/src/views/dashboard/related/topology/Settings.vue +++ b/src/views/dashboard/related/topology/components/Settings.vue @@ -33,17 +33,20 @@ limitations under the License. --> placeholder="Select metrics" @change="changeLinkServerMetrics" /> -
{{ t("linkClientMetrics") }}
- + +
+ {{ t("linkClientMetrics") }} +
+ +
{{ t("nodeSettings") }}
@@ -55,22 +58,24 @@ limitations under the License. --> size="small" class="inputs" /> -
{{ t("instanceDashboard") }}
- -
{{ t("endpointDashboard") }}
- + +
{{ t("instanceDashboard") }}
+ +
{{ t("endpointDashboard") }}
+ +
{{ t("nodeMetrics") }}