debian-mirror-gitlab/app/assets/javascripts/repository/components/table/index.vue

118 lines
3 KiB
Vue
Raw Normal View History

2019-09-04 21:01:54 +05:30
<script>
2019-12-26 22:10:19 +05:30
import { GlSkeletonLoading } from '@gitlab/ui';
2019-09-04 21:01:54 +05:30
import { sprintf, __ } from '../../../locale';
import getRefMixin from '../../mixins/get_ref';
2020-10-24 23:57:45 +05:30
import projectPathQuery from '../../queries/project_path.query.graphql';
2019-09-04 21:01:54 +05:30
import TableHeader from './header.vue';
import TableRow from './row.vue';
import ParentRow from './parent_row.vue';
export default {
components: {
2019-12-26 22:10:19 +05:30
GlSkeletonLoading,
2019-09-04 21:01:54 +05:30
TableHeader,
TableRow,
ParentRow,
},
mixins: [getRefMixin],
apollo: {
projectPath: {
2020-10-24 23:57:45 +05:30
query: projectPathQuery,
2019-09-04 21:01:54 +05:30
},
},
props: {
path: {
type: String,
required: true,
},
2019-12-26 22:10:19 +05:30
entries: {
type: Object,
required: false,
default: () => ({}),
},
isLoading: {
type: Boolean,
required: true,
},
2020-03-13 15:44:24 +05:30
loadingPath: {
type: String,
required: false,
default: '',
},
2019-09-04 21:01:54 +05:30
},
data() {
return {
projectPath: '',
};
},
computed: {
tableCaption() {
2019-12-26 22:10:19 +05:30
if (this.isLoading) {
return sprintf(
__(
'Loading files, directories, and submodules in the path %{path} for commit reference %{ref}',
),
{ path: this.path, ref: this.ref },
);
}
2019-09-04 21:01:54 +05:30
return sprintf(
__('Files, directories, and submodules in the path %{path} for commit reference %{ref}'),
{ path: this.path, ref: this.ref },
);
},
showParentRow() {
2019-12-26 22:10:19 +05:30
return !this.isLoading && ['', '/'].indexOf(this.path) === -1;
2019-09-04 21:01:54 +05:30
},
},
};
</script>
<template>
<div class="tree-content-holder">
<div class="table-holder bordered-box">
2020-03-13 15:44:24 +05:30
<table
:aria-label="tableCaption"
class="table tree-table"
aria-live="polite"
data-qa-selector="file_tree_table"
>
2019-09-04 21:01:54 +05:30
<table-header v-once />
<tbody>
2020-03-13 15:44:24 +05:30
<parent-row
2020-07-28 23:09:34 +05:30
v-if="showParentRow"
2020-05-05 14:28:15 +05:30
:commit-ref="escapedRef"
2020-03-13 15:44:24 +05:30
:path="path"
:loading-path="loadingPath"
/>
2019-09-04 21:01:54 +05:30
<template v-for="val in entries">
<table-row
v-for="entry in val"
:id="entry.id"
:key="`${entry.flatPath}-${entry.id}`"
2019-12-26 22:10:19 +05:30
:sha="entry.sha"
2019-09-30 21:07:59 +05:30
:project-path="projectPath"
2019-09-04 21:01:54 +05:30
:current-path="path"
2019-09-30 21:07:59 +05:30
:name="entry.name"
2019-09-04 21:01:54 +05:30
:path="entry.flatPath"
:type="entry.type"
2020-10-24 23:57:45 +05:30
:url="entry.webUrl || entry.webPath"
2020-07-28 23:09:34 +05:30
:mode="entry.mode"
2019-09-30 21:07:59 +05:30
:submodule-tree-url="entry.treeUrl"
2019-09-04 21:01:54 +05:30
:lfs-oid="entry.lfsOid"
2020-03-13 15:44:24 +05:30
:loading-path="loadingPath"
2019-09-04 21:01:54 +05:30
/>
</template>
2019-12-26 22:10:19 +05:30
<template v-if="isLoading">
<tr v-for="i in 5" :key="i" aria-hidden="true">
<td><gl-skeleton-loading :lines="1" class="h-auto" /></td>
<td><gl-skeleton-loading :lines="1" class="h-auto" /></td>
<td><gl-skeleton-loading :lines="1" class="ml-auto h-auto w-50" /></td>
</tr>
</template>
2019-09-04 21:01:54 +05:30
</tbody>
</table>
</div>
</div>
</template>