mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-14 09:00:50 +00:00
log associate with trace
This commit is contained in:
parent
04014a13be
commit
7712603706
@ -14,46 +14,68 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License. -->
|
limitations under the License. -->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div @click="showSelectSpan" class="log-item">
|
<div class="log-item">
|
||||||
<div v-for="(item, index) in columns" :key="index" :class="item.label">
|
<div v-for="(item, index) in columns" :key="index" :class="item.label">
|
||||||
<span v-if="item.label === 'timestamp'">
|
<span v-if="item.label === 'timestamp'" @click="showSelectSpan">
|
||||||
{{ dateFormat(data.timestamp) }}
|
{{ dateFormat(data.timestamp) }}
|
||||||
</span>
|
</span>
|
||||||
<span v-else-if="item.label === 'tags'">
|
<span v-else-if="item.label === 'tags'" @click="showSelectSpan">
|
||||||
{{ tags }}
|
{{ tags }}
|
||||||
</span>
|
</span>
|
||||||
<!-- <router-link
|
<span
|
||||||
v-else-if="item.label === 'traceId' && !noLink"
|
v-else-if="item.label === 'traceId' && !noLink"
|
||||||
:to="{ name: 'trace', query: { traceid: data[item.label] } }"
|
:class="noLink ? '' : 'blue'"
|
||||||
|
@click="linkTrace(data[item.label])"
|
||||||
>
|
>
|
||||||
<span :class="noLink ? '' : 'blue'">{{ data[item.label] }}</span>
|
{{ data[item.label] }}
|
||||||
</router-link> -->
|
</span>
|
||||||
<span v-else>{{ data[item.label] }}</span>
|
<span v-else @click="showSelectSpan">{{ data[item.label] }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed } from "vue";
|
import { computed, inject } from "vue";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { ServiceLogConstants } from "./data";
|
import { ServiceLogConstants } from "./data";
|
||||||
/*global defineProps, defineEmits */
|
import getDashboard from "@/hooks/useDashboardsSession";
|
||||||
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
|
import { LayoutConfig } from "@/types/dashboard";
|
||||||
|
|
||||||
|
/*global defineProps, defineEmits, Recordable */
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: { type: Object as any, default: () => ({}) },
|
data: { type: Object as any, default: () => ({}) },
|
||||||
noLink: { type: Boolean, default: true },
|
noLink: { type: Boolean, default: true },
|
||||||
});
|
});
|
||||||
|
const dashboardStore = useDashboardStore();
|
||||||
|
const options: Recordable<LayoutConfig> = inject("options") || {};
|
||||||
const emit = defineEmits(["select"]);
|
const emit = defineEmits(["select"]);
|
||||||
const columns = ServiceLogConstants;
|
const columns = ServiceLogConstants;
|
||||||
const tags = computed(() => {
|
const tags = computed(() => {
|
||||||
if (!props.data.tags) {
|
if (!props.data.tags) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
return String(props.data.tags.map((d: any) => `${d.key}=${d.value}`));
|
return String(
|
||||||
|
props.data.tags.map(
|
||||||
|
(d: { key: string; value: string }) => `${d.key}=${d.value}`
|
||||||
|
)
|
||||||
|
);
|
||||||
});
|
});
|
||||||
const dateFormat = (date: number, pattern = "YYYY-MM-DD HH:mm:ss") =>
|
const dateFormat = (date: number, pattern = "YYYY-MM-DD HH:mm:ss") =>
|
||||||
dayjs(date).format(pattern);
|
dayjs(date).format(pattern);
|
||||||
function showSelectSpan() {
|
function showSelectSpan() {
|
||||||
emit("select", props.data);
|
emit("select", props.data);
|
||||||
}
|
}
|
||||||
|
function linkTrace(id: string) {
|
||||||
|
const { associationWidget } = getDashboard(dashboardStore.currentDashboard);
|
||||||
|
associationWidget(
|
||||||
|
(options.id as any) || "",
|
||||||
|
{
|
||||||
|
sourceId: options.id || "",
|
||||||
|
traceId: id,
|
||||||
|
},
|
||||||
|
"Trace"
|
||||||
|
);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.log-item {
|
.log-item {
|
||||||
|
@ -40,14 +40,14 @@ export const ServiceLogConstants = [
|
|||||||
label: "tags",
|
label: "tags",
|
||||||
value: "tags",
|
value: "tags",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: "content",
|
|
||||||
value: "content",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: "traceId",
|
label: "traceId",
|
||||||
value: "traceID",
|
value: "traceID",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "content",
|
||||||
|
value: "content",
|
||||||
|
},
|
||||||
];
|
];
|
||||||
export const ServiceLogDetail = [
|
export const ServiceLogDetail = [
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,7 @@ limitations under the License. -->
|
|||||||
v-loading="logStore.loadLogs"
|
v-loading="logStore.loadLogs"
|
||||||
:tableData="logStore.logs || []"
|
:tableData="logStore.logs || []"
|
||||||
:type="type"
|
:type="type"
|
||||||
:noLink="true"
|
:noLink="false"
|
||||||
>
|
>
|
||||||
<div class="log-tips" v-if="!logStore.logs.length">{{ t("noData") }}</div>
|
<div class="log-tips" v-if="!logStore.logs.length">{{ t("noData") }}</div>
|
||||||
</LogTable>
|
</LogTable>
|
||||||
|
@ -92,7 +92,7 @@ limitations under the License. -->
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, reactive, watch } from "vue";
|
import { ref, reactive, watch, inject } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { Option } from "@/types/app";
|
import { Option } from "@/types/app";
|
||||||
import { Status } from "../../data";
|
import { Status } from "../../data";
|
||||||
@ -103,8 +103,10 @@ import { useSelectorStore } from "@/store/modules/selectors";
|
|||||||
import ConditionTags from "@/views/components/ConditionTags.vue";
|
import ConditionTags from "@/views/components/ConditionTags.vue";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import { EntityType } from "../../data";
|
import { EntityType } from "../../data";
|
||||||
|
import { LayoutConfig } from "@/types/dashboard";
|
||||||
|
|
||||||
/*global defineProps */
|
/*global defineProps, Recordable */
|
||||||
|
const options: LayoutConfig | undefined = inject("options");
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
needQuery: { type: Boolean, default: true },
|
needQuery: { type: Boolean, default: true },
|
||||||
});
|
});
|
||||||
@ -113,12 +115,14 @@ const appStore = useAppStoreWithOut();
|
|||||||
const selectorStore = useSelectorStore();
|
const selectorStore = useSelectorStore();
|
||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
const traceStore = useTraceStore();
|
const traceStore = useTraceStore();
|
||||||
const traceId = ref<string>("");
|
const traceId = ref<string>(
|
||||||
|
(options && options.filters && options.filters.traceId) || ""
|
||||||
|
);
|
||||||
const minTraceDuration = ref<number>();
|
const minTraceDuration = ref<number>();
|
||||||
const maxTraceDuration = ref<number>();
|
const maxTraceDuration = ref<number>();
|
||||||
const tagsList = ref<string[]>([]);
|
const tagsList = ref<string[]>([]);
|
||||||
const tagsMap = ref<Option[]>([]);
|
const tagsMap = ref<Option[]>([]);
|
||||||
const state = reactive<any>({
|
const state = reactive<Recordable>({
|
||||||
status: { label: "All", value: "ALL" },
|
status: { label: "All", value: "ALL" },
|
||||||
instance: { value: "0", label: "All" },
|
instance: { value: "0", label: "All" },
|
||||||
endpoint: { value: "0", label: "All" },
|
endpoint: { value: "0", label: "All" },
|
||||||
|
Loading…
Reference in New Issue
Block a user