Skip to content
This repository has been archived by the owner on Apr 28, 2020. It is now read-only.

Commit

Permalink
Add utility to check if host can add machine (#333)
Browse files Browse the repository at this point in the history
Add host machine name selector
  • Loading branch information
Jiri Tomasek authored and rawagner committed Apr 12, 2019
1 parent b62c324 commit c8339af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/selectors/host/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ export const getProvisioningState = host => get(host, 'status.provisioning.state

export const getHostRole = hostMachine =>
get(hostMachine, ['metadata', 'labels', 'machine.openshift.io/cluster-api-machine-role']);

export const getHostMachineName = host => get(host, 'spec.machineRef.name');
4 changes: 3 additions & 1 deletion src/utils/status/host/hostStatus.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getOperationalStatus, getProvisioningState } from '../../../selectors';

import { HOST_STATUS_TO_TEXT } from './constants';
import { HOST_STATUS_TO_TEXT, HOST_STATUS_READY } from './constants';

export const getHostStatus = host => {
// Returns a status string based on the available host information.
Expand All @@ -16,3 +16,5 @@ export const getHostStatus = host => {
};

export const getSimpleHostStatus = host => getHostStatus(host).status;

export const canHostAddMachine = host => [HOST_STATUS_READY].includes(getSimpleHostStatus(host));

0 comments on commit c8339af

Please sign in to comment.