Skip to content

Commit

Permalink
Disable default columns in sort modal
Browse files Browse the repository at this point in the history
  • Loading branch information
akucharska committed Oct 17, 2024
1 parent 72524f0 commit cb7ff87
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
10 changes: 6 additions & 4 deletions public/extensions/extensions.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@

list:
- name: Name
source: name
- name: Namespace
source: namespace
- name: Display Name
source: metadata.displayName
sort:
default: true
- name: Description
source: description
details: []
form: []
general:
Expand Down
5 changes: 4 additions & 1 deletion src/shared/components/GenericList/GenericList.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export const GenericList = ({
serverDataLoading,
pagination,
sortBy,
disableDefaultColumns = false,
notFoundMessage,
searchSettings,
disableMargin,
Expand All @@ -80,7 +81,9 @@ export const GenericList = ({
searchSettings = { ...defaultSearch, ...searchSettings };
const [entrySelected, setEntrySelected] = useState('');
const [entrySelectedNamespace, setEntrySelectedNamespace] = useState('');
if (typeof sortBy === 'function') sortBy = sortBy(defaultSort);

if (typeof sortBy === 'function')
sortBy = sortBy(disableDefaultColumns ? {} : defaultSort);

const [sort, setSort] = useState({
name: sortBy && Object.keys(sortBy)[0],
Expand Down
4 changes: 4 additions & 0 deletions src/shared/components/ResourcesList/ResourcesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ ResourcesList.propTypes = {
disableEdit: PropTypes.bool,
disableDelete: PropTypes.bool,
disableMargin: PropTypes.bool,
disableDefaultColumns: PropTypes.bool,
enableColumnLayout: PropTypes.bool,
layoutNumber: PropTypes.string,
handleRedirect: PropTypes.func,
Expand All @@ -85,6 +86,7 @@ ResourcesList.defaultProps = {
disableEdit: false,
disableDelete: false,
disableMargin: false,
disableDefaultColumns: false,
enableColumnLayout: false,
layoutNumber: 'StartColumn',
filterFn: () => true,
Expand Down Expand Up @@ -199,6 +201,7 @@ export function ResourceListRenderer({
disableCreate,
disableDelete,
disableMargin,
disableDefaultColumns,
enableColumnLayout,
columnLayout,
customColumnLayout,
Expand Down Expand Up @@ -517,6 +520,7 @@ export function ResourceListRenderer({
columnLayout={columnLayout}
enableColumnLayout={enableColumnLayout}
disableMargin={disableMargin}
disableDefaultColumns={disableDefaultColumns}
title={showTitle ? title || prettifiedResourceName : null}
actions={actions}
entries={resources || []}
Expand Down

0 comments on commit cb7ff87

Please sign in to comment.