mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-13 08:17:33 +00:00
fix: set endpoints and instances
This commit is contained in:
parent
921c961dc1
commit
52e55563a3
@ -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,16 +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 (setPod) {
|
if (setPod) {
|
||||||
updateCurrentPod();
|
await updateCurrentPod(EntityType[2].value);
|
||||||
}
|
}
|
||||||
|
resp = await selectorStore.getEndpoints({ serviceId, ...param });
|
||||||
break;
|
break;
|
||||||
case EntityType[3].value:
|
case EntityType[3].value:
|
||||||
resp = await selectorStore.getServiceInstances({ serviceId });
|
|
||||||
if (setPod) {
|
if (setPod) {
|
||||||
updateCurrentPod();
|
await updateCurrentPod(EntityType[3].value);
|
||||||
}
|
}
|
||||||
|
resp = await selectorStore.getServiceInstances({ serviceId });
|
||||||
break;
|
break;
|
||||||
case EntityType[6].value:
|
case EntityType[6].value:
|
||||||
resp = await selectorStore.getEndpoints({
|
resp = await selectorStore.getEndpoints({
|
||||||
@ -602,13 +603,29 @@ limitations under the License. -->
|
|||||||
selectorStore.setCurrentDestPod(currentDestPod);
|
selectorStore.setCurrentDestPod(currentDestPod);
|
||||||
states.currentDestPod = currentDestPod.label;
|
states.currentDestPod = currentDestPod.label;
|
||||||
}
|
}
|
||||||
function updateCurrentPod() {
|
async function updateCurrentPod(type: string) {
|
||||||
|
if (params.podId) {
|
||||||
|
let resp;
|
||||||
|
if (type === EntityType[2].value) {
|
||||||
|
resp = await selectorStore.getEndpoint(params.podId);
|
||||||
|
} else {
|
||||||
|
resp = await selectorStore.getInstance(params.podId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resp.errors) {
|
||||||
|
return ElMessage.error(resp.errors);
|
||||||
|
}
|
||||||
|
const pod = resp.data.endpoint || resp.data.instance || {};
|
||||||
|
selectorStore.setCurrentPod(pod);
|
||||||
|
states.currentPod = pod.label;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!(selectorStore.pods.length && selectorStore.pods[0])) {
|
if (!(selectorStore.pods.length && selectorStore.pods[0])) {
|
||||||
selectorStore.setCurrentPod(null);
|
selectorStore.setCurrentPod(null);
|
||||||
states.currentPod = "";
|
states.currentPod = "";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const pod = params.podId || selectorStore.pods[0].id;
|
const pod = selectorStore.pods[0].id;
|
||||||
const currentPod = selectorStore.pods.find((d: { id: string }) => d.id === pod);
|
const currentPod = selectorStore.pods.find((d: { id: string }) => d.id === pod);
|
||||||
if (!currentPod) {
|
if (!currentPod) {
|
||||||
selectorStore.setCurrentPod(null);
|
selectorStore.setCurrentPod(null);
|
||||||
|
Loading…
Reference in New Issue
Block a user