Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat(frontend): migrate landing page to React (#19789)
Danny Xu704bf73fd805
diff --git a/frontend/src/react/LandingPageMount.vue b/frontend/src/react/LandingPageMount.vuenew file mode 100644index 0000000000..c22b857735--- /dev/null+++ b/frontend/src/react/LandingPageMount.vue@@ -0,0 +1,49 @@+<template>+ <div ref="container" class="h-full" />+ <ProjectSwitchModal+ :show="showProjectModal"+ @dismiss="showProjectModal = false"+ />+</template>++<script lang="ts" setup>+import { onMounted, onUnmounted, ref, watch } from "vue";+import { useI18n } from "vue-i18n";+import ProjectSwitchModal from "@/components/Project/ProjectSwitch/ProjectSwitchModal.vue";++const { locale } = useI18n();+const container = ref<HTMLElement>();+// biome-ignore lint/suspicious/noExplicitAny: React Root type from dynamic import+let root: any = null; // eslint-disable-line @typescript-eslint/no-explicit-any++const showProjectModal = ref(false);++const props = {+ onOpenProjectSwitch: () => {+ showProjectModal.value = true;+ },+};++async function render() {+ if (!container.value) return;+ const [{ mountReactPage, updateReactPage }, i18nModule] = await Promise.all([+ import("./mount"),+ import("./i18n"),+ ]);+ if (i18nModule.default.language !== locale.value) {+ await i18nModule.default.changeLanguage(locale.value);+ }+ if (!root) {+ root = await mountReactPage(container.value, "LandingPage", props);+ } else {+ await updateReactPage(root, "LandingPage", props);+ }+}++onMounted(() => render());+watch(locale, () => render());+onUnmounted(() => {+ root?.unmount();+ root = null;+});+</script>diff --git a/frontend/src/react/ReactPageMount.vue b/frontend/src/react/ReactPageMount.vueindex 72769c1448..5d86074ec9 100644--- a/frontend/src/react/ReactPageMount.vue+++ b/frontend/src/react/ReactPageMount.vue@@ -1,5 +1,5 @@<template>- <div ref="container" />+ <div ref="container" class="h-full" /></template><script lang="ts" setup>diff --git a/frontend/src/react/pages/settings/LandingPage.tsx b/frontend/src/react/pages/settings/LandingPage.tsxnew file mode 100644index 0000000000..f98e6b4005--- /dev/null+++ b/frontend/src/react/pages/settings/LandingPage.tsx@@ -0,0 +1,590 @@+import {+ CircleDot,+ Database,+ GalleryHorizontalEnd,+ GripVertical,+ Layers,+ Link,+ Settings,+ ShieldCheck,+ SquareStack,+ Users,+ Volume2,+ Workflow,+} from "lucide-react";+import {+ type DragEvent,+ type FC,+ useCallback,+ useEffect,+ useMemo,+ useRef,+ useState,+} from "react";+import { useTranslation } from "react-i18next";+import { useVueState } from "@/react/hooks/useVueState";+import { router } from "@/router";+import {+ DATABASE_ROUTE_DASHBOARD,+ ENVIRONMENT_V1_ROUTE_DASHBOARD,+ INSTANCE_ROUTE_DASHBOARD,+ PROJECT_V1_ROUTE_DASHBOARD,+ WORKSPACE_ROUTE_AUDIT_LOG,+ WORKSPACE_ROUTE_CUSTOM_APPROVAL,+ WORKSPACE_ROUTE_DATA_CLASSIFICATION,+ WORKSPACE_ROUTE_GLOBAL_MASKING,+ WORKSPACE_ROUTE_IDENTITY_PROVIDERS,+ WORKSPACE_ROUTE_IM,+ WORKSPACE_ROUTE_MCP,+ WORKSPACE_ROUTE_MEMBERS,+ WORKSPACE_ROUTE_MY_ISSUES,+ WORKSPACE_ROUTE_RISK_CENTER,+ WORKSPACE_ROUTE_ROLES,+ WORKSPACE_ROUTE_SEMANTIC_TYPES,+ WORKSPACE_ROUTE_SERVICE_ACCOUNTS,+ WORKSPACE_ROUTE_SQL_REVIEW,+ WORKSPACE_ROUTE_USERS,+ WORKSPACE_ROUTE_WORKLOAD_IDENTITIES,+} from "@/router/dashboard/workspaceRoutes";+import {+ SETTING_ROUTE_WORKSPACE_GENERAL,+ SETTING_ROUTE_WORKSPACE_SUBSCRIPTION,+} from "@/router/dashboard/workspaceSetting";+import { useRecentVisit } from "@/router/useRecentVisit";+import {+ useActuatorV1Store,+ useCurrentUserV1,+ useProjectV1Store,+} from "@/store";+import { projectNamePrefix } from "@/store/modules/v1/common";+import { UNKNOWN_PROJECT_NAME } from "@/types";+import type { Project } from "@/types/proto-es/v1/project_service_pb";+import { extractProjectResourceName, storageKeyQuickAccess } from "@/utils";++// ---------------------------------------------------------------------------+// Types+// ---------------------------------------------------------------------------++interface QuickLinkDef {+ id: string;+ title?: string;+ route?: string;+ icon: FC<{ className?: string }>;+}++// ---------------------------------------------------------------------------+// Build the full quick-link catalogue (mirrors useDashboardSidebar + useQuickLink)+// ---------------------------------------------------------------------------++function useFullQuickLinkList(): QuickLinkDef[] {+ const { t } = useTranslation();+ const isSaaSMode = useVueState(() => useActuatorV1Store().isSaaSMode);++ return useMemo(() => {+ // Two special items always first+ const list: QuickLinkDef[] = [+ {+ id: "visit-projects",+ title: t("landing.quick-link.visit-prjects"),+ icon: GalleryHorizontalEnd,+ },+ {+ id: "visit-issues",+ title: t("landing.quick-link.visit-issues"),+ icon: CircleDot,+ },+ ];++ // Sidebar route items (flattened, excluding landing itself)+ const sidebarItems: {+ id: string;+ titleKey: string;+ icon: FC<{ className?: string }>;+ hide?: boolean;+ }[] = [+ {+ id: PROJECT_V1_ROUTE_DASHBOARD,+ titleKey: "common.projects",+ icon: GalleryHorizontalEnd,+ },+ {+ id: INSTANCE_ROUTE_DASHBOARD,+ titleKey: "common.instances",+ icon: Layers,+ },+ {+ id: DATABASE_ROUTE_DASHBOARD,+ titleKey: "common.databases",+ icon: Database,+ },+ {+ id: ENVIRONMENT_V1_ROUTE_DASHBOARD,+ titleKey: "common.environments",+ icon: SquareStack,+ },+ // IAM & Admin+ {+ id: WORKSPACE_ROUTE_USERS,+ titleKey: isSaaSMode+ ? "settings.sidebar.members-and-groups"+ : "settings.sidebar.users-and-groups",+ icon: Users,+ },+ {+ id: WORKSPACE_ROUTE_SERVICE_ACCOUNTS,+ titleKey: "settings.members.service-accounts",+ icon: Users,+ hide: isSaaSMode,+ },+ {+ id: WORKSPACE_ROUTE_WORKLOAD_IDENTITIES,+ titleKey: "settings.members.workload-identities",+ icon: Users,+ hide: isSaaSMode,+ },+ {+ id: WORKSPACE_ROUTE_MEMBERS,+ titleKey: "settings.sidebar.members",+ icon: Users,+ hide: isSaaSMode,+ },+ {+ id: WORKSPACE_ROUTE_ROLES,+ titleKey: "settings.sidebar.custom-roles",+ icon: Users,+ },+ {+ id: WORKSPACE_ROUTE_IDENTITY_PROVIDERS,+ titleKey: "settings.sidebar.sso",+ icon: Users,+ },+ {+ id: WORKSPACE_ROUTE_AUDIT_LOG,+ titleKey: "settings.sidebar.audit-log",+ icon: Users,+ },+ // CI/CD+ {+ id: WORKSPACE_ROUTE_SQL_REVIEW,+ titleKey: "sql-review.title",+ icon: Workflow,+ },+ {+ id: WORKSPACE_ROUTE_RISK_CENTER,+ titleKey: "custom-approval.risk.self",+ icon: Workflow,+ },+ {+ id: WORKSPACE_ROUTE_CUSTOM_APPROVAL,+ titleKey: "custom-approval.self",+ icon: Workflow,+ },+ // Data Access+ {+ id: WORKSPACE_ROUTE_SEMANTIC_TYPES,+ titleKey: "settings.sensitive-data.semantic-types.self",+ icon: ShieldCheck,+ },+ {+ id: WORKSPACE_ROUTE_DATA_CLASSIFICATION,+ titleKey: "settings.sidebar.data-classification",+ icon: ShieldCheck,+ },+ {+ id: WORKSPACE_ROUTE_GLOBAL_MASKING,+ titleKey: "settings.sidebar.global-masking",+ icon: ShieldCheck,+ },+ // Integration+ {+ id: WORKSPACE_ROUTE_IM,+ titleKey: "settings.sidebar.im-integration",+ icon: Link,+ },+ {+ id: WORKSPACE_ROUTE_MCP,+ titleKey: "settings.sidebar.mcp",+ icon: Link,+ },+ // Settings+ {+ id: SETTING_ROUTE_WORKSPACE_GENERAL,+ titleKey: "settings.sidebar.general",+ icon: Settings,+ },+ {+ id: SETTING_ROUTE_WORKSPACE_SUBSCRIPTION,+ titleKey: "settings.sidebar.subscription",+ icon: Settings,+ },+ ];++ for (const item of sidebarItems) {+ if (item.hide) continue;+ list.push({+ id: item.id,+ title: t(item.titleKey),+ route: item.id,+ icon: item.icon,+ });+ }++ return list;+ }, [t, isSaaSMode]);+}++// ---------------------------------------------------------------------------+// localStorage-backed quick-access config (same keys as Vue version)+// ---------------------------------------------------------------------------++const DEFAULT_CONFIG = [+ "visit-issues",+ "visit-projects",+ WORKSPACE_ROUTE_USERS,+ WORKSPACE_ROUTE_SQL_REVIEW,+];++function useQuickAccessConfig(email: string) {+ const key = storageKeyQuickAccess(email);++ const read = useCallback((): string[] => {+ try {+ const raw = localStorage.getItem(key);+ if (raw) return JSON.parse(raw);+ } catch {+ // ignore+ }+ return [...DEFAULT_CONFIG];+ }, [key]);++ const [config, setConfig] = useState<string[]>(read);++ // Sync when email (and thus key) changes+ useEffect(() => {+ setConfig(read());+ }, [read]);++ const persist = useCallback(+ (next: string[]) => {+ setConfig(next);+ localStorage.setItem(key, JSON.stringify(next));+ },+ [key]+ );++ return { config, setConfig: persist };+}++// ---------------------------------------------------------------------------+// Last visited project+// ---------------------------------------------------------------------------++function useLastVisitedProject() {+ const lastVisitProjectPath = useVueState(+ () => useRecentVisit().lastVisitProjectPath.value+ );+ const [project, setProject] = useState<Project | undefined>();++ useEffect(() => {+ if (!lastVisitProjectPath) {+ setProject(undefined);+ return;+ }++ const projectName = `${projectNamePrefix}${extractProjectResourceName(lastVisitProjectPath)}`;+ const projectStore = useProjectV1Store();+ let cancelled = false;+ projectStore.getOrFetchProjectByName(projectName).then((p) => {+ if (cancelled) return;+ setProject(p.name === UNKNOWN_PROJECT_NAME ? undefined : p);+ });+ return () => {+ cancelled = true;+ };+ }, [lastVisitProjectPath]);++ return { project, projectPath: lastVisitProjectPath };+}++// ---------------------------------------------------------------------------+// Config Drawer+// ---------------------------------------------------------------------------++function ConfigDrawer({+ open,+ onClose,+ fullList,+ config,+ setConfig,+}: {+ open: boolean;+ onClose: () => void;+ fullList: QuickLinkDef[];+ config: string[];+ setConfig: (c: string[]) => void;+}) {+ const { t } = useTranslation();++ useEffect(() => {+ if (!open) return;+ const handleKeyDown = (e: KeyboardEvent) => {+ if (e.key === "Escape") onClose();+ };+ document.addEventListener("keydown", handleKeyDown);+ return () => document.removeEventListener("keydown", handleKeyDown);+ }, [open, onClose]);++ const dragItem = useRef<number | null>(null);+ const dragOver = useRef<number | null>(null);++ const selected = useMemo(+ () =>+ config+ .map((id) => fullList.find((l) => l.id === id))+ .filter(Boolean) as QuickLinkDef[],+ [config, fullList]+ );++ const unselected = useMemo(+ () => fullList.filter((l) => !config.includes(l.id)),+ [config, fullList]+ );++ const handleDragStart = (index: number) => {+ dragItem.current = index;+ };++ const handleDragEnter = (index: number) => {+ dragOver.current = index;+ };++ const handleDragEnd = () => {+ if (dragItem.current === null || dragOver.current === null) return;+ // Reorder using the filtered selected IDs, not raw config indices,+ // so stale/hidden IDs in config don't cause index mismatches.+ const selectedIds = selected.map((s) => s.id);+ const [removed] = selectedIds.splice(dragItem.current, 1);+ selectedIds.splice(dragOver.current, 0, removed);+ setConfig(selectedIds);+ dragItem.current = null;+ dragOver.current = null;+ };++ const uncheck = (id: string) => {+ setConfig(config.filter((c) => c !== id));+ };++ const check = (id: string) => {+ setConfig([...config, id]);+ };++ if (!open) return null;++ return (+ <div className="fixed inset-0 z-50 flex justify-end">+ <div className="absolute inset-0 bg-black/30" onClick={onClose} />+ <div className="relative w-96 max-w-[calc(100vw-8rem)] bg-white shadow-xl flex flex-col">+ <div className="flex items-center justify-between px-4 py-3 border-b">+ <h3 className="font-medium text-base">+ {t("landing.quick-link.manage")}+ </h3>+ <button+ onClick={onClose}+ className="text-gray-400 hover:text-gray-600"+ >+ ✕+ </button>+ </div>+ <div className="flex-1 overflow-y-auto px-2 py-2">+ {selected.map((item, i) => (+ <div+ key={item.id}+ draggable+ onDragStart={() => handleDragStart(i)}+ onDragEnter={() => handleDragEnter(i)}+ onDragEnd={handleDragEnd}+ onDragOver={(e: DragEvent) => e.preventDefault()}+ className="flex items-center justify-between p-2 hover:bg-gray-100 rounded-sm cursor-grab"+ >+ <div className="flex items-center gap-x-2">+ <input+ type="checkbox"+ checked+ disabled={selected.length <= 1}+ onChange={() => uncheck(item.id)}+ />+ <item.icon className="w-5 h-5 text-gray-500" />+ {item.title}+ </div>+ <GripVertical className="w-5 h-5 text-gray-500" />+ </div>+ ))}++ {unselected.length > 0 && <div className="border-t my-2" />}++ {unselected.map((item) => (+ <div+ key={item.id}+ className="flex items-center gap-x-2 p-2 hover:bg-gray-100 rounded-sm cursor-pointer"+ onClick={() => check(item.id)}+ >+ <input type="checkbox" checked={false} readOnly />+ <item.icon className="w-5 h-5 text-gray-500" />+ {item.title}+ </div>+ ))}+ </div>+ </div>+ </div>+ );+}++// ---------------------------------------------------------------------------+// LandingPage+// ---------------------------------------------------------------------------++export function LandingPage({+ onOpenProjectSwitch,+}: {+ onOpenProjectSwitch?: () => void;+} = {}) {+ const { t } = useTranslation();+ const [showConfigDrawer, setShowConfigDrawer] = useState(false);++ const email = useVueState(() => useCurrentUserV1().value.email);+ const version = useVueState(() => useActuatorV1Store().version);+ const changelogURL = useVueState(() => useActuatorV1Store().changelogURL);+ const hasNewRelease = useVueState(() => useActuatorV1Store().hasNewRelease);+ const releaseLatest = useVueState(+ () => useActuatorV1Store().releaseInfo.latest+ );++ const fullList = useFullQuickLinkList();+ const { config, setConfig } = useQuickAccessConfig(email);+ const { project: lastProject, projectPath: lastVisitProjectPath } =+ useLastVisitedProject();++ const quickLinkList = useMemo(+ () =>+ config+ .map((id) => fullList.find((l) => l.id === id))+ .filter(Boolean) as QuickLinkDef[],+ [config, fullList]+ );++ const handleClick = useCallback(+ (link: QuickLinkDef) => {+ if (link.route) {+ router.push({ name: link.route });+ return;+ }+ switch (link.id) {+ case "visit-projects":+ if (onOpenProjectSwitch) {+ onOpenProjectSwitch();+ } else {+ router.push({ name: PROJECT_V1_ROUTE_DASHBOARD });+ }+ break;+ case "visit-issues":+ router.push({ name: WORKSPACE_ROUTE_MY_ISSUES });+ break;+ }+ },+ [onOpenProjectSwitch]+ );++ return (+ <>+ <div className="py-4 px-4 flex flex-col h-full items-center relative">+ <div className="flex-1" />+ <div className="flex-[60%] flex flex-col gap-y-6">+ <div className="flex items-baseline gap-x-4">+ <div className="flex items-start gap-x-1">+ <div className="font-semibold text-2xl">+ {t("landing.quick-link.self")}+ </div>+ <button+ className="p-1 rounded hover:bg-gray-100"+ onClick={() => setShowConfigDrawer(true)}+ >+ <Settings className="w-4 h-4 text-gray-500" />+ </button>+ </div>+ {lastProject && lastVisitProjectPath && (+ <a+ className="underline normal-link cursor-pointer"+ onClick={() => router.push({ path: lastVisitProjectPath })}+ >+ {t("landing.last-visit")}: {lastProject.title}+ </a>+ )}+ </div>++ <div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-4">+ {quickLinkList.map((link) => {+ const tileClass =+ "flex justify-center items-center gap-x-2 cursor-pointer border rounded-sm px-4 py-5 bg-white hover:bg-gray-100 no-underline text-main";+ if (link.route) {+ const href = router.resolve({+ name: link.route,+ }).href;+ return (+ <a key={link.id} href={href} className={tileClass}>+ <link.icon className="w-5 h-5 text-gray-500" />+ {link.title}+ </a>+ );+ }+ return (+ <button+ key={link.id}+ type="button"+ className={tileClass}+ onClick={() => handleClick(link)}+ >+ <link.icon className="w-5 h-5 text-gray-500" />+ {link.title}+ </button>+ );+ })}+ </div>++ <div className="flex flex-col gap-y-2">+ {changelogURL && (+ <a+ className="underline normal-link"+ target="_blank"+ rel="noopener noreferrer"+ href={changelogURL}+ >+ {t("landing.changelog-for-version", { version })}+ </a>+ )}+ {hasNewRelease && releaseLatest?.html_url && (+ <a+ className="underline normal-link flex items-center gap-x-1"+ target="_blank"+ rel="noopener noreferrer"+ href={releaseLatest.html_url}+ >+ <Volume2 className="h-4 w-4" />+ {t("remind.release.new-version-available-with-tag", {+ tag: releaseLatest.tag_name,+ })}+ </a>+ )}+ </div>+ </div>+ </div>++ <ConfigDrawer+ open={showConfigDrawer}+ onClose={() => setShowConfigDrawer(false)}+ fullList={fullList}+ config={config}+ setConfig={setConfig}+ />+ </>+ );+}diff --git a/frontend/src/router/dashboard/workspace.ts b/frontend/src/router/dashboard/workspace.tsindex 776b59f37f..b7020dc2d6 100644--- a/frontend/src/router/dashboard/workspace.ts+++ b/frontend/src/router/dashboard/workspace.ts@@ -48,7 +48,7 @@ const workspaceRoutes: RouteRecordRaw[] = [title: () => t("common.home"),},components: {- content: () => import("@/views/DashboardLanding.vue"),+ content: () => import("@/react/LandingPageMount.vue"),leftSidebar: () => import("@/views/DashboardSidebar.vue"),},},diff --git a/frontend/src/store/modules/index.ts b/frontend/src/store/modules/index.tsindex 9b915ea2bc..884b8af3c1 100644--- a/frontend/src/store/modules/index.ts+++ b/frontend/src/store/modules/index.ts@@ -17,6 +17,5 @@ export * from "./utils";export * from "./release";export * from "./revision";export * from "./rollout";-export * from "./quickLink";export * from "./v1";diff --git a/frontend/src/store/modules/quickLink.ts b/frontend/src/store/modules/quickLink.tsdeleted file mode 100644index 377b6224a5..0000000000--- a/frontend/src/store/modules/quickLink.ts+++ /dev/null@@ -1,111 +0,0 @@-import { flatten } from "lodash-es";-import {- CircleDotIcon,- GalleryHorizontalEndIcon,- SettingsIcon,-} from "lucide-vue-next";-import { computed, h, type VNode } from "vue";-import { t } from "@/plugins/i18n";-import {- WORKSPACE_ROUTE_LANDING,- WORKSPACE_ROUTE_SQL_REVIEW,- WORKSPACE_ROUTE_USERS,-} from "@/router/dashboard/workspaceRoutes";-import { useCurrentUserV1 } from "@/store";-import {- type DashboardSidebarItem,- storageKeyQuickAccess,- useDashboardSidebar,- useDynamicLocalStorage,-} from "@/utils";--export interface QuickLink {- id: string;- title: string;- route?: string;- icon: () => VNode;-}--export function useQuickLink() {- const currentUser = useCurrentUserV1();- const { dashboardSidebarItemList } = useDashboardSidebar();-- const getAccessListBySidebar = (- sidebarItem: DashboardSidebarItem,- icon: () => VNode = () => h(SettingsIcon)- ): QuickLink[] => {- if (sidebarItem.type === "route" && sidebarItem.title && sidebarItem.name) {- if (sidebarItem.name === WORKSPACE_ROUTE_LANDING) {- return [];- }- return [- {- id: sidebarItem.name,- title: sidebarItem.title,- route: sidebarItem.name,- icon: sidebarItem.icon || icon,- },- ];- }-- if (sidebarItem.children) {- return flatten(- sidebarItem.children.map((child) =>- getAccessListBySidebar(child, sidebarItem.icon)- )- ).filter((item) => item);- }-- return [];- };-- const fullQuickLinkList = computed((): QuickLink[] => {- const accessList = flatten(- dashboardSidebarItemList.value.map((item) => getAccessListBySidebar(item))- ).filter((item) => item);-- accessList.unshift(- {- id: "visit-projects",- title: t("landing.quick-link.visit-prjects"),- icon: () => h(GalleryHorizontalEndIcon),- },- {- id: "visit-issues",- title: t("landing.quick-link.visit-issues"),- icon: () => h(CircleDotIcon),- }- );-- return accessList;- });-- const quickAccessConfig = useDynamicLocalStorage<string[]>(- computed(() => storageKeyQuickAccess(currentUser.value.email)),- [- "visit-issues",- "visit-projects",- WORKSPACE_ROUTE_USERS,- WORKSPACE_ROUTE_SQL_REVIEW,- ]- );-- const quickLinkList = computed({- get() {- return quickAccessConfig.value- .map((id) => {- return fullQuickLinkList.value.find((item) => item.id === id);- })- .filter((item) => item) as QuickLink[];- },- set(list) {- quickAccessConfig.value = list.map((item) => item.id);- },- });-- return {- quickLinkList,- quickAccessConfig,- fullQuickLinkList,- };-}diff --git a/frontend/src/views/DashboardLanding.vue b/frontend/src/views/DashboardLanding.vuedeleted file mode 100644index 37ee880186..0000000000--- a/frontend/src/views/DashboardLanding.vue+++ /dev/null@@ -1,217 +0,0 @@-<template>- <div class="py-4 px-4 flex flex-col h-full items-center relative">- <div class="flex-1" />- <div class="flex-[60%] flex flex-col gap-y-6">- <div class="flex items-baseline gap-x-4">- <div class="flex items-start gap-x-1">- <div class="font-semibold text-2xl">- {{ $t("landing.quick-link.self") }}- </div>- <NButton- quaternary- size="small"- @click="state.showConfigDrawer = true"- >- <template #icon>- <SettingsIcon class="w-4" />- </template>- </NButton>- </div>- <router-link- v-if="lastProject"- class="underline normal-link"- :to="{ path: lastVisitProjectPath }"- >- {{ $t("landing.last-visit") }}:- {{ lastProject.title }}- </router-link>- </div>- <div- class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-4"- >- <component- :is="access.route ? 'router-link' : 'div'"- v-for="(access, i) in quickLinkList"- :key="i"- :to="{- name: access.route,- }"- class="flex justify-center items-center gap-x-2 cursor-pointer border rounded-sm px-4 py-5 bg-white hover:bg-gray-100"- @click="handleClick(access)"- >- <component :is="access.icon" class="w-5 h-5 text-gray-500" />- {{ access.title }}- </component>- </div>- <div class="flex flex-col gap-y-2">- <a- v-if="actuatorStore.changelogURL"- class="underline normal-link"- target="_blank"- :href="actuatorStore.changelogURL"- >- {{- $t("landing.changelog-for-version", {- version: actuatorStore.version,- })- }}- </a>- <a- v-if="actuatorStore.hasNewRelease"- class="underline normal-link flex items-center gap-x-1"- target="_blank"- :href="actuatorStore.releaseInfo.latest?.html_url"- >- <Volume2Icon class="h-4 w-4" />- {{- $t("remind.release.new-version-available-with-tag", {- tag: actuatorStore.releaseInfo.latest?.tag_name,- })- }}- </a>- </div>- </div>- </div>-- <ProjectSwitchModal- :show="state.showProjectModal"- @dismiss="state.showProjectModal = false"- />-- <Drawer- :show="state.showConfigDrawer"- :close-on-esc="true"- @close="state.showConfigDrawer = false"- >- <DrawerContent- :title="$t('landing.quick-link.manage')"- class="w-96! max-w-full"- style="max-width: calc(100vw - 8rem)"- >- <div>- <VueDraggable v-model="quickLinkList" :animation="300">- <div- v-for="element in quickLinkList"- :key="element.id"- class="flex items-center justify-between p-2 hover:bg-gray-100 rounded-xs cursor-grab"- >- <div class="flex items-center gap-x-2">- <NCheckbox- :disabled="quickLinkList.length <= 1"- :checked="true"- @update:checked="() => uncheckAccessItem(element)"- />- <component :is="element.icon" class="w-5 h-5 text-gray-500" />- {{ element.title }}- </div>- <GripVerticalIcon class="w-5 h-5 text-gray-500" />- </div>- </VueDraggable>- <NDivider />-- <div- v-for="access in unSelectedAccessList"- :key="access.id"- class="flex items-center gap-x-2 p-2 hover:bg-gray-100 rounded-xs cursor-pointer"- @click.prevent.stop="() => checkAccessItem(access)"- >- <NCheckbox- :checked="false"- @update:checked="() => checkAccessItem(access)"- />- <component :is="access.icon" class="w-5 h-5 text-gray-500" />- {{ access.title }}- </div>- </div>- </DrawerContent>- </Drawer>-</template>--<script lang="tsx" setup>-import { computedAsync } from "@vueuse/core";-import { GripVerticalIcon, SettingsIcon, Volume2Icon } from "lucide-vue-next";-import { NButton, NCheckbox, NDivider } from "naive-ui";-import { computed, reactive } from "vue";-import { VueDraggable } from "vue-draggable-plus";-import { useRouter } from "vue-router";-import ProjectSwitchModal from "@/components/Project/ProjectSwitch/ProjectSwitchModal.vue";-import { Drawer, DrawerContent } from "@/components/v2";-import { WORKSPACE_ROUTE_MY_ISSUES } from "@/router/dashboard/workspaceRoutes";-import { useRecentVisit } from "@/router/useRecentVisit";-import {- type QuickLink,- useActuatorV1Store,- useProjectV1Store,- useQuickLink,-} from "@/store";-import { projectNamePrefix } from "@/store/modules/v1/common";-import { UNKNOWN_PROJECT_NAME } from "@/types";-import { extractProjectResourceName } from "@/utils";--interface LocalState {- showProjectModal: boolean;- showConfigDrawer: boolean;-}--const state = reactive<LocalState>({- showProjectModal: false,- showConfigDrawer: false,-});-const projectStore = useProjectV1Store();-const actuatorStore = useActuatorV1Store();-const { lastVisitProjectPath } = useRecentVisit();-const router = useRouter();--const lastProject = computedAsync(async () => {- if (!lastVisitProjectPath.value) {- return;- }- const projectName = `${projectNamePrefix}${extractProjectResourceName(lastVisitProjectPath.value)}`;- const project = await projectStore.getOrFetchProjectByName(projectName);- if (project.name === UNKNOWN_PROJECT_NAME) {- return;- }- return project;-});--const { quickLinkList, quickAccessConfig, fullQuickLinkList } = useQuickLink();--const handleClick = (access: QuickLink) => {- if (access.route) {- return;- }-- switch (access.id) {- case "visit-projects":- state.showProjectModal = true;- break;- case "visit-issues":- router.push({- name: WORKSPACE_ROUTE_MY_ISSUES,- });- return;- default:- return;- }-};--const unSelectedAccessList = computed(() =>- fullQuickLinkList.value.filter(- (item) => !quickAccessConfig.value.includes(item.id)- )-);--const checkAccessItem = (access: QuickLink) => {- const index = quickAccessConfig.value.findIndex((id) => id === access.id);- if (index < 0) {- quickAccessConfig.value.push(access.id);- }-};--const uncheckAccessItem = (access: QuickLink) => {- const index = quickAccessConfig.value.findIndex((id) => id === access.id);- if (index >= 0) {- quickAccessConfig.value.splice(index, 1);- }-};-</script>