diff --git a/src/components/Selector.vue b/src/components/Selector.vue index 92a19d22..3ec91704 100644 --- a/src/components/Selector.vue +++ b/src/components/Selector.vue @@ -43,7 +43,7 @@ limitations under the License. --> import { ref, watch } from "vue"; import type { PropType } from "vue"; - /*global defineProps, defineEmits, Indexable*/ + /*global defineProps, defineEmits, Indexable*/ const emit = defineEmits(["change", "query"]); const props = defineProps({ options: { diff --git a/src/locales/lang/en.ts b/src/locales/lang/en.ts index 78029437..4ac42de4 100644 --- a/src/locales/lang/en.ts +++ b/src/locales/lang/en.ts @@ -296,7 +296,7 @@ const msg = { return: "Return", isError: "Error", contentType: "Content Type", - content: "Timestamp - Content", + content: "Content", level: "Level", viewLogs: "View Logs", logsTagsTip: `Only tags defined in the core/default/searchableLogsTags are searchable. diff --git a/src/locales/lang/zh.ts b/src/locales/lang/zh.ts index a3b079b7..5bc9dfde 100644 --- a/src/locales/lang/zh.ts +++ b/src/locales/lang/zh.ts @@ -293,7 +293,7 @@ const msg = { return: "返回", isError: "错误", contentType: "内容类型", - content: "时间戳 - 内容", + content: "内容", level: "Level", viewLogs: "查看日志", logsTagsTip: "只有core/default/searchableLogsTags中定义的标记才可搜索。查看配置词汇表页面上的更多详细信息。", diff --git a/src/store/modules/log.ts b/src/store/modules/log.ts index d105cb2a..9500c1fb 100644 --- a/src/store/modules/log.ts +++ b/src/store/modules/log.ts @@ -33,6 +33,7 @@ interface LogState { supportQueryLogsByKeywords: boolean; logs: Recordable[]; loadLogs: boolean; + logHeaderType: string; } const { getDurationTime } = useDuration(); @@ -50,6 +51,7 @@ export const logStore = defineStore({ selectorStore: useSelectorStore(), logs: [], loadLogs: false, + logHeaderType: localStorage.getItem("log-header-type") || "content", }), actions: { setLogCondition(data: Recordable) { @@ -62,6 +64,9 @@ export const logStore = defineStore({ paging: { pageNum: 1, pageSize: 15 }, }; }, + setLogHeaderType(type: string) { + this.logHeaderType = type; + }, async getServices(layer: string) { const response = await graphql.query("queryServices").params({ layer, diff --git a/src/store/modules/trace.ts b/src/store/modules/trace.ts index 2173a133..05d60c9e 100644 --- a/src/store/modules/trace.ts +++ b/src/store/modules/trace.ts @@ -24,6 +24,7 @@ import { useSelectorStore } from "@/store/modules/selectors"; import { QueryOrders } from "@/views/dashboard/data"; import { EndpointsTopNDefault } from "../data"; import { useDuration } from "@/hooks/useDuration"; +import { LogItem } from "@/types/log"; interface TraceState { services: Service[]; instances: Instance[]; @@ -32,7 +33,7 @@ interface TraceState { traceSpans: Span[]; currentTrace: Nullable; conditions: Recordable; - traceSpanLogs: Recordable[]; + traceSpanLogs: LogItem[]; selectorStore: Recordable; selectedSpan: Recordable; serviceList: string[]; diff --git a/src/types/log.ts b/src/types/log.ts new file mode 100644 index 00000000..9255eb10 --- /dev/null +++ b/src/types/log.ts @@ -0,0 +1,30 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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. + */ +export interface LogItem { + timestamp: number; + content: string; + tags: { key: string; value: string }[]; + serviceId: string; + traceId: string; + spanId: string; + parentSpanId: string; + processId: string; + processName: string; + processTags: { key: string; value: string }[]; + processStartTime: string; + processEndTime: string; +} diff --git a/src/utils/dateFormat.ts b/src/utils/dateFormat.ts index 7347f19b..f65ebd7b 100644 --- a/src/utils/dateFormat.ts +++ b/src/utils/dateFormat.ts @@ -15,6 +15,11 @@ * limitations under the License. */ import dayjs from "dayjs"; +import utc from "dayjs/plugin/utc"; +import timezone from "dayjs/plugin/timezone"; + +dayjs.extend(utc); +dayjs.extend(timezone); export default function dateFormatStep(date: Date, step: string, monthDayDiff?: boolean): string { const year = date.getFullYear(); const monthTemp = date.getMonth() + 1; @@ -97,4 +102,10 @@ export const dateFormatTime = (date: Date, step: string): string => { return ""; }; -export const dateFormat = (date: number, pattern = "YYYY-MM-DD HH:mm:ss") => dayjs(new Date(date)).format(pattern); +export const dateFormat = (date: number, pattern = "YYYY-MM-DD HH:mm:ss", timezone?: string) => { + const dayjsInstance = dayjs(new Date(date)); + if (timezone) { + return dayjsInstance.tz(timezone).format(pattern); + } + return dayjsInstance.format(pattern); +}; diff --git a/src/views/dashboard/configuration/ContinuousProfiling.vue b/src/views/dashboard/configuration/ContinuousProfiling.vue index e91e865c..ace70c7d 100644 --- a/src/views/dashboard/configuration/ContinuousProfiling.vue +++ b/src/views/dashboard/configuration/ContinuousProfiling.vue @@ -11,8 +11,8 @@ 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/configuration/Tab.vue b/src/views/dashboard/configuration/Tab.vue index 5ce6dd6f..a7558592 100644 --- a/src/views/dashboard/configuration/Tab.vue +++ b/src/views/dashboard/configuration/Tab.vue @@ -11,21 +11,14 @@ 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/configuration/ThirdPartyApp.vue b/src/views/dashboard/configuration/ThirdPartyApp.vue index e9f9063f..8e52d152 100644 --- a/src/views/dashboard/configuration/ThirdPartyApp.vue +++ b/src/views/dashboard/configuration/ThirdPartyApp.vue @@ -11,19 +11,12 @@ 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/configuration/TimeRange.vue b/src/views/dashboard/configuration/TimeRange.vue index 14a8a551..06394738 100644 --- a/src/views/dashboard/configuration/TimeRange.vue +++ b/src/views/dashboard/configuration/TimeRange.vue @@ -11,12 +11,12 @@ 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/configuration/Topology.vue b/src/views/dashboard/configuration/Topology.vue index 9df56cfb..761c20fa 100644 --- a/src/views/dashboard/configuration/Topology.vue +++ b/src/views/dashboard/configuration/Topology.vue @@ -11,22 +11,15 @@ 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/configuration/Widget.vue b/src/views/dashboard/configuration/Widget.vue index a128074a..bf42a488 100644 --- a/src/views/dashboard/configuration/Widget.vue +++ b/src/views/dashboard/configuration/Widget.vue @@ -70,14 +70,7 @@ limitations under the License. --> - + + diff --git a/src/views/dashboard/configuration/style.scss b/src/views/dashboard/configuration/style.scss new file mode 100644 index 00000000..f67c8be2 --- /dev/null +++ b/src/views/dashboard/configuration/style.scss @@ -0,0 +1,26 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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. + */ +.config-item { + margin: 10px 0; +} + +.config-label { + font-size: 13px; + font-weight: 500; + align-items: center; + width: 200px; +} diff --git a/src/views/dashboard/controls/Log.vue b/src/views/dashboard/controls/Log.vue index 2f7a8c1b..194f602f 100644 --- a/src/views/dashboard/controls/Log.vue +++ b/src/views/dashboard/controls/Log.vue @@ -28,7 +28,7 @@ limitations under the License. -->
- +
diff --git a/src/views/dashboard/related/log/Header.vue b/src/views/dashboard/related/log/Header.vue index 26b7ee2a..c0a013be 100644 --- a/src/views/dashboard/related/log/Header.vue +++ b/src/views/dashboard/related/log/Header.vue @@ -438,7 +438,7 @@ limitations under the License. --> top: 0; right: 10px; cursor: pointer; - width: 120px; + width: 80px; } .tips { diff --git a/src/views/dashboard/related/log/List.vue b/src/views/dashboard/related/log/List.vue index 8a5b5b4d..8307cf7a 100644 --- a/src/views/dashboard/related/log/List.vue +++ b/src/views/dashboard/related/log/List.vue @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. -->