mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-02 06:44:02 +00:00
fix: set endpoint and instance selectors with url parameters (#264)
This commit is contained in:
parent
921c961dc1
commit
903cf8e9bd
@ -261,6 +261,7 @@ limitations under the License. -->
|
|||||||
await selectorStore.getService(String(params.serviceId));
|
await selectorStore.getService(String(params.serviceId));
|
||||||
states.currentService = selectorStore.currentService.value;
|
states.currentService = selectorStore.currentService.value;
|
||||||
const e = String(params.entity).split("Relation")[0];
|
const e = String(params.entity).split("Relation")[0];
|
||||||
|
|
||||||
await fetchPods(e, selectorStore.currentService.id, true);
|
await fetchPods(e, selectorStore.currentService.id, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,9 +508,16 @@ limitations under the License. -->
|
|||||||
let resp;
|
let resp;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EntityType[2].value:
|
case EntityType[2].value:
|
||||||
resp = await selectorStore.getEndpoints({ serviceId, ...param });
|
if (params.podId) {
|
||||||
if (setPod) {
|
if (setPod) {
|
||||||
updateCurrentPod();
|
await setCurrentEndpoint();
|
||||||
|
}
|
||||||
|
resp = await selectorStore.getEndpoints({ serviceId, ...param });
|
||||||
|
} else {
|
||||||
|
resp = await selectorStore.getEndpoints({ serviceId, ...param });
|
||||||
|
if (setPod) {
|
||||||
|
updateCurrentPod();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EntityType[3].value:
|
case EntityType[3].value:
|
||||||
@ -519,13 +527,24 @@ limitations under the License. -->
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EntityType[6].value:
|
case EntityType[6].value:
|
||||||
resp = await selectorStore.getEndpoints({
|
if (params.destPodId) {
|
||||||
serviceId,
|
if (setPod) {
|
||||||
isRelation: true,
|
await updateCurrentDestEndpoint();
|
||||||
...param,
|
}
|
||||||
});
|
resp = await selectorStore.getEndpoints({
|
||||||
if (setPod) {
|
serviceId,
|
||||||
updateCurrentDestPod();
|
isRelation: true,
|
||||||
|
...param,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
resp = await selectorStore.getEndpoints({
|
||||||
|
serviceId,
|
||||||
|
isRelation: true,
|
||||||
|
...param,
|
||||||
|
});
|
||||||
|
if (setPod) {
|
||||||
|
updateCurrentDestPod();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EntityType[5].value:
|
case EntityType[5].value:
|
||||||
@ -585,6 +604,19 @@ limitations under the License. -->
|
|||||||
}
|
}
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
async function updateCurrentDestEndpoint() {
|
||||||
|
const resp = await selectorStore.getEndpoint(params.destPodId, true);
|
||||||
|
|
||||||
|
if (resp.errors) {
|
||||||
|
return ElMessage.error(resp.errors);
|
||||||
|
}
|
||||||
|
const pod = resp.data.endpoint || {};
|
||||||
|
if (!pod.id) {
|
||||||
|
ElMessage.info("The Destination endpoint ID doesn't exist.");
|
||||||
|
}
|
||||||
|
selectorStore.setCurrentDestPod(pod);
|
||||||
|
states.currentDestPod = pod.label;
|
||||||
|
}
|
||||||
|
|
||||||
function updateCurrentDestPod() {
|
function updateCurrentDestPod() {
|
||||||
if (!(selectorStore.destPods.length && selectorStore.destPods[0])) {
|
if (!(selectorStore.destPods.length && selectorStore.destPods[0])) {
|
||||||
@ -597,11 +629,27 @@ limitations under the License. -->
|
|||||||
if (!currentDestPod) {
|
if (!currentDestPod) {
|
||||||
states.currentDestPod = "";
|
states.currentDestPod = "";
|
||||||
selectorStore.setCurrentDestPod(null);
|
selectorStore.setCurrentDestPod(null);
|
||||||
|
ElMessage.info(
|
||||||
|
`The Destination ${params.entity === EntityType[6].value ? "endpoint" : "instance"} ID doesn't exist.`,
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
selectorStore.setCurrentDestPod(currentDestPod);
|
selectorStore.setCurrentDestPod(currentDestPod);
|
||||||
states.currentDestPod = currentDestPod.label;
|
states.currentDestPod = currentDestPod.label;
|
||||||
}
|
}
|
||||||
|
async function setCurrentEndpoint() {
|
||||||
|
const resp = await selectorStore.getEndpoint(params.podId);
|
||||||
|
|
||||||
|
if (resp.errors) {
|
||||||
|
return ElMessage.error(resp.errors);
|
||||||
|
}
|
||||||
|
const pod = resp.data.endpoint || {};
|
||||||
|
if (!pod.id) {
|
||||||
|
ElMessage.info("The endpoint ID doesn't exist.");
|
||||||
|
}
|
||||||
|
selectorStore.setCurrentPod(pod);
|
||||||
|
states.currentPod = pod.label || "";
|
||||||
|
}
|
||||||
function updateCurrentPod() {
|
function updateCurrentPod() {
|
||||||
if (!(selectorStore.pods.length && selectorStore.pods[0])) {
|
if (!(selectorStore.pods.length && selectorStore.pods[0])) {
|
||||||
selectorStore.setCurrentPod(null);
|
selectorStore.setCurrentPod(null);
|
||||||
@ -613,6 +661,7 @@ limitations under the License. -->
|
|||||||
if (!currentPod) {
|
if (!currentPod) {
|
||||||
selectorStore.setCurrentPod(null);
|
selectorStore.setCurrentPod(null);
|
||||||
states.currentPod = "";
|
states.currentPod = "";
|
||||||
|
ElMessage.info(`The ${params.entity === EntityType[2].value ? "endpoint" : "instance"} ID doesn't exist.`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
selectorStore.setCurrentPod(currentPod);
|
selectorStore.setCurrentPod(currentPod);
|
||||||
|
Loading…
Reference in New Issue
Block a user