Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Add "Apply SQL to other stages" button when creating issue for multiple stage pipeline
天舟f0dcb970b9c8
diff --git a/frontend/src/assets/css/tailwind.css b/frontend/src/assets/css/tailwind.cssindex a6c3271a49..08fbe15aba 100644--- a/frontend/src/assets/css/tailwind.css+++ b/frontend/src/assets/css/tailwind.css@@ -73,6 +73,10 @@@apply select-none inline-flex items-center text-main hover:text-control-hover 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;}+.btn-small {+ @apply select-none inline-flex border border-control-border rounded-md text-control bg-white hover:bg-control-bg-hover disabled:bg-control-bg disabled:opacity-50 disabled:cursor-not-allowed px-2 text-xs leading-5 focus:ring-control focus:outline-none focus-visible:ring-2 focus:ring-offset-2;+}+.btn-select {@apply text-sm select-none text-main bg-white border border-control-border disabled:bg-control-bg disabled:opacity-50 disabled:cursor-not-allowed rounded-md shadow-sm text-left cursor-default focus:outline-none focus:ring-1 focus:ring-control focus:border-control;}diff --git a/frontend/src/components/IssueTaskStatementPanel.vue b/frontend/src/components/IssueTaskStatementPanel.vueindex 0864e7eaa0..0fd456caa4 100644--- a/frontend/src/components/IssueTaskStatementPanel.vue+++ b/frontend/src/components/IssueTaskStatementPanel.vue@@ -1,5 +1,5 @@<template>- <div class="flex justify-between">+ <div class="flex items-center space-x-4"><divclass="text-sm font-medium":class="isEmpty(state.editStatement) ? 'text-red-600' : 'text-control'"@@ -7,6 +7,17 @@{{ rollback ? "Rollback SQL" : "SQL" }}<span v-if="create && !rollback" class="text-red-600">*</span></div>+ <button+ v-if="showApplyStatement"+ :disabled="isEmpty(state.editStatement)"+ type="button"+ class="btn-small"+ @click.prevent="+ $emit('apply-statement-to-other-stages', state.editStatement)+ "+ >+ Apply to other stages+ </button></div><label class="sr-only">SQL statement</label><template v-if="state.editing">@@ -67,7 +78,7 @@ interface LocalState {export default {name: "IssueTaskStatementPanel",- emits: ["update-statement"],+ emits: ["update-statement", "apply-statement-to-other-stages"],props: {statement: {required: true,@@ -81,6 +92,10 @@ export default {required: true,type: Boolean,},+ showApplyStatement: {+ required: true,+ type: Boolean,+ },},components: {},setup(props, { emit }) {diff --git a/frontend/src/views/IssueDetail.vue b/frontend/src/views/IssueDetail.vueindex 5af511631a..725f070430 100644--- a/frontend/src/views/IssueDetail.vue+++ b/frontend/src/views/IssueDetail.vue@@ -155,7 +155,9 @@:statement="selectedStatement":create="state.create":rollback="false"+ :showApplyStatement="showIssueTaskStatementApply"@update-statement="updateStatement"+ @apply-statement-to-other-stages="applyStatementToOtherStages"/></template><template@@ -168,6 +170,7 @@:statement="statement(stage)":create="state.create":rollback="false"+ :showApplyStatement="showIssueTaskStatementApply"@update-statement="updateStatement"/></template>@@ -182,7 +185,11 @@:statement="selectedRollbackStatement":create="state.create":rollback="true"+ :showApplyStatement="showIssueTaskStatementApply"@update-statement="updateRollbackStatement"+ @apply-statement-to-other-stages="+ applyRollbackStatementToOtherStages+ "/></template><template@@ -194,6 +201,7 @@:statement="rollbackStatment(stage)":create="state.create":rollback="true"+ :showApplyStatement="showIssueTaskStatementApply"@update-statement="updateRollbackStatement"/></template>@@ -514,11 +522,35 @@ export default {stage.taskList[0].statement = newStatement;};+ const applyStatementToOtherStages = (newStatement: string) => {+ for (const stage of (issue.value as IssueCreate).pipeline.stageList) {+ for (const task of stage.taskList) {+ if (+ task.type == "bb.task.general" ||+ task.type == "bb.task.database.create" ||+ task.type == "bb.task.database.schema.update"+ ) {+ task.statement = newStatement;+ }+ }+ }+ };+const updateRollbackStatement = (newStatement: string) => {const stage = selectedStage.value as StageCreate;stage.taskList[0].rollbackStatement = newStatement;};+ const applyRollbackStatementToOtherStages = (newStatement: string) => {+ for (const stage of (issue.value as IssueCreate).pipeline.stageList) {+ for (const task of stage.taskList) {+ if (task.type == "bb.task.database.schema.update") {+ task.rollbackStatement = newStatement;+ }+ }+ }+ };+const updateDescription = (newDescription: string,postUpdated: (updatedIssue: Issue) => void@@ -808,13 +840,34 @@ export default {// return task.type == "bb.task.database.schema.update";});+ const showIssueTaskStatementApply = computed(() => {+ if (!state.create) {+ return false;+ }+ let count = 0;+ for (const stage of (issue.value as IssueCreate).pipeline.stageList) {+ for (const task of stage.taskList) {+ if (+ task.type == "bb.task.general" ||+ task.type == "bb.task.database.create" ||+ task.type == "bb.task.database.schema.update"+ ) {+ count++;+ }+ }+ }+ return count > 1;+ });+return {state,issue,updateName,updateDescription,updateStatement,+ applyStatementToOtherStages,updateRollbackStatement,+ applyRollbackStatementToOtherStages,updateAssigneeId,addSubscriberId,removeSubscriberId,@@ -842,6 +895,7 @@ export default {showIssueOutputPanel,showIssueTaskStatementPanel,showIssueTaskRollbackStatementPanel,+ showIssueTaskStatementApply,};},};