Skip to content

Commit

Permalink
Merge branch 'main' into questionnaire-view
Browse files Browse the repository at this point in the history
  • Loading branch information
ibolton336 authored Aug 16, 2023
2 parents 47c3adf + 4e1ae61 commit a916193
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 41 deletions.
69 changes: 33 additions & 36 deletions client/src/app/pages/controls/tags/components/tag-table.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import React from "react";
import { useTranslation } from "react-i18next";
import {
Table,
Thead,
Tr,
Th,
Tbody,
Td,
ActionsColumn,
IAction,
cellWidth,
IActions,
ICell,
IRow,
IRowData,
} from "@patternfly/react-table";
import {
Table,
TableBody,
TableHeader,
} from "@patternfly/react-table/deprecated";

import { Tag, TagCategory } from "@app/api/models";
import "./tag-table.css";

Expand Down Expand Up @@ -61,8 +62,6 @@ export const TagTable: React.FC<TabTableProps> = ({
});
});

// Rows

const editRow = (row: Tag) => {
onEdit(row);
};
Expand All @@ -71,42 +70,40 @@ export const TagTable: React.FC<TabTableProps> = ({
onDelete(row);
};

const actions: IActions = [
const defaultActions = (tag: IRowData): IAction[] => [
{
title: t("actions.edit"),
onClick: (
event: React.MouseEvent,
rowIndex: number,
rowData: IRowData
) => {
const row: Tag = getRow(rowData);
editRow(row);
},
onClick: () => editRow(getRow(tag)),
},
{
title: t("actions.delete"),
onClick: (
event: React.MouseEvent,
rowIndex: number,
rowData: IRowData
) => {
const row: Tag = getRow(rowData);
deleteRow(row);
},
onClick: () => deleteRow(getRow(tag)),
},
];

return (
<Table
borders={false}
variant="compact"
aria-label="Tag table"
cells={columns}
rows={rows}
actions={actions}
>
<TableHeader />
<TableBody />
<Table borders={false} aria-label="Tag table" variant="compact" isNested>
<Thead noWrap>
<Tr>
<Th>{t("terms.tagName")}</Th>
<Td></Td>
</Tr>
</Thead>
<Tbody>
{rows.map((row: IRow) => {
const rowActions = defaultActions(row);
return (
<Tr>
{row.cells?.map((cell: any) => (
<Td>{cell.title}</Td>
))}
<Td isActionCell>
{rowActions && <ActionsColumn items={rowActions} />}
</Td>
</Tr>
);
})}
</Tbody>
</Table>
);
};
10 changes: 5 additions & 5 deletions server/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ const port = 8080;

const app = express();
app.use(cookieParser());
app.use(express.json());
app.engine("ejs", ejs.renderFile);
app.set("views", pathToClientDist);

app.use(express.static(pathToClientDist));

// Setup proxy handling
for (const proxyPath in proxyMap) {
app.use(proxyPath, createProxyMiddleware(proxyMap[proxyPath]));
}

app.engine("ejs", ejs.renderFile);
app.use(express.json());
app.set("views", pathToClientDist);
app.use(express.static(pathToClientDist));

// Handle any request that hasn't already been handled by express.static or proxy
app.get("*", (_, res) => {
if (process.env.NODE_ENV === "development") {
Expand Down

0 comments on commit a916193

Please sign in to comment.