2020-11-24 15:15:51 +05:30
|
|
|
<script>
|
|
|
|
import { GlAlert, GlButton } from '@gitlab/ui';
|
2021-09-30 23:02:18 +05:30
|
|
|
import { mapState } from 'vuex';
|
2020-11-24 15:15:51 +05:30
|
|
|
|
2022-04-04 11:22:00 +05:30
|
|
|
import { EVT_EXPAND_ALL_FILES } from '../constants';
|
2021-01-29 00:20:46 +05:30
|
|
|
import eventHub from '../event_hub';
|
2020-11-24 15:15:51 +05:30
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
GlAlert,
|
|
|
|
GlButton,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
dismissed: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
isDismissed: this.dismissed,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
2021-09-30 23:02:18 +05:30
|
|
|
...mapState('diffs', ['diffFiles']),
|
|
|
|
shouldDisplay() {
|
|
|
|
return !this.isDismissed && this.diffFiles.length > 1;
|
|
|
|
},
|
2020-11-24 15:15:51 +05:30
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
dismiss() {
|
|
|
|
this.isDismissed = true;
|
|
|
|
this.$emit('dismiss');
|
|
|
|
},
|
|
|
|
expand() {
|
2021-01-29 00:20:46 +05:30
|
|
|
eventHub.$emit(EVT_EXPAND_ALL_FILES);
|
2020-11-24 15:15:51 +05:30
|
|
|
this.dismiss();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2022-04-04 11:22:00 +05:30
|
|
|
<div v-if="shouldDisplay" data-testid="root" class="col-12">
|
2020-11-24 15:15:51 +05:30
|
|
|
<gl-alert
|
|
|
|
:dismissible="true"
|
|
|
|
:title="__('Some changes are not shown')"
|
|
|
|
variant="warning"
|
|
|
|
class="gl-mb-5"
|
|
|
|
@dismiss="dismiss"
|
|
|
|
>
|
|
|
|
<p class="gl-mb-0">
|
|
|
|
{{ __('For a faster browsing experience, some files are collapsed by default.') }}
|
|
|
|
</p>
|
|
|
|
<template #actions>
|
2022-07-23 23:45:48 +05:30
|
|
|
<gl-button class="gl-alert-action" @click="expand">
|
2020-11-24 15:15:51 +05:30
|
|
|
{{ __('Expand all files') }}
|
|
|
|
</gl-button>
|
|
|
|
</template>
|
|
|
|
</gl-alert>
|
|
|
|
</div>
|
|
|
|
</template>
|