mirror of
https://github.com/gnmyt/LicenseAPI.git
synced 2026-01-11 18:51:47 +00:00
Add meta field to columns.jsx
This commit is contained in:
@ -1,9 +1,9 @@
|
|||||||
import {IconButton, Stack} from "@mui/material";
|
import {Chip, IconButton, Stack} from "@mui/material";
|
||||||
import {Delete, Edit, Key} from "@mui/icons-material";
|
import {Delete, Edit, Key} from "@mui/icons-material";
|
||||||
|
|
||||||
export default [
|
export default (deleteLicense) => ([
|
||||||
{
|
{
|
||||||
field: 'key', headerName: 'License key', width: 250, renderCell: (params) => <Stack direction="row" gap={1}
|
field: 'key', headerName: 'License key', width: 230, renderCell: (params) => <Stack direction="row" gap={1}
|
||||||
alignItems="center">
|
alignItems="center">
|
||||||
<Key/>{params.value}
|
<Key/>{params.value}
|
||||||
</Stack>
|
</Stack>
|
||||||
@ -12,20 +12,26 @@ export default [
|
|||||||
params.value.length > 0 ? params.value.join(', ') : "-"},
|
params.value.length > 0 ? params.value.join(', ') : "-"},
|
||||||
{field: 'permissions', headerName: 'Permissions', width: 200, renderCell: (params) =>
|
{field: 'permissions', headerName: 'Permissions', width: 200, renderCell: (params) =>
|
||||||
params.value.length > 0 ? params.value.join(', ') : "-"},
|
params.value.length > 0 ? params.value.join(', ') : "-"},
|
||||||
{field: 'currentUses', headerName: 'Current uses', width: 180},
|
|
||||||
{
|
{
|
||||||
field: 'maxUses', headerName: 'Maximum uses', width: 180, renderCell: (params) =>
|
field: "meta", headerName: "Meta-Data", width: 270, renderCell: (params) => <Stack direction="row" gap={1}
|
||||||
params.value === -1 ? "Unlimited" : params.value
|
height="100%"
|
||||||
|
alignItems="center">
|
||||||
|
{Object.keys(params.value).map((key) => <Chip key={key} label={`${key}: ${params.value[key]}`}/>)}
|
||||||
|
{Object.keys(params.value).length === 0 && "-"}
|
||||||
|
</Stack>
|
||||||
},
|
},
|
||||||
|
{field: 'currentUses', headerName: 'Current uses', width: 180},
|
||||||
|
{field: 'maxUses', headerName: 'Maximum uses', width: 180, renderCell: (params) =>
|
||||||
|
params.value === -1 ? "Unlimited" : params.value},
|
||||||
{
|
{
|
||||||
field: 'expirationDate', headerName: 'Expiration date', width: 200, renderCell: (params) =>
|
field: 'expirationDate', headerName: 'Expiration date', width: 200, renderCell: (params) =>
|
||||||
new Date(params.value).getTime() === 0 ? "Never" : new Date(params.value).toLocaleString()
|
new Date(params.value).getTime() === 0 ? "Never" : new Date(params.value).toLocaleString()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'actions', headerName: 'Actions', width: 80, renderCell: () => <Stack direction="row" gap={1}
|
field: 'actions', headerName: 'Actions', width: 100, renderCell: (params) => <Stack direction="row" gap={1}
|
||||||
height="100%" alignItems="center">
|
height="100%" alignItems="center">
|
||||||
<IconButton size="small" color="primary"><Edit/></IconButton>
|
<IconButton size="small" color="primary"><Edit/></IconButton>
|
||||||
<IconButton size="small" color="error"><Delete/></IconButton>
|
<IconButton size="small" color="error" onClick={() => deleteLicense(params.row.id)}><Delete/></IconButton>
|
||||||
</Stack>, sortable: false, filterable: false, align: 'center'
|
</Stack>, sortable: false, filterable: false, align: 'center'
|
||||||
}
|
}
|
||||||
];
|
]);
|
||||||
Reference in New Issue
Block a user