import { SortByDirection, ThProps } from '@patternfly/react-table'; import HelpPopover from '~/components/HelpPopover'; import { ComponentProps } from '~/shared/components/table/Table'; import { createTableHeaders } from '~/shared/components/table/utils'; export const releaseTableColumnClasses = { name: 'pf-m-width-20 pf-m-width-10-on-xl wrap-column', status: 'pf-m-width-20 pf-m-width-10-on-xl', completionTime: 'pf-m-width-20 pf-m-width-10-on-xl', component: 'pf-m-width-20 pf-m-width-10-on-xl', application: 'pf-m-width-20 pf-m-width-10-on-xl', releasePlan: 'pf-m-width-20 pf-m-width-10-on-xl', product: 'pf-m-width-20 pf-m-width-10-on-xl', productVersion: 'pf-m-width-20 pf-m-width-10-on-xl', namespace: 'pf-m-width-20 pf-m-width-10-on-xl', kebab: 'pf-v6-c-table__action', } as const; export type ReleaseMonitorColumnKey = keyof typeof releaseTableColumnClasses; export enum SortableHeaders { // Column indices must match the actual table column order name = 0, completionTime = 2, } const releaseColumns = [ { title: 'Name', className: releaseTableColumnClasses.name, sortable: true, }, { title: 'Status', className: releaseTableColumnClasses.status, }, { title: 'Completion Time', className: releaseTableColumnClasses.completionTime, sortable: true, }, { title: 'Component', className: releaseTableColumnClasses.component, }, { title: 'Application', className: releaseTableColumnClasses.application, }, { title: 'Release Plan', className: releaseTableColumnClasses.releasePlan, }, { title: 'Namespace', className: releaseTableColumnClasses.namespace, }, { title: ( <> Product{' '} ), className: releaseTableColumnClasses.product, }, { title: ( <> Product Version{' '} ), className: releaseTableColumnClasses.productVersion, }, { title: ' ', className: releaseTableColumnClasses.kebab, }, ] satisfies Parameters[0]; export const getReleasesListHeader = ( activeSortIndex: number, activeSortDirection: SortByDirection, onSort: ThProps['sort']['onSort'], ) => { return (componentProps: ComponentProps) => { return createTableHeaders(releaseColumns)(activeSortIndex, activeSortDirection, onSort)( componentProps, ); }; }; export default createTableHeaders(releaseColumns);