-
Notifications
You must be signed in to change notification settings - Fork 30
Add additional host, machine and node selectors #355
Conversation
src/selectors/node/selectors.js
Outdated
@@ -0,0 +1,3 @@ | |||
import { get } from 'lodash'; | |||
|
|||
export const getNodeUnschedulable = node => get(node, 'spec.unschedulable', false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isNodeUnschedulable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/utils/status/host/hostStatus.js
Outdated
@@ -18,3 +23,5 @@ export const getHostStatus = host => { | |||
export const getSimpleHostStatus = host => getHostStatus(host).status; | |||
|
|||
export const canHostAddMachine = host => [HOST_STATUS_READY].includes(getSimpleHostStatus(host)); | |||
export const canHostStartMaintenance = hostNode => hostNode && !getNodeUnschedulable(hostNode); | |||
export const canHostStopMaintenance = hostNode => hostNode && getNodeUnschedulable(hostNode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for hostNode &&
in canHostStopMaintenance
as getNodeUnschedulable returns false as default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/selectors/machine/selectors.js
Outdated
@@ -0,0 +1,4 @@ | |||
import { find, get } from 'lodash'; | |||
|
|||
export const getMachineNode = (nodes, machine) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please move this to combined.js
? There is a convention for this name in other folders when the selector includes multiple entities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/selectors/host/selectors.js
Outdated
export const getHostErrorMessage = host => get(host, 'status.errorMessage'); | ||
export const getHostPoweredOn = host => _.get(host, 'status.poweredOn'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isHostPoweredOn
? maybe also good to indicate default as false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Pull Request Test Coverage Report for Build 1243
💛 - Coveralls |
import { getHostStatus, getSimpleHostStatus } from '../hostStatus'; | ||
import hostFixtures from '../fixtures/hostStatus.fixture'; | ||
|
||
describe('getHostStatus()', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove this method or add .expected
results to fixtures
Ref kubevirt/web-ui#301