UNPKG

@openshift-assisted/ui-lib

Version:

React component library for the Assisted Installer UI

37 lines 3.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const React = tslib_1.__importStar(require("react")); const react_core_1 = require("@patternfly/react-core"); const global_palette_green_500_1 = require("@patternfly/react-tokens/dist/js/global_palette_green_500"); const check_circle_icon_1 = require("@patternfly/react-icons/dist/js/icons/check-circle-icon"); const exclamation_circle_icon_1 = require("@patternfly/react-icons/dist/js/icons/exclamation-circle-icon"); const use_translation_wrapper_1 = require("../../../../common/hooks/use-translation-wrapper"); const common_1 = require("../../../../common"); const ConditionsTable_1 = tslib_1.__importDefault(require("./ConditionsTable")); const HostedClusterProgress = ({ hostedCluster, launchToOCP }) => { var _a, _b, _c, _d, _e; const { t } = (0, use_translation_wrapper_1.useTranslation)(); const [isExpanded, setExpanded] = React.useState(true); const availableCondtion = (_b = (_a = hostedCluster.status) === null || _a === void 0 ? void 0 : _a.conditions) === null || _b === void 0 ? void 0 : _b.find((c) => c.type === 'Available'); const progressingCondtion = (_d = (_c = hostedCluster.status) === null || _c === void 0 ? void 0 : _c.conditions) === null || _d === void 0 ? void 0 : _d.find((c) => c.type === 'Progressing'); let progressIcon = React.createElement(react_core_1.Spinner, { size: "md" }); if ((progressingCondtion === null || progressingCondtion === void 0 ? void 0 : progressingCondtion.status) === 'False') { progressIcon = (availableCondtion === null || availableCondtion === void 0 ? void 0 : availableCondtion.status) === 'True' ? (React.createElement(check_circle_icon_1.CheckCircleIcon, { color: global_palette_green_500_1.global_palette_green_500.value })) : (React.createElement(common_1.UiIcon, { size: "sm", status: "danger", icon: React.createElement(exclamation_circle_icon_1.ExclamationCircleIcon, null) })); } return (React.createElement(react_core_1.ProgressStep, { icon: progressIcon }, React.createElement(react_core_1.Stack, { hasGutter: true }, React.createElement(react_core_1.StackItem, null, React.createElement(react_core_1.ExpandableSectionToggle, { isExpanded: isExpanded, onToggle: setExpanded, className: "ai-progress-item__header" }, t('ai:Control plane'))), isExpanded && (React.createElement(React.Fragment, null, React.createElement(react_core_1.StackItem, { className: "ai-progress-item__body" }, React.createElement(ConditionsTable_1.default, { conditions: (_e = hostedCluster.status) === null || _e === void 0 ? void 0 : _e.conditions, isDone: (progressingCondtion === null || progressingCondtion === void 0 ? void 0 : progressingCondtion.status) === 'False' })), React.createElement(react_core_1.StackItem, { className: "ai-progress-item__body" }, React.createElement(common_1.ExternalLink, { onClick: () => { var _a, _b; return launchToOCP(`k8s/ns/${((_a = hostedCluster.metadata) === null || _a === void 0 ? void 0 : _a.namespace) || ''}-${((_b = hostedCluster.metadata) === null || _b === void 0 ? void 0 : _b.name) || ''}/pods`, true); } }, t('ai:Control plane pods')))))))); }; exports.default = HostedClusterProgress; //# sourceMappingURL=HostedClusterProgress.js.map