Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Create separate ProjectSettingPanel, ProjectOverviewPanel
天舟61e13b036115
diff --git a/frontend/src/components/ProjectOverviewPanel.vue b/frontend/src/components/ProjectOverviewPanel.vuenew file mode 100644index 0000000000..fb787a93a1--- /dev/null+++ b/frontend/src/components/ProjectOverviewPanel.vue@@ -0,0 +1,99 @@+<template>+ <div class="space-y-6">+ <div class="space-y-2">+ <p class="text-lg font-medium leading-7 text-main">Databases</p>+ <DatabaseTable :mode="'PROJECT'" :databaseList="databaseList" />+ </div>+ <div class="space-y-2">+ <p class="text-lg font-medium leading-7 text-main">Issues</p>+ <IssueTable+ :mode="'PROJECT'"+ :issueSectionList="[+ {+ title: 'In progress',+ list: state.progressIssueList,+ },+ {+ title: 'Recently Closed',+ list: state.closedIssueList,+ },+ ]"+ />+ </div>+ </div>+</template>++<script lang="ts">+import { computed, reactive, watchEffect, PropType } from "vue";+import { useStore } from "vuex";+import { useRouter } from "vue-router";+import DatabaseTable from "../components/DatabaseTable.vue";+import IssueTable from "../components/IssueTable.vue";+import { Issue, Project } from "../types";++interface LocalState {+ progressIssueList: Issue[];+ closedIssueList: Issue[];+}++export default {+ name: "ProjectOverviewPanel",+ components: {+ DatabaseTable,+ IssueTable,+ },+ props: {+ project: {+ required: true,+ type: Object as PropType<Project>,+ },+ },+ setup(props, { emit }) {+ const store = useStore();+ const router = useRouter();++ const state = reactive<LocalState>({+ progressIssueList: [],+ closedIssueList: [],+ });++ const databaseList = computed(() => {+ return store.getters["database/databaseListByProjectId"](+ props.project.id+ );+ });++ const prepareDatabaseList = () => {+ store.dispatch("database/fetchDatabaseListByProjectId", props.project.id);+ };++ watchEffect(prepareDatabaseList);++ const prepareIssueList = () => {+ store+ .dispatch("issue/fetchIssueListForProject", props.project.id)+ .then((issueList: Issue[]) => {+ state.progressIssueList = [];+ state.closedIssueList = [];+ for (const issue of issueList) {+ // "OPEN"+ if (issue.status === "OPEN") {+ state.progressIssueList.push(issue);+ }+ // "DONE" or "CANCELED"+ else if (issue.status === "DONE" || issue.status === "CANCELED") {+ state.closedIssueList.push(issue);+ }+ }+ });+ };++ watchEffect(prepareIssueList);++ return {+ state,+ databaseList,+ };+ },+};+</script>diff --git a/frontend/src/components/ProjectSettingPanel.vue b/frontend/src/components/ProjectSettingPanel.vuenew file mode 100644index 0000000000..b100deafa3--- /dev/null+++ b/frontend/src/components/ProjectSettingPanel.vue@@ -0,0 +1,90 @@+<template>+ <div class="max-w-3xl mx-auto space-y-4">+ <div class="divide-y divide-block-border space-y-6">+ <ProjectGeneralSettingPanel :project="project" />+ <ProjectMemberPanel class="pt-4" :project="project" />+ </div>+ <template v-if="allowArchiveOrRestore">+ <template v-if="project.rowStatus == 'NORMAL'">+ <BBButtonConfirm+ :style="'ARCHIVE'"+ :buttonText="'Archive this project'"+ :okText="'Archive'"+ :confirmTitle="`Archive project '${project.name}'?`"+ :confirmDescription="'Archived project will not be shown on the normal interface. You can still restore later from the Archive page.'"+ :requireConfirm="true"+ @confirm="archiveOrRestoreProject(true)"+ />+ </template>+ <template v-else-if="project.rowStatus == 'ARCHIVED'">+ <BBButtonConfirm+ :style="'RESTORE'"+ :buttonText="'Restore this project'"+ :okText="'Restore'"+ :confirmTitle="`Restore project '${project.name}' to normal state?`"+ :confirmDescription="''"+ :requireConfirm="true"+ @confirm="archiveOrRestoreProject(false)"+ />+ </template>+ </template>+ </div>+</template>++<script lang="ts">+import { computed, PropType } from "vue";+import { useStore } from "vuex";+import { isProjectOwner } from "../utils";+import ProjectGeneralSettingPanel from "../components/ProjectGeneralSettingPanel.vue";+import ProjectMemberPanel from "../components/ProjectMemberPanel.vue";+import { ProjectPatch, Project } from "../types";++export default {+ name: "ProjectSettingPanel",+ components: {+ ProjectGeneralSettingPanel,+ ProjectMemberPanel,+ },+ props: {+ project: {+ required: true,+ type: Object as PropType<Project>,+ },+ },+ setup(props, { emit }) {+ const store = useStore();++ const currentUser = computed(() => store.getters["auth/currentUser"]());++ // Only the project owner can archive/restore the project info.+ // This means even the workspace owner won't be able to edit it.+ // There seems to be no good reason that workspace owner needs to archive/restore the project.+ const allowArchiveOrRestore = computed(() => {+ for (const member of props.project.memberList) {+ if (member.principal.id == currentUser.value.id) {+ if (isProjectOwner(member.role)) {+ return true;+ }+ }+ }+ return false;+ });++ const archiveOrRestoreProject = (archive: boolean) => {+ const projectPatch: ProjectPatch = {+ updaterId: currentUser.value.id,+ rowStatus: archive ? "ARCHIVED" : "NORMAL",+ };+ store.dispatch("project/patchProject", {+ projectId: props.project.id,+ projectPatch,+ });+ };++ return {+ allowArchiveOrRestore,+ archiveOrRestoreProject,+ };+ },+};+</script>diff --git a/frontend/src/views/ProjectDetail.vue b/frontend/src/views/ProjectDetail.vueindex 99f779550f..b36fcadefd 100644--- a/frontend/src/views/ProjectDetail.vue+++ b/frontend/src/views/ProjectDetail.vue@@ -17,82 +17,27 @@"/><div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8">- <div- v-if="state.selectedIndex == OVERVIEW_TAB"- class="space-y-6"- id="overview"- >- <div class="space-y-2">- <p class="text-lg font-medium leading-7 text-main">Databases</p>- <DatabaseTable :mode="'PROJECT'" :databaseList="databaseList" />- </div>- <div class="space-y-2">- <p class="text-lg font-medium leading-7 text-main">Issues</p>- <IssueTable- :mode="'PROJECT'"- :issueSectionList="[- {- title: 'In progress',- list: state.progressIssueList,- },- {- title: 'Recently Closed',- list: state.closedIssueList,- },- ]"- />- </div>- </div>+ <template v-if="state.selectedIndex == OVERVIEW_TAB">+ <ProjectOverviewPanel :project="project" id="overview" />+ </template><template v-else-if="state.selectedIndex == VERSION_CONTROL_TAB"><ProjectVersionControlPanel :project="project" id="version-control" /></template><template v-else-if="state.selectedIndex == SETTING_TAB">- <div class="max-w-3xl mx-auto space-y-4" id="setting">- <div class="divide-y divide-block-border space-y-6">- <ProjectGeneralSettingPanel :project="project" />- <ProjectMemberPanel class="pt-4" :project="project" />- </div>- <template v-if="allowArchiveOrRestore">- <template v-if="project.rowStatus == 'NORMAL'">- <BBButtonConfirm- :style="'ARCHIVE'"- :buttonText="'Archive this project'"- :okText="'Archive'"- :confirmTitle="`Archive project '${project.name}'?`"- :confirmDescription="'Archived project will not be shown on the normal interface. You can still restore later from the Archive page.'"- :requireConfirm="true"- @confirm="archiveOrRestoreProject(true)"- />- </template>- <template v-else-if="project.rowStatus == 'ARCHIVED'">- <BBButtonConfirm- :style="'RESTORE'"- :buttonText="'Restore this project'"- :okText="'Restore'"- :confirmTitle="`Restore project '${project.name}' to normal state?`"- :confirmDescription="''"- :requireConfirm="true"- @confirm="archiveOrRestoreProject(false)"- />- </template>- </template>- </div>+ <ProjectSettingPanel :project="project" id="setting" /></template></div></template><script lang="ts">-import { computed, onMounted, reactive, watchEffect, watch } from "vue";+import { computed, onMounted, reactive, watch } from "vue";import { useStore } from "vuex";import { useRouter } from "vue-router";-import { idFromSlug, isProjectOwner } from "../utils";+import { idFromSlug } from "../utils";import ArchiveBanner from "../components/ArchiveBanner.vue";-import DatabaseTable from "../components/DatabaseTable.vue";-import ProjectGeneralSettingPanel from "../components/ProjectGeneralSettingPanel.vue";-import ProjectMemberPanel from "../components/ProjectMemberPanel.vue";+import ProjectOverviewPanel from "../components/ProjectOverviewPanel.vue";import ProjectVersionControlPanel from "../components/ProjectVersionControlPanel.vue";-import IssueTable from "../components/IssueTable.vue";-import { ProjectPatch, Issue } from "../types";+import ProjectSettingPanel from "../components/ProjectSettingPanel.vue";const OVERVIEW_TAB = 0;const VERSION_CONTROL_TAB = 1;@@ -111,19 +56,15 @@ const projectTabItemList: ProjectTabItem[] = [interface LocalState {selectedIndex: number;- progressIssueList: Issue[];- closedIssueList: Issue[];}export default {name: "ProjectDetail",components: {ArchiveBanner,- DatabaseTable,- ProjectGeneralSettingPanel,- ProjectMemberPanel,+ ProjectOverviewPanel,ProjectVersionControlPanel,- IssueTable,+ ProjectSettingPanel,},props: {projectSlug: {@@ -137,8 +78,6 @@ export default {const state = reactive<LocalState>({selectedIndex: OVERVIEW_TAB,- progressIssueList: [],- closedIssueList: [],});const selectProjectTabOnHash = () => {@@ -170,78 +109,12 @@ export default {});- const currentUser = computed(() => store.getters["auth/currentUser"]());-const project = computed(() => {return store.getters["project/projectById"](idFromSlug(props.projectSlug));});- const databaseList = computed(() => {- return store.getters["database/databaseListByProjectId"](- project.value.id- );- });-- const prepareDatabaseList = () => {- store.dispatch(- "database/fetchDatabaseListByProjectId",- idFromSlug(props.projectSlug)- );- };-- watchEffect(prepareDatabaseList);-- const prepareIssueList = () => {- store- .dispatch(- "issue/fetchIssueListForProject",- idFromSlug(props.projectSlug)- )- .then((issueList: Issue[]) => {- state.progressIssueList = [];- state.closedIssueList = [];- for (const issue of issueList) {- // "OPEN"- if (issue.status === "OPEN") {- state.progressIssueList.push(issue);- }- // "DONE" or "CANCELED"- else if (issue.status === "DONE" || issue.status === "CANCELED") {- state.closedIssueList.push(issue);- }- }- });- };-- watchEffect(prepareIssueList);-- // Only the project owner can archive/restore the project info.- // This means even the workspace owner won't be able to edit it.- // There seems to be no good reason that workspace owner needs to archive/restore the project.- const allowArchiveOrRestore = computed(() => {- for (const member of project.value.memberList) {- if (member.principal.id == currentUser.value.id) {- if (isProjectOwner(member.role)) {- return true;- }- }- }- return false;- });-- const archiveOrRestoreProject = (archive: boolean) => {- const projectPatch: ProjectPatch = {- updaterId: currentUser.value.id,- rowStatus: archive ? "ARCHIVED" : "NORMAL",- };- store.dispatch("project/patchProject", {- projectId: project.value.id,- projectPatch,- });- };-const selectTab = (index: number) => {state.selectedIndex = index;router.replace({@@ -256,9 +129,6 @@ export default {SETTING_TAB,state,project,- databaseList,- allowArchiveOrRestore,- archiveOrRestoreProject,selectTab,projectTabItemList,};