mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
feat(kubernetes): support for jobs and cron jobs - r8s-182 (#260)
Co-authored-by: James Carppe <85850129+jamescarppe@users.noreply.github.com> Co-authored-by: Anthony Lapenna <anthony.lapenna@portainer.io> Co-authored-by: andres-portainer <91705312+andres-portainer@users.noreply.github.com> Co-authored-by: Oscar Zhou <100548325+oscarzhou-portainer@users.noreply.github.com> Co-authored-by: Yajith Dayarathna <yajith.dayarathna@portainer.io> Co-authored-by: LP B <xAt0mZ@users.noreply.github.com> Co-authored-by: oscarzhou <oscar.zhou@portainer.io> Co-authored-by: testA113 <aliharriss1995@gmail.com>
This commit is contained in:
parent
24fdb1f600
commit
d32b0f8b7e
51 changed files with 1786 additions and 22 deletions
|
@ -0,0 +1,7 @@
|
|||
import { columnHelper } from './helper';
|
||||
|
||||
export const command = columnHelper.accessor((row) => row.Command, {
|
||||
header: 'Command',
|
||||
id: 'command',
|
||||
cell: ({ getValue }) => getValue(),
|
||||
});
|
|
@ -0,0 +1,10 @@
|
|||
import { buildExpandColumn } from '@@/datatables/expand-column';
|
||||
|
||||
import { CronJob } from '../types';
|
||||
|
||||
import { columnHelper } from './helper';
|
||||
|
||||
export const expand = columnHelper.display({
|
||||
...buildExpandColumn<CronJob>(),
|
||||
id: 'expand',
|
||||
});
|
|
@ -0,0 +1,5 @@
|
|||
import { createColumnHelper } from '@tanstack/react-table';
|
||||
|
||||
import { CronJob } from '../types';
|
||||
|
||||
export const columnHelper = createColumnHelper<CronJob>();
|
|
@ -0,0 +1,17 @@
|
|||
import { expand } from './expand';
|
||||
import { name } from './name';
|
||||
import { namespace } from './namespace';
|
||||
import { schedule } from './schedule';
|
||||
import { suspend } from './suspend';
|
||||
import { timezone } from './timezone';
|
||||
import { command } from './command';
|
||||
|
||||
export const columns = [
|
||||
expand,
|
||||
name,
|
||||
namespace,
|
||||
command,
|
||||
schedule,
|
||||
suspend,
|
||||
timezone,
|
||||
];
|
|
@ -0,0 +1,23 @@
|
|||
import { SystemBadge } from '@@/Badge/SystemBadge';
|
||||
|
||||
import { columnHelper } from './helper';
|
||||
|
||||
export const name = columnHelper.accessor(
|
||||
(row) => {
|
||||
let result = row.Name;
|
||||
if (row.IsSystem) {
|
||||
result += ' system';
|
||||
}
|
||||
return result;
|
||||
},
|
||||
{
|
||||
header: 'Name',
|
||||
id: 'name',
|
||||
cell: ({ row }) => (
|
||||
<div className="flex gap-2">
|
||||
{row.original.Name}
|
||||
{row.original.IsSystem && <SystemBadge />}
|
||||
</div>
|
||||
),
|
||||
}
|
||||
);
|
|
@ -0,0 +1,32 @@
|
|||
import { Row } from '@tanstack/react-table';
|
||||
|
||||
import { filterHOC } from '@@/datatables/Filter';
|
||||
import { Link } from '@@/Link';
|
||||
|
||||
import { CronJob } from '../types';
|
||||
|
||||
import { columnHelper } from './helper';
|
||||
|
||||
export const namespace = columnHelper.accessor((row) => row.Namespace, {
|
||||
header: 'Namespace',
|
||||
id: 'namespace',
|
||||
cell: ({ getValue, row }) => (
|
||||
<Link
|
||||
to="kubernetes.resourcePools.resourcePool"
|
||||
params={{
|
||||
id: getValue(),
|
||||
}}
|
||||
title={getValue()}
|
||||
data-cy={`cronJob-namespace-link-${row.original.Name}`}
|
||||
>
|
||||
{getValue()}
|
||||
</Link>
|
||||
),
|
||||
meta: {
|
||||
filter: filterHOC('Filter by namespace'),
|
||||
},
|
||||
enableColumnFilter: true,
|
||||
filterFn: (row: Row<CronJob>, _columnId: string, filterValue: string[]) =>
|
||||
filterValue.length === 0 ||
|
||||
filterValue.includes(row.original.Namespace ?? ''),
|
||||
});
|
|
@ -0,0 +1,7 @@
|
|||
import { columnHelper } from './helper';
|
||||
|
||||
export const schedule = columnHelper.accessor((row) => row.Schedule, {
|
||||
header: 'Schedule',
|
||||
id: 'schedule',
|
||||
cell: ({ getValue }) => getValue(),
|
||||
});
|
|
@ -0,0 +1,10 @@
|
|||
import { columnHelper } from './helper';
|
||||
|
||||
export const suspend = columnHelper.accessor((row) => row.Suspend, {
|
||||
header: 'Suspend',
|
||||
id: 'suspend',
|
||||
cell: ({ getValue }) => {
|
||||
const suspended = getValue();
|
||||
return suspended ? 'Yes' : 'No';
|
||||
},
|
||||
});
|
|
@ -0,0 +1,7 @@
|
|||
import { columnHelper } from './helper';
|
||||
|
||||
export const timezone = columnHelper.accessor((row) => row.Timezone, {
|
||||
header: 'Timezone',
|
||||
id: 'timezone',
|
||||
cell: ({ getValue }) => getValue(),
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue