mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-14 17:05:10 +00:00
setup process selector
This commit is contained in:
parent
e6e1f6457b
commit
da851d223f
@ -71,6 +71,12 @@ export const selectorStore = defineStore({
|
|||||||
setCurrentDestProcess(process: Nullable<Process>) {
|
setCurrentDestProcess(process: Nullable<Process>) {
|
||||||
this.currentDestPod = process;
|
this.currentDestPod = process;
|
||||||
},
|
},
|
||||||
|
setDestPods(pods: Array<Instance | Endpoint>) {
|
||||||
|
this.destPods = pods;
|
||||||
|
},
|
||||||
|
setDestProcesses(processes: Array<Process>) {
|
||||||
|
this.destPods = processes;
|
||||||
|
},
|
||||||
async fetchLayers(): Promise<AxiosResponse> {
|
async fetchLayers(): Promise<AxiosResponse> {
|
||||||
const res: AxiosResponse = await graphql.query("queryLayers").params({});
|
const res: AxiosResponse = await graphql.query("queryLayers").params({});
|
||||||
|
|
||||||
|
@ -213,6 +213,11 @@ export const EndpointTools = [
|
|||||||
{ name: "assignment", content: "Add Log", id: "addLog" },
|
{ name: "assignment", content: "Add Log", id: "addLog" },
|
||||||
{ name: "event", content: "Add Event", id: "addEvent" },
|
{ name: "event", content: "Add Event", id: "addEvent" },
|
||||||
];
|
];
|
||||||
|
export const ProcessTools = [
|
||||||
|
{ name: "playlist_add", content: "Add Widget", id: "addWidget" },
|
||||||
|
{ name: "all_inbox", content: "Add Tab", id: "addTab" },
|
||||||
|
{ name: "library_books", content: "Add Text", id: "addText" },
|
||||||
|
];
|
||||||
export const ServiceRelationTools = [
|
export const ServiceRelationTools = [
|
||||||
{ name: "playlist_add", content: "Add Widget", id: "addWidget" },
|
{ name: "playlist_add", content: "Add Widget", id: "addWidget" },
|
||||||
{ name: "all_inbox", content: "Add Tab", id: "addTab" },
|
{ name: "all_inbox", content: "Add Tab", id: "addTab" },
|
||||||
|
@ -50,11 +50,11 @@ limitations under the License. -->
|
|||||||
<div class="selectors-item" v-if="key === 5">
|
<div class="selectors-item" v-if="key === 5">
|
||||||
<span class="label"> $Process </span>
|
<span class="label"> $Process </span>
|
||||||
<Selector
|
<Selector
|
||||||
v-model="states.currentDestPod"
|
v-model="states.currentProcess"
|
||||||
:options="selectorStore.destPods"
|
:options="selectorStore.processes"
|
||||||
size="small"
|
size="small"
|
||||||
placeholder="Select a data"
|
placeholder="Select a data"
|
||||||
@change="changeDestPods"
|
@change="changeProcess"
|
||||||
class="selectors"
|
class="selectors"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -91,11 +91,11 @@ limitations under the License. -->
|
|||||||
<div class="selectors-item" v-if="key === 5">
|
<div class="selectors-item" v-if="key === 5">
|
||||||
<span class="label"> $DestinationProcess </span>
|
<span class="label"> $DestinationProcess </span>
|
||||||
<Selector
|
<Selector
|
||||||
v-model="states.currentDestPod"
|
v-model="states.currentDestProcess"
|
||||||
:options="selectorStore.destPods"
|
:options="selectorStore.destProcesses"
|
||||||
size="small"
|
size="small"
|
||||||
placeholder="Select a data"
|
placeholder="Select a data"
|
||||||
@change="changeDestPods"
|
@change="changeDestProcess"
|
||||||
class="selectors"
|
class="selectors"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -155,6 +155,7 @@ import {
|
|||||||
EndpointRelationTools,
|
EndpointRelationTools,
|
||||||
InstanceRelationTools,
|
InstanceRelationTools,
|
||||||
ServiceRelationTools,
|
ServiceRelationTools,
|
||||||
|
ProcessTools,
|
||||||
} from "../data";
|
} from "../data";
|
||||||
import { useSelectorStore } from "@/store/modules/selectors";
|
import { useSelectorStore } from "@/store/modules/selectors";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
@ -175,16 +176,20 @@ const states = reactive<{
|
|||||||
key: number;
|
key: number;
|
||||||
currentService: string;
|
currentService: string;
|
||||||
currentPod: string;
|
currentPod: string;
|
||||||
|
currentProcess: string;
|
||||||
currentDestService: string;
|
currentDestService: string;
|
||||||
currentDestPod: string;
|
currentDestPod: string;
|
||||||
|
currentDestProcess: string;
|
||||||
}>({
|
}>({
|
||||||
destService: "",
|
destService: "",
|
||||||
destPod: "",
|
destPod: "",
|
||||||
key: 0,
|
key: 0,
|
||||||
currentService: "",
|
currentService: "",
|
||||||
currentPod: "",
|
currentPod: "",
|
||||||
|
currentProcess: "",
|
||||||
currentDestService: "",
|
currentDestService: "",
|
||||||
currentDestPod: "",
|
currentDestPod: "",
|
||||||
|
currentDestProcess: "",
|
||||||
});
|
});
|
||||||
const key = computed(() => {
|
const key = computed(() => {
|
||||||
const type = EntityType.find(
|
const type = EntityType.find(
|
||||||
@ -346,14 +351,18 @@ async function getServices() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
selectorStore.setCurrentService(s || null);
|
selectorStore.setCurrentService(s || null);
|
||||||
let d;
|
let d,
|
||||||
|
val = 1;
|
||||||
|
if (key.value === 5) {
|
||||||
|
val = 0;
|
||||||
|
}
|
||||||
if (states.currentService) {
|
if (states.currentService) {
|
||||||
d = (selectorStore.services || []).find(
|
d = (selectorStore.services || []).find(
|
||||||
(d: { label: string }) => d.label === states.currentDestService
|
(d: { label: string }) => d.label === states.currentDestService
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
d = (selectorStore.services || []).find(
|
d = (selectorStore.services || []).find(
|
||||||
(d: unknown, index: number) => index === 1
|
(d: unknown, index: number) => index === val
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
selectorStore.setCurrentDestService(d || null);
|
selectorStore.setCurrentDestService(d || null);
|
||||||
@ -377,7 +386,9 @@ async function getServices() {
|
|||||||
}
|
}
|
||||||
states.currentDestService = selectorStore.currentDestService.value;
|
states.currentDestService = selectorStore.currentDestService.value;
|
||||||
if (
|
if (
|
||||||
[EntityType[5].value, EntityType[6].value].includes(dashboardStore.entity)
|
[EntityType[5].value, EntityType[6].value, EntityType[7].value].includes(
|
||||||
|
dashboardStore.entity
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
fetchPods(dashboardStore.entity, selectorStore.currentDestService.id, true);
|
fetchPods(dashboardStore.entity, selectorStore.currentDestService.id, true);
|
||||||
}
|
}
|
||||||
@ -409,19 +420,19 @@ function changeDestService(service: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function changePods(pod: any) {
|
function changePods(pod: any) {
|
||||||
if (pod[0]) {
|
selectorStore.setCurrentPod(pod[0] || null);
|
||||||
selectorStore.setCurrentPod(pod[0]);
|
|
||||||
} else {
|
|
||||||
selectorStore.setCurrentPod("");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeDestPods(pod: any) {
|
function changeDestPods(pod: any) {
|
||||||
if (pod[0]) {
|
selectorStore.setCurrentDestPod(pod[0] || null);
|
||||||
selectorStore.setCurrentDestPod(pod[0]);
|
}
|
||||||
} else {
|
|
||||||
selectorStore.setCurrentDestPod(null);
|
function changeDestProcess(pod: any) {
|
||||||
}
|
selectorStore.setCurrentDestProcess(pod[0] || null);
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeProcess(pod: any) {
|
||||||
|
selectorStore.setCurrentProcess(pod[0] || null);
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeMode() {
|
function changeMode() {
|
||||||
@ -614,6 +625,65 @@ async function fetchPods(
|
|||||||
states.currentDestPod = selectorStore.currentDestPod.label;
|
states.currentDestPod = selectorStore.currentDestPod.label;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case EntityType[7].value:
|
||||||
|
resp = await selectorStore.getServiceInstances({ serviceId });
|
||||||
|
if (setPod) {
|
||||||
|
let p, m;
|
||||||
|
if (states.currentPod) {
|
||||||
|
p = selectorStore.pods.find(
|
||||||
|
(d: { label: string }) => d.label === states.currentPod
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
p = selectorStore.pods.find(
|
||||||
|
(d: { label: string }, index: number) => index === 0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
selectorStore.setCurrentPod(p || null);
|
||||||
|
states.currentPod = selectorStore.currentPod.label;
|
||||||
|
selectorStore.setDestPods(selectorStore.pods || []);
|
||||||
|
if (states.currentDestPod) {
|
||||||
|
m = selectorStore.destPods.find(
|
||||||
|
(d: { label: string }) => d.label === states.currentDestPod
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
m = selectorStore.destPods.find(
|
||||||
|
(d: { label: string }, index: number) => index === 1
|
||||||
|
);
|
||||||
|
}
|
||||||
|
selectorStore.setCurrentDestPod(m || null);
|
||||||
|
states.currentDestPod = selectorStore.currentDestPod.label;
|
||||||
|
}
|
||||||
|
resp = await selectorStore.getProcesses({
|
||||||
|
instanceId: selectorStore.currentPod.id,
|
||||||
|
isRelation: true,
|
||||||
|
});
|
||||||
|
if (setPod) {
|
||||||
|
let p, m;
|
||||||
|
if (states.currentProcess) {
|
||||||
|
p = selectorStore.processes.find(
|
||||||
|
(d: { label: string }) => d.label === states.currentProcess
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
p = selectorStore.processes.find(
|
||||||
|
(d: { label: string }, index: number) => index === 0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
selectorStore.setCurrentProcess(p || null);
|
||||||
|
states.currentProcess = selectorStore.currentProcess.label;
|
||||||
|
selectorStore.setDestProcesses(selectorStore.processes || []);
|
||||||
|
if (states.currentDestProcess) {
|
||||||
|
m = selectorStore.destProcesses.find(
|
||||||
|
(d: { label: string }) => d.label === states.currentDestProcess
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
m = selectorStore.destProcesses.find(
|
||||||
|
(d: { label: string }, index: number) => index === 1
|
||||||
|
);
|
||||||
|
}
|
||||||
|
selectorStore.setCurrentDestProcess(m || null);
|
||||||
|
states.currentDestProcess = selectorStore.currentDestProcess.label;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
resp = {};
|
resp = {};
|
||||||
}
|
}
|
||||||
@ -644,6 +714,9 @@ function getTools() {
|
|||||||
case EntityType[6].value:
|
case EntityType[6].value:
|
||||||
toolIcons.value = EndpointRelationTools;
|
toolIcons.value = EndpointRelationTools;
|
||||||
break;
|
break;
|
||||||
|
case EntityType[7].value:
|
||||||
|
toolIcons.value = ProcessTools;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
toolIcons.value = AllTools;
|
toolIcons.value = AllTools;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user