From de42ae7bb8fd62b8db0f324bfb937ac04c5f0309 Mon Sep 17 00:00:00 2001 From: dshuffma-ibm Date: Wed, 6 Jul 2022 15:33:51 -0400 Subject: [PATCH] Fix systemless detection (#245) * fix systemless detection logic on orderer details * add empty state to orderer details * add more loading vars * update node as systemless after sys removal Signed-off-by: David Huffman --- .../apollo/src/assets/i18n/en/messages.json | 2 +- .../components/ChannelModal/ChannelModal.js | 2 +- .../ChannelParticipationDetails.js | 3 + .../ChannelParticipationUnjoinModal.js | 11 ++ .../OrdererDetails/OrdererDetails.js | 108 +++++++++++++----- .../StickySection/_stickySection.scss | 2 +- .../src/rest/ChannelParticipationApi.js | 9 +- .../json_validation/ibp_openapi_v3.yaml | 10 +- 8 files changed, 111 insertions(+), 36 deletions(-) diff --git a/packages/apollo/src/assets/i18n/en/messages.json b/packages/apollo/src/assets/i18n/en/messages.json index 75f684ed..eb69a03a 100644 --- a/packages/apollo/src/assets/i18n/en/messages.json +++ b/packages/apollo/src/assets/i18n/en/messages.json @@ -1207,7 +1207,7 @@ "empty_channels_title": "No channels available", "empty_channels_text": "You can create a channel using an ordering service you have provisioned or imported, or you can join a channel if you have the relevant details.", "empty_cp_channels_title": "No channels available", - "empty_cp_channels_text": "You can join the ordering node to a channel.", + "empty_cp_channels_text": "Join an orderer to a channel to view channels.", "empty_identities_title": "No identities available", "empty_identities_text": "Get started by creating a Certificate Authority and an organization MSP definition. You can then view your organization admin identity here and use it to interact with your network. You can also import identities if you have changed browsers.", "empty_installed_title": "No installed smart contracts", diff --git a/packages/apollo/src/components/ChannelModal/ChannelModal.js b/packages/apollo/src/components/ChannelModal/ChannelModal.js index 2215866b..e869f434 100644 --- a/packages/apollo/src/components/ChannelModal/ChannelModal.js +++ b/packages/apollo/src/components/ChannelModal/ChannelModal.js @@ -1424,7 +1424,7 @@ class ChannelModal extends Component { }); // [PATH 1] - using OSN Admin features in create channel wizard - if (this.props.osnadmin_feats_enabled && orderer && orderer.osnadmin_url) { + if (this.props.osnadmin_feats_enabled && orderer && orderer.osnadmin_url && orderer.systemless) { this.props.updateState(SCOPE, { use_osnadmin: true }); // change the menu options this.showStepsInTimeline(['osn_join_channel', 'channel_orderer_organizations']); this.hideStepsInTimeline(['ordering_service_organization', 'organization_creating_channel']); // but hide these diff --git a/packages/apollo/src/components/OrdererDetails/ChannelParticipationDetails.js b/packages/apollo/src/components/OrdererDetails/ChannelParticipationDetails.js index 79943623..3178c3ab 100644 --- a/packages/apollo/src/components/OrdererDetails/ChannelParticipationDetails.js +++ b/packages/apollo/src/components/OrdererDetails/ChannelParticipationDetails.js @@ -29,6 +29,7 @@ import ChannelParticipationModal from './ChannelParticipationModal'; import ChannelParticipationUnjoinModal from './ChannelParticipationUnjoinModal'; import JoinOSNChannelModal from '../JoinOSNChannelModal/JoinOSNChannelModal'; import _ from 'lodash'; +import emptyImage from '../../assets/images/empty_channels.svg'; const naturalSort = require('javascript-natural-sort'); const SCOPE = 'ChannelParticipationDetails'; @@ -144,11 +145,13 @@ class ChannelParticipationDetails extends Component { ( { @@ -211,6 +232,7 @@ class OrdererDetails extends Component { } }, 30000); this.checkHealth(orderer, skipStatusCache); + if (orderer.raft) { orderer.raft.forEach(node => { ComponentApi.getUsageInformation(node) @@ -256,6 +278,7 @@ class OrdererDetails extends Component { this.openNodeDetails(nodeToOpen); } } + return orderer; //this.props.updateState(SCOPE, { loading: false }); } @@ -274,7 +297,7 @@ class OrdererDetails extends Component { if (this.timestamp) { this.timestamp = 0; this.props.updateState(SCOPE, { notAvailable: false }); - if (!this.channelParticipationEnabled(this.props.details)) { + if (!this.isSystemLess(this.props.details)) { this.getSystemChannelConfig(); } } @@ -405,16 +428,22 @@ class OrdererDetails extends Component { members: this.getMsps(first_consortium.groups), admins: this.getMsps(resp.channel_group.groups.Orderer.groups), capabilities: this.getCapabilities(resp.channel_group), - loading: false, + sysChLoading: false, disabled: false, consenters: l_consenters.map(consenter => this.getConsenterNodeInfo(consenter)), }); }) .catch(error => { + if (this.isSystemLess(this.props.details)) { + // node's without system channel are expected to fail, don't show a warning. + // ideally this function wouldn't be called, but the timing is tricky and this might get called before we know the configuration by checkHealth() + return null; + } + Log.error(error); this.props.updateState(SCOPE, { disabled: true, - loading: false, + sysChLoading: false, }); if (error.message_key) { this.props.showError(error.message_key, { nodeName: error.nodeName }, SCOPE); @@ -1046,6 +1075,26 @@ class OrdererDetails extends Component { const groups = []; let hsm = Helper.getHSMBCCSP(_.get(this.props, 'selectedNode.config_override.General')) === 'PKCS11'; if (!hsm) hsm = Helper.getHSMBCCSP(_.get(this.props, 'selectedNode.config_override[0].General')) === 'PKCS11'; + + if (this.props.channelsLoading) { + groups.push({ + label: 'orderer_type', + value: translate('loading'), + }); + } else { + if (!this.props.selectedNode) { + groups.push({ + label: 'orderer_type', + value: this.isSystemLess(this.props.details) ? translate('systemless_config') : translate('system_config'), + }); + } else { + groups.push({ + label: 'orderer_type', + value: this.isSystemLess(this.props.selectedNode) ? translate('systemless_config') : translate('system_config'), + }); + } + } + if (this.props.selectedNode) { groups.push({ label: 'node_location', @@ -1216,7 +1265,7 @@ class OrdererDetails extends Component { text: 'add_orderer_node', fn: this.openAddOrdererNode, }); - } else if (ActionsHelper.canCreateComponent(this.props.userInfo) && this.channelParticipationEnabled(this.props.details)) { + } else if (ActionsHelper.canCreateComponent(this.props.userInfo) && this.isSystemLess(this.props.details)) { buttonsOnTheNodesTab.push({ text: 'add_orderer_node', fn: this.openAddOrdererNode, @@ -1395,22 +1444,23 @@ class OrdererDetails extends Component { - {!this.props.loading && this.channelParticipationEnabled(this.props.details) && !this.props.orderer_tls_identity && + {!this.props.loading && this.isSystemLess(this.props.details) && !this.props.orderer_tls_identity &&
} - {this.channelParticipationEnabled(this.props.details) && this.props.orderer_tls_identity && + {this.isSystemLess(this.props.details) && this.props.orderer_tls_identity && } - {!hasAssociatedIdentities && ( + {!this.props.loading && !hasAssociatedIdentities && (

{translate('orderer_no_identity')}

)} - {!this.channelParticipationEnabled(this.props.details) && hasAssociatedIdentities && ( + {!this.isSystemLess(this.props.details) && hasAssociatedIdentities && (
{this.renderPendingNotice(translate)} {this.renderRunningPartial(translate)} @@ -1432,7 +1482,7 @@ class OrdererDetails extends Component { configtxlator_url={this.props.configtxlator_url} onClose={this.onClose} ordererId={this.props.match.params.ordererId} - loading={this.props.loading} + loading={this.props.sysChLoading} disableAddItem={this.props.disabled} /> {this.renderConsenters(translate)} @@ -1505,7 +1555,7 @@ class OrdererDetails extends Component { {this.renderUsage(translate)} )} - {this.channelParticipationEnabled(this.props.selectedNode) && ( + {this.isSystemLess(this.props.selectedNode) && (