debian-mirror-gitlab/app/assets/javascripts/projects/compare/components/app.vue

101 lines
2.3 KiB
Vue
Raw Normal View History

2021-03-11 19:13:27 +05:30
<script>
import { GlButton } from '@gitlab/ui';
import csrf from '~/lib/utils/csrf';
2021-04-17 20:07:23 +05:30
import RevisionCard from './revision_card.vue';
2021-03-11 19:13:27 +05:30
export default {
csrf,
components: {
2021-04-17 20:07:23 +05:30
RevisionCard,
2021-03-11 19:13:27 +05:30
GlButton,
},
props: {
projectCompareIndexPath: {
type: String,
required: true,
},
refsProjectPath: {
type: String,
required: true,
},
paramsFrom: {
type: String,
required: false,
default: null,
},
paramsTo: {
type: String,
required: false,
default: null,
},
projectMergeRequestPath: {
type: String,
required: true,
},
createMrPath: {
type: String,
required: true,
},
},
methods: {
onSubmit() {
this.$refs.form.submit();
},
},
};
</script>
<template>
<form
ref="form"
2021-04-17 20:07:23 +05:30
class="js-requires-input js-signature-container"
2021-03-11 19:13:27 +05:30
method="POST"
:action="projectCompareIndexPath"
>
<input :value="$options.csrf.token" type="hidden" name="authenticity_token" />
2021-04-17 20:07:23 +05:30
<div
class="gl-lg-flex-direction-row gl-lg-display-flex gl-align-items-center compare-revision-cards"
2021-03-11 19:13:27 +05:30
>
2021-04-17 20:07:23 +05:30
<revision-card
:refs-project-path="refsProjectPath"
revision-text="Source"
params-name="to"
:params-branch="paramsTo"
/>
<div
class="compare-ellipsis gl-display-flex gl-justify-content-center gl-align-items-center gl-my-4 gl-md-my-0"
data-testid="ellipsis"
>
...
</div>
<revision-card
:refs-project-path="refsProjectPath"
revision-text="Target"
params-name="from"
:params-branch="paramsFrom"
/>
</div>
<div class="gl-mt-4">
<gl-button category="primary" variant="success" @click="onSubmit">
{{ s__('CompareRevisions|Compare') }}
</gl-button>
<gl-button
v-if="projectMergeRequestPath"
:href="projectMergeRequestPath"
data-testid="projectMrButton"
class="btn btn-default gl-button"
>
{{ s__('CompareRevisions|View open merge request') }}
</gl-button>
<gl-button
v-else-if="createMrPath"
:href="createMrPath"
data-testid="createMrButton"
class="btn btn-default gl-button"
>
{{ s__('CompareRevisions|Create merge request') }}
</gl-button>
</div>
2021-03-11 19:13:27 +05:30
</form>
</template>