Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

library update issue fixes #741

Merged
merged 5 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/apollo/src/assets/i18n/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,7 @@
"orderer_storage_warning": "Storage can only be set during the creation of an ordering service. Please plan around this when sizing below.",
"peer_storage_warning": "Storage can only be set during the creation of a peer. Please plan around this when sizing below.",
"usage": "Usage",
"usage_info": "Info and usage {{patch}}",
"usage_info": "Info and usage",
"not_available_for_free_cluster": "Usage information is not available for free clusters.",
"resource_allocation_desc": "Please refer to your cluster configuration when setting these values because this console does not manage them for you.",
"import_resource_desc": "If you are uncertain what values to set, these default values are acceptable for a standard cluster. Storage on these containers cannot be adjusted after creation using this console. The CPU and memory can be adjusted at any time as long as resources exist in your cluster.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ BlockchainTooltip.propTypes = {
triggerText: PropTypes.any,
noIcon: PropTypes.bool,
type: PropTypes.oneOf(['definition', 'standard']),
tooltipText: PropTypes.string,
tooltipText: PropTypes.any,
withCheckbox: PropTypes.bool,
};

Expand Down
128 changes: 54 additions & 74 deletions packages/apollo/src/components/CADetails/CADetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Button, Row, SkeletonPlaceholder, SkeletonText, Tab, TabList, TabPanel, TabPanels, Tabs } from "@carbon/react";
*/
import { Button, Row, SkeletonPlaceholder, SkeletonText, Tab, TabList, TabPanel, TabPanels, Tabs } from '@carbon/react';
import _ from 'lodash';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
Expand Down Expand Up @@ -59,7 +59,7 @@ export class CADetails extends Component {
this.props.clearNotifications(SCOPE);
}

