diff options
Diffstat (limited to 'app/assets/javascripts/vue_shared/components/file_row.vue')
-rw-r--r-- | app/assets/javascripts/vue_shared/components/file_row.vue | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/app/assets/javascripts/vue_shared/components/file_row.vue b/app/assets/javascripts/vue_shared/components/file_row.vue index 0952e37e46e..c1c4f437dee 100644 --- a/app/assets/javascripts/vue_shared/components/file_row.vue +++ b/app/assets/javascripts/vue_shared/components/file_row.vue @@ -14,10 +14,20 @@ export default { type: Object, required: true, }, + fileUrl: { + type: String, + required: false, + default: '', + }, level: { type: Number, required: true, }, + fileClasses: { + type: String, + required: false, + default: '', + }, }, computed: { isTree() { @@ -43,6 +53,9 @@ export default { // don't output a title if we don't have the expanded path return this.file?.tree?.length ? this.file.tree[0].parentPath : false; }, + fileRouterUrl() { + return this.fileUrl || `/project${this.file.url}`; + }, }, watch: { 'file.active': function fileActiveWatch(active) { @@ -69,7 +82,7 @@ export default { this.toggleTreeOpen(this.file.path); } - if (this.$router) this.$router.push(`/project${this.file.url}`); + if (this.$router && !this.hasUrlAtCurrentRoute()) this.$router.push(this.fileRouterUrl); if (this.isBlob) this.clickedFile(this.file.path); }, @@ -99,7 +112,7 @@ export default { hasUrlAtCurrentRoute() { if (!this.$router || !this.$router.currentRoute) return true; - return this.$router.currentRoute.path === `/project${escapeFileUrl(this.file.url)}`; + return this.$router.currentRoute.path === escapeFileUrl(this.fileRouterUrl); }, }, }; @@ -123,6 +136,7 @@ export default { :style="levelIndentation" class="file-row-name str-truncated" data-qa-selector="file_name_content" + :class="fileClasses" > <file-icon class="file-row-icon" |