Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: add "Visit Default Project" button to the project list page (#1163)

tianzhoue95fa5646252
diff --git a/frontend/src/components/ProjectOverviewPanel.vue b/frontend/src/components/ProjectOverviewPanel.vue
index c646dc71dd..9ae38b91b8 100644
--- a/frontend/src/components/ProjectOverviewPanel.vue
+++ b/frontend/src/components/ProjectOverviewPanel.vue
@@ -39,11 +39,6 @@
</div>
</div>
</div>
- <BBAttention
- v-if="project.id == DEFAULT_PROJECT_ID"
- :style="`INFO`"
- :title="$t('project.overview.info-slot-content')"
- />
<YAxisRadioGroup
v-if="isTenantProject && state.yAxisLabel"
@@ -123,14 +118,7 @@ import ActivityTable from "../components/ActivityTable.vue";
import DatabaseTable from "../components/DatabaseTable.vue";
import TenantDatabaseTable, { YAxisRadioGroup } from "./TenantDatabaseTable";
import { IssueTable } from "../components/Issue";
-import {
- Activity,
- Database,
- Issue,
- Project,
- DEFAULT_PROJECT_ID,
- LabelKeyType,
-} from "../types";
+import { Activity, Database, Issue, Project, LabelKeyType } from "../types";
import { findDefaultGroupByLabel } from "../utils";
import { NSpin } from "naive-ui";
import { useActivityStore, useIssueStore, useLabelStore } from "@/store";
@@ -254,7 +242,6 @@ export default defineComponent({
});
return {
- DEFAULT_PROJECT_ID,
state,
isTenantProject,
filteredDatabaseList,
diff --git a/frontend/src/components/QuickActionPanel.vue b/frontend/src/components/QuickActionPanel.vue
index e9bb0fdcab..521c6bce3c 100644
--- a/frontend/src/components/QuickActionPanel.vue
+++ b/frontend/src/components/QuickActionPanel.vue
@@ -160,18 +160,6 @@
</h3>
</div>
- <div
- v-if="quickAction == 'quickaction.bb.project.default'"
- class="flex flex-col items-center w-28"
- >
- <button class="btn-icon-primary p-3" @click.prevent="goDefaultProject">
- <heroicons-outline:cube class="w-6 h-6" />
- </button>
- <h3 class="mt-1 text-center text-base font-normal text-main">
- {{ $t("quick-action.default-project") }}
- </h3>
- </div>
-
<div
v-if="quickAction == 'quickaction.bb.project.database.transfer'"
class="flex flex-col items-center w-28"
@@ -263,7 +251,7 @@ import AlterSchemaPrepForm from "./AlterSchemaPrepForm/";
import CreateDatabasePrepForm from "../components/CreateDatabasePrepForm.vue";
import RequestDatabasePrepForm from "../components/RequestDatabasePrepForm.vue";
import TransferDatabaseForm from "../components/TransferDatabaseForm.vue";
-import { DEFAULT_PROJECT_ID, ProjectId, QuickActionType } from "../types";
+import { ProjectId, QuickActionType } from "../types";
import { idFromSlug } from "../utils";
import { Action, defineAction, useRegisterActions } from "@bytebase/vue-kbar";
import { useI18n } from "vue-i18n";
@@ -326,15 +314,6 @@ export default defineComponent({
state.showModal = true;
};
- const goDefaultProject = () => {
- router.push({
- name: "workspace.project.detail",
- params: {
- projectSlug: DEFAULT_PROJECT_ID,
- },
- });
- };
-
const transferDatabase = () => {
state.modalTitle = t("quick-action.transfer-in-db-title");
state.modalSubtitle = "";
@@ -428,10 +407,6 @@ export default defineComponent({
name: t("quick-action.new-project"),
perform: () => createProject(),
},
- "quickaction.bb.project.default": {
- name: t("quick-action.default-project"),
- perform: () => goDefaultProject(),
- },
"quickaction.bb.project.database.transfer": {
name: t("quick-action.transfer-in-db"),
perform: () => transferDatabase(),
@@ -460,7 +435,6 @@ export default defineComponent({
state,
projectId,
createProject,
- goDefaultProject,
transferDatabase,
createInstance,
alterSchema,
diff --git a/frontend/src/components/TransferDatabaseForm.vue b/frontend/src/components/TransferDatabaseForm.vue
index 5fb315025b..3bb43024db 100644
--- a/frontend/src/components/TransferDatabaseForm.vue
+++ b/frontend/src/components/TransferDatabaseForm.vue
@@ -9,7 +9,7 @@
v-if="state.transferSource == 'DEFAULT'"
class="textinfolabel mb-2"
>
- {{ $t("quick-action.transfer-in-db-hint") }}
+ {{ $t("quick-action.default-db-hint") }}
</div>
<div class="radio-set-row">
<div class="flex flex-row">
diff --git a/frontend/src/layouts/ProjectLayout.vue b/frontend/src/layouts/ProjectLayout.vue
index 58f01d3bff..cb477998e5 100644
--- a/frontend/src/layouts/ProjectLayout.vue
+++ b/frontend/src/layouts/ProjectLayout.vue
@@ -11,6 +11,12 @@
{{ $t("project.mode.tenant") }}
</span>
</h1>
+ <BBAttention
+ v-if="project.id === DEFAULT_PROJECT_ID"
+ class="mx-6 mb-4"
+ :style="'INFO'"
+ :title="$t('project.overview.info-slot-content')"
+ />
<BBTabFilter
class="px-3 pb-2 border-b border-block-border"
:responsive="false"
@@ -39,7 +45,7 @@ import { idFromSlug, isProjectOwner } from "../utils";
import ArchiveBanner from "../components/ArchiveBanner.vue";
import { BBTabFilterItem } from "../bbkit/types";
import { useI18n } from "vue-i18n";
-import { Project } from "../types";
+import { Project, DEFAULT_PROJECT_ID } from "../types";
import { useCurrentUser, useProjectStore } from "@/store";
type ProjectTabItem = {
@@ -185,6 +191,7 @@ export default defineComponent({
);
return {
+ DEFAULT_PROJECT_ID,
state,
project,
allowEdit,
diff --git a/frontend/src/locales/en.yml b/frontend/src/locales/en.yml
index 9410572927..3b770a3bcc 100644
--- a/frontend/src/locales/en.yml
+++ b/frontend/src/locales/en.yml
@@ -34,6 +34,8 @@ common:
settings: Settings
project: Project
projects: Projects
+ default-project: Default Project
+ visit-default-project: "@:common.visit @:common.default-project"
help: Help
database: Database
databases: Databases
@@ -469,7 +471,6 @@ quick-action:
add-instance: "@:common.add @:common.instance"
create-instance: "@:common.create @:common.instance"
manage-user: Manage User
- default-project: Default Project
add-environment: "@:common.add @:common.environment"
create-environment: "@:common.create @:common.environment"
new-project: "@:common.new @:common.project"
@@ -481,7 +482,7 @@ quick-action:
from-default-project: From Default project
from-other-projects: From other projects
transfer-in-db-title: Transfer in database from other projects
- transfer-in-db-hint: >-
+ default-db-hint: >-
Bytebase periodically syncs the instance schema. Newly synced databases are
first placed in this default project.
transfer-in-db-alert: Are you sure to transfer "{ dbName }" into our project?
diff --git a/frontend/src/locales/zh-CN.yml b/frontend/src/locales/zh-CN.yml
index 9161a9a458..ea90863507 100644
--- a/frontend/src/locales/zh-CN.yml
+++ b/frontend/src/locales/zh-CN.yml
@@ -34,6 +34,8 @@ common:
settings: 设置
project: 项目
projects: 项目
+ default-project: 默认项目
+ visit-default-project: "@:common.visit@:common.default-project"
help: 帮助
database: 数据库
databases: 数据库
@@ -442,7 +444,6 @@ quick-action:
add-instance: "@:common.add@:common.instance"
create-instance: "@:common.create@:common.instance"
manage-user: 成员管理
- default-project: 默认项目
add-environment: "@:common.add@:common.environment"
create-environment: "@:common.create@:common.environment"
new-project: "@:common.new@:common.project"
@@ -454,7 +455,7 @@ quick-action:
from-default-project: 从默认项目
from-other-projects: 从其他项目
transfer-in-db-title: 从其他项目转移数据库
- transfer-in-db-hint: Bytebase 会定期同步实例的 Schema。新同步的数据库会放在默认项目中。
+ default-db-hint: Bytebase 会定期同步实例的 Schema。新同步的数据库会放在默认项目中。
transfer-in-db-alert: 您确定要转移 "{ dbName }" 到我们的项目中吗?
create-db:
new-database-name: 新数据库名称
diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts
index 2a2f0973bd..0a1912e621 100644
--- a/frontend/src/router/index.ts
+++ b/frontend/src/router/index.ts
@@ -318,20 +318,8 @@ const routes: Array<RouteRecordRaw> = [
title: () => t("common.projects"),
quickActionListByRole: () => {
return new Map([
- [
- "OWNER",
- [
- "quickaction.bb.project.create",
- "quickaction.bb.project.default",
- ],
- ],
- [
- "DBA",
- [
- "quickaction.bb.project.create",
- "quickaction.bb.project.default",
- ],
- ],
+ ["OWNER", ["quickaction.bb.project.create"]],
+ ["DBA", ["quickaction.bb.project.create"]],
["DEVELOPER", []],
]);
},
@@ -501,27 +489,9 @@ const routes: Array<RouteRecordRaw> = [
title: () => t("common.project"),
quickActionListByRole: () => {
return new Map([
- [
- "OWNER",
- [
- "quickaction.bb.project.create",
- "quickaction.bb.project.default",
- ],
- ],
- [
- "DBA",
- [
- "quickaction.bb.project.create",
- "quickaction.bb.project.default",
- ],
- ],
- [
- "DEVELOPER",
- [
- "quickaction.bb.project.create",
- "quickaction.bb.project.default",
- ],
- ],
+ ["OWNER", ["quickaction.bb.project.create"]],
+ ["DBA", ["quickaction.bb.project.create"]],
+ ["DEVELOPER", ["quickaction.bb.project.create"]],
]);
},
},
diff --git a/frontend/src/types/common.ts b/frontend/src/types/common.ts
index 9b270900b5..8f149f4c60 100644
--- a/frontend/src/types/common.ts
+++ b/frontend/src/types/common.ts
@@ -88,7 +88,6 @@ export type EnvironmentQuickActionType =
| "quickaction.bb.environment.reorder";
export type ProjectQuickActionType =
| "quickaction.bb.project.create"
- | "quickaction.bb.project.default"
| "quickaction.bb.project.database.transfer";
export type InstanceQuickActionType = "quickaction.bb.instance.create";
export type UserQuickActionType = "quickaction.bb.user.manage";
diff --git a/frontend/src/views/ProjectDashboard.vue b/frontend/src/views/ProjectDashboard.vue
index 09114cfcfc..e335cdf8a9 100644
--- a/frontend/src/views/ProjectDashboard.vue
+++ b/frontend/src/views/ProjectDashboard.vue
@@ -1,6 +1,18 @@
<template>
<div class="flex flex-col">
- <div class="px-2 py-2 flex justify-end items-center">
+ <div class="px-2 py-2 flex justify-between items-center">
+ <BBTooltipButton
+ type="normal"
+ tooltip-mode="ALWAYS"
+ @click="goDefaultProject"
+ >
+ {{ $t("common.visit-default-project") }}
+ <template #tooltip>
+ <div class="whitespace-pre-wrap">
+ {{ $t("quick-action.default-db-hint") }}
+ </div>
+ </template>
+ </BBTooltipButton>
<BBTableSearch
ref="searchField"
:placeholder="$t('project.dashboard.search-bar-placeholder')"
@@ -29,9 +41,10 @@
<script lang="ts">
import { useCurrentUser, useUIStateStore, useProjectStore } from "@/store";
+import { useRouter } from "vue-router";
import { watchEffect, onMounted, reactive, ref, defineComponent } from "vue";
import ProjectTable from "../components/ProjectTable.vue";
-import { Project, UNKNOWN_ID } from "../types";
+import { Project, UNKNOWN_ID, DEFAULT_PROJECT_ID } from "../types";
interface LocalState {
projectList: Project[];
@@ -45,6 +58,7 @@ export default defineComponent({
ProjectTable,
},
setup() {
+ const router = useRouter();
const searchField = ref();
const uiStateStore = useUIStateStore();
@@ -100,6 +114,15 @@ export default defineComponent({
state.showGuide = false;
};
+ const goDefaultProject = () => {
+ router.push({
+ name: "workspace.project.detail",
+ params: {
+ projectSlug: DEFAULT_PROJECT_ID,
+ },
+ });
+ };
+
const filteredList = (list: Project[]) => {
if (!state.searchText) {
// Select "All"
@@ -119,6 +142,7 @@ export default defineComponent({
filteredList,
doDismissGuide,
changeSearchText,
+ goDefaultProject,
};
},
});