Skip to content

Commit

Permalink
SP67 Fix incorrect auth profile owner source (#790)
Browse files Browse the repository at this point in the history
* Fix incorrect auth profile owner source

* Fix heading, default to user when making new auth profile

* Fix incorrect owner assignment

* Add ability to set sort key

---------

Co-authored-by: ikethecoder <ikethecoder@copeconsulting.ca>
  • Loading branch information
Jonesy and ikethecoder committed May 17, 2023
1 parent bbc11e6 commit e011b1c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ const AuthorizationProfileDialog: React.FC<AuthorizationProfileDialogProps> = ({
},
[data, handleCreateProfile, handleSaveProfile, id]
);
const owner = id ? data?.owner : data?.owner ?? user;

React.useEffect(() => {
setName(data?.name);
Expand Down Expand Up @@ -305,7 +306,7 @@ const AuthorizationProfileDialog: React.FC<AuthorizationProfileDialogProps> = ({
</Tab>
<Box flex={1} />
<Box p="relative" mt={-10} mb={2}>
<UserProfile data={user} />
<UserProfile heading="Owner" data={owner} />
</Box>
</TabList>
</Tabs>
Expand Down
3 changes: 2 additions & 1 deletion src/nextapp/components/table/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ interface Column extends TableColumnHeaderProps {
name: React.ReactNode;
key?: string;
sortable?: boolean;
sortKey?: string;
}

interface ApsTableProps extends TableProps {
Expand Down Expand Up @@ -109,7 +110,7 @@ const ApsTable: React.FC<ApsTableProps> = ({
}
onClick={
sort && tableProps.key
? handleSort(tableProps.key)
? handleSort(tableProps.sortKey ?? tableProps.key)
: undefined
}
_hover={{
Expand Down
4 changes: 4 additions & 0 deletions src/nextapp/components/user-profile/user-profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ const UserProfile: React.FC<UserProfileProps> = ({
...props
}) => {
const testId = props['data-testid'] ?? 'user-profile';
if (!data) {
return null;
}

return (
<Box {...props}>
<Heading size="sm" mb={3.5}>
Expand Down
2 changes: 1 addition & 1 deletion src/nextapp/pages/manager/consumers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ const ConsumersPage: React.FC<
key: 'tags',
sortable: false,
},
{ name: 'Updated', key: 'sortDate' },
{ name: 'Updated', key: 'sortDate', sortKey: 'updatedAt' },
]}
data={consumers}
data-testid="all-consumer-control-tbl"
Expand Down

0 comments on commit e011b1c

Please sign in to comment.