From fade4ca93f683071778772e1779a6e232316b9e9 Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Mon, 18 Apr 2022 21:19:58 +0800 Subject: [PATCH] get task list --- src/assets/icons/view.svg | 15 ++ src/graphql/fragments/ebpf.ts | 13 ++ src/graphql/query/ebpf.ts | 8 +- src/store/modules/ebpf.ts | 24 +-- src/views/dashboard/related/ebpf/Content.vue | 13 +- src/views/dashboard/related/ebpf/Header.vue | 21 +-- .../related/ebpf/components/NewTask.vue | 5 +- .../related/ebpf/components/TaskList.vue | 147 ++++++++++++++++++ .../related/profile/components/TaskList.vue | 2 +- 9 files changed, 212 insertions(+), 36 deletions(-) create mode 100644 src/assets/icons/view.svg create mode 100644 src/views/dashboard/related/ebpf/components/TaskList.vue diff --git a/src/assets/icons/view.svg b/src/assets/icons/view.svg new file mode 100644 index 00000000..4122084d --- /dev/null +++ b/src/assets/icons/view.svg @@ -0,0 +1,15 @@ + + diff --git a/src/graphql/fragments/ebpf.ts b/src/graphql/fragments/ebpf.ts index e9ca9da6..69cd87fd 100644 --- a/src/graphql/fragments/ebpf.ts +++ b/src/graphql/fragments/ebpf.ts @@ -32,3 +32,16 @@ export const createEBPFTask = { id }`, }; +export const queryEBPFTasks = { + variable: "$serviceId: ID!", + query: ` + queryEBPFTasks: queryEBPFProfilingTasks(serviceId: $serviceId) { + taskId + processLabels + taskStartTime + triggerType + fixedTriggerDuration + targetType + createTime + }`, +}; diff --git a/src/graphql/query/ebpf.ts b/src/graphql/query/ebpf.ts index f8180934..81c724b7 100644 --- a/src/graphql/query/ebpf.ts +++ b/src/graphql/query/ebpf.ts @@ -15,8 +15,14 @@ * limitations under the License. */ -import { queryCreateTaskData, createEBPFTask } from "../fragments/ebpf"; +import { + queryCreateTaskData, + createEBPFTask, + queryEBPFTasks, +} from "../fragments/ebpf"; export const getCreateTaskData = `query queryCreateTaskData(${queryCreateTaskData.variable}) {${queryCreateTaskData.query}}`; export const saveEBPFTask = `mutation createEBPFTask(${createEBPFTask.variable}) {${createEBPFTask.query}}`; + +export const getEBPFTasks = `query queryEBPFTasks(${queryEBPFTasks.variable}) {${queryEBPFTasks.query}}`; diff --git a/src/store/modules/ebpf.ts b/src/store/modules/ebpf.ts index f1220d03..e99b802f 100644 --- a/src/store/modules/ebpf.ts +++ b/src/store/modules/ebpf.ts @@ -31,7 +31,6 @@ import { useAppStoreWithOut } from "@/store/modules/app"; interface EbpfStore { durationTime: Duration; - condition: { serviceId: string; endpointName: string }; taskList: TaskListItem[]; segmentList: Trace[]; currentSegment: Trace | Record; @@ -48,7 +47,6 @@ export const ebpfStore = defineStore({ id: "eBPF", state: (): EbpfStore => ({ durationTime: useAppStoreWithOut().durationTime, - condition: { serviceId: "", endpointName: "" }, taskList: [], segmentList: [], currentSegment: {}, @@ -61,12 +59,6 @@ export const ebpfStore = defineStore({ couldProfiling: false, }), actions: { - setConditions(data: { serviceId?: string; endpointName?: string }) { - this.condition = { - ...this.condition, - ...data, - }; - }, setCurrentSpan(span: Span) { this.currentSpan = span; }, @@ -91,24 +83,16 @@ export const ebpfStore = defineStore({ }); return res.data; }, - async getTaskList() { + async getTaskList(serviceId: string) { const res: AxiosResponse = await graphql - .query("getProfileTaskList") - .params(this.condition); + .query("getEBPFTasks") + .params({ serviceId }); if (res.data.errors) { return res.data; } - const list = res.data.data.taskList; - this.taskList = list; - if (!list.length) { - this.segmentList = []; - this.segmentSpans = []; - this.analyzeTrees = []; + this.taskList = res.data.data.queryEBPFTasks || []; - return res.data; - } - this.getSegmentList({ taskID: list[0].id }); return res.data; }, async getSegmentList(params: { taskID: string }) { diff --git a/src/views/dashboard/related/ebpf/Content.vue b/src/views/dashboard/related/ebpf/Content.vue index f692e0de..d72327cd 100644 --- a/src/views/dashboard/related/ebpf/Content.vue +++ b/src/views/dashboard/related/ebpf/Content.vue @@ -13,5 +13,16 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> + + diff --git a/src/views/dashboard/related/ebpf/Header.vue b/src/views/dashboard/related/ebpf/Header.vue index 6400e3f2..d2f7c208 100644 --- a/src/views/dashboard/related/ebpf/Header.vue +++ b/src/views/dashboard/related/ebpf/Header.vue @@ -14,7 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. -->