From 21f2a06c677b698c612ad17c04081d37ef7c2b1e Mon Sep 17 00:00:00 2001 From: Mark Reynolds Date: Nov 08 2019 21:57:32 +0000 Subject: Issue 50696 - Fix various UI bugs https://bugzilla.redhat.com/show_bug.cgi?id=1751004 Bug 1751004 - Log Settings "Create New Log Every" takes non integer as input, it even takes alphabets https://bugzilla.redhat.com/show_bug.cgi?id=1748349 Bug 1748349 - 'View objectclass' modal dialog doesn't have all controls disabled https://bugzilla.redhat.com/show_bug.cgi?id=1688614 Bug 1688614 - Chaining Configuration Error: Cockpit had an unexpected internal error https://bugzilla.redhat.com/show_bug.cgi?id=1748355 Bug 1748355 - LDAPI and Autobind configuration should have a warning https://bugzilla.redhat.com/show_bug.cgi?id=1751157 Bug 1751157 - Cannot Create Database Link https://bugzilla.redhat.com/show_bug.cgi?id=1751011 Bug 1751011 - DS instance can be easily destroyed by changing non existing Directory Manager DN https://bugzilla.redhat.com/show_bug.cgi?id=1688663 Bug 1688663 - Cockpit: Enable Replication failed with error "Failed to add replication manager because the base DN of the entry does not exist" https://bugzilla.redhat.com/show_bug.cgi?id=1751035 Bug 1751035 - Allow and Deny same Ciphers same time relates: https://pagure.io/389-ds-base/issue/50696 Reviewed by: spichugi(Thanks!) --- diff --git a/src/cockpit/389-console/src/database.jsx b/src/cockpit/389-console/src/database.jsx index b1c3953..697eb14 100644 --- a/src/cockpit/389-console/src/database.jsx +++ b/src/cockpit/389-console/src/database.jsx @@ -212,8 +212,8 @@ export class Database extends React.Component { cockpit .spawn(cmd, { superuser: true, err: "message" }) .done(content => { - const config = JSON.parse(content); - const availableOids = config.items.filter((el) => !this.state.chainingConfig.oidList.includes(el)); + let config = JSON.parse(content); + let availableOids = config.items.filter((el) => !this.state.chainingConfig.oidList.includes(el)); this.setState((prevState) => ( { chainingConfig: { @@ -304,15 +304,19 @@ export class Database extends React.Component { const config = JSON.parse(content); let availableComps = config.attrs.nspossiblechainingcomponents; let compList = []; + let oidList = []; if ('nsactivechainingcomponents' in config.attrs) { availableComps = config.attrs.nspossiblechainingcomponents.filter((el) => !config.attrs.nsactivechainingcomponents.includes(el)); compList = config.attrs.nsactivechainingcomponents; } + if ('nstransmittedcontrols' in config.attrs) { + oidList = config.attrs.nstransmittedcontrols; + } this.setState(() => ( { chainingConfig: { ...this.state.chainingConfig, - oidList: config.attrs.nstransmittedcontrols, + oidList: oidList, compList: compList, availableComps: availableComps } diff --git a/src/cockpit/389-console/src/lib/database/chaining.jsx b/src/cockpit/389-console/src/lib/database/chaining.jsx index 749d414..63cf899 100644 --- a/src/cockpit/389-console/src/lib/database/chaining.jsx +++ b/src/cockpit/389-console/src/lib/database/chaining.jsx @@ -969,7 +969,13 @@ export class ChainingConfig extends React.Component {
- {this.props.suffix} ({this.props.bename}) + + {this.props.suffix} ({this.props.bename}) + this.props.reload(this.props.suffix)} + /> + @@ -1463,6 +1474,7 @@ EnableReplModal.propTypes = { handleChange: PropTypes.func, saveHandler: PropTypes.func, spinning: PropTypes.bool, + disabled: PropTypes.bool, error: PropTypes.object, }; @@ -1472,6 +1484,7 @@ EnableReplModal.defaultProps = { handleChange: noop, saveHandler: noop, spinning: false, + disabled: false, error: {}, }; diff --git a/src/cockpit/389-console/src/lib/replication/replSuffix.jsx b/src/cockpit/389-console/src/lib/replication/replSuffix.jsx index 0978c0c..a83ca37 100644 --- a/src/cockpit/389-console/src/lib/replication/replSuffix.jsx +++ b/src/cockpit/389-console/src/lib/replication/replSuffix.jsx @@ -42,6 +42,7 @@ export class ReplSuffix extends React.Component { enableBindPW: "", enableBindPWConfirm: "", enableBindGroupDN: "", + disabled: false, // Disable repl enable button // Disable replication showDisableReplModal: false, disableChecked: false, @@ -104,11 +105,12 @@ export class ReplSuffix extends React.Component { let attr = e.target.id; let valueErr = false; let errObj = this.state.errObj; + let disable = false; - if (attr == "enableBindDN" && value != "" && !valid_dn(value)) { + if (attr == "enableBindDN" && value != "" && (!valid_dn(value) || !value.includes(','))) { valueErr = true; } - if (attr == "enableBindGroupDN" && value != "" && !valid_dn(value)) { + if (attr == "enableBindGroupDN" && value != "" && (!valid_dn(value) || !value.includes(','))) { valueErr = true; } if (attr == "enableBindPW") { @@ -127,10 +129,24 @@ export class ReplSuffix extends React.Component { errObj.enableBindPWConfirm = false; } } + + // Validate form and disable enable button if something is wrong. + if (valueErr) { + disable = true; + } else { + if ((attr != "enableBindPW" && attr != "enableBindPWConfirm" && this.state.enableBindPW != this.state.enableBindPWConfirm) || + (this.state.enableBindDN != "" && attr != "enableBindDN" && (!valid_dn(this.state.enableBindDN) || + !this.state.enableBindDN.includes(','))) || + (this.state.enableBindGroupDN != "" && attr != "enableBindGroupDN" && (!valid_dn(this.state.enableBindGroupDN) || + !this.state.enableBindGroupDN.includes(',')))) { + disable = true; + } + } errObj[attr] = valueErr; this.setState({ [attr]: value, - errObj: errObj + errObj: errObj, + disabled: disable }); } @@ -395,6 +411,7 @@ export class ReplSuffix extends React.Component { saveHandler={this.enableReplication} spinning={this.state.addManagerSpinning} role={this.state.enableRole} + disabled={this.state.disabled} error={this.state.errObj} /> { - this.setState({ - allowCiphers: value - }); + this.handleCipherChange("allow", value); }} selected={this.state.allowCiphers} - options={this.props.supportedCiphers} + options={this.state.availableCiphers} newSelectionPrefix="Add a cipher: " placeholder="Type a cipher..." id="allowCipher" @@ -220,12 +264,10 @@ export class Ciphers extends React.Component { { - this.setState({ - denyCiphers: value - }); + this.handleCipherChange("deny", value); }} selected={this.state.denyCiphers} - options={this.props.supportedCiphers} + options={this.state.availableCiphers} newSelectionPrefix="Add a cipher: " placeholder="Type a cipher..." id="denyCipher" diff --git a/src/cockpit/389-console/src/lib/tools.jsx b/src/cockpit/389-console/src/lib/tools.jsx index ca402f5..b37dd86 100644 --- a/src/cockpit/389-console/src/lib/tools.jsx +++ b/src/cockpit/389-console/src/lib/tools.jsx @@ -125,6 +125,9 @@ export function valid_port (val) { export function valid_dn (dn) { // Validate value is a valid DN (sanity validation) + if (dn.endsWith(',')) { + return false; + } let dn_regex = new RegExp("^([A-Za-z]+=.*)"); let result = dn_regex.test(dn); return result; diff --git a/src/cockpit/389-console/src/schema.html b/src/cockpit/389-console/src/schema.html index 36f61be..cb6baf9 100644 --- a/src/cockpit/389-console/src/schema.html +++ b/src/cockpit/389-console/src/schema.html @@ -79,27 +79,27 @@
+ >Attribute Name
+ >Description
+ >OID
+ class="ds-input" type="text" id="attr-parent-view" size="40" disabled />
+ class="ds-input" type="text" id="attr-syntax-view" size="40" disabled />
+ class="ds-input" type="text" id="attr-usage-view" size="40" disabled />