2020-03-13 15:44:24 +05:30
|
|
|
<script>
|
|
|
|
import DefaultActions from './blob_header_default_actions.vue';
|
|
|
|
import BlobFilepath from './blob_header_filepath.vue';
|
2021-03-11 19:13:27 +05:30
|
|
|
import ViewerSwitcher from './blob_header_viewer_switcher.vue';
|
2020-03-13 15:44:24 +05:30
|
|
|
import { SIMPLE_BLOB_VIEWER } from './constants';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
ViewerSwitcher,
|
|
|
|
DefaultActions,
|
|
|
|
BlobFilepath,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
blob: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
hideDefaultActions: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
hideViewerSwitcher: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
activeViewerType: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: SIMPLE_BLOB_VIEWER,
|
|
|
|
},
|
2020-06-23 00:09:42 +05:30
|
|
|
hasRenderError: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
|
|
|
},
|
2020-03-13 15:44:24 +05:30
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
viewer: this.hideViewerSwitcher ? null : this.activeViewerType,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
showViewerSwitcher() {
|
|
|
|
return !this.hideViewerSwitcher && Boolean(this.blob.simpleViewer && this.blob.richViewer);
|
|
|
|
},
|
|
|
|
showDefaultActions() {
|
|
|
|
return !this.hideDefaultActions;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
viewer(newVal, oldVal) {
|
|
|
|
if (!this.hideViewerSwitcher && newVal !== oldVal) {
|
|
|
|
this.$emit('viewer-changed', newVal);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
proxyCopyRequest() {
|
|
|
|
this.$emit('copy');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<template>
|
|
|
|
<div class="js-file-title file-title-flex-parent">
|
|
|
|
<blob-filepath :blob="blob">
|
2021-01-29 00:20:46 +05:30
|
|
|
<template #filepath-prepend>
|
2020-03-13 15:44:24 +05:30
|
|
|
<slot name="prepend"></slot>
|
|
|
|
</template>
|
|
|
|
</blob-filepath>
|
|
|
|
|
2021-03-11 19:13:27 +05:30
|
|
|
<div class="gl-display-none gl-sm-display-flex">
|
2020-03-13 15:44:24 +05:30
|
|
|
<viewer-switcher v-if="showViewerSwitcher" v-model="viewer" />
|
|
|
|
|
|
|
|
<slot name="actions"></slot>
|
|
|
|
|
|
|
|
<default-actions
|
|
|
|
v-if="showDefaultActions"
|
|
|
|
:raw-path="blob.rawPath"
|
|
|
|
:active-viewer="viewer"
|
2020-06-23 00:09:42 +05:30
|
|
|
:has-render-error="hasRenderError"
|
2020-03-13 15:44:24 +05:30
|
|
|
@copy="proxyCopyRequest"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|