UNPKG

@openshift-assisted/ui-lib

Version:

React component library for the Assisted Installer UI

44 lines 2.75 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AgentTableEmptyState = exports.getAgentId = void 0; const tslib_1 = require("tslib"); const React = tslib_1.__importStar(require("react")); const EmptyState_1 = tslib_1.__importDefault(require("../../../common/components/ui/uiState/EmptyState")); const connected_icon_1 = require("@patternfly/react-icons/dist/js/icons/connected-icon"); const tableUtils_1 = require("../Agent/tableUtils"); const tableUtils_2 = require("../../../common/components/hosts/tableUtils"); const HostsTable_1 = tslib_1.__importStar(require("../../../common/components/hosts/HostsTable")); const usePagination_1 = require("../../../common/components/hosts/usePagination"); const use_translation_wrapper_1 = require("../../../common/hooks/use-translation-wrapper"); const agentStatus_1 = require("../helpers/agentStatus"); const getAgentId = (agent) => { var _a; return (_a = agent.metadata) === null || _a === void 0 ? void 0 : _a.uid; }; exports.getAgentId = getAgentId; const AgentTableEmptyState = () => { const { t } = (0, use_translation_wrapper_1.useTranslation)(); return (React.createElement(EmptyState_1.default, { icon: connected_icon_1.ConnectedIcon, title: t('ai:Waiting for hosts...'), content: t('ai:Hosts may take a few minutes to appear here after booting.') })); }; exports.AgentTableEmptyState = AgentTableEmptyState; const ClusterDeploymentDetailsTable = ({ agents, agentClusterInstall, }) => { const agentClusterInstalls = React.useMemo(() => [agentClusterInstall], [agentClusterInstall]); const [hosts, , actionResolver] = (0, tableUtils_1.useAgentsTable)({ agents, agentClusterInstalls }); const { t } = (0, use_translation_wrapper_1.useTranslation)(); const agentStatuses = (0, agentStatus_1.agentStatus)(t); const content = React.useMemo(() => [ (0, tableUtils_2.hostnameColumn)(t), (0, tableUtils_2.roleColumn)(t), (0, tableUtils_1.agentStatusColumn)({ agents, agentStatuses, t, }), (0, tableUtils_1.infraEnvColumn)(agents, t), (0, tableUtils_2.cpuCoresColumn)(t), (0, tableUtils_2.memoryColumn)(t), (0, tableUtils_2.disksColumn)(t), ], [agentStatuses, agents, t]); const paginationProps = (0, usePagination_1.usePagination)(agents.length); return (React.createElement(HostsTable_1.default, Object.assign({ hosts: hosts, content: content, actionResolver: actionResolver, ExpandComponent: HostsTable_1.DefaultExpandComponent }, paginationProps), React.createElement(exports.AgentTableEmptyState, null))); }; exports.default = ClusterDeploymentDetailsTable; //# sourceMappingURL=ClusterDeploymentDetailsTable.js.map