Skip to content

Commit

Permalink
🐛 Address permission display issues on archetypes page
Browse files Browse the repository at this point in the history
Signed-off-by: ibolton336 <[email protected]>
  • Loading branch information
ibolton336 committed Jan 2, 2024
1 parent da3c1bf commit aa79151
Showing 1 changed file with 78 additions and 71 deletions.
149 changes: 78 additions & 71 deletions client/src/app/pages/archetypes/archetypes-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ const Archetypes: React.FC = () => {
<FilterToolbar {...filterToolbarProps} />
<ToolbarGroup variant="button-group">
<ToolbarItem>
<CreateButton />
{archetypeWriteAccess && <CreateButton />}
</ToolbarItem>
</ToolbarGroup>
<ToolbarItem {...paginationToolbarItemProps}>
Expand Down Expand Up @@ -381,76 +381,83 @@ const Archetypes: React.FC = () => {
<ArchetypeApplicationsColumn archetype={archetype} />
</Td>
<Td isActionCell>
<ActionsColumn
items={[
...(archetypeWriteAccess
? [
{
title: t("actions.duplicate"),
onClick: () =>
setArchetypeToDuplicate(archetype),
},
]
: []),
...(assessmentWriteAccess
? [
{
title: t("actions.assess"),
onClick: () =>
assessSelectedArchetype(archetype),
},
]
: []),
...(reviewsWriteAccess
? [
{
title: t("actions.review"),
onClick: () =>
reviewSelectedArchetype(archetype),
},
]
: []),
...(archetypeWriteAccess
? [
{
title: t("actions.edit"),
onClick: () =>
setArchetypeToEdit(archetype),
},
]
: []),
...(archetype?.assessments?.length &&
assessmentWriteAccess
? [
{
title: t("actions.discardAssessment"),
onClick: () =>
setAssessmentToDiscard(archetype),
},
]
: []),
...(archetype?.review && reviewsWriteAccess
? [
{
title: t("actions.discardReview"),
onClick: () =>
setReviewToDiscard(archetype),
},
]
: []),
{ isSeparator: true },
...(archetypeWriteAccess
? [
{
title: t("actions.delete"),
onClick: () =>
setArchetypeToDelete(archetype),
isDanger: true,
},
]
: []),
]}
/>
{(archetypeWriteAccess ||
assessmentWriteAccess ||
reviewsWriteAccess ||
(archetype?.assessments?.length &&
assessmentWriteAccess) ||
(archetype?.review && reviewsWriteAccess)) && (
<ActionsColumn
items={[
...(archetypeWriteAccess
? [
{
title: t("actions.duplicate"),
onClick: () =>
setArchetypeToDuplicate(archetype),
},
]
: []),
...(assessmentWriteAccess
? [
{
title: t("actions.assess"),
onClick: () =>
assessSelectedArchetype(archetype),
},
]
: []),
...(reviewsWriteAccess
? [
{
title: t("actions.review"),
onClick: () =>
reviewSelectedArchetype(archetype),
},
]
: []),
...(archetypeWriteAccess
? [
{
title: t("actions.edit"),
onClick: () =>
setArchetypeToEdit(archetype),
},
]
: []),
...(archetype?.assessments?.length &&
assessmentWriteAccess
? [
{
title: t("actions.discardAssessment"),
onClick: () =>
setAssessmentToDiscard(archetype),
},
]
: []),
...(archetype?.review && reviewsWriteAccess
? [
{
title: t("actions.discardReview"),
onClick: () =>
setReviewToDiscard(archetype),
},
]
: []),
{ isSeparator: true },
...(archetypeWriteAccess
? [
{
title: t("actions.delete"),
onClick: () =>
setArchetypeToDelete(archetype),
isDanger: true,
},
]
: []),
]}
/>
)}
</Td>
</TableRowContentWithControls>
</Tr>
Expand Down

0 comments on commit aa79151

Please sign in to comment.