Commit 4d28ac48 authored by Phil Hughes's avatar Phil Hughes

UX improvements to Vue file listing refactor

Improves the loading state of the table
Fixes some tooltip placements
parent 91e1e5cb
...@@ -128,7 +128,7 @@ export default { ...@@ -128,7 +128,7 @@ export default {
<div class="ci-status-link"> <div class="ci-status-link">
<gl-link <gl-link
v-if="commit.latestPipeline" v-if="commit.latestPipeline"
v-gl-tooltip v-gl-tooltip.left
:href="commit.latestPipeline.detailedStatus.detailsPath" :href="commit.latestPipeline.detailedStatus.detailsPath"
:title="statusTitle" :title="statusTitle"
class="js-commit-pipeline" class="js-commit-pipeline"
......
<script> <script>
import { GlLoadingIcon } from '@gitlab/ui'; import { GlSkeletonLoading } from '@gitlab/ui';
import createFlash from '~/flash'; import createFlash from '~/flash';
import { sprintf, __ } from '../../../locale'; import { sprintf, __ } from '../../../locale';
import getRefMixin from '../../mixins/get_ref'; import getRefMixin from '../../mixins/get_ref';
...@@ -13,7 +13,7 @@ const PAGE_SIZE = 100; ...@@ -13,7 +13,7 @@ const PAGE_SIZE = 100;
export default { export default {
components: { components: {
GlLoadingIcon, GlSkeletonLoading,
TableHeader, TableHeader,
TableRow, TableRow,
ParentRow, ParentRow,
...@@ -44,6 +44,15 @@ export default { ...@@ -44,6 +44,15 @@ export default {
}, },
computed: { computed: {
tableCaption() { tableCaption() {
if (this.isLoadingFiles) {
return sprintf(
__(
'Loading files, directories, and submodules in the path %{path} for commit reference %{ref}',
),
{ path: this.path, ref: this.ref },
);
}
return sprintf( return sprintf(
__('Files, directories, and submodules in the path %{path} for commit reference %{ref}'), __('Files, directories, and submodules in the path %{path} for commit reference %{ref}'),
{ path: this.path, ref: this.ref }, { path: this.path, ref: this.ref },
...@@ -117,12 +126,7 @@ export default { ...@@ -117,12 +126,7 @@ export default {
<template> <template>
<div class="tree-content-holder"> <div class="tree-content-holder">
<div class="table-holder bordered-box"> <div class="table-holder bordered-box">
<table class="table tree-table qa-file-tree" aria-live="polite"> <table :aria-label="tableCaption" class="table tree-table qa-file-tree" aria-live="polite">
<caption class="sr-only">
{{
tableCaption
}}
</caption>
<table-header v-once /> <table-header v-once />
<tbody> <tbody>
<parent-row v-show="showParentRow" :commit-ref="ref" :path="path" /> <parent-row v-show="showParentRow" :commit-ref="ref" :path="path" />
...@@ -141,9 +145,15 @@ export default { ...@@ -141,9 +145,15 @@ export default {
:lfs-oid="entry.lfsOid" :lfs-oid="entry.lfsOid"
/> />
</template> </template>
<template v-if="isLoadingFiles">
<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>
</tbody> </tbody>
</table> </table>
<gl-loading-icon v-show="isLoadingFiles" class="my-3" size="md" />
</div> </div>
</div> </div>
</template> </template>
...@@ -124,13 +124,18 @@ export default { ...@@ -124,13 +124,18 @@ export default {
</template> </template>
</td> </td>
<td class="d-none d-sm-table-cell tree-commit"> <td class="d-none d-sm-table-cell tree-commit">
<gl-link v-if="commit" :href="commit.commitPath" class="str-truncated-100 tree-commit-link"> <gl-link
v-if="commit"
:href="commit.commitPath"
:title="commit.message"
class="str-truncated-100 tree-commit-link"
>
{{ commit.message }} {{ commit.message }}
</gl-link> </gl-link>
<gl-skeleton-loading v-else :lines="1" class="h-auto" /> <gl-skeleton-loading v-else :lines="1" class="h-auto" />
</td> </td>
<td class="tree-time-ago text-right"> <td class="tree-time-ago text-right">
<timeago-tooltip v-if="commit" :time="commit.committedDate" tooltip-placement="bottom" /> <timeago-tooltip v-if="commit" :time="commit.committedDate" />
<gl-skeleton-loading v-else :lines="1" class="ml-auto h-auto w-50" /> <gl-skeleton-loading v-else :lines="1" class="ml-auto h-auto w-50" />
</td> </td>
</tr> </tr>
......
...@@ -32,7 +32,7 @@ export default { ...@@ -32,7 +32,7 @@ export default {
</script> </script>
<template> <template>
<time <time
v-gl-tooltip="{ placement: tooltipPlacement }" v-gl-tooltip.viewport="{ placement: tooltipPlacement }"
:class="cssClass" :class="cssClass"
:title="tooltipTitle(time)" :title="tooltipTitle(time)"
v-text="timeFormated(time)" v-text="timeFormated(time)"
......
...@@ -9954,6 +9954,9 @@ msgstr "" ...@@ -9954,6 +9954,9 @@ msgstr ""
msgid "Loading contribution stats for group members" msgid "Loading contribution stats for group members"
msgstr "" msgstr ""
msgid "Loading files, directories, and submodules in the path %{path} for commit reference %{ref}"
msgstr ""
msgid "Loading functions timed out. Please reload the page to try again." msgid "Loading functions timed out. Please reload the page to try again."
msgstr "" msgstr ""
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { GlLoadingIcon } from '@gitlab/ui'; import { GlSkeletonLoading } from '@gitlab/ui';
import Table from '~/repository/components/table/index.vue'; import Table from '~/repository/components/table/index.vue';
let vm; let vm;
...@@ -35,7 +35,7 @@ describe('Repository table component', () => { ...@@ -35,7 +35,7 @@ describe('Repository table component', () => {
vm.setData({ ref }); vm.setData({ ref });
expect(vm.find('caption').text()).toEqual( expect(vm.find('.table').attributes('aria-label')).toEqual(
`Files, directories, and submodules in the path ${path} for commit reference ${ref}`, `Files, directories, and submodules in the path ${path} for commit reference ${ref}`,
); );
}); });
...@@ -45,7 +45,7 @@ describe('Repository table component', () => { ...@@ -45,7 +45,7 @@ describe('Repository table component', () => {
vm.setData({ isLoadingFiles: true }); vm.setData({ isLoadingFiles: true });
expect(vm.find(GlLoadingIcon).isVisible()).toBe(true); expect(vm.find(GlSkeletonLoading).exists()).toBe(true);
}); });
describe('normalizeData', () => { describe('normalizeData', () => {
......
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