Commit 770a12bf authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera Committed by Jose Ivan Vargas

Update sort filter naming and structure

- constants
- utils
- components binding
parent d0a4f311
...@@ -51,7 +51,7 @@ export default { ...@@ -51,7 +51,7 @@ export default {
<gl-sorting-item <gl-sorting-item
v-for="item in sortableFields" v-for="item in sortableFields"
ref="packageListSortItem" ref="packageListSortItem"
:key="item.key" :key="item.orderBy"
@click="onSortItemClick(item.orderBy)" @click="onSortItemClick(item.orderBy)"
> >
{{ item.label }} {{ item.label }}
......
...@@ -15,7 +15,7 @@ export const GROUP_PAGE_TYPE = 'groups'; ...@@ -15,7 +15,7 @@ export const GROUP_PAGE_TYPE = 'groups';
export const LIST_KEY_NAME = 'name'; export const LIST_KEY_NAME = 'name';
export const LIST_KEY_PROJECT = 'project_path'; export const LIST_KEY_PROJECT = 'project_path';
export const LIST_KEY_VERSION = 'version'; export const LIST_KEY_VERSION = 'version';
export const LIST_KEY_PACKAGE_TYPE = 'package_type'; export const LIST_KEY_PACKAGE_TYPE = 'type';
export const LIST_KEY_CREATED_AT = 'created_at'; export const LIST_KEY_CREATED_AT = 'created_at';
export const LIST_KEY_ACTIONS = 'actions'; export const LIST_KEY_ACTIONS = 'actions';
...@@ -23,47 +23,35 @@ export const LIST_LABEL_NAME = __('Name'); ...@@ -23,47 +23,35 @@ export const LIST_LABEL_NAME = __('Name');
export const LIST_LABEL_PROJECT = __('Project'); export const LIST_LABEL_PROJECT = __('Project');
export const LIST_LABEL_VERSION = __('Version'); export const LIST_LABEL_VERSION = __('Version');
export const LIST_LABEL_PACKAGE_TYPE = __('Type'); export const LIST_LABEL_PACKAGE_TYPE = __('Type');
export const LIST_LABEL_CREATED_AT = __('Created'); export const LIST_LABEL_CREATED_AT = __('Published');
export const LIST_LABEL_ACTIONS = ''; export const LIST_LABEL_ACTIONS = '';
export const LIST_ORDER_BY_PACKAGE_TYPE = 'type';
export const ASCENDING_ODER = 'asc'; export const ASCENDING_ODER = 'asc';
export const DESCENDING_ORDER = 'desc'; export const DESCENDING_ORDER = 'desc';
// The following is not translated because it is used to build a JavaScript exception error message // The following is not translated because it is used to build a JavaScript exception error message
export const MISSING_DELETE_PATH_ERROR = 'Missing delete_api_path link'; export const MISSING_DELETE_PATH_ERROR = 'Missing delete_api_path link';
export const TABLE_HEADER_FIELDS = [ export const SORT_FIELDS = [
{ {
key: LIST_KEY_NAME,
label: LIST_LABEL_NAME,
orderBy: LIST_KEY_NAME, orderBy: LIST_KEY_NAME,
class: ['text-left'], label: LIST_LABEL_NAME,
}, },
{ {
key: LIST_KEY_PROJECT,
label: LIST_LABEL_PROJECT,
orderBy: LIST_KEY_PROJECT, orderBy: LIST_KEY_PROJECT,
class: ['text-left'], label: LIST_LABEL_PROJECT,
}, },
{ {
key: LIST_KEY_VERSION,
label: LIST_LABEL_VERSION,
orderBy: LIST_KEY_VERSION, orderBy: LIST_KEY_VERSION,
class: ['text-center'], label: LIST_LABEL_VERSION,
}, },
{ {
key: LIST_KEY_PACKAGE_TYPE, orderBy: LIST_KEY_PACKAGE_TYPE,
label: LIST_LABEL_PACKAGE_TYPE, label: LIST_LABEL_PACKAGE_TYPE,
orderBy: LIST_ORDER_BY_PACKAGE_TYPE,
class: ['text-center'],
}, },
{ {
key: LIST_KEY_CREATED_AT,
label: LIST_LABEL_CREATED_AT,
orderBy: LIST_KEY_CREATED_AT, orderBy: LIST_KEY_CREATED_AT,
class: ['text-center'], label: LIST_LABEL_CREATED_AT,
}, },
]; ];
......
import { LIST_KEY_PROJECT, TABLE_HEADER_FIELDS } from './constants'; import { LIST_KEY_PROJECT, SORT_FIELDS } from './constants';
export default isGroupPage => export default isGroupPage => SORT_FIELDS.filter(f => f.key !== LIST_KEY_PROJECT || isGroupPage);
TABLE_HEADER_FIELDS.filter(f => f.key !== LIST_KEY_PROJECT || isGroupPage);
/** /**
* A small util function that works out if the delete action has deleted the * A small util function that works out if the delete action has deleted the
......
---
title: Rename Created to Published in package sort dropdown
merge_request: 42677
author:
type: changed
...@@ -20682,6 +20682,9 @@ msgstr "" ...@@ -20682,6 +20682,9 @@ msgstr ""
msgid "Publish to status page" msgid "Publish to status page"
msgstr "" msgstr ""
msgid "Published"
msgstr ""
msgid "Published on status page" msgid "Published on status page"
msgstr "" msgstr ""
......
...@@ -84,11 +84,11 @@ RSpec.shared_examples 'shared package sorting' do ...@@ -84,11 +84,11 @@ RSpec.shared_examples 'shared package sorting' do
let(:packages) { [package_two, package_one] } let(:packages) { [package_two, package_one] }
end end
it_behaves_like 'correctly sorted packages list', 'Created' do it_behaves_like 'correctly sorted packages list', 'Published' do
let(:packages) { [package_two, package_one] } let(:packages) { [package_two, package_one] }
end end
it_behaves_like 'correctly sorted packages list', 'Created', ascending: true do it_behaves_like 'correctly sorted packages list', 'Published', ascending: true do
let(:packages) { [package_one, package_two] } let(:packages) { [package_one, package_two] }
end end
end end
......
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