debian-mirror-gitlab/app/assets/javascripts/diffs/components/no_changes.vue

72 lines
2 KiB
Vue
Raw Normal View History

2018-11-08 19:23:39 +05:30
<script>
2020-11-24 15:15:51 +05:30
import { GlButton, GlSprintf } from '@gitlab/ui';
2021-03-11 19:13:27 +05:30
import { mapGetters } from 'vuex';
2018-11-08 19:23:39 +05:30
export default {
2019-02-15 15:39:39 +05:30
components: {
2020-07-28 23:09:34 +05:30
GlButton,
2020-11-24 15:15:51 +05:30
GlSprintf,
2019-02-15 15:39:39 +05:30
},
props: {
changesEmptyStateIllustration: {
type: String,
required: true,
},
2018-11-08 19:23:39 +05:30
},
computed: {
2021-03-08 18:12:59 +05:30
...mapGetters('diffs', [
'diffCompareDropdownTargetVersions',
'diffCompareDropdownSourceVersions',
]),
2019-02-15 15:39:39 +05:30
...mapGetters(['getNoteableData']),
2021-03-08 18:12:59 +05:30
selectedSourceVersion() {
return this.diffCompareDropdownSourceVersions.find((x) => x.selected);
},
sourceName() {
if (!this.selectedSourceVersion || this.selectedSourceVersion.isLatestVersion) {
return this.getNoteableData.source_branch;
}
return this.selectedSourceVersion.versionName;
},
selectedTargetVersion() {
return this.diffCompareDropdownTargetVersions.find((x) => x.selected);
},
targetName() {
if (!this.selectedTargetVersion || this.selectedTargetVersion.version_index < 0) {
return this.getNoteableData.target_branch;
}
return this.selectedTargetVersion.versionName || '';
},
2018-11-08 19:23:39 +05:30
},
};
</script>
<template>
2019-02-15 15:39:39 +05:30
<div class="row empty-state">
<div class="col-12">
<div class="svg-content svg-250"><img :src="changesEmptyStateIllustration" /></div>
2018-11-08 19:23:39 +05:30
</div>
2019-02-15 15:39:39 +05:30
<div class="col-12">
2018-11-08 19:23:39 +05:30
<div class="text-content text-center">
2021-03-08 18:12:59 +05:30
<div data-testid="no-changes-message">
<gl-sprintf :message="__('No changes between %{source} and %{target}')">
<template #source>
<span class="ref-name">{{ sourceName }}</span>
</template>
<template #target>
<span class="ref-name">{{ targetName }}</span>
</template>
</gl-sprintf>
</div>
2018-11-08 19:23:39 +05:30
<div class="text-center">
2020-07-28 23:09:34 +05:30
<gl-button :href="getNoteableData.new_blob_path" variant="success" category="primary">{{
2019-02-15 15:39:39 +05:30
__('Create commit')
2020-07-28 23:09:34 +05:30
}}</gl-button>
2018-11-08 19:23:39 +05:30
</div>
</div>
</div>
</div>
</template>