diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2019-05-27 08:55:29 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2019-05-27 08:55:29 +0000 |
commit | 665c73e5be03f34ee14bafc12b9e2355963fbe78 (patch) | |
tree | bddafb9df0a7a5920fc4315708a303f16a8b4130 /app | |
parent | 6cc11ff9936f2d019c4960fb096b26833179bf34 (diff) | |
parent | 1b998a4a121053210b3684664f3f7f4667da4431 (diff) | |
download | gitlab-ce-665c73e5be03f34ee14bafc12b9e2355963fbe78.tar.gz |
Merge branch 'parent-row-repo-list' into 'master'
Added parent table row to files table
See merge request gitlab-org/gitlab-ce!28658
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/repository/components/table/index.vue | 6 | ||||
-rw-r--r-- | app/assets/javascripts/repository/components/table/parent_row.vue | 37 |
2 files changed, 43 insertions, 0 deletions
diff --git a/app/assets/javascripts/repository/components/table/index.vue b/app/assets/javascripts/repository/components/table/index.vue index 758f4b88be2..2b0a4644bf6 100644 --- a/app/assets/javascripts/repository/components/table/index.vue +++ b/app/assets/javascripts/repository/components/table/index.vue @@ -7,6 +7,7 @@ import getFiles from '../../queries/getFiles.graphql'; import getProjectPath from '../../queries/getProjectPath.graphql'; import TableHeader from './header.vue'; import TableRow from './row.vue'; +import ParentRow from './parent_row.vue'; const PAGE_SIZE = 100; @@ -15,6 +16,7 @@ export default { GlLoadingIcon, TableHeader, TableRow, + ParentRow, }, mixins: [getRefMixin], apollo: { @@ -47,6 +49,9 @@ export default { { path: this.path, ref: this.ref }, ); }, + showParentRow() { + return !this.isLoadingFiles && this.path !== ''; + }, }, watch: { $route: function routeChange() { @@ -120,6 +125,7 @@ export default { </caption> <table-header v-once /> <tbody> + <parent-row v-show="showParentRow" :commit-ref="ref" :path="path" /> <template v-for="val in entries"> <table-row v-for="entry in val" diff --git a/app/assets/javascripts/repository/components/table/parent_row.vue b/app/assets/javascripts/repository/components/table/parent_row.vue new file mode 100644 index 00000000000..b4433f00d8a --- /dev/null +++ b/app/assets/javascripts/repository/components/table/parent_row.vue @@ -0,0 +1,37 @@ +<script> +export default { + props: { + commitRef: { + type: String, + required: true, + }, + path: { + type: String, + required: true, + }, + }, + computed: { + parentRoute() { + const splitArray = this.path.split('/'); + splitArray.pop(); + + return { path: `/tree/${this.commitRef}/${splitArray.join('/')}` }; + }, + }, + methods: { + clickRow() { + this.$router.push(this.parentRoute); + }, + }, +}; +</script> + +<template> + <tr v-once @click="clickRow"> + <td colspan="3" class="tree-item-file-name"> + <router-link :to="parentRoute" :aria-label="__('Go to parent')"> + .. + </router-link> + </td> + </tr> +</template> |