mirror of
https://github.com/ansible/awx.git
synced 2026-02-28 16:28:43 -03:30
158 paginated data list (#180)
* working: rename OrganizationTeamsList to PaginatedDataList * convert org notifications list fully to PaginatedDataList * update NotificationList tests * refactor org access to use PaginatedDataList * update tests for org access refactor; fix pagination & sorting * restore Add Role functionality to Org roles * fix displayed text when list of items is empty * preserve query params when navigating through pagination * fix bugs after RBAC rebase * fix lint errors, fix add org access button
This commit is contained in:
@@ -11,6 +11,7 @@ export const encodeQueryString = (params) => {
|
||||
|
||||
return Object.keys(params)
|
||||
.sort()
|
||||
.filter(key => params[key] !== null)
|
||||
.map(key => ([key, params[key]]))
|
||||
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
|
||||
.join('&');
|
||||
@@ -27,7 +28,7 @@ export const encodeQueryString = (params) => {
|
||||
export const parseQueryString = (queryString, integerFields = ['page', 'page_size']) => {
|
||||
if (!queryString) return {};
|
||||
|
||||
const keyValuePairs = queryString.split('&')
|
||||
const keyValuePairs = queryString.replace(/^\?/, '').split('&')
|
||||
.map(s => s.split('='))
|
||||
.map(([key, value]) => {
|
||||
if (integerFields.includes(key)) {
|
||||
|
||||
16
src/util/strings.js
Normal file
16
src/util/strings.js
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
export function pluralize (str) {
|
||||
return str[str.length - 1] === 's' ? `${str}es` : `${str}s`;
|
||||
}
|
||||
|
||||
export function getArticle (str) {
|
||||
const first = str[0];
|
||||
if (('aeiou').includes(first)) {
|
||||
return 'an';
|
||||
}
|
||||
return 'a';
|
||||
}
|
||||
|
||||
export function ucFirst (str) {
|
||||
return `${str[0].toUpperCase()}${str.substr(1)}`;
|
||||
}
|
||||
Reference in New Issue
Block a user