Skip to content

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

feat(frontend): adjust the layout of the settings-project page (#1558)

Liu Ji53d1c48061ae
diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts
index cc75532759..532f08fe5b 100644
--- a/frontend/src/router/index.ts
+++ b/frontend/src/router/index.ts
@@ -325,8 +325,8 @@ const routes: Array<RouteRecordRaw> = [
title: () => t("common.projects"),
quickActionListByRole: () => {
return new Map([
- ["OWNER", ["quickaction.bb.project.create"]],
- ["DBA", ["quickaction.bb.project.create"]],
+ ["OWNER", []],
+ ["DBA", []],
["DEVELOPER", []],
]);
},
diff --git a/frontend/src/views/SettingWorkspaceProject.vue b/frontend/src/views/SettingWorkspaceProject.vue
index dfb843c195..022332b22b 100644
--- a/frontend/src/views/SettingWorkspaceProject.vue
+++ b/frontend/src/views/SettingWorkspaceProject.vue
@@ -1,41 +1,84 @@
<template>
<div class="flex flex-col">
- <BBAttention style="INFO" :title="$t('setting.project.description')" />
- <div class="px-2 py-2 flex justify-end items-center">
- <BBTableSearch
- ref="searchField"
- :placeholder="$t('project.dashboard.search-bar-placeholder')"
- @change-text="(text: string) => changeSearchText(text)"
- />
+ <div class="py-2 flex justify-between items-center">
+ <div class="flex justify-start items-center gap-x-2">
+ <BBAttention
+ class="px-0"
+ style="INFO"
+ :title="$t('setting.project.description')"
+ />
+ </div>
+
+ <div class="flex justify-end items-center px-2 gap-x-2">
+ <button
+ v-if="allowCreate"
+ class="btn-primary"
+ @click="state.showCreateModal = true"
+ >
+ {{ $t("quick-action.new-project") }}
+ </button>
+ <BBTableSearch
+ ref="searchField"
+ :placeholder="$t('project.dashboard.search-bar-placeholder')"
+ @change-text="(text: string) => changeSearchText(text)"
+ />
+ </div>
</div>
+
<ProjectTable :project-list="filteredList(state.projectList)" />
+
+ <BBModal
+ v-if="state.showCreateModal"
+ class="relative overflow-hidden"
+ :title="$t('quick-action.create-project')"
+ @close="state.showCreateModal = false"
+ >
+ <ProjectCreate @dismiss="state.showCreateModal = false" />
+ </BBModal>
</div>
</template>
<script lang="ts">
-import { useProjectStore } from "@/store";
-import { watchEffect, onMounted, reactive, ref, defineComponent } from "vue";
+import { useCurrentUser, useProjectStore } from "@/store";
+import {
+ watchEffect,
+ onMounted,
+ reactive,
+ ref,
+ defineComponent,
+ computed,
+} from "vue";
import ProjectTable from "../components/ProjectTable.vue";
+import ProjectCreate from "../components/ProjectCreate.vue";
import { Project } from "../types";
+import { isDBAOrOwner } from "@/utils";
interface LocalState {
projectList: Project[];
searchText: string;
+ showCreateModal: boolean;
}
export default defineComponent({
name: "SettingWorkspaceMember",
components: {
+ ProjectCreate,
ProjectTable,
},
setup() {
const searchField = ref();
const projectStore = useProjectStore();
+ const currentUser = useCurrentUser();
const state = reactive<LocalState>({
projectList: [],
searchText: "",
+ showCreateModal: false,
+ });
+
+ const allowCreate = computed(() => {
+ return isDBAOrOwner(currentUser.value.role);
});
onMounted(() => {
@@ -71,6 +114,7 @@ export default defineComponent({
return {
searchField,
state,
+ allowCreate,
filteredList,
changeSearchText,
};