mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-07-18 08:25:25 +00:00
feat: add Settings in pod topology
This commit is contained in:
parent
06a4a4ac96
commit
895bed9ab2
@ -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;
|
||||
},
|
||||
|
@ -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. -->
|
||||
<template>
|
||||
<div :style="`height:${height}px;width:${width}px;`" v-if="isSankey">
|
||||
<Sankey />
|
||||
</div>
|
||||
<PodTopology v-if="isSankey" />
|
||||
<Graph v-else />
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref } from "vue";
|
||||
import Graph from "./Graph.vue";
|
||||
import Sankey from "./Sankey.vue";
|
||||
import Graph from "./components/Graph.vue";
|
||||
import PodTopology from "./components/PodTopology.vue";
|
||||
import { EntityType } from "../../data";
|
||||
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||
|
||||
@ -29,6 +27,4 @@ const dashboardStore = useDashboardStore();
|
||||
const isSankey = ref<boolean>(
|
||||
[EntityType[2].value, EntityType[4].value].includes(dashboardStore.entity)
|
||||
);
|
||||
const height = ref<number>(document.body.clientHeight - 90);
|
||||
const width = ref<number>(document.body.clientWidth - 40);
|
||||
</script>
|
||||
|
@ -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";
|
@ -0,0 +1,84 @@
|
||||
<!-- Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
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 class="tool">
|
||||
<span class="switch-icon ml-5" title="Settings">
|
||||
<Icon @click="setConfig" size="middle" iconName="settings" />
|
||||
</span>
|
||||
<div class="settings" v-show="showSettings">
|
||||
<Settings @update="updateConfig" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="sankey" :style="`height:${height}px;width:${width}px;`">
|
||||
<Sankey />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref } from "vue";
|
||||
import Sankey from "./Sankey.vue";
|
||||
import Settings from "./Settings.vue";
|
||||
|
||||
const height = ref<number>(document.body.clientHeight - 110);
|
||||
const width = ref<number>(document.body.clientWidth - 40);
|
||||
const showSettings = ref<boolean>(false);
|
||||
|
||||
function setConfig() {
|
||||
showSettings.value = !showSettings.value;
|
||||
}
|
||||
|
||||
function updateConfig(config: any) {
|
||||
console.log(config);
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.sankey {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.settings {
|
||||
position: absolute;
|
||||
top: 40px;
|
||||
right: 0;
|
||||
width: 360px;
|
||||
height: 700px;
|
||||
background-color: #2b3037;
|
||||
overflow: auto;
|
||||
padding: 0 15px;
|
||||
border-radius: 3px;
|
||||
color: #ccc;
|
||||
transition: all 0.5ms linear;
|
||||
z-index: 99;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.tool {
|
||||
text-align: right;
|
||||
margin-top: 10px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.switch-icon {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
transition: all 0.5ms linear;
|
||||
background-color: #252a2f99;
|
||||
color: #ddd;
|
||||
display: inline-block;
|
||||
border-radius: 3px;
|
||||
}
|
||||
</style>
|
@ -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();
|
@ -33,17 +33,20 @@ limitations under the License. -->
|
||||
placeholder="Select metrics"
|
||||
@change="changeLinkServerMetrics"
|
||||
/>
|
||||
<div class="label">{{ t("linkClientMetrics") }}</div>
|
||||
<Selector
|
||||
class="inputs"
|
||||
v-show="dashboardStore.entity !== EntityType[2].value"
|
||||
:multiple="true"
|
||||
:value="states.linkClientMetrics"
|
||||
:options="states.linkMetricList"
|
||||
size="small"
|
||||
placeholder="Select metrics"
|
||||
@change="changeLinkClientMetrics"
|
||||
/>
|
||||
<span v-show="dashboardStore.entity !== EntityType[2].value">
|
||||
<div class="label">
|
||||
{{ t("linkClientMetrics") }}
|
||||
</div>
|
||||
<Selector
|
||||
class="inputs"
|
||||
:multiple="true"
|
||||
:value="states.linkClientMetrics"
|
||||
:options="states.linkMetricList"
|
||||
size="small"
|
||||
placeholder="Select metrics"
|
||||
@change="changeLinkClientMetrics"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
<div class="node-settings">
|
||||
<h5 class="title">{{ t("nodeSettings") }}</h5>
|
||||
@ -55,22 +58,24 @@ limitations under the License. -->
|
||||
size="small"
|
||||
class="inputs"
|
||||
/>
|
||||
<div class="label">{{ t("instanceDashboard") }}</div>
|
||||
<el-input
|
||||
v-model="states.instanceDashboard"
|
||||
placeholder="Please input a dashboard name for service instances"
|
||||
@change="updateSettings"
|
||||
size="small"
|
||||
class="inputs"
|
||||
/>
|
||||
<div class="label">{{ t("endpointDashboard") }}</div>
|
||||
<el-input
|
||||
v-model="states.endpointDashboard"
|
||||
placeholder="Please input a dashboard name for endpoints"
|
||||
@change="updateSettings"
|
||||
size="small"
|
||||
class="inputs"
|
||||
/>
|
||||
<span v-show="isService">
|
||||
<div class="label">{{ t("instanceDashboard") }}</div>
|
||||
<el-input
|
||||
v-model="states.instanceDashboard"
|
||||
placeholder="Please input a dashboard name for service instances"
|
||||
@change="updateSettings"
|
||||
size="small"
|
||||
class="inputs"
|
||||
/>
|
||||
<div class="label">{{ t("endpointDashboard") }}</div>
|
||||
<el-input
|
||||
v-model="states.endpointDashboard"
|
||||
placeholder="Please input a dashboard name for endpoints"
|
||||
@change="updateSettings"
|
||||
size="small"
|
||||
class="inputs"
|
||||
/>
|
||||
</span>
|
||||
<div class="label">{{ t("nodeMetrics") }}</div>
|
||||
<Selector
|
||||
class="inputs"
|
||||
@ -84,16 +89,16 @@ limitations under the License. -->
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { reactive } from "vue";
|
||||
import { reactive, ref } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||
import { useTopologyStore } from "@/store/modules/topology";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { MetricCatalog } from "../../data";
|
||||
import { MetricCatalog } from "../../../data";
|
||||
import { Option } from "@/types/app";
|
||||
import { useQueryTopologyMetrics } from "@/hooks/useProcessor";
|
||||
import { Node, Call } from "@/types/topology";
|
||||
import { EntityType } from "../../data";
|
||||
import { EntityType } from "../../../data";
|
||||
|
||||
/*global defineEmits */
|
||||
const emit = defineEmits(["update"]);
|
||||
@ -121,6 +126,9 @@ const states = reactive<{
|
||||
nodeMetricList: [],
|
||||
linkMetricList: [],
|
||||
});
|
||||
const isService = ref(
|
||||
[EntityType[1].value, EntityType[0].value].includes(dashboardStore.entity)
|
||||
);
|
||||
|
||||
getMetricList();
|
||||
async function getMetricList() {
|
Loading…
Reference in New Issue
Block a user