Commit 1b998a4a authored by Phil Hughes's avatar Phil Hughes

Added parent row link to files table

parent c0ea4164
...@@ -7,6 +7,7 @@ import getFiles from '../../queries/getFiles.graphql'; ...@@ -7,6 +7,7 @@ import getFiles from '../../queries/getFiles.graphql';
import getProjectPath from '../../queries/getProjectPath.graphql'; import getProjectPath from '../../queries/getProjectPath.graphql';
import TableHeader from './header.vue'; import TableHeader from './header.vue';
import TableRow from './row.vue'; import TableRow from './row.vue';
import ParentRow from './parent_row.vue';
const PAGE_SIZE = 100; const PAGE_SIZE = 100;
...@@ -15,6 +16,7 @@ export default { ...@@ -15,6 +16,7 @@ export default {
GlLoadingIcon, GlLoadingIcon,
TableHeader, TableHeader,
TableRow, TableRow,
ParentRow,
}, },
mixins: [getRefMixin], mixins: [getRefMixin],
apollo: { apollo: {
...@@ -47,6 +49,9 @@ export default { ...@@ -47,6 +49,9 @@ export default {
{ path: this.path, ref: this.ref }, { path: this.path, ref: this.ref },
); );
}, },
showParentRow() {
return !this.isLoadingFiles && this.path !== '';
},
}, },
watch: { watch: {
$route: function routeChange() { $route: function routeChange() {
...@@ -120,6 +125,7 @@ export default { ...@@ -120,6 +125,7 @@ export default {
</caption> </caption>
<table-header v-once /> <table-header v-once />
<tbody> <tbody>
<parent-row v-show="showParentRow" :commit-ref="ref" :path="path" />
<template v-for="val in entries"> <template v-for="val in entries">
<table-row <table-row
v-for="entry in val" v-for="entry in val"
......
<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>
...@@ -4647,6 +4647,9 @@ msgstr "" ...@@ -4647,6 +4647,9 @@ msgstr ""
msgid "Go to %{link_to_google_takeout}." msgid "Go to %{link_to_google_takeout}."
msgstr "" msgstr ""
msgid "Go to parent"
msgstr ""
msgid "Go to project" msgid "Go to project"
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment