CEC-2579 Add ability to edit manifest (#226)

This commit is contained in:
arpanetus
2022-10-26 03:54:20 +06:00
committed by GitHub
parent aaf47f4cc7
commit 9a9766df12
11 changed files with 656 additions and 0 deletions

View File

@@ -31,6 +31,7 @@ import { Roles, hasRole } from "../../../utils/roles";
import { useLocalStorage } from "../../useLocalStorage";
import { TYPE_MANIFEST_SOFTWARE } from "../../../utils/manifest_types";
import DeleteConfirmation from "../../DeleteConfirmation";
import EditIcon from "@material-ui/icons/Edit";
const tableColumns = [
{
@@ -45,6 +46,10 @@ const tableColumns = [
id: "version",
label: "Version",
},
{
id: "type",
label: "Type",
},
{
id: "created_at",
label: "Created",
@@ -59,6 +64,15 @@ const tableColumns = [
},
];
const formatManifestType = (type) => {
switch (type) {
case "forced":
return "Forced";
default:
return "Standard";
}
}
const PAGE_SIZE = "MANIFEST_LIST_PAGE_SIZE";
const MainForm = () => {
@@ -161,6 +175,12 @@ const MainForm = () => {
icon: (
<VisibilityIcon aria-label={`Status ${row.name} ${row.version}`} />
),
}, {
tip: `Update "${row.name} ${row.version}"`,
link: `/package-update/${row.id}`,
icon: (
<EditIcon aria-label={`Update ${row.name} ${row.version}`} />
),
});
}
if (hasRole([Roles.CREATE], groups)) {
@@ -237,6 +257,7 @@ const MainForm = () => {
)}
</TableCell>
<TableCell align="center">{row.version}</TableCell>
<TableCell align="center">{formatManifestType(row.type)}</TableCell>
<TableCell align="center">
{LocalDateTimeString(row.created)}
</TableCell>