Skip to content

Commit

Permalink
Fix a couple of code style issues introduced on #128375
Browse files Browse the repository at this point in the history
  • Loading branch information
machadoum committed Mar 29, 2022
1 parent 39c8b4f commit b315812
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,44 @@ const rowItems: ItemsPerRow[] = [
},
];

const getUsersColumns = (): UsersTableColumns => [
{
field: 'name',
name: i18n.USER_NAME,
truncateText: false,
sortable: true,
mobileOptions: { show: true },
render: (name) =>
getRowItemDraggables({
rowItems: [name],
attrName: 'user.name',
idPrefix: `users-table-${name}-name`,
render: (item) => <UserDetailsLink userName={item} />,
}),
},
{
field: 'lastSeen',
name: i18n.LAST_SEEN,
sortable: true,
truncateText: false,
mobileOptions: { show: true },
render: (lastSeen) => <FormattedRelativePreferenceDate value={lastSeen} />,
},
{
field: 'domain',
name: i18n.DOMAIN,
sortable: false,
truncateText: false,
mobileOptions: { show: true },
render: (domain) =>
getRowItemDraggables({
rowItems: [domain],
attrName: 'user.domain',
idPrefix: `users-table-${domain}-domain`,
}),
},
];

const UsersTableComponent: React.FC<UsersTableProps> = ({
users,
totalCount,
Expand Down Expand Up @@ -146,41 +184,3 @@ const UsersTableComponent: React.FC<UsersTableProps> = ({
UsersTableComponent.displayName = 'UsersTableComponent';

export const UsersTable = React.memo(UsersTableComponent);

const getUsersColumns = (): UsersTableColumns => [
{
field: 'name',
name: i18n.USER_NAME,
truncateText: false,
sortable: true,
mobileOptions: { show: true },
render: (name) =>
getRowItemDraggables({
rowItems: [name],
attrName: 'user.name',
idPrefix: `users-table-${name}-name`,
render: (item) => <UserDetailsLink userName={item} />,
}),
},
{
field: 'lastSeen',
name: i18n.LAST_SEEN,
sortable: true,
truncateText: false,
mobileOptions: { show: true },
render: (lastSeen) => <FormattedRelativePreferenceDate value={lastSeen} />,
},
{
field: 'domain',
name: i18n.DOMAIN,
sortable: false,
truncateText: false,
mobileOptions: { show: true },
render: (domain) =>
getRowItemDraggables({
rowItems: [domain],
attrName: 'user.domain',
idPrefix: `users-table-${domain}-domain`,
}),
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ export const buildUsersQuery = ({
},
];

const agg = { user_count: { cardinality: { field: 'user.name' } } };

const dslQuery = {
allow_no_indices: true,
index: defaultIndex,
Expand All @@ -47,7 +45,7 @@ export const buildUsersQuery = ({
body: {
...(!isEmpty(docValueFields) ? { docvalue_fields: docValueFields } : {}),
aggregations: {
...agg,
user_count: { cardinality: { field: 'user.name' } },
user_data: {
terms: { size: querySize, field: 'user.name', order: getQueryOrder(sort) },
aggs: {
Expand Down

0 comments on commit b315812

Please sign in to comment.