From f3bd104d0015f540ff8959a7d26648593995cd10 Mon Sep 17 00:00:00 2001 From: Mark Reynolds Date: Apr 24 2020 16:55:56 +0000 Subject: Issue 51047 - React deprecating ComponentWillMount Description: ComponentWillMount has been deemed as unsafe, switching to ComponentDidMount is the preferred solution and does not seem to affect the UX. Fixes: https://pagure.io/389-ds-base/issue/51047 Reviewed by: spichugi(Thanks!) --- diff --git a/src/cockpit/389-console/src/ds.jsx b/src/cockpit/389-console/src/ds.jsx index 7ff8b03..90d9e5a 100644 --- a/src/cockpit/389-console/src/ds.jsx +++ b/src/cockpit/389-console/src/ds.jsx @@ -60,7 +60,7 @@ const staticStates = { }; export class DSInstance extends React.Component { - componentWillMount() { + componentDidMount() { this.loadInstanceList(); this.updateProgress(25); } diff --git a/src/cockpit/389-console/src/lib/database/chaining.jsx b/src/cockpit/389-console/src/lib/database/chaining.jsx index b67c562..d6d6486 100644 --- a/src/cockpit/389-console/src/lib/database/chaining.jsx +++ b/src/cockpit/389-console/src/lib/database/chaining.jsx @@ -45,6 +45,7 @@ export class ChainingDatabaseConfig extends React.Component { defBindRetryLimit: this.props.data.defBindRetryLimit, defConcurLimit: this.props.data.defConcurLimit, defConcurOpLimit: this.props.data.defConcurOpLimit, + defConcurBindLimit: this.props.data.defConcurBindLimit, defConnLife: this.props.data.defConnLife, defHopLimit: this.props.data.defHopLimit, defDelay: this.props.data.defDelay, @@ -539,14 +540,6 @@ export class ChainingDatabaseConfig extends React.Component { - - Abandoned Op Check Interval - - - - - - Max LDAP Connections @@ -567,7 +560,7 @@ export class ChainingDatabaseConfig extends React.Component { Max Binds Per Connection - + diff --git a/src/cockpit/389-console/src/lib/database/globalPwp.jsx b/src/cockpit/389-console/src/lib/database/globalPwp.jsx index d3cac0d..c202ca6 100644 --- a/src/cockpit/389-console/src/lib/database/globalPwp.jsx +++ b/src/cockpit/389-console/src/lib/database/globalPwp.jsx @@ -103,17 +103,15 @@ export class GlobalPwPolicy extends React.Component { this.loadGlobal = this.loadGlobal.bind(this); } - componentWillMount() { + componentDidMount() { // Loading config TODO if (!this.state.loaded) { this.loadGlobal(); + } else { + this.props.enableTree(); } } - componentDidMount() { - this.props.enableTree(); - } - handleNavSelect(key) { this.setState({ activeKey: key }); } @@ -658,7 +656,7 @@ export class GlobalPwPolicy extends React.Component { _passwordbadwords: attrs['passwordbadwords'][0], _passworduserattributes: pwUserAttrs, _passwordadmindn: attrs['passwordadmindn'][0], - }) + }), this.props.enableTree() ); }) .fail(err => { diff --git a/src/cockpit/389-console/src/lib/database/indexes.jsx b/src/cockpit/389-console/src/lib/database/indexes.jsx index 475febf..9653eaa 100644 --- a/src/cockpit/389-console/src/lib/database/indexes.jsx +++ b/src/cockpit/389-console/src/lib/database/indexes.jsx @@ -71,7 +71,7 @@ export class SuffixIndexes extends React.Component { this.closeReindexModal = this.closeReindexModal.bind(this); } - componentWillMount () { + componentDidMount () { this.loadIndexes(); } diff --git a/src/cockpit/389-console/src/lib/database/localPwp.jsx b/src/cockpit/389-console/src/lib/database/localPwp.jsx index 3b9bac0..59be577 100644 --- a/src/cockpit/389-console/src/lib/database/localPwp.jsx +++ b/src/cockpit/389-console/src/lib/database/localPwp.jsx @@ -701,17 +701,15 @@ export class LocalPwPolicy extends React.Component { this.showDeletePolicy = this.showDeletePolicy.bind(this); } - componentWillMount() { + componentDidMount() { // Loading config if (!this.state.loaded) { this.loadPolicies(); + } else { + this.props.enableTree(); } } - componentDidMount() { - this.props.enableTree(); - } - showDeletePolicy(name) { this.setState({ showDeletePolicy: true, @@ -1406,7 +1404,7 @@ export class LocalPwPolicy extends React.Component { _create_passwordmintokenlength: "0", _create_passwordbadwords: "", _create_passworduserattributes: [], - }); + }, this.props.enableTree); }) .fail(err => { let errMsg = JSON.parse(err); diff --git a/src/cockpit/389-console/src/lib/monitor/monitorTables.jsx b/src/cockpit/389-console/src/lib/monitor/monitorTables.jsx index d38e2fc..0fef3a7 100644 --- a/src/cockpit/389-console/src/lib/monitor/monitorTables.jsx +++ b/src/cockpit/389-console/src/lib/monitor/monitorTables.jsx @@ -1662,7 +1662,7 @@ class DiskTable extends React.Component { header: { label: "Available Space", props: { - index: 2, + index: 3, rowSpan: 1, colSpan: 1, sort: true diff --git a/src/cockpit/389-console/src/lib/plugins/accountPolicy.jsx b/src/cockpit/389-console/src/lib/plugins/accountPolicy.jsx index 74ba3da..96a2f21 100644 --- a/src/cockpit/389-console/src/lib/plugins/accountPolicy.jsx +++ b/src/cockpit/389-console/src/lib/plugins/accountPolicy.jsx @@ -22,7 +22,7 @@ import "../../css/ds.css"; // Use default aacount policy name class AccountPolicy extends React.Component { - componentWillMount(prevProps) { + componentDidMount() { this.updateFields(); } diff --git a/src/cockpit/389-console/src/lib/plugins/attributeUniqueness.jsx b/src/cockpit/389-console/src/lib/plugins/attributeUniqueness.jsx index 59e7525..af25ebb 100644 --- a/src/cockpit/389-console/src/lib/plugins/attributeUniqueness.jsx +++ b/src/cockpit/389-console/src/lib/plugins/attributeUniqueness.jsx @@ -23,7 +23,7 @@ import { log_cmd } from "../tools.jsx"; import "../../css/ds.css"; class AttributeUniqueness extends React.Component { - componentWillMount() { + componentDidMount() { if (this.props.wasActiveList.includes(5)) { if (this.state.firstLoad) { this.loadConfigs(); diff --git a/src/cockpit/389-console/src/lib/plugins/autoMembership.jsx b/src/cockpit/389-console/src/lib/plugins/autoMembership.jsx index ff4d9d4..9dc0e73 100644 --- a/src/cockpit/389-console/src/lib/plugins/autoMembership.jsx +++ b/src/cockpit/389-console/src/lib/plugins/autoMembership.jsx @@ -20,7 +20,7 @@ import { log_cmd } from "../tools.jsx"; import "../../css/ds.css"; class AutoMembership extends React.Component { - componentWillMount() { + componentDidMount() { if (this.props.wasActiveList.includes(5)) { if (this.state.firstLoad) { this.loadDefinitions(); diff --git a/src/cockpit/389-console/src/lib/plugins/dna.jsx b/src/cockpit/389-console/src/lib/plugins/dna.jsx index f083937..567733e 100644 --- a/src/cockpit/389-console/src/lib/plugins/dna.jsx +++ b/src/cockpit/389-console/src/lib/plugins/dna.jsx @@ -21,7 +21,7 @@ import { log_cmd } from "../tools.jsx"; import "../../css/ds.css"; class DNA extends React.Component { - componentWillMount() { + componentDidMount() { if (this.props.wasActiveList.includes(5)) { if (this.state.firstLoad) { this.loadConfigs(); diff --git a/src/cockpit/389-console/src/lib/plugins/linkedAttributes.jsx b/src/cockpit/389-console/src/lib/plugins/linkedAttributes.jsx index 88bb399..b789762 100644 --- a/src/cockpit/389-console/src/lib/plugins/linkedAttributes.jsx +++ b/src/cockpit/389-console/src/lib/plugins/linkedAttributes.jsx @@ -20,7 +20,7 @@ import { log_cmd } from "../tools.jsx"; import "../../css/ds.css"; class LinkedAttributes extends React.Component { - componentWillMount() { + componentDidMount() { if (this.props.wasActiveList.includes(5)) { if (this.state.firstLoad) { this.loadConfigs(); diff --git a/src/cockpit/389-console/src/lib/plugins/managedEntries.jsx b/src/cockpit/389-console/src/lib/plugins/managedEntries.jsx index 7afdd2c..c25209d 100644 --- a/src/cockpit/389-console/src/lib/plugins/managedEntries.jsx +++ b/src/cockpit/389-console/src/lib/plugins/managedEntries.jsx @@ -20,7 +20,7 @@ import { log_cmd } from "../tools.jsx"; import "../../css/ds.css"; class ManagedEntries extends React.Component { - componentWillMount() { + componentDidMount() { this.updateFields(); } diff --git a/src/cockpit/389-console/src/lib/plugins/memberOf.jsx b/src/cockpit/389-console/src/lib/plugins/memberOf.jsx index 74a74e6..b24bc48 100644 --- a/src/cockpit/389-console/src/lib/plugins/memberOf.jsx +++ b/src/cockpit/389-console/src/lib/plugins/memberOf.jsx @@ -20,7 +20,7 @@ import { log_cmd } from "../tools.jsx"; import "../../css/ds.css"; class MemberOf extends React.Component { - componentWillMount(prevProps) { + componentDidMount(prevProps) { if (this.props.wasActiveList.includes(5)) { if (this.state.firstLoad) { this.getObjectClasses(); diff --git a/src/cockpit/389-console/src/lib/plugins/pluginBasicConfig.jsx b/src/cockpit/389-console/src/lib/plugins/pluginBasicConfig.jsx index 966c60f..49d3cf5 100644 --- a/src/cockpit/389-console/src/lib/plugins/pluginBasicConfig.jsx +++ b/src/cockpit/389-console/src/lib/plugins/pluginBasicConfig.jsx @@ -17,7 +17,7 @@ import { log_cmd } from "../tools.jsx"; import "../../css/ds.css"; class PluginBasicConfig extends React.Component { - componentWillMount(prevProps) { + componentDidMount(prevProps) { this.updateFields(); } diff --git a/src/cockpit/389-console/src/lib/plugins/referentialIntegrity.jsx b/src/cockpit/389-console/src/lib/plugins/referentialIntegrity.jsx index e65cbcc..2508f96 100644 --- a/src/cockpit/389-console/src/lib/plugins/referentialIntegrity.jsx +++ b/src/cockpit/389-console/src/lib/plugins/referentialIntegrity.jsx @@ -19,7 +19,7 @@ import { log_cmd } from "../tools.jsx"; import "../../css/ds.css"; class ReferentialIntegrity extends React.Component { - componentWillMount(prevProps) { + componentDidMount(prevProps) { if (this.props.wasActiveList.includes(5)) { if (this.state.firstLoad) { this.getAttributes(); diff --git a/src/cockpit/389-console/src/lib/plugins/retroChangelog.jsx b/src/cockpit/389-console/src/lib/plugins/retroChangelog.jsx index e17a903..8529c24 100644 --- a/src/cockpit/389-console/src/lib/plugins/retroChangelog.jsx +++ b/src/cockpit/389-console/src/lib/plugins/retroChangelog.jsx @@ -17,7 +17,7 @@ import { log_cmd } from "../tools.jsx"; import "../../css/ds.css"; class RetroChangelog extends React.Component { - componentWillMount(prevProps) { + componentDidMount(prevProps) { if (this.props.wasActiveList.includes(5)) { if (this.state.firstLoad) { this.getAttributes(); diff --git a/src/cockpit/389-console/src/lib/plugins/rootDNAccessControl.jsx b/src/cockpit/389-console/src/lib/plugins/rootDNAccessControl.jsx index 6c8b1eb..f4c10d2 100644 --- a/src/cockpit/389-console/src/lib/plugins/rootDNAccessControl.jsx +++ b/src/cockpit/389-console/src/lib/plugins/rootDNAccessControl.jsx @@ -6,7 +6,7 @@ import PluginBasicConfig from "./pluginBasicConfig.jsx"; import "../../css/ds.css"; class RootDNAccessControl extends React.Component { - componentWillMount(prevProps) { + componentDidMount(prevProps) { this.updateFields(); } diff --git a/src/cockpit/389-console/src/lib/plugins/usn.jsx b/src/cockpit/389-console/src/lib/plugins/usn.jsx index 6a3acad..e15666f 100644 --- a/src/cockpit/389-console/src/lib/plugins/usn.jsx +++ b/src/cockpit/389-console/src/lib/plugins/usn.jsx @@ -19,7 +19,7 @@ import { log_cmd } from "../tools.jsx"; import "../../css/ds.css"; class USN extends React.Component { - componentWillMount() { + componentDidMount() { if (this.props.wasActiveList.includes(5)) { if (this.state.firstLoad) { this.loadSuffixList(); diff --git a/src/cockpit/389-console/src/lib/plugins/winsync.jsx b/src/cockpit/389-console/src/lib/plugins/winsync.jsx index 0e2ff13..3721918 100644 --- a/src/cockpit/389-console/src/lib/plugins/winsync.jsx +++ b/src/cockpit/389-console/src/lib/plugins/winsync.jsx @@ -19,7 +19,7 @@ import { log_cmd } from "../tools.jsx"; import "../../css/ds.css"; class WinSync extends React.Component { - componentWillMount(prevProps) { + componentDidMount(prevProps) { this.updateFields(); } diff --git a/src/cockpit/389-console/src/lib/security/ciphers.jsx b/src/cockpit/389-console/src/lib/security/ciphers.jsx index a4199eb..c54cb09 100644 --- a/src/cockpit/389-console/src/lib/security/ciphers.jsx +++ b/src/cockpit/389-console/src/lib/security/ciphers.jsx @@ -30,7 +30,7 @@ export class Ciphers extends React.Component { this.handleCipherChange = this.handleCipherChange.bind(this); } - componentWillMount () { + componentDidMount () { let cipherPref = "default"; let allowedCiphers = []; let deniedCiphers = []; diff --git a/src/cockpit/389-console/src/lib/server/accessLog.jsx b/src/cockpit/389-console/src/lib/server/accessLog.jsx index 3dcf7e8..f47a663 100644 --- a/src/cockpit/389-console/src/lib/server/accessLog.jsx +++ b/src/cockpit/389-console/src/lib/server/accessLog.jsx @@ -74,17 +74,15 @@ export class ServerAccessLog extends React.Component { this.saveConfig = this.saveConfig.bind(this); } - componentWillMount() { + componentDidMount() { // Loading config if (!this.state.loaded) { this.loadConfig(); + } else { + this.props.enableTree(); } } - componentDidMount() { - this.props.enableTree(); - } - handleNavSelect(key) { this.setState({ activeKey: key }); } @@ -357,7 +355,7 @@ export class ServerAccessLog extends React.Component { '_nsslapd-accesslog-logrotationtimeunit': attrs['nsslapd-accesslog-logrotationtimeunit'][0], '_nsslapd-accesslog-maxlogsize': attrs['nsslapd-accesslog-maxlogsize'][0], '_nsslapd-accesslog-maxlogsperdir': attrs['nsslapd-accesslog-maxlogsperdir'][0], - }); + }, this.props.enableTree); } render() { diff --git a/src/cockpit/389-console/src/lib/server/auditLog.jsx b/src/cockpit/389-console/src/lib/server/auditLog.jsx index 623231b..164320f 100644 --- a/src/cockpit/389-console/src/lib/server/auditLog.jsx +++ b/src/cockpit/389-console/src/lib/server/auditLog.jsx @@ -63,17 +63,15 @@ export class ServerAuditLog extends React.Component { this.saveConfig = this.saveConfig.bind(this); } - componentWillMount() { + componentDidMount() { // Loading config if (!this.state.loaded) { this.loadConfig(); + } else { + this.props.enableTree(); } } - componentDidMount() { - this.props.enableTree(); - } - handleNavSelect(key) { this.setState({ activeKey: key }); } @@ -216,7 +214,7 @@ export class ServerAuditLog extends React.Component { '_nsslapd-auditlog-logrotationtimeunit': attrs['nsslapd-auditlog-logrotationtimeunit'][0], '_nsslapd-auditlog-maxlogsize': attrs['nsslapd-auditlog-maxlogsize'][0], '_nsslapd-auditlog-maxlogsperdir': attrs['nsslapd-auditlog-maxlogsperdir'][0], - }); + }, this.props.enableTree); } reloadConfig() { diff --git a/src/cockpit/389-console/src/lib/server/auditfailLog.jsx b/src/cockpit/389-console/src/lib/server/auditfailLog.jsx index caf49c7..97b769a 100644 --- a/src/cockpit/389-console/src/lib/server/auditfailLog.jsx +++ b/src/cockpit/389-console/src/lib/server/auditfailLog.jsx @@ -63,17 +63,15 @@ export class ServerAuditFailLog extends React.Component { this.saveConfig = this.saveConfig.bind(this); } - componentWillMount() { + componentDidMount() { // Loading config if (!this.state.loaded) { this.loadConfig(); + } else { + this.props.enableTree(); } } - componentDidMount() { - this.props.enableTree(); - } - handleNavSelect(key) { this.setState({ activeKey: key }); } @@ -283,7 +281,7 @@ export class ServerAuditFailLog extends React.Component { '_nsslapd-auditfaillog-logrotationtimeunit': attrs['nsslapd-auditfaillog-logrotationtimeunit'][0], '_nsslapd-auditfaillog-maxlogsize': attrs['nsslapd-auditfaillog-maxlogsize'][0], '_nsslapd-auditfaillog-maxlogsperdir': attrs['nsslapd-auditfaillog-maxlogsperdir'][0], - }); + }, this.props.enableTree); } render() { diff --git a/src/cockpit/389-console/src/lib/server/errorLog.jsx b/src/cockpit/389-console/src/lib/server/errorLog.jsx index b21d005..193f04d 100644 --- a/src/cockpit/389-console/src/lib/server/errorLog.jsx +++ b/src/cockpit/389-console/src/lib/server/errorLog.jsx @@ -83,17 +83,15 @@ export class ServerErrorLog extends React.Component { this.saveConfig = this.saveConfig.bind(this); } - componentWillMount() { + componentDidMount() { // Loading config if (!this.state.loaded) { this.loadConfig(); + } else { + this.props.enableTree(); } } - componentDidMount() { - this.props.enableTree(); - } - handleNavSelect(key) { this.setState({ activeKey: key }); } @@ -290,7 +288,7 @@ export class ServerErrorLog extends React.Component { '_nsslapd-errorlog-logrotationtimeunit': attrs['nsslapd-errorlog-logrotationtimeunit'][0], '_nsslapd-errorlog-maxlogsize': attrs['nsslapd-errorlog-maxlogsize'][0], '_nsslapd-errorlog-maxlogsperdir': attrs['nsslapd-errorlog-maxlogsperdir'][0], - }); + }, this.props.enableTree); } reloadConfig() { diff --git a/src/cockpit/389-console/src/lib/server/ldapi.jsx b/src/cockpit/389-console/src/lib/server/ldapi.jsx index 42dee17..c004e63 100644 --- a/src/cockpit/389-console/src/lib/server/ldapi.jsx +++ b/src/cockpit/389-console/src/lib/server/ldapi.jsx @@ -42,17 +42,15 @@ export class ServerLDAPI extends React.Component { this.saveConfig = this.saveConfig.bind(this); } - componentWillMount() { + componentDidMount() { // Loading config if (!this.state.loaded) { this.loadConfig(); + } else { + this.props.enableTree(); } } - componentDidMount() { - this.props.enableTree(); - } - handleChange(e) { let value = e.target.type === 'checkbox' ? e.target.checked : e.target.value; let attr = e.target.id; @@ -106,7 +104,7 @@ export class ServerLDAPI extends React.Component { '_nsslapd-ldapientrysearchbase': attrs['nsslapd-ldapientrysearchbase'][0], '_nsslapd-ldapigidnumbertype': attrs['nsslapd-ldapigidnumbertype'][0], '_nsslapd-ldapiuidnumbertype': attrs['nsslapd-ldapiuidnumbertype'][0], - }); + }, this.props.enableTree); } saveConfig() { diff --git a/src/cockpit/389-console/src/lib/server/sasl.jsx b/src/cockpit/389-console/src/lib/server/sasl.jsx index 28cc330..5865b5c 100644 --- a/src/cockpit/389-console/src/lib/server/sasl.jsx +++ b/src/cockpit/389-console/src/lib/server/sasl.jsx @@ -69,17 +69,15 @@ export class ServerSASL extends React.Component { this.deleteMapping = this.deleteMapping.bind(this); } - componentWillMount() { + componentDidMount() { // Loading config if (!this.state.loaded) { this.loadConfig(); + } else { + this.props.enableTree(); } } - componentDidMount() { - this.props.enableTree(); - } - handleTestRegex() { let test_string = this.state.saslTestText; let regex = this.state.saslMapRegex; @@ -345,7 +343,7 @@ export class ServerSASL extends React.Component { loaded: true, tableLoading: false, configLoading: false, - }); + }, this.props.enableTree); }); } diff --git a/src/cockpit/389-console/src/lib/server/settings.jsx b/src/cockpit/389-console/src/lib/server/settings.jsx index bc81310..dbb7c39 100644 --- a/src/cockpit/389-console/src/lib/server/settings.jsx +++ b/src/cockpit/389-console/src/lib/server/settings.jsx @@ -98,17 +98,15 @@ export class ServerSettings extends React.Component { this.reloadAdvanced = this.reloadAdvanced.bind(this); } - componentWillMount() { + componentDidMount() { // Loading config if (!this.state.loaded) { this.loadConfig(); + } else { + this.props.enableTree(); } } - componentDidMount() { - this.props.enableTree(); - } - handleNavSelect(key) { this.setState({ activeKey: key }); } diff --git a/src/cockpit/389-console/src/lib/server/tuning.jsx b/src/cockpit/389-console/src/lib/server/tuning.jsx index 6f78958..d9edced 100644 --- a/src/cockpit/389-console/src/lib/server/tuning.jsx +++ b/src/cockpit/389-console/src/lib/server/tuning.jsx @@ -54,17 +54,14 @@ export class ServerTuning extends React.Component { this.saveConfig = this.saveConfig.bind(this); } - componentWillMount() { - // Loading config + componentDidMount() { if (!this.state.loaded) { this.loadConfig(); + } else { + this.props.enableTree(); } } - componentDidMount() { - this.props.enableTree(); - } - handleChange(e) { let value = e.target.type === 'checkbox' ? e.target.checked : e.target.value; let attr = e.target.id; @@ -164,7 +161,7 @@ export class ServerTuning extends React.Component { '_nsslapd-listen-backlog-size': attrs['nsslapd-listen-backlog-size'][0], '_nsslapd-max-filter-nest-level': attrs['nsslapd-max-filter-nest-level'][0], '_nsslapd-ndn-cache-max-size': attrs['nsslapd-ndn-cache-max-size'][0], - }); + }, this.props.enableTree()); } saveConfig() { diff --git a/src/cockpit/389-console/src/security.jsx b/src/cockpit/389-console/src/security.jsx index 5d6d84f..1b56e04 100644 --- a/src/cockpit/389-console/src/security.jsx +++ b/src/cockpit/389-console/src/security.jsx @@ -87,20 +87,12 @@ export class Security extends React.Component { this.reloadConfig = this.reloadConfig.bind(this); } - componentWillMount () { + componentDidMount () { if (!this.state.loaded) { this.setState({securityEnabled: true}, this.setState({securityEnabled: false})); this.loadSecurityConfig(); - } - } - - componentDidMount () { - this.props.enableTree(); - } - - componentDidUpdate(prevProps) { - if (this.props.serverId !== prevProps.serverId) { - this.loadSecurityConfig(); + } else { + this.props.enableTree(); } } @@ -178,7 +170,7 @@ export class Security extends React.Component { { CACerts: certs, loaded: true - }) + }), this.props.enableTree() ); }) .fail(err => { diff --git a/src/cockpit/389-console/src/server.jsx b/src/cockpit/389-console/src/server.jsx index 4501a48..98cceb6 100644 --- a/src/cockpit/389-console/src/server.jsx +++ b/src/cockpit/389-console/src/server.jsx @@ -35,14 +35,10 @@ export class Server extends React.Component { this.selectNode = this.selectNode.bind(this); } - componentDidUpdate(prevProps) { + componentDidMount() { if (this.props.wasActiveList.includes(1)) { if (this.state.firstLoad) { this.loadConfig(); - } else { - if (this.props.serverId !== prevProps.serverId) { - this.loadConfig(); - } } } }