update serviceid

This commit is contained in:
Qiuxia Fan 2022-03-24 21:18:47 +08:00
parent c83cbd184e
commit f61031736f
4 changed files with 36 additions and 20 deletions

View File

@ -68,9 +68,12 @@ export const logStore = defineStore({
this.services = res.data.data.services;
return res.data;
},
async getInstances() {
async getInstances(id: string) {
const serviceId = this.selectorStore.currentService
? this.selectorStore.currentService.id
: id;
const res: AxiosResponse = await graphql.query("queryInstances").params({
serviceId: this.selectorStore.currentService.id,
serviceId,
duration: this.durationTime,
});
@ -83,9 +86,12 @@ export const logStore = defineStore({
] || [{ value: " 0", label: "All" }];
return res.data;
},
async getEndpoints() {
async getEndpoints(id: string) {
const serviceId = this.selectorStore.currentService
? this.selectorStore.currentService.id
: id;
const res: AxiosResponse = await graphql.query("queryEndpoints").params({
serviceId: this.selectorStore.currentService.id,
serviceId,
duration: this.durationTime,
keyword: "",
});

View File

@ -83,9 +83,12 @@ export const traceStore = defineStore({
this.services = res.data.data.services;
return res.data;
},
async getInstances() {
async getInstances(id: string) {
const serviceId = this.selectorStore.currentService
? this.selectorStore.currentService.id
: id;
const res: AxiosResponse = await graphql.query("queryInstances").params({
serviceId: this.selectorStore.currentService.id,
serviceId: serviceId,
duration: this.durationTime,
});
@ -98,9 +101,12 @@ export const traceStore = defineStore({
] || [{ value: " 0", label: "All" }];
return res.data;
},
async getEndpoints() {
async getEndpoints(id: string) {
const serviceId = this.selectorStore.currentService
? this.selectorStore.currentService.id
: id;
const res: AxiosResponse = await graphql.query("queryEndpoints").params({
serviceId: this.selectorStore.currentService.id,
serviceId,
duration: this.durationTime,
keyword: "",
});

View File

@ -186,18 +186,20 @@ async function getServices() {
return;
}
state.service = logStore.services[0];
getInstances(state.service.id);
getEndpoints(state.service.id);
}
async function getEndpoints() {
const resp = await logStore.getEndpoints();
async function getEndpoints(id?: string) {
const resp = await logStore.getEndpoints(id);
if (resp.errors) {
ElMessage.error(resp.errors);
return;
}
state.endpoint = logStore.endpoints[0];
}
async function getInstances() {
const resp = await logStore.getInstances();
async function getInstances(id?: string) {
const resp = await logStore.getInstances(id);
if (resp.errors) {
ElMessage.error(resp.errors);
return;
@ -237,8 +239,8 @@ async function queryLogs() {
function changeField(type: string, opt: any) {
state[type] = opt[0];
if (type === "service") {
getEndpoints();
getInstances();
getEndpoints(state.service.id);
getInstances(state.service.id);
}
}
function updateTags(data: { tagsMap: Array<Option>; tagsList: string[] }) {

View File

@ -145,18 +145,20 @@ async function getServices() {
return;
}
state.service = traceStore.services[0];
getEndpoints(state.service.id);
getInstances(state.service.id);
}
async function getEndpoints() {
const resp = await traceStore.getEndpoints();
async function getEndpoints(id?: string) {
const resp = await traceStore.getEndpoints(id);
if (resp.errors) {
ElMessage.error(resp.errors);
return;
}
state.endpoint = traceStore.endpoints[0];
}
async function getInstances() {
const resp = await traceStore.getInstances();
async function getInstances(id?: string) {
const resp = await traceStore.getInstances(id);
if (resp.errors) {
ElMessage.error(resp.errors);
return;
@ -198,8 +200,8 @@ async function queryTraces() {
function changeField(type: string, opt: any) {
state[type] = opt[0];
if (type === "service") {
getEndpoints();
getInstances();
getEndpoints(state.service.id);
getInstances(state.service.id);
}
}
function updateTags(data: { tagsMap: Array<Option>; tagsList: string[] }) {