diff options
author | Zuul <zuul@review.opendev.org> | 2022-09-17 00:16:22 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2022-09-17 00:16:22 +0000 |
commit | c2ce5a7111a7622ebedbc2b5af201a2ba0b81f17 (patch) | |
tree | 87abe9b2279f60ad5556aabfd84a069a57d6eab8 | |
parent | 8e594caf65c8f7727b2e10c78ae6ee5907ba101b (diff) | |
parent | bb71a0d133aa74e0668e1fadb0b57d4b4c2ffe72 (diff) | |
download | zuul-c2ce5a7111a7622ebedbc2b5af201a2ba0b81f17.tar.gz |
Merge "web: refactor console item generation"
-rw-r--r-- | web/src/containers/build/Console.jsx | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/web/src/containers/build/Console.jsx b/web/src/containers/build/Console.jsx index 96ccb95e9..cf3ab841a 100644 --- a/web/src/containers/build/Console.jsx +++ b/web/src/containers/build/Console.jsx @@ -215,7 +215,7 @@ class HostTask extends React.Component { // their results that show command output, etc. These plays get // an expansion that shows these values without having to click // and bring up the full insepction modal. - const interestingKeys = hasInterestingKeys(this.props.host, INTERESTING_KEYS) + const interestingKeys = hasInterestingKeys(host, INTERESTING_KEYS) let name = task.task.name if (!name) { @@ -302,27 +302,28 @@ class HostTask extends React.Component { const content = <TaskOutput data={this.props.host} include={INTERESTING_KEYS}/> - const expandableItem = <DataListItem isExpanded={this.state.expanded}> - <DataListItemRow> - <DataListToggle - onClick={() => {this.setState({expanded: !this.state.expanded})}} - isExpanded={this.state.expanded} - /> - <DataListItemCells dataListCells={ dataListCells } /> - </DataListItemRow> - <DataListContent - isHidden={!this.state.expanded}> - { content } - </DataListContent> - </DataListItem> - - const regularItem = <DataListItem> - <DataListItemRow> - <DataListItemCells dataListCells={ dataListCells } /> - </DataListItemRow> - </DataListItem> - - const item = interestingKeys ? expandableItem : regularItem + let item = null + if (interestingKeys) { + item = <DataListItem isExpanded={this.state.expanded}> + <DataListItemRow> + <DataListToggle + onClick={() => {this.setState({expanded: !this.state.expanded})}} + isExpanded={this.state.expanded} + /> + <DataListItemCells dataListCells={ dataListCells } /> + </DataListItemRow> + <DataListContent + isHidden={!this.state.expanded}> + { content } + </DataListContent> + </DataListItem> + } else { + item = <DataListItem> + <DataListItemRow> + <DataListItemCells dataListCells={ dataListCells } /> + </DataListItemRow> + </DataListItem> + } const modalDescription = <Flex> <FlexItem>{label}</FlexItem> |