Skip to content

Commit

Permalink
fix error msg when changing channel capabilities (#532)
Browse files Browse the repository at this point in the history
* fix error msg when changing channel capabilities
* add error log if version is empty
* use version pretty print in more places
* update release notes
---------
Signed-off-by: David Huffman <dshuffma@us.ibm.com>
  • Loading branch information
dshuffma-ibm authored Oct 2, 2023
1 parent 4bac72a commit c497672
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 24 deletions.
30 changes: 15 additions & 15 deletions packages/apollo/src/assets/i18n/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@
"step_x_of_x": "Step ${currentStep} of ${totalSteps}",
"find_more_here": "Find out more here",
"upload_package": "Upload package",
"only_cds_packages": "Package file must be in .cds format. ${cc_limit} MB max file size. If you want to install a .tgz file for Fabric 2.x lifecycle, you can do so from either the peer or channel details page.",
"only_cds_packages": "Package file must be in .cds format. ${cc_limit} MB max file size. If you want to install a .tgz file for Fabric v2.x lifecycle, you can do so from either the peer or channel details page.",
"only_cds_or_tgz_packages": "Package file must be in .cds, .tar.gz, or .tgz format. ${cc_limit} MB max file size",
"only_json": "File must be in JSON format",
"error_install_peer": "An error occurred when installing smart contract on peer.",
Expand Down Expand Up @@ -1447,9 +1447,9 @@
"confirm_patch_desc": "This action cannot be undone. This will permanently upgrade ${name} to version ${version}. This will stop any transactions during the upgrade, which can take up to a minute to complete.",
"peer_breaking_upgrade_title": "Breaking upgrade",
"peer_breaking_title": "Version Warning",
"peer_breaking_upgrade": "The selected peer version is not always compatible with Node.js v8 chaincode (which was often used by Fabric 1.4). You should first upgrade to a peer that is compatible (such as v2.2.10). After updating your peer, update any node chaincode to be compatible with Node.js v16. Then you may upgrade your peer to the selected version.",
"peer_breaking_upgrade": "The selected peer version is not always compatible with Node.js v8 chaincode (which was often used by Fabric v1.4). You should first upgrade to a peer that is compatible (such as v2.2.10). After updating your peer, update any node chaincode to be compatible with Node.js v16. Then you may upgrade your peer to the selected version.",
"peer_breaking_upgrade_2": "The selected peer version is not compatible with Node.js v8 chaincode. You should first update all node chaincode to be compatible with Node.js v16. Then you may upgrade your peer to the selected version.",
"peer_breaking": "The selected peer version is not always compatible with Node.js v8 chaincode (which was often used by Fabric 1.4). It's recommended to use a version that is compatible (such as v2.2.10). This warning can be ignored if all node chaincode is compatible with Node.js v16.",
"peer_breaking": "The selected peer version is not always compatible with Node.js v8 chaincode (which was often used by Fabric v1.4). It's recommended to use a version that is compatible (such as v2.2.10). This warning can be ignored if all node chaincode is compatible with Node.js v16.",
"breaking_link_text": "Fabric documentation details",
"ignore_breaking_txt": "I understand this is a potentially breaking change. Upgrade anyway.",
"confirm_upgrade_node_name": "Node to be upgraded",
Expand Down Expand Up @@ -1927,7 +1927,7 @@
"channel_capabilities_desc1": "Every channel has three levels of capabilities to ensure that tasks are handled deterministically: one for the ordering service, one for transactions between peers, and \"channel\" capabilities for shared tasks.",
"create_channel_capabilities_desc2": "During channel creation, it is only possible to modify application level capabilities. The ordering service and channel capabilities are inherited from the ordering system channel and can only be modified through a channel configuration update, which will require the signature of an ordering service admin.",
"channel_capabilities_desc3": "Note that in order to use the latest features, it may be necessary to set the latest level of capabilities. For more information about capabilities, [[click here]](_CAPABILITIES_LINK01).",
"channel_warning_20": "There are some nodes in the cluster that are not Fabric 2.x. Ensure that all nodes are updated to 2.x before updating capabilities.",
"channel_warning_20": "There are some nodes in the cluster that are not Fabric v2.x. Ensure that all nodes are updated to v2.x before updating capabilities.",
"_CAPABILITIES_LINK01": "https://hyperledger-fabric.readthedocs.io/en/release-2.4/capabilities_concept.html",
"update_channel_capabilities_desc2": "With the exception of the application capabilities, which under certain circumstances can be set during channel creation, these capability levels are inherited by default from the ordering system channel.",
"create_channel_capabilities_important_box": "It is considered a best practice to upgrade your peers to the latest release. This is because a peer that is below the level of either the application or channel capability will crash upon attempting to join the channel and will have to be upgraded. While the application capability can be set here, you must contact an ordering service admin to learn the channel capability level before attempting to join a peer to the channel.",
Expand Down Expand Up @@ -2608,12 +2608,12 @@
"duplicate_mspid_error_title": "Duplicate MSP ID",
"review_lifecycle_policy_error": "Navigate to the Lifecycle endorsement policy section and select policy before submitting the request.",
"duplicate_mspid_error_desc": "Same MSP ID already exists for selected CA. Please enter a different MSP ID or choose another CA to continue.",
"channel_warning_20_single_application": "Node ${nodes} in the cluster is not at Fabric version 2.x. Upgrade this node to 2.x before updating the Application capability.",
"channel_warning_20_single_orderer": "Node ${nodes} in the cluster is not at Fabric version 2.x. Upgrade this node to 2.x before updating the Orderer capability.",
"channel_warning_20_single_channel": "Node ${nodes} in the cluster is not at Fabric version 2.x. Upgrade this node to 2.x before updating the Channel capability.",
"channel_warning_20_multi_application": "Nodes ${nodes} in the cluster are not at Fabric version 2.x. Upgrade all of the nodes to 2.x before updating the Application capability.",
"channel_warning_20_multi_orderer": "Nodes ${nodes} in the cluster are not at Fabric version 2.x. Upgrade all of the nodes to 2.x before updating the Orderer capability.",
"channel_warning_20_multi_channel": "Nodes ${nodes} in the cluster are not at Fabric version 2.x. Upgrade all of the nodes to 2.x before updating the Channel capability.",
"channel_warning_20_single_application": "Node ${nodes} in the cluster is not at Fabric version v2.x. Upgrade this node to v2.x before updating the Application capability.",
"channel_warning_20_single_orderer": "Node ${nodes} in the cluster is not at Fabric version v2.x. Upgrade this node to v2.x before updating the Orderer capability.",
"channel_warning_20_single_channel": "Node ${nodes} in the cluster is not at Fabric version v2.x. Upgrade this node to v2.x before updating the Channel capability.",
"channel_warning_20_multi_application": "Nodes ${nodes} in the cluster are not at Fabric version v2.x. Upgrade all of the nodes to v2.x before updating the Application capability.",
"channel_warning_20_multi_orderer": "Nodes ${nodes} in the cluster are not at Fabric version v2.x. Upgrade all of the nodes to v2.x before updating the Orderer capability.",
"channel_warning_20_multi_channel": "Nodes ${nodes} in the cluster are not at Fabric version v2.x. Upgrade all of the nodes to v2.x before updating the Channel capability.",
"channel_consenter_orderer_msp_tooltip": "Ordering service admins will be prompted with this field as the proposed channel configuration update requires their signature.",
"select_orderer_msp": "Select Orderer MSP",
"update_tls_certs": "Update orderer certificates",
Expand All @@ -2630,9 +2630,9 @@
"update_consenter_confirm": "Please type the name of the consenter to confirm:",
"confirm_remove_consenter_name_placeholder": "Enter the name of the consenter to be removed",
"confirm_update_consenter_name_placeholder": "Enter the name of the consenter to be updated",
"channel_warning_20_join_peer_application": "${peer} is at Fabric version V${peerVersion} while the Application capability for the channel is at ${channelVersion}. Ensure that the peer Fabric version is updated to 2.x before joining the channel.",
"channel_warning_20_join_peer_orderer": "${peer} is at Fabric version V${peerVersion} while the Orderer capability for the channel is at ${channelVersion}. Ensure that the peer Fabric version is updated to 2.x before joining the channel.",
"channel_warning_20_join_peer_channel": "${peer} is at Fabric version V${peerVersion} while the Channel capability for the channel is at ${channelVersion}. Ensure that the peer Fabric version is updated to 2.x before joining the channel.",
"channel_warning_20_join_peer_application": "${peer} is at Fabric version ${peerVersion} while the Application capability for the channel is at ${channelVersion}. Ensure that the peer Fabric version is updated to v2.x before joining the channel.",
"channel_warning_20_join_peer_orderer": "${peer} is at Fabric version ${peerVersion} while the Orderer capability for the channel is at ${channelVersion}. Ensure that the peer Fabric version is updated to v2.x before joining the channel.",
"channel_warning_20_join_peer_channel": "${peer} is at Fabric version ${peerVersion} while the Channel capability for the channel is at ${channelVersion}. Ensure that the peer Fabric version is updated to v2.x before joining the channel.",
"duplicate_msp_id_warning": "An organization with MSP ID \"${msp_id}\" has already been added. It is recommended that you do not use the same MSP ID.",
"remove_ca_user": "Remove CA User",
"remove_ca_user_desc": "This action will remove registered user ${enroll_id} from the Certificate Authority. Use with caution. While the existing certificate and private key for this user continue to be valid and can be used to transact on the network, you will not be able to enroll or reenroll (renew) the certificate.",
Expand All @@ -2656,9 +2656,9 @@
"cert_refresh_error": "An error occurred when refreshing certs.",
"refresh_certs": "Refresh Certs",
"non_admin_identity": "A Non-Admin identity is associated.",
"channel_nodeou_warning": "Please enable NodeOU for ${msps} before updating channel capability to 2.x",
"channel_nodeou_warning": "Please enable NodeOU for ${msps} before updating channel capability to v2.x",
"missing_endorsement_policy_title": "Endorsement policy missing for some organizations",
"missing_endorsement_policy_desc": "The organization-level endorsement policies needed to run the 2.x smart contract lifecycle are missing from <strong>${orgs}</strong> in this Consortium. To add the endorsement policies, remove and then re-add the MSPs.",
"missing_endorsement_policy_desc": "The organization-level endorsement policies needed to run the v2.x smart contract lifecycle are missing from <strong>${orgs}</strong> in this Consortium. To add the endorsement policies, remove and then re-add the MSPs.",
"peer_v1_v2_chaincode_title": "Existing Smart Contracts",
"peer_v1_v2_chaincode_desc": "Existing smart contracts that are installed on the peer may need to be updated in order to run correctly after the upgrade.",
"peer_v1_v2_chaincode_link": "${DOC_PREFIX}?topic=contracts-deploy-smart-fabric-v2x",
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo/src/components/CADetails/CADetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ export class CADetails extends Component {
if (this.props.details && (this.props.details.location === 'ibm_saas' || this.props.details.version)) {
groups.push({
label: 'node_version_title',
value: this.props.details && this.props.details.version ? this.props.details.version : translate('version_not_found'),
value: this.props.details && this.props.details.version ? Helper.prettyPrintVersion(this.props.details.version) : translate('version_not_found'),
loadingData: this.props.details && !this.props.details.name && !this.props.details.version,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ class JoinChannelModal extends React.Component {
<SidePanelWarning
title={translate(`channel_warning_20_join_peer_${x.type}`, {
peer: x.nodes.map(node => node.name),
peerVersion: x.nodes.map(node => node.version),
peerVersion: Helper.prettyPrintVersion(x.nodes.map(node => node.version)),
channelVersion: x.channelVersion,
})}
/>
Expand Down
3 changes: 2 additions & 1 deletion packages/apollo/src/components/NodeDetails/NodeDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import _ from 'lodash';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { withLocalize } from 'react-localize-redux';
import Helper from '../../utils/helper';

class NodeDetails extends Component {
getTitle() {
Expand Down Expand Up @@ -46,7 +47,7 @@ class NodeDetails extends Component {
<div className="node-details-field-value"
key={field + '-value'}
>
{_.get(this.props.node, field)}
{field === 'version' ? Helper.prettyPrintVersion(_.get(this.props.node, field)) : _.get(this.props.node, field)}
</div>,
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ class OrdererDetails extends Component {
label: 'node_location',
value: this.props.selectedNode.location ? translate(this.props.selectedNode.location) : '',
});
let versionLabel = this.props.selectedNode.version ? this.props.selectedNode.version : translate('version_not_found');
let versionLabel = this.props.selectedNode.version ? Helper.prettyPrintVersion(this.props.selectedNode.version) : translate('version_not_found');
if (this.props.selectedNode && this.props.selectedNode.isUnsupported) {
versionLabel = translate('unsupported');
}
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo/src/components/PeerDetails/PeerDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ class PeerDetails extends Component {
}

getStickySectionGroups(translate) {
let versionLabel = this.props.details && this.props.details.version ? this.props.details.version : translate('version_not_found');
let versionLabel = this.props.details && this.props.details.version ? Helper.prettyPrintVersion(this.props.details.version) : translate('version_not_found');
if (this.props.details && this.props.details.isUnsupported) {
versionLabel = translate('unsupported');
}
Expand Down
14 changes: 12 additions & 2 deletions packages/apollo/src/utils/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -1393,9 +1393,15 @@ const Helper = {
}
return 'v' + parts.join('.');
}
return str;
return '-';
},

// '2.0.0' -> 'v2.0.0'
// '2.0.0-5' -> 'v2.0.0-5'
// 'V2.0.0-5' -> 'v2.0.0-5'
prettyPrintVersion(str) {
return this.prettyPrintPolicy(str);
},

readLocalBinaryFile(file, limit) {
return new Promise((resolve, reject) => {
Expand Down Expand Up @@ -1501,10 +1507,13 @@ const Helper = {
return highest;
},

// return array of nodes that are using a fabric version older than v2.0
getPre20Nodes(nodes) {
let pre20Nodes = [];
nodes.forEach(node => {
if (!node.version || node.version.indexOf('2') !== 0) {
if (!node.version) {
console.error('cannot check if node is older than v2 b/c node does not have a "version" field', node);
} else if (this.version_matches_pattern('1.4.x', node.version)) {
pre20Nodes.push({
name: node.display_name || node.name,
version: node.version || '1.4.x',
Expand All @@ -1514,6 +1523,7 @@ const Helper = {
return pre20Nodes;
},

// check if the user has the right fabric versions on each relevant peer/orderer for the capability selected
validateCapability20Update(applicationCapability, ordererCapability, channelCapability, channelPeers, channelOrderers) {
let channel_warning_20 = false;
let channel_warning_20_details = [];
Expand Down
4 changes: 2 additions & 2 deletions packages/athena/public/releaseNotes.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"version": "1.0.6-3",
"date": "26 Sept 2023",
"version": "1.0.6-4",
"date": "02 Oct 2023",
"description": [
{
"title": "Bug & security fixes",
Expand Down

0 comments on commit c497672

Please sign in to comment.