mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 07:49:41 +02:00
feat(helm): add registry dropdown [r8s-340] (#779)
This commit is contained in:
parent
c9e3717ce3
commit
1963edda66
16 changed files with 288 additions and 190 deletions
|
@ -1,4 +1,4 @@
|
|||
import { CellContext } from '@tanstack/react-table';
|
||||
import { CellContext, Row } from '@tanstack/react-table';
|
||||
import clsx from 'clsx';
|
||||
|
||||
import {
|
||||
|
@ -6,14 +6,22 @@ import {
|
|||
KubernetesApplicationTypes,
|
||||
} from '@/kubernetes/models/application/models/appConstants';
|
||||
|
||||
import { filterHOC } from '@@/datatables/Filter';
|
||||
|
||||
import styles from './columns.status.module.css';
|
||||
import { helper } from './columns.helper';
|
||||
import { ApplicationRowData } from './types';
|
||||
|
||||
export const status = helper.accessor('Status', {
|
||||
export const status = helper.accessor(getStatusSummary, {
|
||||
header: 'Status',
|
||||
cell: Cell,
|
||||
enableSorting: false,
|
||||
meta: {
|
||||
filter: filterHOC('Filter by status'),
|
||||
},
|
||||
enableColumnFilter: true,
|
||||
filterFn: (row: Row<ApplicationRowData>, _: string, filterValue: string[]) =>
|
||||
filterValue.length === 0 ||
|
||||
filterValue.includes(getStatusSummary(row.original)),
|
||||
});
|
||||
|
||||
function Cell({
|
||||
|
@ -67,3 +75,17 @@ function Cell({
|
|||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function getStatusSummary(item: ApplicationRowData): 'Ready' | 'Not Ready' {
|
||||
if (
|
||||
item.ApplicationType === KubernetesApplicationTypes.Pod &&
|
||||
item.Pods &&
|
||||
item.Pods.length > 0
|
||||
) {
|
||||
return item.Pods[0].Status === 'Running' ? 'Ready' : 'Not Ready';
|
||||
}
|
||||
return item.TotalPodsCount > 0 &&
|
||||
item.TotalPodsCount === item.RunningPodsCount
|
||||
? 'Ready'
|
||||
: 'Not Ready';
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import { CellContext } from '@tanstack/react-table';
|
||||
import { CellContext, Row } from '@tanstack/react-table';
|
||||
|
||||
import { isoDate, truncate } from '@/portainer/filters/filters';
|
||||
import { useIsSystemNamespace } from '@/react/kubernetes/namespaces/queries/useIsSystemNamespace';
|
||||
|
||||
import { Link } from '@@/Link';
|
||||
import { SystemBadge } from '@@/Badge/SystemBadge';
|
||||
import { filterHOC } from '@@/datatables/Filter';
|
||||
|
||||
import { Application } from './types';
|
||||
import { helper } from './columns.helper';
|
||||
|
@ -49,7 +50,15 @@ export const image = helper.accessor('Image', {
|
|||
});
|
||||
|
||||
export const appType = helper.accessor('ApplicationType', {
|
||||
header: 'Application Type',
|
||||
header: 'Application type',
|
||||
meta: {
|
||||
filter: filterHOC('Filter by application type'),
|
||||
},
|
||||
enableColumnFilter: true,
|
||||
filterFn: (row: Row<Application>, _: string, filterValue: string[]) =>
|
||||
filterValue.length === 0 ||
|
||||
(!!row.original.ApplicationType &&
|
||||
filterValue.includes(row.original.ApplicationType)),
|
||||
});
|
||||
|
||||
export const published = helper.accessor('Services', {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue