Skip to content

Commit

Permalink
Feedback | fixing sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
snyaggarwal committed Oct 11, 2024
1 parent 2138451 commit 6ca13e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/components/search/ResultConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export const ALL_COLUMNS = {
{id: 'datatype', labelKey: 'concept.datatype', value: 'datatype', sortOn: 'datatype'},
{id: 'updatedOn', labelKey: 'common.updated_on', value: 'version_updated_on', formatter: formatDate, sortOn: 'last_update', global: false},
{id: 'updatedBy', labelKey: 'common.updated_by', value: 'version_updated_by', global: false},
{id: 'parent', labelKey: 'repo.repo', value: 'source', sortOn: 'source', nested: false, renderer: (item, isSplitView) => <RepoChip size='small' hideType repo={{type: 'Source Version', short_code: item.source, id: item?.latest_source_version, url: toParentURI(item.url)}} version={item.latest_source_version} vertical={isSplitView} />},
{id: 'owner', labelKey: 'common.owner', value: 'owner', sortOn: 'owner', nested: false, renderer: item => <OrgChip size='small' hideType org={{ownerType: item.owner_type, id: item.owner, url: toOwnerURI(item.url)}} />},
{id: 'parent', labelKey: 'repo.repo', value: 'source', sortOn: 'source', nested: false, sortable: false, renderer: (item, isSplitView) => <RepoChip size='small' hideType repo={{type: 'Source Version', short_code: item.source, id: item?.latest_source_version, url: toParentURI(item.url)}} version={item.latest_source_version} vertical={isSplitView} />},
{id: 'owner', labelKey: 'common.owner', value: 'owner', sortOn: 'owner', nested: false, sortable: false, renderer: item => <OrgChip size='small' hideType org={{ownerType: item.owner_type, id: item.owner, url: toOwnerURI(item.url)}} />},
],
mappings: [
{id: 'id', labelKey: 'common.id', value: 'id', sortOn: 'id_lowercase', className: 'searchable'},
Expand All @@ -32,13 +32,13 @@ export const ALL_COLUMNS = {
repos: [
{id: 'id', labelKey: 'common.id', value: 'id', sortOn: 'id', className: 'searchable'},
{id: 'name', labelKey: 'common.name', value: 'name', sortOn: 'name', className: 'searchable'},
{id: 'type', labelKey: 'repo.repo_type', value: 'type'},
{id: 'owner', labelKey: 'common.owner', value: 'owner', sortOn: 'owner', renderer: item => <OrgChip size='small' hideType org={{ownerType: item.owner_type, id: item.owner, url: toOwnerURI(item.url)}} />},
{id: 'type', labelKey: 'repo.repo_type', value: 'type', sortable: false},
{id: 'owner', labelKey: 'common.owner', value: 'owner', sortOn: 'owner', sortable: false, renderer: item => <OrgChip size='small' hideType org={{ownerType: item.owner_type, id: item.owner, url: toOwnerURI(item.url)}} />},
],
orgs: [
{id: 'id', labelKey: 'common.id', value: 'id', sortOn: '_mnemonic', className: 'searchable'},
{id: 'name', labelKey: 'common.name', value: 'name', sortOn: '_name', sortBy: 'asc', className: 'searchable'},
{id: 'createdOn', labelKey: 'common.created_on', value: 'created_on', formatter: formatDate, sortOn: 'created_on'},
{id: 'createdOn', labelKey: 'common.created_on', value: 'created_on', formatter: formatDate, sortOn: 'created_on', sortable: false},
],
users: [
{id: 'username', labelKey: 'user.username', value: 'username', sortOn: '_username', sortBy: 'asc', className: 'searchable'},
Expand Down
8 changes: 5 additions & 3 deletions src/components/search/TableResults.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@ const EnhancedTableHead = props => {
<TableSortLabel
active={orderBy === headCell.id}
direction={orderBy === headCell.id ? order : 'asc'}
onClick={createSortHandler(headCell.id)}
onClick={headCell?.sortable === false ? undefined : createSortHandler(headCell.id)}
>
<b>{t(headCell.labelKey)}</b>
{orderBy === headCell.id ? (
{
orderBy === headCell.id ? (
<Box component="span" sx={visuallyHidden}>
{order === 'desc' ? 'sorted descending' : 'sorted ascending'}
</Box>
) : null}
) : null
}
</TableSortLabel>
</TableCell>
))}
Expand Down

0 comments on commit 6ca13e6

Please sign in to comment.