Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add validate all tabs func on mount
Browse files Browse the repository at this point in the history
droideck committed Sep 20, 2024
1 parent f11ead4 commit 436fba3
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/cockpit/389-console/src/lib/server/settings.jsx
Original file line number Diff line number Diff line change
@@ -178,6 +178,7 @@ export class ServerSettings extends React.Component {
];

this.validatePaths = this.validatePaths.bind(this);
this.validateAllTabs = this.validateAllTabs.bind(this);
this.handleChange = this.handleChange.bind(this);
this.loadConfig = this.loadConfig.bind(this);
this.handleSaveConfig = this.handleSaveConfig.bind(this);
@@ -218,7 +219,7 @@ export class ServerSettings extends React.Component {
this.loadConfig();
} else {
this.props.enableTree();
// TODO: this.validateSaveBtn() on all tabs? test this
this.validateAllTabs();
}
}

@@ -377,6 +378,30 @@ export class ServerSettings extends React.Component {
}, () => { this.validateSaveBtn(nav_tab, attr, value) });
}

validateAllTabs() {
const tabs = ['config', 'rootdn', 'diskmon', 'adv'];
tabs.forEach(tab => {
let attrs;
switch (tab) {
case 'config':
attrs = general_attrs;
break;
case 'rootdn':
attrs = rootdn_attrs;
break;
case 'diskmon':
attrs = disk_attrs;
break;
case 'adv':
attrs = adv_attrs;
break;
}
attrs.forEach(attr => {
this.validateSaveBtn(tab, attr, this.state[attr]);
});
});
}

loadConfig() {
const attrs = this.state.attrs;
// Handle the checkbox values

0 comments on commit 436fba3

Please sign in to comment.