mirror of
https://github.com/go-gitea/gitea.git
synced 2024-09-01 14:56:30 +00:00
Adjust automerge buttons to reduce the steps and also fix cannot do automerge if there is only one mergestyle
This commit is contained in:
parent
5fd3b098a3
commit
a920bbc205
@ -22,6 +22,7 @@ export default {
|
|||||||
mergeTitleFieldText: '',
|
mergeTitleFieldText: '',
|
||||||
mergeMessageFieldText: '',
|
mergeMessageFieldText: '',
|
||||||
hideAutoMerge: false,
|
hideAutoMerge: false,
|
||||||
|
name: '',
|
||||||
},
|
},
|
||||||
mergeStyleAllowedCount: 0,
|
mergeStyleAllowedCount: 0,
|
||||||
|
|
||||||
@ -69,6 +70,10 @@ export default {
|
|||||||
this.mergeTitleFieldValue = this.mergeStyleDetail.mergeTitleFieldText;
|
this.mergeTitleFieldValue = this.mergeStyleDetail.mergeTitleFieldText;
|
||||||
this.mergeMessageFieldValue = this.mergeStyleDetail.mergeMessageFieldText;
|
this.mergeMessageFieldValue = this.mergeStyleDetail.mergeMessageFieldText;
|
||||||
},
|
},
|
||||||
|
switchToActionform(mergeStyle, autoMerge) {
|
||||||
|
this.switchMergeStyle(mergeStyle, autoMerge);
|
||||||
|
this.toggleActionForm(true);
|
||||||
|
},
|
||||||
switchMergeStyle(name, autoMerge = false) {
|
switchMergeStyle(name, autoMerge = false) {
|
||||||
this.mergeStyle = name;
|
this.mergeStyle = name;
|
||||||
this.autoMergeWhenSucceed = autoMerge;
|
this.autoMergeWhenSucceed = autoMerge;
|
||||||
@ -138,26 +143,30 @@ export default {
|
|||||||
|
|
||||||
<div v-if="!showActionForm" class="tw-flex">
|
<div v-if="!showActionForm" class="tw-flex">
|
||||||
<!-- the merge button -->
|
<!-- the merge button -->
|
||||||
<div class="ui buttons merge-button" :class="[mergeForm.emptyCommit ? '' : mergeForm.allOverridableChecksOk ? 'primary' : 'red']" @click="toggleActionForm(true)">
|
<div class="ui buttons merge-button" v-if="!mergeForm.hasPendingPullRequestMerge" :class="[mergeForm.emptyCommit ? '' : mergeForm.allOverridableChecksOk ? 'primary' : 'red']" @click="switchToActionform(mergeStyleDetail.name,false)">
|
||||||
<button class="ui button">
|
<button class="ui button">
|
||||||
<svg-icon name="octicon-git-merge"/>
|
<svg-icon name="octicon-git-merge"/>
|
||||||
<span class="button-text">
|
<span class="button-text">
|
||||||
{{ mergeStyleDetail.textDoMerge }}
|
{{ mergeStyleDetail.textDoMerge }}
|
||||||
<template v-if="autoMergeWhenSucceed">
|
|
||||||
{{ mergeForm.textAutoMergeButtonWhenSucceed }}
|
|
||||||
</template>
|
|
||||||
</span>
|
</span>
|
||||||
|
<div v-if="mergeStyleAllowedCount==1 && !mergeStyleDetail.hideAutoMerge" class="auto-merge-small" @click.stop="switchToActionform(mergeStyleDetail.name, true)">
|
||||||
|
<svg-icon name="octicon-clock" :size="14"/>
|
||||||
|
<div class="auto-merge-tip">
|
||||||
|
{{ mergeForm.textAutoMergeWhenSucceed }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div class="ui dropdown icon button" @click.stop="showMergeStyleMenu = !showMergeStyleMenu" v-if="mergeStyleAllowedCount>1">
|
<div class="ui dropdown icon button" @click.stop="showMergeStyleMenu = !showMergeStyleMenu" v-if="mergeStyleAllowedCount>1">
|
||||||
<svg-icon name="octicon-triangle-down" :size="14"/>
|
<svg-icon name="octicon-triangle-down" :size="14"/>
|
||||||
<div class="menu" :class="{'show':showMergeStyleMenu}">
|
<div class="menu" :class="{'show':showMergeStyleMenu}">
|
||||||
<template v-for="msd in mergeForm.mergeStyles">
|
<template v-for="msd in mergeForm.mergeStyles">
|
||||||
<!-- if can merge now, show one action "merge now", and an action "auto merge when succeed" -->
|
<!-- if can merge now, show one action "merge now", and an action "auto merge when succeed" -->
|
||||||
<div class="item" v-if="msd.allowed && mergeForm.canMergeNow" :key="msd.name" @click.stop="switchMergeStyle(msd.name)">
|
<div class="item" v-if="msd.allowed && mergeForm.canMergeNow" :key="msd.name" @click.stop="switchToActionform(msd.name, false)">
|
||||||
<div class="action-text">
|
<div class="action-text">
|
||||||
{{ msd.textDoMerge }}
|
{{ msd.textDoMerge }}
|
||||||
</div>
|
</div>
|
||||||
<div v-if="!msd.hideAutoMerge" class="auto-merge-small" @click.stop="switchMergeStyle(msd.name, true)">
|
<div v-if="!msd.hideAutoMerge" class="auto-merge-small" @click.stop="switchToActionform(msd.name, true)">
|
||||||
<svg-icon name="octicon-clock" :size="14"/>
|
<svg-icon name="octicon-clock" :size="14"/>
|
||||||
<div class="auto-merge-tip">
|
<div class="auto-merge-tip">
|
||||||
{{ mergeForm.textAutoMergeWhenSucceed }}
|
{{ mergeForm.textAutoMergeWhenSucceed }}
|
||||||
@ -166,7 +175,7 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- if can NOT merge now, only show one action "auto merge when succeed" -->
|
<!-- if can NOT merge now, only show one action "auto merge when succeed" -->
|
||||||
<div class="item" v-if="msd.allowed && !mergeForm.canMergeNow && !msd.hideAutoMerge" :key="msd.name" @click.stop="switchMergeStyle(msd.name, true)">
|
<div class="item" v-if="msd.allowed && !mergeForm.canMergeNow && !msd.hideAutoMerge" :key="msd.name" @click.stop="switchToActionform(msd.name, true)">
|
||||||
<div class="action-text">
|
<div class="action-text">
|
||||||
{{ msd.textDoMerge }} {{ mergeForm.textAutoMergeButtonWhenSucceed }}
|
{{ msd.textDoMerge }} {{ mergeForm.textAutoMergeButtonWhenSucceed }}
|
||||||
</div>
|
</div>
|
||||||
@ -177,7 +186,7 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- the cancel auto merge button -->
|
<!-- the cancel auto merge button -->
|
||||||
<form v-if="mergeForm.hasPendingPullRequestMerge" :action="mergeForm.baseLink+'/cancel_auto_merge'" method="post" class="tw-ml-4">
|
<form v-if="mergeForm.hasPendingPullRequestMerge" :action="mergeForm.baseLink+'/cancel_auto_merge'" method="post" class="tw-ml-0">
|
||||||
<input type="hidden" name="_csrf" :value="csrfToken">
|
<input type="hidden" name="_csrf" :value="csrfToken">
|
||||||
<button class="ui button">
|
<button class="ui button">
|
||||||
{{ mergeForm.textAutoMergeCancelSchedule }}
|
{{ mergeForm.textAutoMergeCancelSchedule }}
|
||||||
@ -243,10 +252,12 @@ export default {
|
|||||||
color: var(--color-info-text);
|
color: var(--color-info-text);
|
||||||
background-color: var(--color-info-bg);
|
background-color: var(--color-info-bg);
|
||||||
border: 1px solid var(--color-info-border);
|
border: 1px solid var(--color-info-border);
|
||||||
|
border-radius: 0.5em 0 0 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.auto-merge-small:hover .auto-merge-tip {
|
.auto-merge-small:hover .auto-merge-tip {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
border-radius: 0 0.5em 0.5em 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user