summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ide
diff options
context:
space:
mode:
authorDenys Mishunov <dmishunov@gitlab.com>2019-04-17 22:41:07 +0200
committerDenys Mishunov <dmishunov@gitlab.com>2019-04-17 23:57:29 +0200
commit5e2d50aa18be186112e066c7b856d58979eb9097 (patch)
tree2cee55ad21b9fcc34b78df8f453778a0a0116471 /app/assets/javascripts/ide
parenta6a1afe070ffe4fa66b5ace9d35ca8c6ee481986 (diff)
downloadgitlab-ce-5e2d50aa18be186112e066c7b856d58979eb9097.tar.gz
Passes file type down to ContentViewer
Instead of ContentViewer attempts to compute file type and render appropriate viewer type, compute it on the parent RepoEditor having all file-related information at its disposal and pass it down to ContentViewer as a prop
Diffstat (limited to 'app/assets/javascripts/ide')
-rw-r--r--app/assets/javascripts/ide/components/repo_editor.vue6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/assets/javascripts/ide/components/repo_editor.vue b/app/assets/javascripts/ide/components/repo_editor.vue
index 94a9e87369c..1029fc0f7b5 100644
--- a/app/assets/javascripts/ide/components/repo_editor.vue
+++ b/app/assets/javascripts/ide/components/repo_editor.vue
@@ -1,5 +1,6 @@
<script>
import { mapState, mapGetters, mapActions } from 'vuex';
+import { viewerInformationForPath } from '~/vue_shared/components/content_viewer/lib/viewer_utils';
import flash from '~/flash';
import ContentViewer from '~/vue_shared/components/content_viewer/content_viewer.vue';
import DiffViewer from '~/vue_shared/components/diff_viewer/diff_viewer.vue';
@@ -56,6 +57,10 @@ export default {
active: this.file.viewMode === 'preview',
};
},
+ fileType() {
+ const info = viewerInformationForPath(this.file.path);
+ return (info && info.id) || '';
+ },
},
watch: {
file(newVal, oldVal) {
@@ -258,6 +263,7 @@ export default {
:path="file.rawPath || file.path"
:file-size="file.size"
:project-path="file.projectId"
+ :type="fileType"
/>
<diff-viewer
v-if="showDiffViewer"