mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-07-17 02:35:24 +00:00
update topology config
This commit is contained in:
parent
2aa63f0746
commit
dd030b28bc
@ -49,7 +49,7 @@ const props = defineProps({
|
|||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
value: {
|
value: {
|
||||||
type: [Array, String] as PropType<string[] | string>,
|
type: [Array, String, Number] as PropType<any>,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
size: { type: null, default: "default" },
|
size: { type: null, default: "default" },
|
||||||
|
@ -27,6 +27,7 @@ import { Duration } from "@/types/app";
|
|||||||
import { AxiosResponse } from "axios";
|
import { AxiosResponse } from "axios";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
|
import { EntityType } from "@/views/dashboard/data";
|
||||||
interface DashboardState {
|
interface DashboardState {
|
||||||
showConfig: boolean;
|
showConfig: boolean;
|
||||||
layout: LayoutConfig[];
|
layout: LayoutConfig[];
|
||||||
@ -94,12 +95,13 @@ export const dashboardStore = defineStore({
|
|||||||
if (type === "Topology") {
|
if (type === "Topology") {
|
||||||
newItem.h = 36;
|
newItem.h = 36;
|
||||||
newItem.graph = {
|
newItem.graph = {
|
||||||
fontColor: "white",
|
|
||||||
backgroundColor: "green",
|
|
||||||
iconTheme: true,
|
|
||||||
content: "Topology",
|
|
||||||
fontSize: 18,
|
|
||||||
showDepth: true,
|
showDepth: true,
|
||||||
|
depth:
|
||||||
|
this.entity === EntityType[1].value
|
||||||
|
? 2
|
||||||
|
: this.entity === EntityType[0].value
|
||||||
|
? 1
|
||||||
|
: 3,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (type === "Trace" || type === "Profile" || type === "Log") {
|
if (type === "Trace" || type === "Profile" || type === "Log") {
|
||||||
|
@ -129,6 +129,6 @@ export interface TopologyConfig {
|
|||||||
iconTheme?: boolean;
|
iconTheme?: boolean;
|
||||||
content?: string;
|
content?: string;
|
||||||
fontSize?: number;
|
fontSize?: number;
|
||||||
depth?: string;
|
depth?: number;
|
||||||
showDepth?: boolean;
|
showDepth?: boolean;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,8 @@ limitations under the License. -->
|
|||||||
:destroy-on-close="true"
|
:destroy-on-close="true"
|
||||||
@closed="dashboardStore.setConfigPanel(false)"
|
@closed="dashboardStore.setConfigPanel(false)"
|
||||||
>
|
>
|
||||||
<Widget />
|
<TopologyConfig v-if="dashboardStore.selectedGrid.type === 'Topology'" />
|
||||||
|
<WidgetConfig v-else />
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -37,7 +38,8 @@ import { useI18n } from "vue-i18n";
|
|||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
import GridLayout from "./panel/Layout.vue";
|
import GridLayout from "./panel/Layout.vue";
|
||||||
import Tool from "./panel/Tool.vue";
|
import Tool from "./panel/Tool.vue";
|
||||||
import Widget from "./configuration/Widget.vue";
|
import TopologyConfig from "./configuration/Topology.vue";
|
||||||
|
import WidgetConfig from "./configuration/Widget.vue";
|
||||||
import { useDashboardStore } from "@/store/modules/dashboard";
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
import { useAppStoreWithOut } from "@/store/modules/app";
|
import { useAppStoreWithOut } from "@/store/modules/app";
|
||||||
|
|
||||||
|
94
src/views/dashboard/configuration/Topology.vue
Normal file
94
src/views/dashboard/configuration/Topology.vue
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
<!-- 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="item">
|
||||||
|
<span class="label">{{ t("showDepth") }}</span>
|
||||||
|
<el-switch
|
||||||
|
v-model="showDepth"
|
||||||
|
active-text="Yes"
|
||||||
|
inactive-text="No"
|
||||||
|
@change="changeConfig({ showDepth })"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="item" v-show="showDepth">
|
||||||
|
<span class="label">{{ t("defaultDepth") }}</span>
|
||||||
|
<Selector
|
||||||
|
class="input"
|
||||||
|
size="small"
|
||||||
|
:value="depth"
|
||||||
|
:options="DepthList"
|
||||||
|
@change="changeDepth($event)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="footer">
|
||||||
|
<el-button size="small">
|
||||||
|
{{ t("cancel") }}
|
||||||
|
</el-button>
|
||||||
|
<el-button size="small" type="primary" @click="applyConfig">
|
||||||
|
{{ t("apply") }}
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref } from "vue";
|
||||||
|
import { useI18n } from "vue-i18n";
|
||||||
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
|
import { DepthList } from "../data";
|
||||||
|
import { Option } from "@/types/app";
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
const dashboardStore = useDashboardStore();
|
||||||
|
const { selectedGrid } = dashboardStore;
|
||||||
|
const showDepth = ref<boolean>(selectedGrid.graph.showDepth);
|
||||||
|
const depth = ref<number>(selectedGrid.graph.depth || 2);
|
||||||
|
|
||||||
|
function applyConfig() {
|
||||||
|
dashboardStore.setConfigs(dashboardStore.selectedGrid);
|
||||||
|
dashboardStore.setConfigPanel(false);
|
||||||
|
}
|
||||||
|
function changeConfig(param: { [key: string]: unknown }) {
|
||||||
|
const { selectedGrid } = dashboardStore;
|
||||||
|
const graph = {
|
||||||
|
...selectedGrid.graph,
|
||||||
|
...param,
|
||||||
|
};
|
||||||
|
dashboardStore.selectWidget({ ...selectedGrid, graph });
|
||||||
|
}
|
||||||
|
function changeDepth(opt: Option[] | any) {
|
||||||
|
const val = opt[0].value;
|
||||||
|
changeConfig({ depth: val });
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.footer {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
border-top: 1px solid #eee;
|
||||||
|
padding: 10px;
|
||||||
|
text-align: right;
|
||||||
|
width: 100%;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item {
|
||||||
|
margin: 10px 0;
|
||||||
|
}
|
||||||
|
</style>
|
@ -81,10 +81,10 @@ import { useDashboardStore } from "@/store/modules/dashboard";
|
|||||||
import { useAppStoreWithOut } from "@/store/modules/app";
|
import { useAppStoreWithOut } from "@/store/modules/app";
|
||||||
import { Option } from "@/types/app";
|
import { Option } from "@/types/app";
|
||||||
import graphs from "../graphs";
|
import graphs from "../graphs";
|
||||||
import configs from "./graph-styles";
|
import configs from "./widget/graph-styles";
|
||||||
import WidgetOptions from "./WidgetOptions.vue";
|
import WidgetOptions from "./widget/WidgetOptions.vue";
|
||||||
import StandardOptions from "./StandardOptions.vue";
|
import StandardOptions from "./widget/StandardOptions.vue";
|
||||||
import MetricOptions from "./MetricOptions.vue";
|
import MetricOptions from "./widget/MetricOptions.vue";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "ConfigEdit",
|
name: "ConfigEdit",
|
||||||
|
@ -96,7 +96,7 @@ import {
|
|||||||
ChartTypes,
|
ChartTypes,
|
||||||
PodsChartTypes,
|
PodsChartTypes,
|
||||||
ListEntity,
|
ListEntity,
|
||||||
} from "../data";
|
} from "../../data";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import Icon from "@/components/Icon.vue";
|
import Icon from "@/components/Icon.vue";
|
||||||
import { useQueryProcessor, useSourceProcessor } from "@/hooks/useProcessor";
|
import { useQueryProcessor, useSourceProcessor } from "@/hooks/useProcessor";
|
@ -117,7 +117,7 @@ limitations under the License. -->
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { SortOrder } from "../data";
|
import { SortOrder } from "../../data";
|
||||||
import { useDashboardStore } from "@/store/modules/dashboard";
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
import { useQueryProcessor, useSourceProcessor } from "@/hooks/useProcessor";
|
import { useQueryProcessor, useSourceProcessor } from "@/hooks/useProcessor";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
@ -34,7 +34,7 @@ limitations under the License. -->
|
|||||||
</div>
|
</div>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
</div>
|
</div>
|
||||||
<Topology />
|
<Topology :config="props.data" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
@ -229,19 +229,10 @@ export enum LegendOpt {
|
|||||||
VALUE = "value",
|
VALUE = "value",
|
||||||
CONDITION = "condition",
|
CONDITION = "condition",
|
||||||
}
|
}
|
||||||
export const DepthList = ["1", "2", "3", "4", "5"].map((item: string) => ({
|
export const DepthList = [1, 2, 3, 4, 5].map((item: number) => ({
|
||||||
value: item,
|
value: item,
|
||||||
label: item,
|
label: item,
|
||||||
}));
|
}));
|
||||||
export const Colors: any = {
|
|
||||||
green: "#67C23A",
|
|
||||||
blue: "#409EFF",
|
|
||||||
red: "#F56C6C",
|
|
||||||
grey: "#909399",
|
|
||||||
white: "#fff",
|
|
||||||
black: "#000",
|
|
||||||
orange: "#E6A23C",
|
|
||||||
};
|
|
||||||
export const Status = [
|
export const Status = [
|
||||||
{ label: "All", value: "ALL" },
|
{ label: "All", value: "ALL" },
|
||||||
{ label: "Success", value: "SUCCESS" },
|
{ label: "Success", value: "SUCCESS" },
|
||||||
|
@ -13,18 +13,27 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License. -->
|
limitations under the License. -->
|
||||||
<template>
|
<template>
|
||||||
<PodTopology v-if="isSankey" />
|
<PodTopology :config="config" v-if="isSankey" />
|
||||||
<Graph v-else />
|
<Graph :config="config" v-else />
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import type { PropType } from "vue";
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import Graph from "./components/Graph.vue";
|
import Graph from "./components/Graph.vue";
|
||||||
import PodTopology from "./components/PodTopology.vue";
|
import PodTopology from "./components/PodTopology.vue";
|
||||||
import { EntityType } from "../../data";
|
import { EntityType } from "../../data";
|
||||||
import { useDashboardStore } from "@/store/modules/dashboard";
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
|
|
||||||
|
/*global defineProps */
|
||||||
|
defineProps({
|
||||||
|
config: {
|
||||||
|
type: Object as PropType<any>,
|
||||||
|
default: () => ({ graph: {} }),
|
||||||
|
},
|
||||||
|
});
|
||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
|
console.log(dashboardStore.entity);
|
||||||
const isSankey = ref<boolean>(
|
const isSankey = ref<boolean>(
|
||||||
[EntityType[2].value, EntityType[4].value].includes(dashboardStore.entity)
|
[EntityType[2].value, EntityType[3].value].includes(dashboardStore.entity)
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
@ -23,7 +23,7 @@ limitations under the License. -->
|
|||||||
<Settings @update="updateSettings" @updateNodes="freshNodes" />
|
<Settings @update="updateSettings" @updateNodes="freshNodes" />
|
||||||
</div>
|
</div>
|
||||||
<div class="tool">
|
<div class="tool">
|
||||||
<span v-show="dashboardStore.selectedGrid.showDepth">
|
<span v-show="config.graph.showDepth">
|
||||||
<span class="label">{{ t("currentDepth") }}</span>
|
<span class="label">{{ t("currentDepth") }}</span>
|
||||||
<Selector
|
<Selector
|
||||||
class="inputs"
|
class="inputs"
|
||||||
@ -63,6 +63,7 @@ limitations under the License. -->
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import type { PropType } from "vue";
|
||||||
import { ref, onMounted, onBeforeUnmount, reactive } from "vue";
|
import { ref, onMounted, onBeforeUnmount, reactive } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import * as d3 from "d3";
|
import * as d3 from "d3";
|
||||||
@ -83,7 +84,13 @@ 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";
|
||||||
|
|
||||||
/*global Nullable */
|
/*global Nullable, defineProps */
|
||||||
|
const props = defineProps({
|
||||||
|
config: {
|
||||||
|
type: Object as PropType<any>,
|
||||||
|
default: () => ({ graph: {} }),
|
||||||
|
},
|
||||||
|
});
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const selectorStore = useSelectorStore();
|
const selectorStore = useSelectorStore();
|
||||||
const topologyStore = useTopologyStore();
|
const topologyStore = useTopologyStore();
|
||||||
@ -110,9 +117,10 @@ const items = ref<
|
|||||||
{ id: "inspect", title: "Inspect", func: handleInspect },
|
{ id: "inspect", title: "Inspect", func: handleInspect },
|
||||||
{ id: "alarm", title: "Alarm", func: handleGoAlarm },
|
{ id: "alarm", title: "Alarm", func: handleGoAlarm },
|
||||||
]);
|
]);
|
||||||
const depth = ref<string>(dashboardStore.selectedGrid.depth || "2");
|
const depth = ref<number>(props.config.graph.depth || 2);
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
console.log(props.config.graph);
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const resp = await getTopology();
|
const resp = await getTopology();
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
@ -16,8 +16,7 @@ limitations under the License. -->
|
|||||||
<div class="tool">
|
<div class="tool">
|
||||||
<span
|
<span
|
||||||
v-show="
|
v-show="
|
||||||
dashboardStore.entity === EntityType[2].value &&
|
dashboardStore.entity === EntityType[2].value && config.graph.showDepth
|
||||||
dashboardStore.selectedGrid.showDepth
|
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<span class="label">{{ t("currentDepth") }}</span>
|
<span class="label">{{ t("currentDepth") }}</span>
|
||||||
@ -72,6 +71,7 @@ limitations under the License. -->
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import type { PropType } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { ref, onMounted, reactive } from "vue";
|
import { ref, onMounted, reactive } from "vue";
|
||||||
import { Option } from "@/types/app";
|
import { Option } from "@/types/app";
|
||||||
@ -84,6 +84,13 @@ import Sankey from "./Sankey.vue";
|
|||||||
import Settings from "./Settings.vue";
|
import Settings from "./Settings.vue";
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
|
|
||||||
|
/*global defineProps */
|
||||||
|
const props = defineProps({
|
||||||
|
config: {
|
||||||
|
type: Object as PropType<any>,
|
||||||
|
default: () => ({ graph: {} }),
|
||||||
|
},
|
||||||
|
});
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
const selectorStore = useSelectorStore();
|
const selectorStore = useSelectorStore();
|
||||||
@ -94,14 +101,14 @@ const width = ref<number>(document.body.clientWidth);
|
|||||||
const showSettings = ref<boolean>(false);
|
const showSettings = ref<boolean>(false);
|
||||||
const settings = ref<any>({});
|
const settings = ref<any>({});
|
||||||
const operationsPos = reactive<{ x: number; y: number }>({ x: NaN, y: NaN });
|
const operationsPos = reactive<{ x: number; y: number }>({ x: NaN, y: NaN });
|
||||||
const depth = ref<string>(dashboardStore.selectedGrid.depth || "3");
|
const depth = ref<number>(props.config.graph.depth || 3);
|
||||||
const items = [
|
const items = [
|
||||||
{ id: "inspect", title: "Inspect", func: inspect },
|
{ id: "inspect", title: "Inspect", func: inspect },
|
||||||
{ id: "dashboard", title: "View Dashboard", func: goDashboard },
|
{ id: "dashboard", title: "View Dashboard", func: goDashboard },
|
||||||
{ id: "alarm", title: "View Alarm", func: goAlarm },
|
{ id: "alarm", title: "View Alarm", func: goAlarm },
|
||||||
];
|
];
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(() => {
|
||||||
loadTopology(selectorStore.currentPod && selectorStore.currentPod.id);
|
loadTopology(selectorStore.currentPod && selectorStore.currentPod.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -196,7 +203,7 @@ async function getTopology(id: string) {
|
|||||||
Number(depth.value)
|
Number(depth.value)
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case EntityType[4].value:
|
case EntityType[3].value:
|
||||||
resp = await topologyStore.getInstanceTopology();
|
resp = await topologyStore.getInstanceTopology();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -221,7 +228,7 @@ function handleClick(event: any) {
|
|||||||
top: 60px;
|
top: 60px;
|
||||||
right: 10px;
|
right: 10px;
|
||||||
width: 400px;
|
width: 400px;
|
||||||
height: 700px;
|
height: 500px;
|
||||||
background-color: #2b3037;
|
background-color: #2b3037;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
padding: 0 15px;
|
padding: 0 15px;
|
||||||
|
Loading…
Reference in New Issue
Block a user