mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-01 17:44:48 +00:00
fix: verify query params to avoid invalid queries (#77)
This commit is contained in:
parent
7d1bb43adb
commit
2a2500a28d
@ -85,6 +85,9 @@ export const ebpfStore = defineStore({
|
|||||||
return res.data;
|
return res.data;
|
||||||
},
|
},
|
||||||
async getTaskList(serviceId: string) {
|
async getTaskList(serviceId: string) {
|
||||||
|
if (!serviceId) {
|
||||||
|
return new Promise((resolve) => resolve({}));
|
||||||
|
}
|
||||||
const res: AxiosResponse = await graphql
|
const res: AxiosResponse = await graphql
|
||||||
.query("getEBPFTasks")
|
.query("getEBPFTasks")
|
||||||
.params({ serviceId });
|
.params({ serviceId });
|
||||||
@ -101,6 +104,9 @@ export const ebpfStore = defineStore({
|
|||||||
return res.data;
|
return res.data;
|
||||||
},
|
},
|
||||||
async getEBPFSchedules(params: { taskId: string; duration?: Duration }) {
|
async getEBPFSchedules(params: { taskId: string; duration?: Duration }) {
|
||||||
|
if (!params.taskId) {
|
||||||
|
return new Promise((resolve) => resolve({}));
|
||||||
|
}
|
||||||
const duration = useAppStoreWithOut().durationTime;
|
const duration = useAppStoreWithOut().durationTime;
|
||||||
const res: AxiosResponse = await graphql
|
const res: AxiosResponse = await graphql
|
||||||
.query("getEBPFSchedules")
|
.query("getEBPFSchedules")
|
||||||
@ -124,6 +130,12 @@ export const ebpfStore = defineStore({
|
|||||||
scheduleIdList: string[];
|
scheduleIdList: string[];
|
||||||
timeRanges: Array<{ start: number; end: number }>;
|
timeRanges: Array<{ start: number; end: number }>;
|
||||||
}) {
|
}) {
|
||||||
|
if (!params.scheduleIdList.length) {
|
||||||
|
return new Promise((resolve) => resolve({}));
|
||||||
|
}
|
||||||
|
if (!params.timeRanges.length) {
|
||||||
|
return new Promise((resolve) => resolve({}));
|
||||||
|
}
|
||||||
const res: AxiosResponse = await graphql
|
const res: AxiosResponse = await graphql
|
||||||
.query("getEBPFResult")
|
.query("getEBPFResult")
|
||||||
.params(params);
|
.params(params);
|
||||||
|
@ -122,6 +122,9 @@ export const profileStore = defineStore({
|
|||||||
return res.data;
|
return res.data;
|
||||||
},
|
},
|
||||||
async getSegmentList(params: { taskID: string }) {
|
async getSegmentList(params: { taskID: string }) {
|
||||||
|
if (!params.taskID) {
|
||||||
|
return new Promise((resolve) => resolve({}));
|
||||||
|
}
|
||||||
const res: AxiosResponse = await graphql
|
const res: AxiosResponse = await graphql
|
||||||
.query("getProfileTaskSegmentList")
|
.query("getProfileTaskSegmentList")
|
||||||
.params(params);
|
.params(params);
|
||||||
@ -148,6 +151,9 @@ export const profileStore = defineStore({
|
|||||||
return res.data;
|
return res.data;
|
||||||
},
|
},
|
||||||
async getSegmentSpans(params: { segmentId: string }) {
|
async getSegmentSpans(params: { segmentId: string }) {
|
||||||
|
if (!params.segmentId) {
|
||||||
|
return new Promise((resolve) => resolve({}));
|
||||||
|
}
|
||||||
const res: AxiosResponse = await graphql
|
const res: AxiosResponse = await graphql
|
||||||
.query("queryProfileSegment")
|
.query("queryProfileSegment")
|
||||||
.params(params);
|
.params(params);
|
||||||
@ -180,6 +186,12 @@ export const profileStore = defineStore({
|
|||||||
segmentId: string;
|
segmentId: string;
|
||||||
timeRanges: Array<{ start: number; end: number }>;
|
timeRanges: Array<{ start: number; end: number }>;
|
||||||
}) {
|
}) {
|
||||||
|
if (!params.segmentId) {
|
||||||
|
return new Promise((resolve) => resolve({}));
|
||||||
|
}
|
||||||
|
if (!params.timeRanges.length) {
|
||||||
|
return new Promise((resolve) => resolve({}));
|
||||||
|
}
|
||||||
const res: AxiosResponse = await graphql
|
const res: AxiosResponse = await graphql
|
||||||
.query("getProfileAnalyze")
|
.query("getProfileAnalyze")
|
||||||
.params(params);
|
.params(params);
|
||||||
|
@ -140,6 +140,7 @@ const selectedTask = ref<TaskListItem | Record<string, never>>({});
|
|||||||
const instanceLogs = ref<TaskLog | any>({});
|
const instanceLogs = ref<TaskLog | any>({});
|
||||||
|
|
||||||
async function changeTask(item: TaskListItem) {
|
async function changeTask(item: TaskListItem) {
|
||||||
|
profileStore.setCurrentSegment({});
|
||||||
selectedTask.value = item;
|
selectedTask.value = item;
|
||||||
const res = await profileStore.getSegmentList({ taskID: item.id });
|
const res = await profileStore.getSegmentList({ taskID: item.id });
|
||||||
if (res.errors) {
|
if (res.errors) {
|
||||||
|
Loading…
Reference in New Issue
Block a user