Refactor UUID generation to shared utils.id.uuid (#7898)

This commit is contained in:
Ryan Wang
2025-11-05 11:13:35 +08:00
committed by GitHub
parent 705713c345
commit ad3b5c0680
20 changed files with 68 additions and 45 deletions

View File

@@ -1,5 +1,4 @@
<script lang="ts" setup>
import { randomUUID } from "@/utils/id";
import { ucApiClient } from "@halo-dev/api-client";
import {
Dialog,
@@ -15,9 +14,10 @@ import {
VDropdownItem,
VTabbar,
} from "@halo-dev/components";
import type {
DashboardWidget,
DashboardWidgetDefinition,
import {
utils,
type DashboardWidget,
type DashboardWidgetDefinition,
} from "@halo-dev/console-shared";
import { useQueryClient } from "@tanstack/vue-query";
import { useEventListener } from "@vueuse/core";
@@ -194,7 +194,7 @@ function handleAddWidget(widgetDefinition: DashboardWidgetDefinition) {
}, 0);
const newWidget: DashboardWidget = {
i: randomUUID(),
i: utils.id.uuid(),
x: 0,
y: maxY + 1,
w: widgetDefinition.defaultSize.w,
@@ -313,7 +313,7 @@ function handleCopyFromLayout(breakpoint: string) {
...layout.value,
...layoutToCopy.map((widget, index) => ({
...widget,
i: randomUUID(),
i: utils.id.uuid(),
y: maxY + index + 1,
})),
];