-
Notifications
You must be signed in to change notification settings - Fork 619
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use machine selectors from @console/shared
* update machine selector types to use specific kinds * remove selectors definition from machine module * use machine selectors from @console/shared in machine, machine-set and machine-deployment modules
- Loading branch information
Jiri Tomasek
committed
Jun 17, 2019
1 parent
5017a6f
commit 3c293aa
Showing
7 changed files
with
32 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
import * as _ from 'lodash-es'; | ||
|
||
import { K8sResourceKind } from '@console/internal/module/k8s'; | ||
import { | ||
MachineKind, | ||
MachineSetKind, | ||
MachineDeploymentKind, | ||
NodeKind, | ||
} from '@console/internal/module/k8s'; | ||
import { getName } from './common'; | ||
|
||
export const getMachineRole = (machine) => | ||
_.get(machine, ['metadata', 'labels', 'machine.openshift.io/cluster-api-machine-role']); | ||
export const getMachineNodeName = (machine) => _.get(machine, 'status.nodeRef.name'); | ||
export const getMachineRole = (obj: MachineKind | MachineSetKind | MachineDeploymentKind) => | ||
_.get(obj, ['metadata', 'labels', 'machine.openshift.io/cluster-api-machine-role']); | ||
export const getMachineNodeName = (obj: MachineKind) => _.get(obj, 'status.nodeRef.name'); | ||
export const getMachineAWSPlacement = (machine: MachineKind) => | ||
_.get(machine, 'spec.providerSpec.value.placement') || {}; | ||
|
||
export const getMachineNode = (machine: K8sResourceKind, nodes: K8sResourceKind[]) => | ||
export const getMachineNode = (machine: MachineKind, nodes: NodeKind[]) => | ||
nodes.find((node) => getMachineNodeName(machine) === getName(node)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { getMachineRole, DASH } from '@console/shared'; | ||
import { K8sResourceKind } from '@console/internal/module/k8s'; | ||
import { MachineKind } from '@console/internal/module/k8s'; | ||
|
||
type BaremetalHostRoleProps = { | ||
machine: K8sResourceKind; | ||
machine: MachineKind; | ||
}; | ||
export const BaremetalHostRole: React.FC<BaremetalHostRoleProps> = ({ machine }) => | ||
getMachineRole(machine) || DASH; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters