refactor: optimize data types for widgets and dashboards (#490)

This commit is contained in:
Fine0830
2025-08-14 18:25:40 +08:00
committed by GitHub
parent e885b61353
commit 54a700bf19
141 changed files with 972 additions and 743 deletions

View File

@@ -157,18 +157,17 @@ limitations under the License. -->
import { dateFormat } from "@/utils/dateFormat";
import { useTraceStore } from "@/store/modules/trace";
import LogTable from "@/views/dashboard/related/log/LogTable/Index.vue";
import type { SpanAttachedEvent } from "@/types/trace";
import type { SpanAttachedEvent, Ref, Span } from "@/types/trace";
import getDashboard from "@/hooks/useDashboardsSession";
import { useDashboardStore } from "@/store/modules/dashboard";
import { WidgetType } from "@/views/dashboard/data";
import type { LayoutConfig } from "@/types/dashboard";
import type { LayoutConfig, DashboardItem } from "@/types/dashboard";
/*global defineProps, Nullable, Recordable */
const props = defineProps({
currentSpan: { type: Object as PropType<Recordable>, default: () => ({}) },
currentSpan: { type: Object as PropType<Span>, default: () => ({}) },
traceId: { type: String, default: "" },
});
const options: Recordable<LayoutConfig> = inject("options") || {};
const options: LayoutConfig | null = inject("options") || null;
const { t } = useI18n();
const traceStore = useTraceStore();
const dashboardStore = useDashboardStore();
@@ -246,12 +245,12 @@ limitations under the License. -->
tree.value.draw();
}
function viewRelateTrace(item: Recordable) {
const { associationWidget } = getDashboard(dashboardStore.currentDashboard);
function viewRelateTrace(item: Ref) {
const { associationWidget } = getDashboard(dashboardStore.currentDashboard as DashboardItem);
associationWidget(
(options.id as any) || "",
(options?.id as string) || "",
{
sourceId: options.id || "",
sourceId: (options?.id as string) || "",
traceId: item.traceId || "",
id: "0",
},