Commit 2901d7c8 authored by Pedro Moreira da Silva's avatar Pedro Moreira da Silva Committed by pedroms

Migrate merge moment dropdown to GitLab UI

parent ada28f94
<script> <script>
import { isEmpty } from 'lodash'; import { isEmpty } from 'lodash';
import { GlIcon, GlButton, GlSprintf, GlLink } from '@gitlab/ui'; import { GlIcon, GlButton, GlButtonGroup, GlDropdown, GlDropdownItem, GlSprintf, GlLink, GlTooltipDirective } from '@gitlab/ui';
import readyToMergeMixin from 'ee_else_ce/vue_merge_request_widget/mixins/ready_to_merge'; import readyToMergeMixin from 'ee_else_ce/vue_merge_request_widget/mixins/ready_to_merge';
import simplePoll from '~/lib/utils/simple_poll'; import simplePoll from '~/lib/utils/simple_poll';
import { __ } from '~/locale'; import { __ } from '~/locale';
...@@ -36,6 +36,9 @@ export default { ...@@ -36,6 +36,9 @@ export default {
GlSprintf, GlSprintf,
GlLink, GlLink,
GlButton, GlButton,
GlButtonGroup,
GlDropdown,
GlDropdownItem,
MergeTrainHelperText: () => MergeTrainHelperText: () =>
import('ee_component/vue_merge_request_widget/components/merge_train_helper_text.vue'), import('ee_component/vue_merge_request_widget/components/merge_train_helper_text.vue'),
MergeImmediatelyConfirmationDialog: () => MergeImmediatelyConfirmationDialog: () =>
...@@ -43,6 +46,9 @@ export default { ...@@ -43,6 +46,9 @@ export default {
'ee_component/vue_merge_request_widget/components/merge_immediately_confirmation_dialog.vue' 'ee_component/vue_merge_request_widget/components/merge_immediately_confirmation_dialog.vue'
), ),
}, },
directives: {
GlTooltip: GlTooltipDirective,
},
mixins: [readyToMergeMixin], mixins: [readyToMergeMixin],
props: { props: {
mr: { type: Object, required: true }, mr: { type: Object, required: true },
...@@ -283,7 +289,7 @@ export default { ...@@ -283,7 +289,7 @@ export default {
<status-icon :status="iconClass" /> <status-icon :status="iconClass" />
<div class="media-body"> <div class="media-body">
<div class="mr-widget-body-controls media space-children"> <div class="mr-widget-body-controls media space-children">
<span class="btn-group"> <gl-button-group>
<gl-button <gl-button
size="medium" size="medium"
category="primary" category="primary"
...@@ -294,54 +300,34 @@ export default { ...@@ -294,54 +300,34 @@ export default {
@click="handleMergeButtonClick(isAutoMergeAvailable)" @click="handleMergeButtonClick(isAutoMergeAvailable)"
>{{ mergeButtonText }}</gl-button >{{ mergeButtonText }}</gl-button
> >
<button <gl-dropdown
v-if="shouldShowMergeImmediatelyDropdown" v-if="shouldShowMergeImmediatelyDropdown"
v-gl-tooltip.hover.focus="__('Select merge moment')"
:disabled="isMergeButtonDisabled" :disabled="isMergeButtonDisabled"
type="button" variant="info"
class="btn btn-sm btn-info dropdown-toggle js-merge-moment" class="js-merge-moment"
data-toggle="dropdown"
data-qa-selector="merge_moment_dropdown" data-qa-selector="merge_moment_dropdown"
:aria-label="__('Select merge moment')" toggle-class="btn-icon"
>
<i class="fa fa-chevron-down" aria-hidden="true"></i>
</button>
<ul
v-if="shouldShowMergeImmediatelyDropdown"
class="dropdown-menu dropdown-menu-right"
role="menu"
> >
<li> <template #button-content>
<a <gl-icon name="chevron-down" class="mr-0" />
class="auto_merge_enabled qa-merge-when-pipeline-succeeds-option" <span class="sr-only">{{ __('Select merge moment') }}</span>
href="#" </template>
@click.prevent="handleMergeButtonClick(true)" <gl-dropdown-item
> icon-name="warning"
<span class="media"> class="accept-merge-request js-merge-immediately-button"
<gl-icon name="status_success" class="merge-opt-icon" aria-hidden="true" /> data-qa-selector="merge_immediately_option"
<span class="media-body merge-opt-title">{{ autoMergeText }}</span> @click="handleMergeImmediatelyButtonClick"
</span> >
</a> {{ __('Merge immediately') }}
</li> </gl-dropdown-item>
<li> </gl-dropdown>
<merge-immediately-confirmation-dialog </gl-button-group>
ref="confirmationDialog" <merge-immediately-confirmation-dialog
:docs-url="mr.mergeImmediatelyDocsPath" ref="confirmationDialog"
@mergeImmediately="onMergeImmediatelyConfirmation" :docs-url="mr.mergeImmediatelyDocsPath"
/> @mergeImmediately="onMergeImmediatelyConfirmation"
<a />
class="accept-merge-request js-merge-immediately-button"
data-qa-selector="merge_immediately_option"
href="#"
@click.prevent="handleMergeImmediatelyButtonClick"
>
<span class="media">
<gl-icon name="status_warning" class="merge-opt-icon" aria-hidden="true" />
<span class="media-body merge-opt-title">{{ __('Merge immediately') }}</span>
</span>
</a>
</li>
</ul>
</span>
<div class="media-body-wrap space-children"> <div class="media-body-wrap space-children">
<template v-if="shouldShowMergeControls"> <template v-if="shouldShowMergeControls">
<label v-if="mr.canRemoveSourceBranch"> <label v-if="mr.canRemoveSourceBranch">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment