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

Add additional host, machine and node selectors #355

Merged
merged 4 commits into from
Apr 15, 2019

Conversation

jtomasek
Copy link

@jtomasek jtomasek commented Apr 15, 2019

@@ -0,0 +1,3 @@
import { get } from 'lodash';

export const getNodeUnschedulable = node => get(node, 'spec.unschedulable', false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isNodeUnschedulable?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -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);
Copy link
Contributor

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -0,0 +1,4 @@
import { find, get } from 'lodash';

export const getMachineNode = (nodes, machine) =>
Copy link
Contributor

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

export const getHostErrorMessage = host => get(host, 'status.errorMessage');
export const getHostPoweredOn = host => _.get(host, 'status.poweredOn');
Copy link
Contributor

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?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@coveralls
Copy link

coveralls commented Apr 15, 2019

Pull Request Test Coverage Report for Build 1243

  • 6 of 7 (85.71%) changed or added relevant lines in 4 files are covered.
  • 3 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.004%) to 87.336%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/selectors/machine/combined.js 1 2 50.0%
Files with Coverage Reduction New Missed Lines %
src/components/StorageOverview/StorageOverview.js 1 88.89%
src/utils/utils.js 2 81.25%
Totals Coverage Status
Change from base Build 1223: 0.004%
Covered Lines: 3384
Relevant Lines: 3714

💛 - Coveralls

import { getHostStatus, getSimpleHostStatus } from '../hostStatus';
import hostFixtures from '../fixtures/hostStatus.fixture';

describe('getHostStatus()', () => {
Copy link
Contributor

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

@atiratree atiratree merged commit a4e286d into kubevirt:master Apr 15, 2019
@jtomasek jtomasek deleted the add_selectors branch April 15, 2019 15:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants