diff --git a/src/graphql/fragments/log.ts b/src/graphql/fragments/log.ts index cfc505d5..78738d8e 100644 --- a/src/graphql/fragments/log.ts +++ b/src/graphql/fragments/log.ts @@ -63,3 +63,15 @@ export const QueryLogsByKeywords = { query: ` support: supportQueryLogsByKeywords`, }; + +export const LogTagKeys = { + variable: "$duration: Duration!", + query: ` + tagKeys: queryLogTagAutocompleteKeys(duration: $duration)`, +}; + +export const LogTagValues = { + variable: "$tagKey: String!, $duration: Duration!", + query: ` + tagValues: queryLogTagAutocompleteValues(tagKey: $tagKey, duration: $duration)`, +}; diff --git a/src/graphql/fragments/trace.ts b/src/graphql/fragments/trace.ts index 2dd391a1..04f718e0 100644 --- a/src/graphql/fragments/trace.ts +++ b/src/graphql/fragments/trace.ts @@ -74,3 +74,14 @@ export const TraceSpans = { } `, }; +export const TraceTagKeys = { + variable: "$duration: Duration!", + query: ` + tagKeys: queryTraceTagAutocompleteKeys(duration: $duration)`, +}; + +export const TraceTagValues = { + variable: "$tagKey: String!, $duration: Duration!", + query: ` + tagValues: queryTraceTagAutocompleteValues(tagKey: $tagKey, duration: $duration)`, +}; diff --git a/src/graphql/query/log.ts b/src/graphql/query/log.ts index cac2e2e1..dfe8c002 100644 --- a/src/graphql/query/log.ts +++ b/src/graphql/query/log.ts @@ -19,9 +19,13 @@ import { QueryBrowserErrorLogs, QueryServiceLogs, QueryLogsByKeywords, + LogTagValues, + LogTagKeys, } from "../fragments/log"; export const queryBrowserErrorLogs = `query queryBrowserErrorLogs(${QueryBrowserErrorLogs.variable}) { ${QueryBrowserErrorLogs.query}}`; export const queryServiceLogs = `query queryLogs(${QueryServiceLogs.variable}) {${QueryServiceLogs.query}}`; export const queryLogsByKeywords = `query queryLogsByKeywords {${QueryLogsByKeywords.query}}`; +export const queryLogTagValues = `query queryTagValues(${LogTagValues.variable}) {${LogTagValues.query}}`; +export const queryLogTagKeys = `query queryTagKeys(${LogTagKeys.variable}) {${LogTagKeys.query}}`; diff --git a/src/graphql/query/trace.ts b/src/graphql/query/trace.ts index 6195160a..c4ce706f 100644 --- a/src/graphql/query/trace.ts +++ b/src/graphql/query/trace.ts @@ -15,8 +15,17 @@ * limitations under the License. */ -import { Traces, TraceSpans } from "../fragments/trace"; +import { + Traces, + TraceSpans, + TraceTagKeys, + TraceTagValues, +} from "../fragments/trace"; export const queryTraces = `query queryTraces(${Traces.variable}) {${Traces.query}}`; export const queryTrace = `query queryTrace(${TraceSpans.variable}) {${TraceSpans.query}}`; + +export const queryTraceTagKeys = `query queryTraceTagKeys(${TraceTagKeys.variable}) {${TraceTagKeys.query}}`; + +export const queryTraceTagValues = `query queryTraceTagValues(${TraceTagValues.variable}) {${TraceTagValues.query}}`; diff --git a/src/locales/lang/en.ts b/src/locales/lang/en.ts index b04edd50..6e3041e0 100644 --- a/src/locales/lang/en.ts +++ b/src/locales/lang/en.ts @@ -326,7 +326,7 @@ const msg = { addExcludingKeywordsOfContent: "Please input a keyword of excluding content", noticeTag: "Please press Enter after inputting a tag(key=value).", conditionNotice: - "Notice: Please press Enter after inputting a tag, key of content, exclude key of content(key=value).", + "Notice: Please press Enter after inputting a key of content, exclude key of content(key=value).", language: "Language", }; export default msg; diff --git a/src/locales/lang/zh.ts b/src/locales/lang/zh.ts index 3e222342..a2d9ecd5 100644 --- a/src/locales/lang/zh.ts +++ b/src/locales/lang/zh.ts @@ -327,7 +327,7 @@ const msg = { addExcludingKeywordsOfContent: "请输入一个内容不包含的关键词", noticeTag: "请输入一个标签(key=value)之后回车", conditionNotice: - "请输入一个标签、内容关键词或者内容不包含的关键词(key=value)之后回车", + "请输入一个内容关键词或者内容不包含的关键词(key=value)之后回车", language: "语言", }; export default msg; diff --git a/src/store/modules/log.ts b/src/store/modules/log.ts index b9934976..9790ac22 100644 --- a/src/store/modules/log.ts +++ b/src/store/modules/log.ts @@ -151,6 +151,20 @@ export const logStore = defineStore({ this.logsTotal = res.data.data.queryBrowserErrorLogs.total; return res.data; }, + async getLogTagKeys() { + const res: AxiosResponse = await graphql + .query("queryLogTagKeys") + .params({ duration: useAppStoreWithOut().durationTime }); + + return res.data; + }, + async getLogTagValues(tagKey: string) { + const res: AxiosResponse = await graphql + .query("queryLogTagValues") + .params({ tagKey, duration: useAppStoreWithOut().durationTime }); + + return res.data; + }, }, }); diff --git a/src/store/modules/trace.ts b/src/store/modules/trace.ts index 794cdffa..85a3fec3 100644 --- a/src/store/modules/trace.ts +++ b/src/store/modules/trace.ts @@ -161,6 +161,20 @@ export const traceStore = defineStore({ this.traceSpanLogsTotal = res.data.data.queryLogs.total; return res.data; }, + async getTagKeys() { + const res: AxiosResponse = await graphql + .query("queryTraceTagKeys") + .params({ duration: useAppStoreWithOut().durationTime }); + + return res.data; + }, + async getTagValues(tagKey: string) { + const res: AxiosResponse = await graphql + .query("queryTraceTagValues") + .params({ tagKey, duration: useAppStoreWithOut().durationTime }); + + return res.data; + }, }, }); diff --git a/src/views/components/ConditionTags.vue b/src/views/components/ConditionTags.vue index 19b58548..c85ada38 100644 --- a/src/views/components/ConditionTags.vue +++ b/src/views/components/ConditionTags.vue @@ -13,65 +13,97 @@ 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/trace/components/Table/TableItem.vue b/src/views/dashboard/related/trace/components/Table/TableItem.vue index 4becc9a1..66ce4285 100644 --- a/src/views/dashboard/related/trace/components/Table/TableItem.vue +++ b/src/views/dashboard/related/trace/components/Table/TableItem.vue @@ -200,9 +200,9 @@ export default defineComponent({ dom.style.background = "rgba(0, 0, 0, 0.1)"; } function selectSpan(event: any) { - const dom = event.path.find((d: any) => - d.className.includes("trace-item") - ); + const dom = event + .composedPath() + .find((d: any) => d.className.includes("trace-item")); emit("select", props.data); if (props.headerType === "profile") { @@ -212,9 +212,9 @@ export default defineComponent({ viewSpanDetail(dom); } function viewSpan(event: any) { - const dom = event.path.find((d: any) => - d.className.includes("trace-item") - ); + const dom = event + .composedPath() + .find((d: any) => d.className.includes("trace-item")); emit("select", props.data); viewSpanDetail(dom); }