@openshift-assisted/ui-lib
Version:
React component library for the Assisted Installer UI
33 lines • 1.99 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.isSomeDisksSkipFormatting = exports.canAbortInstallation = exports.getBuiltInOperators = exports.calculateCollectedLogsCount = exports.filterHostsByLogStates = exports.isAddHostsCluster = void 0;
// The Day2 cluster
const isAddHostsCluster = (cluster) => cluster.kind === 'AddHostsCluster';
exports.isAddHostsCluster = isAddHostsCluster;
const filterHostsByLogStates = (cluster, logStates) => { var _a; return ((_a = cluster.hosts) === null || _a === void 0 ? void 0 : _a.filter(({ logsInfo }) => logsInfo && logStates.includes(logsInfo))) || []; };
exports.filterHostsByLogStates = filterHostsByLogStates;
const calculateCollectedLogsCount = (cluster) => {
const collectedLogStates = ['completed', 'timeout'];
const clusterHasCollectedLogs = cluster.logsInfo && collectedLogStates.includes(cluster.logsInfo);
const hostsWithCollectedLogsCount = (0, exports.filterHostsByLogStates)(cluster, collectedLogStates).length;
return (clusterHasCollectedLogs ? 1 : 0) + hostsWithCollectedLogsCount;
};
exports.calculateCollectedLogsCount = calculateCollectedLogsCount;
const getBuiltInOperators = (monitoredOperators = []) => monitoredOperators.filter((operator) => operator.operatorType === 'builtin');
exports.getBuiltInOperators = getBuiltInOperators;
const canAbortInstallation = (cluster) => {
const allowedClusterStates = [
'preparing-for-installation',
'installing',
'installing-pending-user-action',
'finalizing',
];
return allowedClusterStates.includes(cluster.status);
};
exports.canAbortInstallation = canAbortInstallation;
const isSomeDisksSkipFormatting = (cluster) => {
var _a;
return (_a = cluster.hosts) === null || _a === void 0 ? void 0 : _a.some((host) => host.skipFormattingDisks && host.skipFormattingDisks.length > 0);
};
exports.isSomeDisksSkipFormatting = isSomeDisksSkipFormatting;
//# sourceMappingURL=utils.js.map
;