Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix(frontend): fix two bugs in the sidebar of the issue page (#128)
Luke Zhou8f837c600dfa
diff --git a/frontend/src/components/IssueSidebar.vue b/frontend/src/components/IssueSidebar.vueindex aff6c24133..bf7e1eb467 100644--- a/frontend/src/components/IssueSidebar.vue+++ b/frontend/src/components/IssueSidebar.vue@@ -87,7 +87,13 @@<divclass="col-span-2 text-sm font-medium text-main":class="isDatabaseCreated ? 'cursor-pointer hover:underline' : ''"- @click.prevent="clickDatabase"+ @click.prevent="+ {+ if (isDatabaseCreated) {+ clickDatabase();+ }+ }+ ">{{ databaseName }}<span class="text-control-light">{{@@ -365,7 +371,8 @@ export default {// TODO: errors detected by Vetur below is related to https://github.com/bytebase/bytebase/issues/56// Will fix this in another branch.const clickDatabase = () => {- if (props.database.value) {+ // If the database has not been created yet, do nothing+ if (props.database && props.database.value) {router.push({name: "workspace.database.detail",params: {diff --git a/frontend/src/views/IssueDetail.vue b/frontend/src/views/IssueDetail.vueindex ab243bd271..023617db4b 100644--- a/frontend/src/views/IssueDetail.vue+++ b/frontend/src/views/IssueDetail.vue@@ -573,10 +573,10 @@ export default {return newIssue;};- const create = props.issueSlug.toLowerCase() == "new";const state = reactive<LocalState>({- create: create,- newIssue: create ? buildNewIssue() : undefined,+ create: props.issueSlug.toLowerCase() == "new",+ newIssue:+ props.issueSlug.toLowerCase() == "new" ? buildNewIssue() : undefined,});// pollIssue invalidates the current timer and schedule a new timer in <<interval>> microseconds@@ -924,7 +924,6 @@ export default {}}}-if (state.create) {return issue.value.pipeline.stageList[0];}@@ -1139,39 +1138,35 @@ export default {});const database = computed((): Database | undefined => {- const temp = selectedStage as unknown;- if (create) {- const stage = temp as ComputedRef<StageCreate>;- const databaseId = stage.value.taskList[0].databaseId;+ if (state.create) {+ const databaseId = selectedStage.value.taskList[0].databaseId;if (databaseId) {return store.getters["database/databaseById"](databaseId);}-return undefined;}- const stage = temp as ComputedRef<Stage>;- return stage.value.taskList[0].database;+ return selectedStage.value.taskList[0].database;});const instance = computed((): Instance => {- const temp = selectedStage as unknown;- if (create) {+ if (state.create) {// If database is available, then we derive the instance from database because we always fetch database's instance.- // On the other hand, instance for stage.taskList[0].instanceId might not be loaded (e.g. when creating an update schema issue)if (database.value) {return database.value.instance;}- const stage = temp as ComputedRef<StageCreate>;return store.getters["instance/instanceById"](- stage.value.taskList[0].instanceId+ selectedStage.value.taskList[0].instanceId);}- const stage = temp as ComputedRef<Stage>;- return stage.value.taskList[0].instance;+ return selectedStage.value.taskList[0].instance;});const sqlHint = (isRollBack: boolean): string | undefined => {- if (!isRollBack && !create && selectedMigrateType.value == "BASELINE") {+ if (+ !isRollBack &&+ !state.create &&+ selectedMigrateType.value == "BASELINE"+ ) {return `This is a baseline migration and bytebase won't apply the SQL to the database, it will only record a baseline history`;}if (!isRollBack && instance.value.engine === "SNOWFLAKE") {