revert logs on trace widget (#170)

This commit is contained in:
Fine0830 2022-10-14 11:28:10 +08:00 committed by GitHub
parent 2bf90d6a6d
commit 9f57e35119
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 62 additions and 24 deletions

View File

@ -154,6 +154,7 @@ const msg = {
query: "Query", query: "Query",
postgreSQL: "PostgreSQL", postgreSQL: "PostgreSQL",
endpointTips: "The table shows up to 20 pieces of endpoints.", endpointTips: "The table shows up to 20 pieces of endpoints.",
apisix: "APISIX",
seconds: "Seconds", seconds: "Seconds",
hourTip: "Select Hour", hourTip: "Select Hour",
minuteTip: "Select Minute", minuteTip: "Select Minute",

View File

@ -154,6 +154,7 @@ const msg = {
query: "Consulta", query: "Consulta",
postgreSQL: "PostgreSQL", postgreSQL: "PostgreSQL",
endpointTips: "Aquí, la tabla muestra hasta 20 punto final.", endpointTips: "Aquí, la tabla muestra hasta 20 punto final.",
apisix: "APISIX",
seconds: "Segundos", seconds: "Segundos",
hourTip: "Seleccione Hora", hourTip: "Seleccione Hora",
minuteTip: "Seleccione Minuto", minuteTip: "Seleccione Minuto",

View File

@ -151,6 +151,7 @@ const msg = {
query: "查询", query: "查询",
postgreSQL: "PostgreSQL", postgreSQL: "PostgreSQL",
endpointTips: "这里最多展示20条endpoints。", endpointTips: "这里最多展示20条endpoints。",
apisix: "APISIX",
seconds: "秒", seconds: "秒",
hourTip: "选择小时", hourTip: "选择小时",
minuteTip: "选择分钟", minuteTip: "选择分钟",

View File

@ -30,7 +30,7 @@ export default [
path: "/apisix", path: "/apisix",
name: "APISIX", name: "APISIX",
meta: { meta: {
title: "APISIX", title: "apisix",
layer: "APISIX", layer: "APISIX",
}, },
}, },

View File

@ -9,6 +9,7 @@ declare module '@vue/runtime-core' {
ElCollapse: typeof import('element-plus/es')['ElCollapse'] ElCollapse: typeof import('element-plus/es')['ElCollapse']
ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem'] ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
ElDialog: typeof import('element-plus/es')['ElDialog'] ElDialog: typeof import('element-plus/es')['ElDialog']
ElDrawer: typeof import('element-plus/es')['ElDrawer']
ElDropdown: typeof import('element-plus/es')['ElDropdown'] ElDropdown: typeof import('element-plus/es')['ElDropdown']
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem'] ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu'] ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']

View File

@ -362,14 +362,6 @@ watch(
border-radius: 4px; border-radius: 4px;
} }
.trace-list .trace-node rect {
cursor: pointer;
&:hover {
fill: rgba(0, 0, 0, 0.05);
}
}
.dialog-c-text { .dialog-c-text {
white-space: pre; white-space: pre;
overflow: auto; overflow: auto;

View File

@ -81,34 +81,75 @@ limitations under the License. -->
{{ t("relatedTraceLogs") }} {{ t("relatedTraceLogs") }}
</el-button> </el-button>
</div> </div>
<el-dialog
v-model="showRelatedLogs"
:destroy-on-close="true"
fullscreen
@closed="showRelatedLogs = false"
>
<el-pagination
v-model:currentPage="pageNum"
v-model:page-size="pageSize"
:small="true"
layout="prev, pager, next"
:pager-count="5"
:total="total"
@current-change="turnPage"
/>
<LogTable
:tableData="traceStore.traceSpanLogs || []"
:type="`service`"
:noLink="true"
>
<div class="log-tips" v-if="!traceStore.traceSpanLogs.length">
{{ t("noData") }}
</div>
</LogTable>
</el-dialog>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { inject } from "vue"; import { ref, computed } from "vue";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import type { PropType } from "vue"; import type { PropType } from "vue";
import copy from "@/utils/copy"; import copy from "@/utils/copy";
import getDashboard from "@/hooks/useDashboardsSession"; import { ElMessage } from "element-plus";
import { LayoutConfig } from "@/types/dashboard";
import { dateFormat } from "@/utils/dateFormat"; import { dateFormat } from "@/utils/dateFormat";
import { useTraceStore } from "@/store/modules/trace";
import LogTable from "@/views/dashboard/related/log/LogTable/Index.vue";
/*global defineProps, Recordable */ /*global defineProps */
const options: Recordable<LayoutConfig> = inject("options") || {};
const props = defineProps({ const props = defineProps({
currentSpan: { type: Object as PropType<any>, default: () => ({}) }, currentSpan: { type: Object as PropType<any>, default: () => ({}) },
}); });
const { t } = useI18n(); const { t } = useI18n();
const traceStore = useTraceStore();
const pageNum = ref<number>(1);
const showRelatedLogs = ref<boolean>(false);
const pageSize = 10;
const total = computed(() =>
traceStore.traceList.length === pageSize
? pageSize * pageNum.value + 1
: pageSize * pageNum.value
);
async function getTaceLogs() { async function getTaceLogs() {
const { associationWidget } = getDashboard(); showRelatedLogs.value = true;
associationWidget( const res = await traceStore.getSpanLogs({
(options.id as any) || "", condition: {
{ relatedTrace: {
sourceId: options?.id || "", traceId: props.currentSpan.traceId,
traceId: props.currentSpan.traceId, segmentId: props.currentSpan.segmentId,
segmentId: props.currentSpan.segmentId, spanId: props.currentSpan.spanId,
spanId: props.currentSpan.spanId, },
paging: { pageNum: pageNum.value, pageSize },
}, },
"Log" });
); if (res.errors) {
ElMessage.error(res.errors);
}
}
function turnPage(p: number) {
pageNum.value = p;
getTaceLogs();
} }
function showCurrentSpanDetail(text: string) { function showCurrentSpanDetail(text: string) {
copy(text); copy(text);

View File

@ -141,6 +141,7 @@ export default class ListGraph {
.append("g") .append("g")
.attr("transform", `translate(${source.y0},${source.x0})`) .attr("transform", `translate(${source.y0},${source.x0})`)
.attr("class", "trace-node") .attr("class", "trace-node")
.attr("style", "cursor: pointer")
.style("opacity", 0) .style("opacity", 0)
.on("mouseover", function (event: any, d: Trace) { .on("mouseover", function (event: any, d: Trace) {
t.tip.show(d, this); t.tip.show(d, this);