Add network filter management
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
Pierre HUBERT 2024-04-20 11:28:10 +02:00
parent f404018392
commit 43382991eb

View File

@ -13,6 +13,7 @@ import {
import React from "react";
import { NWFilter } from "../../api/NWFilterApi";
import { NetworkInfo } from "../../api/NetworksApi";
import { ServerApi } from "../../api/ServerApi";
import { APIToken, TokenRight } from "../../api/TokensApi";
import { VMInfo } from "../../api/VMApi";
@ -382,6 +383,94 @@ export function TokenRightsEditor(p: {
</Table>
</RightsSection>
{/* Network filters */}
<RightsSection label="Network filters">
<RouteRight
{...p}
right={{ verb: "POST", path: "/api/nwfilter/create" }}
label="Create a new network filter"
/>
<RouteRight
{...p}
right={{ verb: "GET", path: "/api/nwfilter/list" }}
label="Get list of network filters"
/>
</RightsSection>
{/* Networks filters management */}
<RightsSection label="Networks filters management">
<Table size="small">
<TableHead>
<TableRow>
<TableCell>Network filter name</TableCell>
<TableCell align="center">Get definition</TableCell>
<TableCell align="center">Update</TableCell>
<TableCell align="center">Delete</TableCell>
<TableCell align="center">Get XML definition</TableCell>
</TableRow>
</TableHead>
<TableBody>
{/* All networks filters operations */}
<TableRow hover>
<TableCell>
<i>All</i>
</TableCell>
<CellRight
{...p}
right={{ verb: "GET", path: "/api/nwfilter/*" }}
/>
<CellRight
{...p}
right={{ verb: "PUT", path: "/api/nwfilter/*" }}
/>
<CellRight
{...p}
right={{ verb: "DELETE", path: "/api/nwfilter/*" }}
/>
<CellRight
{...p}
right={{ verb: "GET", path: "/api/nwfilter/*/src" }}
/>
</TableRow>
{/* Per network filter operations */}
{p.nwFilters.map((v, n) => (
<TableRow hover key={n}>
<TableCell>{v.name}</TableCell>
<CellRight
{...p}
right={{ verb: "GET", path: `/api/nwfilter/${v.uuid}` }}
parent={{ verb: "GET", path: "/api/nwfilter/*" }}
/>
{ServerApi.Config.builtin_nwfilter_rules.includes(v.name!) ? (
<TableCell></TableCell>
) : (
<CellRight
{...p}
right={{ verb: "PUT", path: `/api/nwfilter/${v.uuid}` }}
parent={{ verb: "PUT", path: "/api/nwfilter/*" }}
/>
)}
{ServerApi.Config.builtin_nwfilter_rules.includes(v.name!) ? (
<TableCell></TableCell>
) : (
<CellRight
{...p}
right={{ verb: "DELETE", path: `/api/nwfilter/${v.uuid}` }}
parent={{ verb: "DELETE", path: "/api/nwfilter/*" }}
/>
)}
<CellRight
{...p}
right={{ verb: "GET", path: `/api/nwfilter/${v.uuid}/src` }}
parent={{ verb: "GET", path: "/api/nwfilter/*/src" }}
/>
</TableRow>
))}
</TableBody>
</Table>
</RightsSection>
{/* ISO files */}
<RightsSection label="ISO files">
<RouteRight