Commit a7e2d31e authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'ph/vueFileListLockIcon' into 'master'

Render folder lock icon in table rows

See merge request gitlab-org/gitlab!19776
parents 5747d40e 1983602e
<script>
import { GlBadge, GlLink, GlSkeletonLoading } from '@gitlab/ui';
import { GlBadge, GlLink, GlSkeletonLoading, GlTooltipDirective } from '@gitlab/ui';
import { visitUrl } from '~/lib/utils/url_utility';
import TimeagoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import Icon from '~/vue_shared/components/icon.vue';
import { getIconName } from '../../utils/icon';
import getRefMixin from '../../mixins/get_ref';
import getCommit from '../../queries/getCommit.query.graphql';
......@@ -12,6 +13,10 @@ export default {
GlLink,
GlSkeletonLoading,
TimeagoTooltip,
Icon,
},
directives: {
GlTooltip: GlTooltipDirective,
},
apollo: {
commit: {
......@@ -95,6 +100,9 @@ export default {
shortSha() {
return this.id.slice(0, 8);
},
hasLockLabel() {
return this.commit && this.commit.lockLabel;
},
},
methods: {
openRow(e) {
......@@ -122,6 +130,14 @@ export default {
<template v-if="isSubmodule">
@ <gl-link :href="submoduleTreeUrl" class="commit-sha">{{ shortSha }}</gl-link>
</template>
<icon
v-if="hasLockLabel"
v-gl-tooltip
:title="commit.lockLabel"
name="lock"
:size="12"
class="ml-2 vertical-align-middle"
/>
</td>
<td class="d-none d-sm-table-cell tree-commit">
<gl-link
......
......@@ -14,6 +14,7 @@ export function normalizeData(data) {
commitPath: d.commit_path,
fileName: d.file_name,
type: d.type,
lockLabel: d.lock_label,
__typename: 'LogTreeCommit',
}));
}
......
......@@ -6,5 +6,6 @@ query getCommit($fileName: String!, $type: String!, $path: String!) {
commitPath
fileName
type
lockLabel
}
}
......@@ -6,5 +6,6 @@ query getCommits {
commitPath
fileName
type
lockLabel
}
}
......@@ -25,6 +25,8 @@ exports[`Repository table row component renders table row 1`] = `
<!---->
<!---->
<!---->
</td>
<td
......
......@@ -2,6 +2,7 @@ import { shallowMount, RouterLinkStub } from '@vue/test-utils';
import { GlBadge, GlLink } from '@gitlab/ui';
import { visitUrl } from '~/lib/utils/url_utility';
import TableRow from '~/repository/components/table/row.vue';
import Icon from '~/vue_shared/components/icon.vue';
jest.mock('~/lib/utils/url_utility');
......@@ -156,4 +157,17 @@ describe('Repository table row component', () => {
expect(vm.find('a').attributes('href')).toEqual('https://test.com');
expect(vm.find(GlLink).attributes('href')).toEqual('https://test.com/commit');
});
it('renders lock icon', () => {
factory({
id: '1',
path: 'test',
type: 'tree',
currentPath: '/',
});
vm.setData({ commit: { lockLabel: 'Locked by Root', committedDate: '2019-01-01' } });
expect(vm.find(Icon).exists()).toBe(true);
});
});
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