Skip to content
代码片段 群组 项目
未验证 提交 a5424712 编辑于 作者: Justin Ho Tuan Duong's avatar Justin Ho Tuan Duong 提交者: GitLab
浏览文件

Remove thWidthClass in violations_report

We still need `gl-p-5!` due to the left-aligned sort icon.
上级 5ebe1dfc
No related branches found
No related tags found
无相关合并请求
...@@ -10,9 +10,6 @@ export const BV_SHOW_TOOLTIP = 'bv::show::tooltip'; ...@@ -10,9 +10,6 @@ export const BV_SHOW_TOOLTIP = 'bv::show::tooltip';
export const BV_DROPDOWN_SHOW = 'bv::dropdown::show'; export const BV_DROPDOWN_SHOW = 'bv::dropdown::show';
export const BV_DROPDOWN_HIDE = 'bv::dropdown::hide'; export const BV_DROPDOWN_HIDE = 'bv::dropdown::hide';
export const DEFAULT_TH_CLASSES =
'gl-bg-transparent! gl-border-b-solid! gl-border-b-gray-100! gl-p-5! gl-border-b-1!';
// We set the drawer's z-index to 252 to clear flash messages that might // We set the drawer's z-index to 252 to clear flash messages that might
// be displayed in the page and that have a z-index of 251. // be displayed in the page and that have a z-index of 251.
export const DRAWER_Z_INDEX = 252; export const DRAWER_Z_INDEX = 252;
......
import { convertToSnakeCase, convertToCamelCase } from '~/lib/utils/text_utility'; import { convertToSnakeCase, convertToCamelCase } from '~/lib/utils/text_utility';
import { DEFAULT_TH_CLASSES } from './constants';
/**
* Deprecated: use thWidthPercent instead
* Generates the table header classes to be used for GlTable fields.
*
* @param {Number} width - The column width as a percentage.
* @returns {String} The classes to be used in GlTable fields object.
*/
export const thWidthClass = (width) => `gl-w-${width}p ${DEFAULT_TH_CLASSES}`;
/** /**
* Generates the table header class for width to be used for GlTable fields. * Generates the table header class for width to be used for GlTable fields.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { GlAlert, GlButton, GlKeysetPagination, GlLoadingIcon, GlTable } from '@gitlab/ui'; import { GlAlert, GlButton, GlKeysetPagination, GlLoadingIcon, GlTable } from '@gitlab/ui';
import * as Sentry from '~/sentry/sentry_browser_wrapper'; import * as Sentry from '~/sentry/sentry_browser_wrapper';
import { __, s__ } from '~/locale'; import { __, s__ } from '~/locale';
import { sortObjectToString, sortStringToObject, thWidthClass } from '~/lib/utils/table_utility'; import { sortObjectToString, sortStringToObject, thWidthPercent } from '~/lib/utils/table_utility';
import { DRAWER_Z_INDEX } from '~/lib/utils/constants'; import { DRAWER_Z_INDEX } from '~/lib/utils/constants';
import UrlSync from '~/vue_shared/components/url_sync.vue'; import UrlSync from '~/vue_shared/components/url_sync.vue';
import SeverityBadge from 'ee/vue_shared/security_reports/components/severity_badge.vue'; import SeverityBadge from 'ee/vue_shared/security_reports/components/severity_badge.vue';
...@@ -173,28 +173,28 @@ export default { ...@@ -173,28 +173,28 @@ export default {
{ {
key: 'severityLevel', key: 'severityLevel',
label: __('Severity'), label: __('Severity'),
thClass: thWidthClass(10), thClass: `gl-p-5! ${thWidthPercent(10)}`,
tdClass: 'gl-vertical-align-middle!', tdClass: 'gl-vertical-align-middle!',
sortable: true, sortable: true,
}, },
{ {
key: 'violationReason', key: 'violationReason',
label: __('Violation'), label: __('Violation'),
thClass: thWidthClass(15), thClass: `gl-p-5! ${thWidthPercent(15)}`,
tdClass: 'gl-vertical-align-middle!', tdClass: 'gl-vertical-align-middle!',
sortable: true, sortable: true,
}, },
{ {
key: 'mergeRequestTitle', key: 'mergeRequestTitle',
label: __('Merge request'), label: __('Merge request'),
thClass: thWidthClass(40), thClass: `gl-p-5! ${thWidthPercent(40)}`,
tdClass: 'gl-vertical-align-middle!', tdClass: 'gl-vertical-align-middle!',
sortable: true, sortable: true,
}, },
{ {
key: 'mergedAt', key: 'mergedAt',
label: __('Date merged'), label: __('Date merged'),
thClass: thWidthClass(20), thClass: `gl-p-5! ${thWidthPercent(20)}`,
tdClass: 'gl-vertical-align-middle!', tdClass: 'gl-vertical-align-middle!',
sortable: true, sortable: true,
}, },
......
...@@ -6,9 +6,7 @@ import Target from 'ee/security_configuration/corpus_management/components/colum ...@@ -6,9 +6,7 @@ import Target from 'ee/security_configuration/corpus_management/components/colum
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import UserDate from '~/vue_shared/components/user_date.vue'; import UserDate from '~/vue_shared/components/user_date.vue';
import { ISO_SHORT_FORMAT } from '~/vue_shared/constants'; import { ISO_SHORT_FORMAT } from '~/vue_shared/constants';
import { thWidthClass } from '~/lib/utils/table_utility'; import { thWidthPercent } from '~/lib/utils/table_utility';
const thClass = 'gl-bg-transparent! gl-border-gray-100! gl-border-b-solid! gl-border-b-1!';
export default { export default {
components: { components: {
...@@ -29,29 +27,29 @@ export default { ...@@ -29,29 +27,29 @@ export default {
{ {
key: 'name', key: 'name',
label: s__('CorpusManagement|Corpus name'), label: s__('CorpusManagement|Corpus name'),
thClass: `${thClass} ${thWidthClass(40)}`, thClass: thWidthPercent(40),
tdClass: 'gl-text-truncate gl-max-w-15', tdClass: 'gl-text-truncate gl-max-w-15',
}, },
{ {
key: 'target', key: 'target',
label: s__('CorpusManagement|Target'), label: s__('CorpusManagement|Target'),
thClass: `${thClass} ${thWidthClass(20)}`, thClass: thWidthPercent(20),
tdClass: 'gl-word-break-word', tdClass: 'gl-word-break-word',
}, },
{ {
key: 'lastUpdated', key: 'lastUpdated',
label: s__('CorpusManagement|Last updated'), label: s__('CorpusManagement|Last updated'),
thClass: `${thClass} ${thWidthClass(15)}`, thClass: thWidthPercent(15),
}, },
{ {
key: 'lastUsed', key: 'lastUsed',
label: s__('CorpusManagement|Last used'), label: s__('CorpusManagement|Last used'),
thClass: `${thClass} ${thWidthClass(15)}`, thClass: thWidthPercent(15),
}, },
{ {
key: 'actions', key: 'actions',
label: s__('CorpusManagement|Actions'), label: s__('CorpusManagement|Actions'),
thClass: `${thClass} ${thWidthClass(10)}`, thClass: thWidthPercent(10),
}, },
], ],
i18n: { i18n: {
......
...@@ -6,7 +6,7 @@ exports[`Corpus table corpus management renders with the correct columns 1`] = ` ...@@ -6,7 +6,7 @@ exports[`Corpus table corpus management renders with the correct columns 1`] = `
> >
<th <th
aria-colindex="1" aria-colindex="1"
class="gl-bg-transparent! gl-border-b-1! gl-border-b-gray-100! gl-border-b-solid! gl-border-gray-100! gl-p-5! gl-w-40p" class="gl-w-40p"
role="columnheader" role="columnheader"
scope="col" scope="col"
> >
...@@ -16,7 +16,7 @@ exports[`Corpus table corpus management renders with the correct columns 1`] = ` ...@@ -16,7 +16,7 @@ exports[`Corpus table corpus management renders with the correct columns 1`] = `
</th> </th>
<th <th
aria-colindex="2" aria-colindex="2"
class="gl-bg-transparent! gl-border-b-1! gl-border-b-gray-100! gl-border-b-solid! gl-border-gray-100! gl-p-5! gl-w-20p" class="gl-w-20p"
role="columnheader" role="columnheader"
scope="col" scope="col"
> >
...@@ -26,7 +26,7 @@ exports[`Corpus table corpus management renders with the correct columns 1`] = ` ...@@ -26,7 +26,7 @@ exports[`Corpus table corpus management renders with the correct columns 1`] = `
</th> </th>
<th <th
aria-colindex="3" aria-colindex="3"
class="gl-bg-transparent! gl-border-b-1! gl-border-b-gray-100! gl-border-b-solid! gl-border-gray-100! gl-p-5! gl-w-15p" class="gl-w-15p"
role="columnheader" role="columnheader"
scope="col" scope="col"
> >
...@@ -36,7 +36,7 @@ exports[`Corpus table corpus management renders with the correct columns 1`] = ` ...@@ -36,7 +36,7 @@ exports[`Corpus table corpus management renders with the correct columns 1`] = `
</th> </th>
<th <th
aria-colindex="4" aria-colindex="4"
class="gl-bg-transparent! gl-border-b-1! gl-border-b-gray-100! gl-border-b-solid! gl-border-gray-100! gl-p-5! gl-w-15p" class="gl-w-15p"
role="columnheader" role="columnheader"
scope="col" scope="col"
> >
...@@ -46,7 +46,7 @@ exports[`Corpus table corpus management renders with the correct columns 1`] = ` ...@@ -46,7 +46,7 @@ exports[`Corpus table corpus management renders with the correct columns 1`] = `
</th> </th>
<th <th
aria-colindex="5" aria-colindex="5"
class="gl-bg-transparent! gl-border-b-1! gl-border-b-gray-100! gl-border-b-solid! gl-border-gray-100! gl-p-5! gl-w-10p" class="gl-w-10p"
role="columnheader" role="columnheader"
scope="col" scope="col"
> >
......
import { DEFAULT_TH_CLASSES } from '~/lib/utils/constants';
import * as tableUtils from '~/lib/utils/table_utility'; import * as tableUtils from '~/lib/utils/table_utility';
describe('table_utility', () => { describe('table_utility', () => {
describe('thWidthClass', () => {
it('returns the width class including default table header classes', () => {
const width = 50;
expect(tableUtils.thWidthClass(width)).toBe(`gl-w-${width}p ${DEFAULT_TH_CLASSES}`);
});
});
describe('thWidthPercent', () => { describe('thWidthPercent', () => {
it('returns the width class including default table header classes', () => { it('returns the width class including default table header classes', () => {
const width = 50; const width = 50;
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册