Skip to content

Commit

Permalink
✨ Add actions kebab to archetypes table with stub dropdown items (#1328)
Browse files Browse the repository at this point in the history
Part of #1264.

Uses the ActionsColumn component pattern introduced in
#1314 to add a kebab menu for
actions shown in [this
mockup](https://www.sketch.com/s/af50e991-8061-4b69-84c1-c11241e274f2/a/eldjjKW).
All 3 actions are currently stubs to unblock @sjd78 from integrating his
Edit functionality. PR to implement Duplicate and Delete will be next.

Follows the pattern found in this PF example for "danger" menu items
(red text below a separator):
https://www.patternfly.org/components/menus/menu#danger-menu-item

---------

Signed-off-by: Mike Turley <mike.turley@alum.cs.umass.edu>
  • Loading branch information
mturley authored Sep 5, 2023
1 parent 0a9dded commit 9287edd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
1 change: 1 addition & 0 deletions client/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"discardAssessment": "Discard assessment/review",
"downloadCsvTemplate": "Download CSV template",
"download": "Download {{what}}",
"duplicate": "Duplicate",
"edit": "Edit",
"export": "Export",
"filterBy": "Filter by {{what}}",
Expand Down
31 changes: 29 additions & 2 deletions client/src/app/pages/archetypes/archetypes-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ import {
ToolbarGroup,
ToolbarItem,
} from "@patternfly/react-core";
import { Table, Tbody, Th, Thead, Tr, Td } from "@patternfly/react-table";
import {
Table,
Tbody,
Th,
Thead,
Tr,
Td,
ActionsColumn,
} from "@patternfly/react-table";
import { CubesIcon } from "@patternfly/react-icons";

import { AppPlaceholder } from "@app/components/AppPlaceholder";
Expand Down Expand Up @@ -202,7 +210,26 @@ const Archetypes: React.FC = () => {
<Td {...getTdProps({ columnKey: "applications" })}>
<ArchetypeApplicationsColumn archetype={archetype} />
</Td>
<Td>{/* TODO: Add kebab action menu */}</Td>
<Td isActionCell>
<ActionsColumn
items={[
{
title: t("actions.duplicate"),
onClick: () => alert("TODO"),
},
{
title: t("actions.edit"),
onClick: () => alert("TODO"),
},
{ isSeparator: true },
{
title: t("actions.delete"),
onClick: () => alert("TODO"),
isDanger: true,
},
]}
/>
</Td>
</TableRowContentWithControls>
</Tr>
</Tbody>
Expand Down

0 comments on commit 9287edd

Please sign in to comment.