mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-07-18 14:45:25 +00:00
fix: query metrics
This commit is contained in:
parent
bc87567f14
commit
57e6fc342d
@ -41,6 +41,9 @@ export function useQueryProcessor(config: any) {
|
|||||||
"ServiceInstanceRelation",
|
"ServiceInstanceRelation",
|
||||||
"EndpointRelation",
|
"EndpointRelation",
|
||||||
].includes(dashboardStore.entity);
|
].includes(dashboardStore.entity);
|
||||||
|
if (isRelation && !selectorStore.currentDestService) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const fragment = config.metrics.map((name: string, index: number) => {
|
const fragment = config.metrics.map((name: string, index: number) => {
|
||||||
const metricType = config.metricTypes[index] || "";
|
const metricType = config.metricTypes[index] || "";
|
||||||
const labels = ["0", "1", "2", "3", "4"];
|
const labels = ["0", "1", "2", "3", "4"];
|
||||||
|
@ -129,7 +129,6 @@ export const topologyStore = defineStore({
|
|||||||
},
|
},
|
||||||
setLinkServerMetrics(m: { id: string; value: unknown }[]) {
|
setLinkServerMetrics(m: { id: string; value: unknown }[]) {
|
||||||
this.linkServerMetrics = m;
|
this.linkServerMetrics = m;
|
||||||
console.log(m);
|
|
||||||
},
|
},
|
||||||
setLinkClientMetrics(m: { id: string; value: unknown }[]) {
|
setLinkClientMetrics(m: { id: string; value: unknown }[]) {
|
||||||
this.linkClientMetrics = m;
|
this.linkClientMetrics = m;
|
||||||
|
@ -143,4 +143,9 @@
|
|||||||
.dark-dialog {
|
.dark-dialog {
|
||||||
background-color: #333840;
|
background-color: #333840;
|
||||||
color: #ddd;
|
color: #ddd;
|
||||||
|
|
||||||
|
.el-loading-mask {
|
||||||
|
background-color: #333840;
|
||||||
|
color: #ddd;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,20 +147,12 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
watch(
|
watch(
|
||||||
() => [selectorStore.currentPod],
|
() => [selectorStore.currentPod, selectorStore.currentDestPod],
|
||||||
() => {
|
|
||||||
if (dashboardStore.entity === EntityType[0].value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
queryMetrics();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
watch(
|
|
||||||
() => [selectorStore.currentDestPod],
|
|
||||||
() => {
|
() => {
|
||||||
if (dashboardStore.entity === EntityType[0].value) {
|
if (dashboardStore.entity === EntityType[0].value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
console.log("enter");
|
||||||
queryMetrics();
|
queryMetrics();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -149,46 +149,13 @@ async function setSelector() {
|
|||||||
EntityType[6].value,
|
EntityType[6].value,
|
||||||
].includes(String(params.entity))
|
].includes(String(params.entity))
|
||||||
) {
|
) {
|
||||||
await selectorStore.getService(String(params.serviceId));
|
setSourceSelector();
|
||||||
states.currentService = selectorStore.currentService.value;
|
|
||||||
const e = String(params.entity).split("Relation")[0];
|
|
||||||
await fetchPods(e, selectorStore.currentService.id, false);
|
|
||||||
if (!(selectorStore.pods.length && selectorStore.pods[0])) {
|
|
||||||
selectorStore.setCurrentPod(null);
|
|
||||||
states.currentPod = "";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const pod = params.podId || selectorStore.pods[0].id;
|
|
||||||
const currentPod = selectorStore.pods.filter(
|
|
||||||
(d: { id: string }) => d.id === pod
|
|
||||||
)[0];
|
|
||||||
if (currentPod) {
|
|
||||||
selectorStore.setCurrentPod(currentPod);
|
|
||||||
states.currentPod = currentPod.label;
|
|
||||||
}
|
|
||||||
if (
|
if (
|
||||||
[EntityType[2].value, EntityType[3].value].includes(String(params.entity))
|
[EntityType[2].value, EntityType[3].value].includes(String(params.entity))
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await fetchPods(
|
setDestSelector();
|
||||||
String(params.entity),
|
|
||||||
selectorStore.currentDestService.id,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
if (!(selectorStore.destPods.length && selectorStore.destPods[0])) {
|
|
||||||
selectorStore.setCurrentDestPod(null);
|
|
||||||
states.currentDestPod = "";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const destPod = params.destPodId || selectorStore.destPods[0].id;
|
|
||||||
const currentDestPod = selectorStore.destPods.filter(
|
|
||||||
(d: { id: string }) => d.id === destPod
|
|
||||||
)[0];
|
|
||||||
if (currentDestPod) {
|
|
||||||
selectorStore.setCurrentDestPod(currentDestPod);
|
|
||||||
states.currentDestPod = currentDestPod.label;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// entity=Service/ServiceRelation
|
// entity=Service/ServiceRelation
|
||||||
@ -212,6 +179,49 @@ async function setSelector() {
|
|||||||
states.currentDestService = selectorStore.currentDestService.value;
|
states.currentDestService = selectorStore.currentDestService.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function setSourceSelector() {
|
||||||
|
await selectorStore.getService(String(params.serviceId));
|
||||||
|
states.currentService = selectorStore.currentService.value;
|
||||||
|
const e = String(params.entity).split("Relation")[0];
|
||||||
|
await fetchPods(e, selectorStore.currentService.id, false);
|
||||||
|
if (!(selectorStore.pods.length && selectorStore.pods[0])) {
|
||||||
|
selectorStore.setCurrentPod(null);
|
||||||
|
states.currentPod = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const pod = params.podId || selectorStore.pods[0].id;
|
||||||
|
const currentPod = selectorStore.pods.filter(
|
||||||
|
(d: { id: string }) => d.id === pod
|
||||||
|
)[0];
|
||||||
|
if (currentPod) {
|
||||||
|
selectorStore.setCurrentPod(currentPod);
|
||||||
|
states.currentPod = currentPod.label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function setDestSelector() {
|
||||||
|
await selectorStore.getService(String(params.destServiceId), true);
|
||||||
|
states.currentDestService = selectorStore.currentDestService.value;
|
||||||
|
await fetchPods(
|
||||||
|
String(params.entity),
|
||||||
|
selectorStore.currentDestService.id,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
if (!(selectorStore.destPods.length && selectorStore.destPods[0])) {
|
||||||
|
selectorStore.setCurrentDestPod(null);
|
||||||
|
states.currentDestPod = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const destPod = params.destPodId || selectorStore.destPods[0].id;
|
||||||
|
const currentDestPod = selectorStore.destPods.filter(
|
||||||
|
(d: { id: string }) => d.id === destPod
|
||||||
|
)[0];
|
||||||
|
if (currentDestPod) {
|
||||||
|
selectorStore.setCurrentDestPod(currentDestPod);
|
||||||
|
states.currentDestPod = currentDestPod.label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function getServices() {
|
async function getServices() {
|
||||||
if (!dashboardStore.layerId) {
|
if (!dashboardStore.layerId) {
|
||||||
return;
|
return;
|
||||||
@ -233,8 +243,16 @@ async function getServices() {
|
|||||||
states.currentService = selectorStore.currentService.value;
|
states.currentService = selectorStore.currentService.value;
|
||||||
states.currentDestService = selectorStore.currentDestService.value;
|
states.currentDestService = selectorStore.currentDestService.value;
|
||||||
const e = dashboardStore.entity.split("Relation")[0];
|
const e = dashboardStore.entity.split("Relation")[0];
|
||||||
fetchPods(e, selectorStore.currentService.id, true);
|
if (
|
||||||
fetchPods(dashboardStore.entity, selectorStore.currentDestService.id, true);
|
[EntityType[2].value, EntityType[3].value].includes(dashboardStore.entity)
|
||||||
|
) {
|
||||||
|
fetchPods(e, selectorStore.currentService.id, true);
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
[EntityType[5].value, EntityType[6].value].includes(dashboardStore.entity)
|
||||||
|
) {
|
||||||
|
fetchPods(dashboardStore.entity, selectorStore.currentDestService.id, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function changeService(service: Service[]) {
|
async function changeService(service: Service[]) {
|
||||||
|
@ -100,7 +100,7 @@ const items = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
loadTopology(selectorStore.currentPod.id);
|
loadTopology(selectorStore.currentPod && selectorStore.currentPod.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
async function loadTopology(id: string) {
|
async function loadTopology(id: string) {
|
||||||
@ -127,7 +127,11 @@ function goAlarm() {
|
|||||||
topologyStore.setNode(null);
|
topologyStore.setNode(null);
|
||||||
}
|
}
|
||||||
function goDashboard() {
|
function goDashboard() {
|
||||||
const path = `/dashboard/${dashboardStore.layerId}/${dashboardStore.entity}/${topologyStore.node.serviceId}/${topologyStore.node.id}/${settings.value.nodeDashboard}`;
|
const entity =
|
||||||
|
dashboardStore.entity === EntityType[2].value
|
||||||
|
? EntityType[2].value
|
||||||
|
: EntityType[3].value;
|
||||||
|
const path = `/dashboard/${dashboardStore.layerId}/${entity}/${topologyStore.node.serviceId}/${topologyStore.node.id}/${settings.value.nodeDashboard}`;
|
||||||
const routeUrl = router.resolve({ path });
|
const routeUrl = router.resolve({ path });
|
||||||
window.open(routeUrl.href, "_blank");
|
window.open(routeUrl.href, "_blank");
|
||||||
topologyStore.setNode(null);
|
topologyStore.setNode(null);
|
||||||
@ -149,6 +153,7 @@ function backToTopology() {
|
|||||||
|
|
||||||
function selectNodeLink(d: any) {
|
function selectNodeLink(d: any) {
|
||||||
if (d.dataType === "edge") {
|
if (d.dataType === "edge") {
|
||||||
|
console.log(d.data);
|
||||||
topologyStore.setNode(null);
|
topologyStore.setNode(null);
|
||||||
topologyStore.setLink(d.data);
|
topologyStore.setLink(d.data);
|
||||||
if (!settings.value.linkDashboard) {
|
if (!settings.value.linkDashboard) {
|
||||||
@ -194,6 +199,8 @@ async function getTopology(id: string) {
|
|||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.sankey {
|
.sankey {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
|
background-color: #333840;
|
||||||
|
color: #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
.settings {
|
.settings {
|
||||||
@ -248,7 +255,7 @@ async function getTopology(id: string) {
|
|||||||
span {
|
span {
|
||||||
display: block;
|
display: block;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
width: 100px;
|
width: 140px;
|
||||||
line-height: 30px;
|
line-height: 30px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user