mirror of
https://github.com/halo-dev/halo.git
synced 2025-12-20 16:44:38 +08:00
refactor: enable dashboard widgets query cache (#7520)
#### What type of PR is this? /kind improvement /area ui /milestone 2.21.x #### What this PR does / why we need it: Enable query cache for dashboard widgets. #### Does this PR introduce a user-facing change? ```release-note None ```
This commit is contained in:
@@ -6,10 +6,10 @@ import {
|
||||
VPageHeader,
|
||||
} from "@halo-dev/components";
|
||||
import type { DashboardWidgetDefinition } from "@halo-dev/console-shared";
|
||||
import { computed, type ComputedRef, provide, ref } from "vue";
|
||||
import { computed, type ComputedRef, provide, ref, toRaw } from "vue";
|
||||
import WidgetViewItem from "./components/WidgetViewItem.vue";
|
||||
import { useDashboardExtensionPoint } from "./composables/use-dashboard-extension-point";
|
||||
import { useDashboardWidgetsFetch } from "./composables/use-dashboard-widgets-fetch";
|
||||
import { useDashboardWidgetsViewFetch } from "./composables/use-dashboard-widgets-fetch";
|
||||
import "./styles/dashboard.css";
|
||||
import { internalWidgetDefinitions } from "./widgets";
|
||||
|
||||
@@ -19,7 +19,7 @@ function breakpointChangedEvent(breakpoint: string) {
|
||||
currentBreakpoint.value = breakpoint;
|
||||
}
|
||||
|
||||
const { layouts, layout } = useDashboardWidgetsFetch(currentBreakpoint);
|
||||
const { data } = useDashboardWidgetsViewFetch(currentBreakpoint);
|
||||
|
||||
const { widgetDefinitions } = useDashboardExtensionPoint();
|
||||
|
||||
@@ -52,8 +52,8 @@ provide<ComputedRef<DashboardWidgetDefinition[]>>(
|
||||
|
||||
<div class="dashboard m-4">
|
||||
<grid-layout
|
||||
v-model:layout="layout"
|
||||
:responsive-layouts="layouts"
|
||||
:layout="toRaw(data?.layout || [])"
|
||||
:responsive-layouts="data?.layouts"
|
||||
:col-num="12"
|
||||
:is-draggable="false"
|
||||
:is-resizable="false"
|
||||
@@ -66,7 +66,7 @@ provide<ComputedRef<DashboardWidgetDefinition[]>>(
|
||||
:cols="{ lg: 12, md: 12, sm: 6, xs: 4 }"
|
||||
@breakpoint-changed="breakpointChangedEvent"
|
||||
>
|
||||
<WidgetViewItem v-for="item in layout" :key="item.i" :item="item" />
|
||||
<WidgetViewItem v-for="item in data?.layout" :key="item.i" :item="item" />
|
||||
</grid-layout>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user