From 5a7488b9339941063c3d41709aa8ea5ecd772b09 Mon Sep 17 00:00:00 2001 From: sg00dwin Date: Fri, 1 Mar 2019 17:00:28 -0500 Subject: [PATCH] Updates to Machine, MachineSets - Rename machines sidnav item to "Compute" - Move Nodes into the sidenav Compute section - Add machines column into Nodes list view - Remove orphaned code - Add horizontal separator between Machine Config and Machine Config pools Console story - https://jira.coreos.com/browse/CONSOLE-1284 --- .../tests/performance.scenario.ts | 2 +- frontend/public/components/machine.tsx | 26 +++++--- frontend/public/components/nav.jsx | 16 +++-- frontend/public/components/node.tsx | 62 ++++++------------- frontend/public/features.ts | 4 -- 5 files changed, 44 insertions(+), 66 deletions(-) diff --git a/frontend/integration-tests/tests/performance.scenario.ts b/frontend/integration-tests/tests/performance.scenario.ts index 265bdb2d3f8..cba819b23d6 100644 --- a/frontend/integration-tests/tests/performance.scenario.ts +++ b/frontend/integration-tests/tests/performance.scenario.ts @@ -26,7 +26,7 @@ const chunkedRoutes = OrderedMap() .set('storage-class', {section: 'Storage', name: 'Storage Classes'}) .set('build-config', {section: 'Builds', name: 'Build Configs'}) .set('image-stream', {section: 'Builds', name: 'Image Streams'}) - .set('node', {section: 'Administration', name: 'Nodes'}) + .set('node', {section: 'Compute', name: 'Nodes'}) .set('service-account', {section: 'Administration', name: 'Service Accounts'}) .set('resource-quota', {section: 'Administration', name: 'Resource Quotas'}) .set('limit-range', {section: 'Administration', name: 'Limit Ranges'}) diff --git a/frontend/public/components/machine.tsx b/frontend/public/components/machine.tsx index 94f377bef99..60583feb27b 100644 --- a/frontend/public/components/machine.tsx +++ b/frontend/public/components/machine.tsx @@ -25,26 +25,34 @@ const getAWSPlacement = (machine: MachineKind) => _.get(machine, 'spec.providerS export const getMachineRole = (obj: MachineKind | MachineSetKind | MachineDeploymentKind) => _.get(obj, ['metadata', 'labels', 'sigs.k8s.io/cluster-api-machine-role']); +const getNodeName = (obj) => _.get(obj, 'status.nodeRef.name'); + const MachineHeader = props => - Name - Namespace - Region - Availability Zone + Name + Namespace + Node + Region + Availability Zone ; const MachineRow: React.SFC = ({obj}: {obj: MachineKind}) => { const { availabilityZone, region } = getAWSPlacement(obj); + const nodeName = getNodeName(obj); + return
-
+
-
+
-
+
+ {nodeName ? : '-'} +
+
{region || '-'}
-
+
{availabilityZone || '-'}
@@ -54,7 +62,7 @@ const MachineRow: React.SFC = ({obj}: {obj: MachineKind}) => { }; const MachineDetails: React.SFC = ({obj}: {obj: MachineKind}) => { - const nodeName = _.get(obj, 'status.nodeRef.name'); + const nodeName = getNodeName(obj); const machineRole = getMachineRole(obj); const { availabilityZone, region } = getAWSPlacement(obj); return diff --git a/frontend/public/components/nav.jsx b/frontend/public/components/nav.jsx index 14f517383f1..fd9d87cc996 100644 --- a/frontend/public/components/nav.jsx +++ b/frontend/public/components/nav.jsx @@ -140,9 +140,7 @@ HrefLink.propTypes = { const navSectionStateToProps = (state, {required}) => { const flags = state[featureReducerName]; - // `required` can either be a single flag or array. Cast to an array when it's a single value. - const requiredArray = required ? _.castArray(required) : []; - const canRender = _.every(requiredArray, flag => flags.get(flag)); + const canRender = required ? flags.get(required) : true; return { flags, canRender, @@ -374,17 +372,17 @@ export const Navigation = ({ isNavOpen, onNavSelect }) => { - - - - - + + + + + + - diff --git a/frontend/public/components/node.tsx b/frontend/public/components/node.tsx index d48e2f6a05b..5d794f94512 100644 --- a/frontend/public/components/node.tsx +++ b/frontend/public/components/node.tsx @@ -30,6 +30,16 @@ const menuActions = [MarkAsSchedulable, MarkAsUnschedulable, ModifyLabels, Modif const NodeKebab = ({node}) => ; +const getMachine = (node: K8sResourceKind) => { + const machine = _.get(node, 'metadata.annotations["machine.openshift.io/machine"]'); + if (!machine) { + return null; + } + + const [namespace, name] = machine.split('/'); + return { namespace, name }; +}; + export const NodeIPList = ({ips, expand = false}) =>
{_.sortBy(ips, ['type']).map((ip, i) => ip.address &&
{(expand || ip.type === 'InternalIP') &&

@@ -44,29 +54,25 @@ const Header = props => { return null; } return - Node Name - Status - Node Addresses + Node Name + Status + Machine + Node Addresses ; }; -const HeaderSearch = props => - Node Name - Status - Node Labels - Node Addresses -; - const NodeStatus = ({node}) => ; const NodeRow = ({obj: node, expand}) => { + const machine = getMachine(node); return -

+
-
-
+
+
+
{expand &&
} @@ -76,27 +82,7 @@ const NodeRow = ({obj: node, expand}) => { ; }; -const NodeRowSearch = ({obj: node}) =>
-
- -
-
- -
-
- -
-
- -
-
- -
-
; - -// We have different list layouts for the Nodes page list and the Search page list const NodesList = props => ; -export const NodesListSearch = props => ; const filters = [{ type: 'node-status', @@ -141,16 +127,6 @@ const NodeGraphs = requirePrometheus(({node}) => { ; }); -const getMachine = (node: K8sResourceKind) => { - const machine = _.get(node, 'metadata.annotations.machine'); - if (!machine) { - return null; - } - - const [namespace, name] = machine.split('/'); - return { namespace, name }; -}; - const Details = ({obj: node}) => { const images = _.filter(node.status.images, 'names'); const machine = getMachine(node); diff --git a/frontend/public/features.ts b/frontend/public/features.ts index 4eed22d2a0f..d02e3d00874 100644 --- a/frontend/public/features.ts +++ b/frontend/public/features.ts @@ -55,7 +55,6 @@ export enum FLAGS { CAN_LIST_PV = 'CAN_LIST_PV', CAN_LIST_STORE = 'CAN_LIST_STORE', CAN_LIST_CRD = 'CAN_LIST_CRD', - CAN_LIST_MACHINE_CONFIG = 'CAN_LIST_MACHINE_CONFIG', CAN_CREATE_PROJECT = 'CAN_CREATE_PROJECT', SHOW_OPENSHIFT_START_GUIDE = 'SHOW_OPENSHIFT_START_GUIDE', SERVICE_CATALOG = 'SERVICE_CATALOG', @@ -241,9 +240,6 @@ const ssarChecks = [{ }, { flag: FLAGS.CAN_LIST_CRD, resourceAttributes:{ group: 'apiextensions.k8s.io', resource: 'customresourcedefinitions', verb: 'list' }, -}, { - flag: FLAGS.CAN_LIST_MACHINE_CONFIG, - resourceAttributes:{ group: MachineConfigModel.apiGroup, resource: MachineConfigModel.plural, verb: 'list' }, }]; ssarChecks.forEach(({flag, resourceAttributes, after}) => {