getDetails = skipStatusCache => {
getDetails = (skipStatusCache) => {
this.props.updateState(SCOPE, {
loading: true,
affiliations: [],
Expand All @@ -71,7 +71,7 @@ export class CADetails extends Component {
usageInfo: null,
});
CertificateAuthorityRestApi.getCADetails(this.props.match.params.caId, null, skipStatusCache)
.then(async details => {
.then(async (details) => {
this.props.updateBreadcrumb('breadcrumb_name', { name: details.name }, this.pathname);
try {
// Get complete config from deployer because the value stored in database stores only the latest config override json
Expand All @@ -91,7 +91,7 @@ export class CADetails extends Component {
// after 15 (or 5) seconds, if we do not have a response, show
// the not available message
if (this.timestamp) {
this.props.updateState(SCOPE, { notAvailable: true, loading: false, });
this.props.updateState(SCOPE, { notAvailable: true, loading: false });
}
},
details.associatedIdentity ? 15000 : 5000
Expand All @@ -110,14 +110,14 @@ export class CADetails extends Component {
}
);
NodeRestApi.getCompsResources(details)
.then(usageInfo => {
.then((usageInfo) => {
this.props.updateState(SCOPE, { usageInfo });
})
.catch(error => {
.catch((error) => {
Log.error(error);
});
})
.catch(error => {
.catch((error) => {
Log.error(error);
this.props.updateState(SCOPE, {
details: null,
Expand All @@ -142,13 +142,13 @@ export class CADetails extends Component {
}
this.props.updateState(SCOPE, { loading: true });
CertificateAuthorityRestApi.getUsers(details)
.then(users => {
.then((users) => {
this.props.updateState(SCOPE, {
users,
});
this.getAffiliations(details);
})
.catch(error => {
.catch((error) => {
Log.error(error);
this.props.updateState(SCOPE, {
users: [],
Expand All @@ -161,12 +161,12 @@ export class CADetails extends Component {

getAffiliations(details) {
CertificateAuthorityRestApi.getAffiliations(details)
.then(list => {
.then((list) => {
const affiliations = [];
list.forEach(org => {
list.forEach((org) => {
affiliations.push({ name: org.name });
if (org.affiliations) {
org.affiliations.forEach(a => {
org.affiliations.forEach((a) => {
affiliations.push(a);
});
}
Expand All @@ -176,7 +176,7 @@ export class CADetails extends Component {
loading: false,
});
})
.catch(error => {
.catch((error) => {
Log.error(error);
this.props.updateState(SCOPE, {
affiliations: [],
Expand All @@ -193,31 +193,31 @@ export class CADetails extends Component {
this.props.updateState(SCOPE, { showAddUser: false });
};

generateCertificate = selected_user => {
generateCertificate = (selected_user) => {
this.props.updateState(SCOPE, { showCertificate: true, selectedUser: selected_user });
};

closeCertificate = () => {
this.props.updateState(SCOPE, { showCertificate: false });
};

showDeleteUserModal = selected_user => {
showDeleteUserModal = (selected_user) => {
this.props.updateState(SCOPE, { showDeleteUser: true, selectedUser: selected_user });
};

closeDeleteUser = () => {
this.props.updateState(SCOPE, { showDeleteUser: false });
};

showUserDetails = user => {
showUserDetails = (user) => {
this.props.updateState(SCOPE, { userDetails: user });
};

hideUserDetails = () => {
this.props.updateState(SCOPE, { userDetails: null });
};

openCASettings = type => {
openCASettings = (type) => {
this.props.updateState(SCOPE, {
showSettings: true,
caModalType: type,
Expand All @@ -228,7 +228,7 @@ export class CADetails extends Component {
this.props.updateState(SCOPE, { showSettings: false });
};

showGenerateCert = user => {
showGenerateCert = (user) => {
this.generateCertificate(user);
};

Expand All @@ -242,29 +242,25 @@ export class CADetails extends Component {
this.generateCertificate(null);
},
disabled: !ActionsHelper.canManageComponent(this.props.userInfo, this.props.feature_flags),
decoupleFromLoading: true
decoupleFromLoading: true,
});
buttons.push({
text: 'register_user',
fn: this.openAddUser,
icon: 'plus',
disabled: !ActionsHelper.canManageComponent(this.props.userInfo, this.props.feature_flags),
decoupleFromLoading: true
decoupleFromLoading: true,
});
}
return buttons;
}

renderItemContainer(translate) {
return (
<div id="user-container"
className="ibp__user--container"
>
<div id="user-container" className="ibp__user--container">
{this.props.notAvailable && this.props.loading && (
<div className="ibp-not-available ibp-error-panel">
<SidePanelWarning title="ca_not_available_title"
subtitle="ca_not_available_text"
/>
<SidePanelWarning title="ca_not_available_title" subtitle="ca_not_available_text" />
</div>
)}
{this.props.details && !this.props.details.associatedIdentity ? (
Expand All @@ -282,7 +278,7 @@ export class CADetails extends Component {
loading={this.props.loading}
items={this.props.users}
select={this.showUserDetails}
menuItems={user => [
menuItems={(user) => [
{
text: 'generate_cert',
fn: () => {
Expand Down Expand Up @@ -322,13 +318,13 @@ export class CADetails extends Component {
);
}

generateComplete = name => {
generateComplete = (name) => {
if (!this.props.details.associatedIdentity) {
IdentityApi.associateCertificateAuthority(name, this.props.details.id)
.then(() => {
this.getDetails(true);
})
.catch(error => {
.catch((error) => {
this.showError('error_associate_identity');
});
}
Expand Down Expand Up @@ -360,9 +356,7 @@ export class CADetails extends Component {
) : (
<div>
<p>{translate('ca_no_identity')}</p>
<Button id="no-identity-button"
onClick={() => this.openCASettings('associate')}
>
<Button id="no-identity-button" onClick={() => this.openCASettings('associate')}>
{translate('associate_identity')}
</Button>
</div>
Expand All @@ -386,7 +380,7 @@ export class CADetails extends Component {
let upgrade_version = null;
if (isUpgradeAvailable) {
className = className + ' ibp-upgrade-available';
this.props.details.upgradable_versions.forEach(ver => {
this.props.details.upgradable_versions.forEach((ver) => {
if (upgrade_version === null || semver.gt(ver, upgrade_version)) {
upgrade_version = ver;
}
Expand All @@ -410,11 +404,7 @@ export class CADetails extends Component {
>
{translate('view_release_notes')}
</a>
<Button id="patch_node"
kind="primary"
className="ibp-patch-button"
onClick={() => this.openCASettings('upgrade')}
>
<Button id="patch_node" kind="primary" className="ibp-patch-button" onClick={() => this.openCASettings('upgrade')}>
{translate('update_version')}
</Button>
</div>
Expand Down Expand Up @@ -596,10 +586,7 @@ export class CADetails extends Component {
return (
<PageContainer>
<Row>
<PageHeader
history={this.props.history}
headerName={caName ? translate('ca_details_title', { caName: caName }) : ''}
/>
<PageHeader history={this.props.history} headerName={caName ? translate('ca_details_title', { caName: caName }) : ''} />
</Row>

<Row>
Expand Down Expand Up @@ -628,36 +615,32 @@ export class CADetails extends Component {
<div className="ibp-column width-75 p-lr-10">
<Tabs className="ibp-tabs-container" aria-label="sub-navigation">
<TabList contained>
<Tab id="ibp-ca-detail-tab-root-ca">
{translate('details')}
</Tab>
<Tab id="ibp-ca-detail-tab-root-ca">{translate('details')}</Tab>
{this.props.details && (
<Tab
id="ibp-ca-usage"
className={
this.props.details &&
this.props.details.isUpgradeAvailable &&
this.props.details.location === 'ibm_saas' &&
ActionsHelper.canCreateComponent(this.props.userInfo, this.props.feature_flags)
this.props.details.isUpgradeAvailable &&
this.props.details.location === 'ibm_saas' &&
ActionsHelper.canCreateComponent(this.props.userInfo, this.props.feature_flags)
? 'ibp-patch-available-tab'
: ''
}
>
{translate('usage_info', {
patch:
this.props.details &&
this.props.details.isUpgradeAvailable &&
this.props.details.location === 'ibm_saas' &&
ActionsHelper.canCreateComponent(this.props.userInfo, this.props.feature_flags) ?
(<div className="ibp-details-patch-container">
<div className="ibp-patch-available-tag ibp-node-details"
onClick={() => this.openCASettings('upgrade')}
>
{translate('patch_available')}
</div>
</div>
) : (''),
})}
{translate('usage_info')}
{this.props.details &&
this.props.details.isUpgradeAvailable &&
this.props.details.location === 'ibm_saas' &&
ActionsHelper.canCreateComponent(this.props.userInfo, this.props.feature_flags) ? (
<div className="ibp-details-patch-container">
<div className="ibp-patch-available-tag ibp-node-details" onClick={() => this.openCASettings('upgrade')}>
{translate('patch_available')}
</div>
</div>
) : (
''
)}
</Tab>
)}
</TabList>
Expand All @@ -669,9 +652,7 @@ export class CADetails extends Component {
{this.renderItemContainer(translate)}
</div>
</TabPanel>
{this.props.details && <TabPanel>
{this.renderUsage(translate)}
</TabPanel>}
{this.props.details && <TabPanel>{this.renderUsage(translate)}</TabPanel>}
</TabPanels>
</Tabs>
</div>
Expand All @@ -689,7 +670,8 @@ export class CADetails extends Component {
</div>
<div>
{this.props.showDeleteUser && (
<DeleteCAUserModal ca={this.props.details}
<DeleteCAUserModal
ca={this.props.details}
selectedUser={this.props.selectedUser}
onClose={this.closeDeleteUser}
onComplete={() => {
Expand Down Expand Up @@ -718,18 +700,16 @@ export class CADetails extends Component {
onComplete={() => {
this.props.updateState(SCOPE, { usageInfo: null });
NodeRestApi.getCompsResources(this.props.details)
.then(usageInfo => {
.then((usageInfo) => {
this.props.updateState(SCOPE, { usageInfo });
})
.catch(error => {
.catch((error) => {
Log.error(error);
});
}}
/>
)}
{!!this.props.userDetails && <UserDetailsModal user={this.props.userDetails}
onClose={this.hideUserDetails}
/>}
{!!this.props.userDetails && <UserDetailsModal user={this.props.userDetails} onClose={this.hideUserDetails} />}
{this.props.showSettings && (
<CAModal
associatedIdentity={this.props.details.associatedIdentity}
Expand Down Expand Up @@ -787,7 +767,7 @@ CADetails.propTypes = {
};

export default connect(
state => {
(state) => {
let newProps = Helper.mapStateToProps(state[SCOPE], dataProps);
newProps.clusterType = _.get(state, 'settings.cluster_data.type');
newProps['userInfo'] = state['userInfo'] ? state['userInfo'] : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@
height: 2.5rem;
margin-left: 1.5rem;
white-space: nowrap;
margin-bottom: 0;
}

.ibp-add-admin,
Expand All @@ -466,6 +467,7 @@
margin-left: 1.5rem;
width: 7rem;
white-space: nowrap;
margin-bottom: 0;
}

.ibp-reset-admin,
Expand Down
4 changes: 2 additions & 2 deletions packages/apollo/src/components/Form/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -822,10 +822,10 @@ class Form extends Component {
id={this.props.id + '-' + optionId}
name={optionValue}
className={`ibp-multi-select-item ${disabled ? 'ibp-multi-select-item-disabled' : ''}`}
handleClick={() => {
onClick={() => {
this.onMultiSelectChange(field, option);
}}
handleKeyDown={evt => {
onKeyDown={evt => {
if (evt.which === null) {
this.onMultiSelectChange(field, option);
}
Expand Down
Loading
Loading