Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: update grant request issue styles (#6096)
boojackea8e55cb9b0f
diff --git a/frontend/src/components/DatabaseSelect.vue b/frontend/src/components/DatabaseSelect.vueindex 053ff1a9e7..2495883929 100644--- a/frontend/src/components/DatabaseSelect.vue+++ b/frontend/src/components/DatabaseSelect.vue@@ -39,6 +39,7 @@ import {EnvironmentId,EngineType,DatabaseSyncStatus,+ DEFAULT_PROJECT_ID,} from "../types";interface LocalState {@@ -157,6 +158,10 @@ export default defineComponent({});}+ list = list.filter((database: Database) => {+ return database.project.id !== DEFAULT_PROJECT_ID;+ });+return list;});diff --git a/frontend/src/components/DatabasesSelectPanel.vue b/frontend/src/components/DatabasesSelectPanel.vueindex 8d6118c411..09f636c4e4 100644--- a/frontend/src/components/DatabasesSelectPanel.vue+++ b/frontend/src/components/DatabasesSelectPanel.vue@@ -211,7 +211,7 @@ const toggleAllDatabasesSelectionForEnvironment = (on: boolean) => {databaseList- .filter((db) => db.instance.environment.id === environment.uid)+ .filter((db) => String(db.instance.environment.id) === environment.uid).forEach((db) => toggleDatabaseSelected(db.id, on));};@@ -221,7 +221,7 @@ const getAllSelectionStateForEnvironment = (): { checked: boolean; indeterminate: boolean } => {const set = new Set(state.selectedDatabaseList- .filter((db) => db.instance.environment.id === environment.uid)+ .filter((db) => String(db.instance.environment.id) === environment.uid).map((db) => db.id));const checked = databaseList.every((db) => set.has(db.id));@@ -239,7 +239,7 @@ const getSelectionStateSummaryForEnvironment = () => {const set = new Set(state.selectedDatabaseList- .filter((db) => db.instance.environment.id === environment.uid)+ .filter((db) => String(db.instance.environment.id) === environment.uid).map((db) => db.id));const selected = databaseList.filter((db) => set.has(db.id)).length;diff --git a/frontend/src/components/EnvironmentSelect.vue b/frontend/src/components/EnvironmentSelect.vueindex 2213bd0e41..5c8fe7f9f8 100644--- a/frontend/src/components/EnvironmentSelect.vue+++ b/frontend/src/components/EnvironmentSelect.vue@@ -106,7 +106,7 @@ export default defineComponent({(selectedId) => {invalidateSelectionIfNeeded();state.selectedEnvironment = environmentList.value.find(- (env) => env.uid === selectedId+ (env) => env.uid === String(selectedId));},{ immediate: true }diff --git a/frontend/src/components/Issue/IssueDescriptionPanel.vue b/frontend/src/components/Issue/IssueDescriptionPanel.vueindex 219503c869..8e44cd58b0 100644--- a/frontend/src/components/Issue/IssueDescriptionPanel.vue+++ b/frontend/src/components/Issue/IssueDescriptionPanel.vue@@ -1,23 +1,20 @@<template><!-- Description Bar -->- <div class="flex justify-between">- <div class="textlabel">{{ descriptionTitle }}</div>- <div v-if="!create" class="space-x-2">+ <div class="flex justify-between items-center">+ <div class="textlabel !leading-7">{{ descriptionTitle }}</div>+ <div v-if="!create" class="space-x-2 mt-0.5"><buttonv-if="allowEditNameAndDescription && !state.editing"type="button"class="btn-icon"@click.prevent="beginEdit">- <!-- Heroicon name: solid/pencil -->- <!-- Use h-5 to avoid flickering when show/hide icon --><heroicons-solid:pencil class="h-5 w-5" /></button>- <!-- mt-0.5 is to prevent jiggling between switching edit/none-edit --><buttonv-if="state.editing"type="button"- class="mt-0.5 px-3 rounded-sm text-control hover:bg-control-bg-hover disabled:bg-control-bg disabled:opacity-50 disabled:cursor-not-allowed text-sm leading-5 font-normal focus:ring-control focus:outline-none focus-visible:ring-2 focus:ring-offset-2"+ class="px-2 leading-6 rounded-sm text-control hover:bg-control-bg-hover disabled:bg-control-bg disabled:opacity-50 disabled:cursor-not-allowed text-sm font-normal focus:ring-control focus:outline-none focus-visible:ring-2 focus:ring-offset-2"@click.prevent="cancelEdit">{{ $t("common.cancel") }}@@ -25,7 +22,7 @@<buttonv-if="state.editing"type="button"- class="mt-0.5 px-3 border border-control-border rounded-sm text-control bg-control-bg hover:bg-control-bg-hover disabled:bg-control-bg disabled:opacity-50 disabled:cursor-not-allowed text-sm leading-5 font-normal focus:ring-control focus:outline-none focus-visible:ring-2 focus:ring-offset-2"+ class="px-2 border leading-6 border-control-border rounded-sm text-control bg-control-bg hover:bg-control-bg-hover disabled:bg-control-bg disabled:opacity-50 disabled:cursor-not-allowed text-sm font-normal focus:ring-control focus:outline-none focus-visible:ring-2 focus:ring-offset-2":disabled="state.editDescription == issue.description"@click.prevent="saveEdit">@@ -33,40 +30,36 @@</button></div></div>- <!-- Description -->- <label for="description" class="sr-only">- {{ $t("issue.edit-description") }}- </label>- <!-- Use border-white focus:border-white to have the invisible border width- otherwise it will have 1px jiggling switching between focus/unfocus state -->- <textarea- ref="editDescriptionTextArea"- v-model="state.editDescription"- :rows="create ? 5 : 3"- class="mt-2 mx-[2px] w-full resize-none whitespace-pre-wrap border-white focus:border-white outline-none"- :class="state.editing ? 'focus:ring-control focus-visible:ring-2' : ''"- :style="- state.editing- ? ''- : '-webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none'- "- :placeholder="$t('issue.add-some-description')"- :readonly="!state.editing"- @input="- (e) => {- sizeToFit(e.target as HTMLTextAreaElement);- // When creating the issue, we will emit the event on keystroke to update the in-memory state.- if (create) {- updateDescription(state.editDescription);- }- }- "- @focus="- (e) => {- sizeToFit(e.target as HTMLTextAreaElement);- }- "- ></textarea>+ <div class="mt-2 w-full px-[2px]">+ <textarea+ ref="editDescriptionTextArea"+ v-model="state.editDescription"+ :rows="create ? 5 : 3"+ class="w-full resize-none whitespace-pre-wrap border-white focus:border-white outline-none"+ :class="state.editing ? 'focus:ring-control focus-visible:ring-2' : ''"+ :style="+ state.editing+ ? ''+ : '-webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none'+ "+ :placeholder="$t('issue.add-some-description')"+ :readonly="!state.editing"+ @input="+ (e) => {+ sizeToFit(e.target as HTMLTextAreaElement);+ // When creating the issue, we will emit the event on keystroke to update the in-memory state.+ if (create) {+ updateDescription(state.editDescription);+ }+ }+ "+ @focus="+ (e) => {+ sizeToFit(e.target as HTMLTextAreaElement);+ }+ "+ ></textarea>+ </div></template><script lang="ts" setup>diff --git a/frontend/src/components/Issue/form/GrantRequestExporterForm.vue b/frontend/src/components/Issue/form/GrantRequestExporterForm.vueindex b0fea5d765..f3327c3f57 100644--- a/frontend/src/components/Issue/form/GrantRequestExporterForm.vue+++ b/frontend/src/components/Issue/form/GrantRequestExporterForm.vue@@ -3,7 +3,7 @@class="w-full mx-auto flex flex-col justify-start items-start space-y-4 my-8 gap-4"><div v-if="create" class="w-full flex flex-row justify-start items-center">- <span class="flex w-40 items-center">+ <span class="flex w-40 items-center textlabel !leading-6">{{ $t("common.project") }}<RequiredStar /></span>@@ -14,8 +14,8 @@@select-project-id="handleProjectSelect"/></div>- <div class="w-full flex flex-row justify-start items-start">- <span class="flex w-40 items-center shrink-0">+ <div class="w-full flex flex-row justify-start items-center">+ <span class="flex w-40 items-center shrink-0 textlabel !leading-6">{{ $t("common.database") }}<RequiredStar /></span>@@ -25,7 +25,7 @@name="environment":select-default="false":selected-id="state.environmentId"- @select-environment-id="(id) => (state.environmentId = id)"+ @select-environment-id="handleEnvironmentSelect"/><DatabaseSelectclass="!w-128"@@ -35,7 +35,7 @@:project-id="state.projectId":sync-status="'OK'":customize-item="true"- @select-database-id="(id) => (state.databaseId = id)"+ @select-database-id="handleDatabaseSelect"><template #customizeItem="{ database }"><div class="flex items-center">@@ -58,7 +58,7 @@</div></div><div class="w-full flex flex-row justify-start items-center">- <span class="flex w-40 items-center">+ <span class="flex w-40 items-center textlabel !leading-6">{{ $t("issue.grant-request.export-rows") }}<RequiredStar /></span>@@ -72,7 +72,7 @@/></div><div class="w-full flex flex-row justify-start items-start">- <span class="flex w-40 items-center">+ <span class="flex w-40 items-center textlabel !leading-6">{{ $t("issue.grant-request.export-format") }}<RequiredStar /></span>@@ -91,19 +91,18 @@</div></div><div class="w-full flex flex-row justify-start items-start">- <span class="flex w-40 items-center shrink-0">SQL<RequiredStar /></span>+ <span class="flex w-40 items-center shrink-0 textlabel !leading-6 mt-4"+ >SQL<RequiredStar+ /></span><div class="whitespace-pre-wrap w-full overflow-hidden border"><MonacoEditor- ref="editorRef"- class="w-full h-[360px]"- data-label="bb-issue-sql-editor"+ class="w-full h-[360px] py-2":value="state.statement":auto-focus="false":language="'sql'":dialect="dialect":readonly="!create"@change="handleStatementChange"- @ready="handleMonacoEditorReady"/></div></div>@@ -112,10 +111,9 @@<script lang="ts" setup>import { head } from "lodash-es";-import { computed, onMounted, reactive, ref, watch } from "vue";+import { computed, onMounted, reactive, watch } from "vue";import { useIssueLogic } from "../logic";import {- Database,DatabaseId,EnvironmentId,GrantRequestContext,@@ -128,9 +126,8 @@ import {dialectOfEngine,} from "@/types";import { getProjectMemberList } from "@/utils";-import { useDBSchemaStore, useDatabaseStore } from "@/store";+import { useDatabaseStore } from "@/store";import MonacoEditor from "@/components/MonacoEditor";-import { TableMetadata } from "@/types/proto/store/database";import { useInstanceV1Store } from "@/store/modules/v1/instance";import { instanceNamePrefix } from "@/store/modules/v1/common";import RequiredStar from "@/components/RequiredStar.vue";@@ -148,13 +145,11 @@ interface LocalState {const { create, issue } = useIssueLogic();const instanceV1Store = useInstanceV1Store();const databaseStore = useDatabaseStore();-const dbSchemaStore = useDBSchemaStore();const state = reactive<LocalState>({maxRowCount: 1000,exportFormat: "CSV",statement: "",});-const editorRef = ref<InstanceType<typeof MonacoEditor>>();const projectId = computed(() => {return create.value ? state.projectId : (issue.value as Issue).project.id;@@ -199,6 +194,27 @@ const handleProjectSelect = async (projectId: ProjectId) => {}};+const handleEnvironmentSelect = (environmentId: EnvironmentId) => {+ state.environmentId = environmentId;+ const database = databaseStore.getDatabaseById(+ state.databaseId || UNKNOWN_ID+ );+ if (database && database.instance.environment.id !== state.environmentId) {+ state.databaseId = undefined;+ }+};++const handleDatabaseSelect = (databaseId: DatabaseId) => {+ state.databaseId = databaseId;+ const database = databaseStore.getDatabaseById(+ state.databaseId || UNKNOWN_ID+ );+ if (database) {+ state.environmentId = database.instance.environment.id;+ handleProjectSelect(database.projectId);+ }+};+const handleStatementChange = (value: string) => {state.statement = value;};@@ -216,57 +232,19 @@ watch(.createContext as GrantRequestContext;if (state.databaseId) {context.databases = [state.databaseId as string];+ } else {+ context.databases = [];}context.maxRowCount = state.maxRowCount;context.exportFormat = state.exportFormat;context.statement = state.statement;}+ },+ {+ immediate: true,});-// Handle and update monaco editor auto completion context.-const useDatabaseAndTableList = () => {- const databaseList = computed(() => {- if (selectedDatabase.value) return [selectedDatabase.value];- return [];- });-- watch(- databaseList,- (list) => {- list.forEach((db) => {- if (db.id && db.id !== UNKNOWN_ID) {- dbSchemaStore.getOrFetchTableListByDatabaseId(db.id);- }- });- },- { immediate: true }- );-- const tableList = computed(() => {- return databaseList.value- .map((item) => dbSchemaStore.getTableListByDatabaseId(item.id))- .flat();- });-- return { databaseList, tableList };-};--const { databaseList } = useDatabaseAndTableList();--const handleUpdateEditorAutoCompletionContext = async () => {- const databaseMap: Map<Database, TableMetadata[]> = new Map();- for (const database of databaseList.value) {- const tableList = dbSchemaStore.getTableListByDatabaseId(database.id);- databaseMap.set(database, tableList);- }- editorRef.value?.setEditorAutoCompletionContext(databaseMap);-};--const handleMonacoEditorReady = () => {- handleUpdateEditorAutoCompletionContext();-};-watch(create,async () => {diff --git a/frontend/src/components/Issue/form/GrantRequestQuerierForm.vue b/frontend/src/components/Issue/form/GrantRequestQuerierForm.vueindex 9912524978..14dd47dcf8 100644--- a/frontend/src/components/Issue/form/GrantRequestQuerierForm.vue+++ b/frontend/src/components/Issue/form/GrantRequestQuerierForm.vue@@ -2,8 +2,8 @@<divclass="w-full mx-auto flex flex-col justify-start items-start space-y-4 my-8 gap-4">- <div v-if="create" class="w-full flex flex-row justify-start items-center">- <span class="flex w-40 items-center">+ <div v-if="create" class="w-full flex flex-row justify-start items-start">+ <span class="flex w-40 items-center textlabel !leading-6 mt-2">{{ $t("common.project") }}<RequiredStar /></span>@@ -15,33 +15,52 @@/></div><div class="w-full flex flex-row justify-start items-start">- <span class="flex w-40 items-center">+ <span class="flex w-40 items-center textlabel !leading-6">{{ $t("common.databases") }}<RequiredStar /></span><div v-if="create"><NRadioGroupv-model:value="state.allDatabases"- class="w-full !flex flex-row justify-start items-center gap-4"+ class="w-full !flex flex-row justify-start items-start gap-4"name="radiogroup"><NRadio+ class="!leading-6":value="true":label="$t('issue.grant-request.all-databases')"/>- <div>+ <div class="flex flex-row justify-start flex-wrap"><NRadio+ class="!leading-6":value="false":disabled="!state.projectId":label="$t('issue.grant-request.manually-select')"+ @click="handleManullySelectClick"/><buttonv-if="state.projectId"- class="ml-2 normal-link disabled:cursor-not-allowed"+ class="ml-2 normal-link h-6 disabled:cursor-not-allowed"@click="state.showSelectDatabasePanel = true">{{ $t("common.select") }}</button>+ <div+ v-if="selectedDatabaseList.length > 0"+ class="ml-6 flex flex-row justify-start items-start gap-4"+ >+ <div+ v-for="database in selectedDatabaseList"+ :key="database.id"+ class="flex flex-row justify-start items-center"+ >+ <InstanceEngineIcon+ class="mr-1"+ :instance="database.instance"+ />+ {{ database.name }}+ </div>+ </div></div></NRadioGroup></div>@@ -60,8 +79,8 @@</div></div></div>- <div class="w-full flex flex-row justify-start items-center">- <span class="flex w-40 items-start">+ <div class="w-full flex flex-row justify-start items-start">+ <span class="flex w-40 items-start textlabel !leading-6">{{create? $t("issue.grant-request.expire-days")@@ -72,26 +91,28 @@<div v-if="create"><NRadioGroupv-model:value="state.expireDays"- class="!grid grid-cols-4 gap-2"+ class="!grid grid-cols-4 gap-x-4 gap-y-4"name="radiogroup">- <NRadio+ <divv-for="day in expireDaysOptions":key="day.value"- :value="day.value"- :label="day.label"- />+ class="col-span-1 flex flex-row justify-start items-center"+ >+ <NRadio :value="day.value" :label="day.label" />+ </div><div class="col-span-2 flex flex-row justify-start items-center"><NRadio :value="-1" :label="$t('issue.grant-request.customize')" /><NInputNumberv-model:value="state.customDays"+ class="!w-24 ml-2":disabled="state.expireDays !== -1"- size="small":min="1"- :max="365"- :step="1"- class="!w-24"- />+ :show-button="false"+ :placeholder="''"+ >+ <template #suffix>{{ $t("common.date.days") }}</template>+ </NInputNumber></div></NRadioGroup></div>@@ -114,6 +135,7 @@import { head } from "lodash-es";import { NRadioGroup, NRadio, NInputNumber } from "naive-ui";import { computed, onMounted, reactive, watch } from "vue";+import { useI18n } from "vue-i18n";import { useIssueLogic } from "../logic";import {DatabaseId,@@ -125,11 +147,11 @@ import {UNKNOWN_ID,} from "@/types";import { getProjectMemberList, parseExpiredTimeString } from "@/utils";-import DatabasesSelectPanel from "../../DatabasesSelectPanel.vue";import { useDatabaseStore } from "@/store";import { useInstanceV1Store } from "@/store/modules/v1/instance";import { instanceNamePrefix } from "@/store/modules/v1/common";import RequiredStar from "@/components/RequiredStar.vue";+import DatabasesSelectPanel from "../../DatabasesSelectPanel.vue";interface LocalState {showSelectDatabasePanel: boolean;@@ -143,33 +165,7 @@ interface LocalState {expiredAt: string;}-const expireDaysOptions = [- {- value: 7,- label: "7 days",- },- {- value: 30,- label: "30 days",- },- {- value: 60,- label: "60 days",- },- {- value: 90,- label: "90 days",- },- {- value: 180,- label: "6 months",- },- {- value: 365,- label: "1 year",- },-];-+const { t } = useI18n();const { create, issue } = useIssueLogic();const databaseStore = useDatabaseStore();const instanceV1Store = useInstanceV1Store();@@ -193,6 +189,33 @@ const selectedDatabaseList = computed(() => {});});+const expireDaysOptions = computed(() => [+ {+ value: 7,+ label: t("common.date.days", { days: 7 }),+ },+ {+ value: 30,+ label: t("common.date.days", { days: 30 }),+ },+ {+ value: 60,+ label: t("common.date.days", { days: 60 }),+ },+ {+ value: 90,+ label: t("common.date.days", { days: 90 }),+ },+ {+ value: 180,+ label: t("common.date.months", { months: 6 }),+ },+ {+ value: 365,+ label: t("common.date.years", { years: 1 }),+ },+]);+onMounted(() => {if (create.value) {const projectId = (issue.value as IssueCreate).projectId;@@ -218,6 +241,16 @@ const handleProjectSelect = async (projectId: ProjectId) => {if (projectOwner) {(issue.value as IssueCreate).assigneeId = projectOwner.principal.id;}+ state.selectedDatabaseIdList = state.selectedDatabaseIdList.filter((id) => {+ const database = databaseStore.getDatabaseById(id);+ return database.project.id === projectId;+ });+};++const handleManullySelectClick = () => {+ if (state.selectedDatabaseIdList.length === 0) {+ state.showSelectDatabasePanel = true;+ }};const handleSelectedDatabaseIdListChanged = (databaseIdList: DatabaseId[]) => {diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 3f18453d11..c74f32d37a 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -245,7 +245,12 @@"collapse": "Collapse","select": "Select","optional": "Optional",- "reason": "Reason"+ "reason": "Reason",+ "date": {+ "days": "{days} days",+ "months": "{months} months",+ "years": "{years} year"+ }},"error-page": {"go-back-home": "Go back home"diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex aed0abf5e3..cd9db07bae 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -245,7 +245,12 @@"collapse": "Colapsar","select": "Seleccionar","optional": "Opcional",- "reason": "Razón"+ "reason": "Razón",+ "date": {+ "days": "{days} días",+ "months": "{months} meses",+ "years": "{years} años"+ }},"error-page": {"go-back-home": "Volver al inicio"diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 686aba592d..776fbd4038 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -243,7 +243,12 @@"collapse": "收起","select": "选择","optional": "可选",- "reason": "理由"+ "reason": "理由",+ "date": {+ "days": "{days} 天",+ "months": "{months} 月",+ "years": "{years} 年"+ }},"error-page": {"go-back-home": "回到主页"