import * as React from 'react'; import { Link } from 'react-router-dom'; import { capitalize, pluralize, Skeleton } from '@patternfly/react-core'; import { APPLICATION_LIST_PATH } from '@routes/paths'; import { useApplications } from '~/hooks/useApplications'; import { RowFunctionArgs, TableData } from '~/shared'; import ActionMenu from '~/shared/components/action-menu/ActionMenu'; import { NAMESPACE_VISIBILITY_VALUES, NAMESPACE_VISIBILITY_LABEL } from '~/shared/providers/const'; import { NamespaceKind } from '~/types'; import { namespaceTableColumnClasses } from './NamespaceListHeader'; import { useNamespaceActions } from './useNamespaceActions'; const NamespaceListRow: React.FC>> = ({ obj, }) => { const [actions, , onToggle] = useNamespaceActions(obj); const [applications, loaded, error] = useApplications(obj.metadata.name); const namespaceVisibility = obj.metadata.labels?.[NAMESPACE_VISIBILITY_LABEL]; return ( <> {obj.metadata.name} {namespaceVisibility ? namespaceVisibility === NAMESPACE_VISIBILITY_VALUES.AUTHENTICATED ? 'Public' : capitalize(namespaceVisibility) : 'N/A'} {loaded ? ( error ? ( 'Failed to load applications' ) : ( pluralize(applications.length, 'Application') ) ) : ( )} ); }; export default NamespaceListRow;