Skip to content

Commit

Permalink
Issue 4796 - Add support for nsslapd-state to CLI & UI
Browse files Browse the repository at this point in the history
Description:  Add support for nsslapd-state to lib389 and UI.  Also
              added a check to prevent the changing of nsslapd-state
              for replicated suffixes.

              Also did a little UI cleanup where a bottom margin was added
              to the bottom of pages instead of using <hr> to create the gap.

relates: 389ds#4796

Reviewed by: jachapman & spichugi(Thanks!!)
  • Loading branch information
mreynolds389 committed Sep 11, 2021
1 parent 674aefb commit 735c5a7
Show file tree
Hide file tree
Showing 26 changed files with 140 additions and 69 deletions.
2 changes: 2 additions & 0 deletions src/cockpit/389-console/src/database.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,7 @@ export class Database extends React.Component {
cachememsize: config.attrs['nsslapd-cachememsize'][0],
cachesize: config.attrs['nsslapd-cachesize'][0],
dncachememsize: config.attrs['nsslapd-dncachememsize'][0],
dbstate: config.attrs['nsslapd-state'][0],
readOnly: readonly,
requireIndex: requireindex,
}
Expand Down Expand Up @@ -977,6 +978,7 @@ export class Database extends React.Component {
cachememsize: config.attrs['nsslapd-cachememsize'][0],
cachesize: config.attrs['nsslapd-cachesize'][0],
dncachememsize: config.attrs['nsslapd-dncachememsize'][0],
dbstate: config.attrs['nsslapd-state'][0],
readOnly: readonly,
requireIndex: requireindex,
}
Expand Down
3 changes: 1 addition & 2 deletions src/cockpit/389-console/src/lib/database/chaining.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ export class ChainingDatabaseConfig extends React.Component {
</TextContent>
<Tabs className="ds-margin-top-xlg" activeKey={this.state.activeTabKey} onSelect={this.handleNavSelect}>
<Tab eventKey={0} title={<TabTitleText><b>Default Creation Settings</b></TabTitleText>}>
<div className="ds-indent">
<div className="ds-indent ds-margin-bottom-md">
<Grid
title="The size limit of entries returned over a database link (nsslapd-sizelimit)."
className="ds-margin-top-xlg"
Expand Down Expand Up @@ -861,7 +861,6 @@ export class ChainingDatabaseConfig extends React.Component {
>
{saveBtnName}
</Button>
<hr />
</div>
</Tab>
<Tab eventKey={1} title={<TabTitleText><b>Controls & Components</b></TabTitleText>}>
Expand Down
3 changes: 1 addition & 2 deletions src/cockpit/389-console/src/lib/database/databaseConfig.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ export class GlobalDatabaseConfig extends React.Component {
}

return (
<div className={this.state.saving ? "ds-disabled" : ""} id="db-global-page">
<div className={this.state.saving ? "ds-disabled ds-margin-bottom-md" : "ds-margin-bottom-md"} id="db-global-page">
{spinner}
<div className={this.state.loading ? 'ds-fadeout' : 'ds-fadein'}>
<TextContent>
Expand Down Expand Up @@ -753,7 +753,6 @@ export class GlobalDatabaseConfig extends React.Component {
>
{saveBtnName}
</Button>
<hr />
</div>
</div>
);
Expand Down
3 changes: 1 addition & 2 deletions src/cockpit/389-console/src/lib/database/globalPwp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,7 @@ export class GlobalPwPolicy extends React.Component {
</div>;
} else {
pwp_element =
<div className={this.state.loading ? 'ds-fadeout' : 'ds-fadein ds-left-margin'}>
<div className={this.state.loading ? 'ds-fadeout ds-margin-bottom-md' : 'ds-fadein ds-left-margin ds-margin-bottom-md'}>
<Tabs className="ds-margin-top-xlg" activeKey={this.state.activeTabKey} onSelect={this.handleNavSelect}>
<Tab eventKey={0} title={<TabTitleText><b>General Settings</b></TabTitleText>}>
<Form className="ds-margin-left-sm" isHorizontal>
Expand Down Expand Up @@ -1342,7 +1342,6 @@ export class GlobalPwPolicy extends React.Component {
>
{saveBtnName}
</Button>
<hr />
</Tab>
<Tab eventKey={1} title={<TabTitleText><b>Expiration</b></TabTitleText>}>
<Form className="ds-margin-top-xlg ds-margin-left" isHorizontal>
Expand Down
4 changes: 1 addition & 3 deletions src/cockpit/389-console/src/lib/database/indexes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ export class SuffixIndexes extends React.Component {
<div className="ds-margin-top-xlg ds-left-indent">
<Tabs isSecondary isBox activeKey={this.state.activeTabKey} onSelect={this.handleNavSelect}>
<Tab eventKey={0} title={<TabTitleText>Database Indexes <font size="2">({this.props.indexRows.length})</font></TabTitleText>}>
<div className="ds-left-indent">
<div className="ds-left-indent ds-margin-bottom-md">
<IndexTable
editable
rows={this.props.indexRows}
Expand All @@ -790,14 +790,12 @@ export class SuffixIndexes extends React.Component {
deleteIndex={this.showConfirmDeleteIndex}
/>
<Button
className="ds-margin-top"
variant="primary"
type="button"
onClick={this.showIndexModal}
>
Add Index
</Button>
<hr />
</div>
</Tab>
<Tab eventKey={1} title={<TabTitleText>System Indexes <font size="2">({this.props.systemIndexRows.length})</font></TabTitleText>}>
Expand Down
3 changes: 1 addition & 2 deletions src/cockpit/389-console/src/lib/database/localPwp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class CreatePolicy extends React.Component {
}

return (
<div>
<div className="ds-margin-bottom-md">
<Form className="ds-margin-left ds-margin-top-xlg" isHorizontal>
<TextContent>
<Text className="ds-center" component={TextVariants.h3}>
Expand Down Expand Up @@ -777,7 +777,6 @@ class CreatePolicy extends React.Component {
>
Create New Policy
</Button>
<hr />
</div>
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/cockpit/389-console/src/lib/database/referrals.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,13 @@ export class SuffixReferrals extends React.Component {

render() {
return (
<div className="ds-sub-header">
<div className="ds-sub-header ds-margin-bottom-md">
<ReferralTable
key={this.props.rows}
rows={this.props.rows}
deleteRef={this.showConfirmRefDelete}
/>
<Button className="ds-margin-top" variant="primary" onClick={this.showRefModal}>
<Button variant="primary" onClick={this.showRefModal}>
Create Referral
</Button>
<DoubleConfirmModal
Expand Down
15 changes: 13 additions & 2 deletions src/cockpit/389-console/src/lib/database/suffix.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ export class Suffix extends React.Component {
dncachememsize: this.props.data.dncachememsize,
readOnly: this.props.data.readOnly,
requireIndex: this.props.data.requireIndex,
dbstate: this.props.data.dbstate,
_cachememsize: this.props.data.cachememsize,
_cachesize: this.props.data.cachesize,
_dncachememsize: this.props.data.dncachememsize,
_readOnly: this.props.data.readOnly,
_requireIndex: this.props.data.requireIndex,
_dbstate: this.props.data.dbstate,
savingConfig: false,
saveBtnDisabled: true,

Expand Down Expand Up @@ -209,7 +211,7 @@ export class Suffix extends React.Component {

const configAttrs = [
'cachememsize', 'cachesize', 'dncachememsize',
'readOnly', 'requireIndex',
'readOnly', 'requireIndex', 'dbstate'
];
for (const check_attr of configAttrs) {
if (attr != check_attr) {
Expand Down Expand Up @@ -773,6 +775,10 @@ export class Suffix extends React.Component {
cmd.push("--dncache-memsize=" + this.state.dncachememsize);
requireRestart = true;
}
if (this.state._dbstate != this.state.dbstate) {
cmd.push("--state=" + this.state.dbstate);
requireRestart = true;
}
if (cmd.length > 7) {
this.setState({
savingConfig: true
Expand All @@ -797,9 +803,13 @@ export class Suffix extends React.Component {
.fail(err => {
const errMsg = JSON.parse(err);
this.props.reload(this.props.suffix);
let msg = errMsg.desc;
if ('info' in errMsg) {
msg = errMsg.desc + " - " + errMsg.info;
}
this.props.addNotification(
"error",
`Error updating suffix configuration - ${errMsg.desc}`
`Error updating suffix configuration - ${msg}`
);
this.setState({
savingConfig: false
Expand Down Expand Up @@ -875,6 +885,7 @@ export class Suffix extends React.Component {
cachememsize={this.state.cachememsize}
cachesize={this.state.cachesize}
dncachememsize={this.state.dncachememsize}
dbstate={this.state.dbstate}
readOnly={this.state.readOnly}
requireIndex={this.state.requireIndex}
autoTuning={this.state.autoTuning}
Expand Down
29 changes: 27 additions & 2 deletions src/cockpit/389-console/src/lib/database/suffixConfig.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import {
Button,
Checkbox,
Form,
FormSelect,
FormSelectOption,
Grid,
GridItem,
TextInput,
Expand Down Expand Up @@ -132,7 +134,30 @@ export class SuffixConfig extends React.Component {
<div className="ds-margin-top-lg">
{cacheInputs}
<Form isHorizontal>
<Grid className="ds-margin-top-lg" title="Put database in Read-Only mode (nsslapd-readonly).">
<Grid
className="ds-margin-top-lg"
title="Set the backend type. Warning, changing this setting could lead to unexpected database behavior."
>
<GridItem className="ds-label" span={3}>
Backend State
</GridItem>
<GridItem span={9}>
<FormSelect
id="dbstate"
value={this.props.dbstate}
onChange={(str, e) => {
this.props.handleChange(e);
}}
aria-label="FormSelect Input"
>
<FormSelectOption value="backend" label="Backend" />
<FormSelectOption value="disabled" label="Disabled" />
<FormSelectOption value="referral" label="Referral" />
<FormSelectOption value="referral on update" label="Referral On Update" />
</FormSelect>
</GridItem>
</Grid>
<Grid title="Put database in Read-Only mode (nsslapd-readonly).">
<GridItem span={12}>
<Checkbox
label="Database Read-Only Mode"
Expand All @@ -145,7 +170,7 @@ export class SuffixConfig extends React.Component {
/>
</GridItem>
</Grid>
<Grid className="ds-margin-top" title="Block unindexed searches on this suffix (nsslapd-require-index).">
<Grid title="Block unindexed searches on this suffix (nsslapd-require-index).">
<GridItem span={12}>
<Checkbox
label="Block Unindexed Searches"
Expand Down
3 changes: 1 addition & 2 deletions src/cockpit/389-console/src/lib/database/vlvIndexes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ export class VLVIndexes extends React.Component {

render() {
return (
<div className="ds-tab-table">
<div className="ds-tab-table ds-margin-bottom-md">
<VLVTable
rows={this.props.vlvItems}
key={this.props.vlvItems}
Expand All @@ -421,7 +421,6 @@ export class VLVIndexes extends React.Component {
updating={this.state.updating}
/>
<Button
className="ds-margin-top"
variant="primary"
onClick={this.showVLVModal}
>
Expand Down
6 changes: 3 additions & 3 deletions src/cockpit/389-console/src/lib/monitor/dbMonitor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ export class DatabaseMonitor extends React.Component {
<Tabs activeKey={this.state.activeTabKey} onSelect={this.handleNavSelect}>
<Tab eventKey={0} title={<TabTitleText><b>Database Cache</b></TabTitleText>}>
<div className="ds-margin-top">
<Card>
<Card isHoverable>
<CardBody>
<div className="ds-container">
<div className="ds-center">
Expand Down Expand Up @@ -326,7 +326,7 @@ export class DatabaseMonitor extends React.Component {
<div className="ds-margin-top-lg">
<Grid hasGutter>
<GridItem span={6}>
<Card>
<Card isHoverable>
<CardBody>
<div className="ds-container">
<div className="ds-center">
Expand Down Expand Up @@ -372,7 +372,7 @@ export class DatabaseMonitor extends React.Component {
</Card>
</GridItem>
<GridItem span={6}>
<Card>
<Card isHoverable>
<CardBody>
<div className="ds-container">
<div className="ds-center">
Expand Down
3 changes: 1 addition & 2 deletions src/cockpit/389-console/src/lib/monitor/replMonitor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,7 @@ export class ReplMonitor extends React.Component {
}

const reportContent =
<div className="ds-margin-top-lg ds-indent">
<div className="ds-margin-top-lg ds-indent ds-margin-bottom-md">
<Tabs isBox activeKey={this.state.activeTabKey} onSelect={this.handleNavSelect}>
<Tab eventKey={0} title={<TabTitleText>{_("Prepare Report")}</TabTitleText>}>
<ExpandableSection
Expand Down Expand Up @@ -1410,7 +1410,6 @@ export class ReplMonitor extends React.Component {
>
Add Alias
</Button>
<hr />
</Tab>
<Tab isHidden={reportData.length == 0} eventKey={1} title={<TabTitleText>{_("Report Result")}</TabTitleText>}>
<div className="ds-indent ds-margin-top-lg">
Expand Down
Loading

0 comments on commit 735c5a7

Please sign in to comment.