mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[ML] [6.x] Group selector duplicate validation (#24139)
This commit is contained in:
parent
df9c17a091
commit
4e14ccc8d7
3 changed files with 15 additions and 1 deletions
|
@ -231,6 +231,7 @@ export class GroupSelector extends Component {
|
||||||
|
|
||||||
<NewGroupInput
|
<NewGroupInput
|
||||||
addNewGroup={this.addNewGroup}
|
addNewGroup={this.addNewGroup}
|
||||||
|
allJobIds={this.props.allJobIds}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<EuiHorizontalRule margin="m" />
|
<EuiHorizontalRule margin="m" />
|
||||||
|
@ -254,5 +255,6 @@ export class GroupSelector extends Component {
|
||||||
}
|
}
|
||||||
GroupSelector.propTypes = {
|
GroupSelector.propTypes = {
|
||||||
jobs: PropTypes.array.isRequired,
|
jobs: PropTypes.array.isRequired,
|
||||||
|
allJobIds: PropTypes.array.isRequired,
|
||||||
refreshJobs: PropTypes.func.isRequired,
|
refreshJobs: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,7 +34,16 @@ export class NewGroupInput extends Component {
|
||||||
|
|
||||||
changeTempNewGroup = (e) => {
|
changeTempNewGroup = (e) => {
|
||||||
const tempNewGroupName = e.target.value;
|
const tempNewGroupName = e.target.value;
|
||||||
const groupsValidationError = (tempNewGroupName === '') ? '' : validateGroupNames([tempNewGroupName]).message;
|
let groupsValidationError = '';
|
||||||
|
|
||||||
|
if (tempNewGroupName === '') {
|
||||||
|
groupsValidationError = '';
|
||||||
|
} else if (this.props.allJobIds.includes(tempNewGroupName)) {
|
||||||
|
groupsValidationError = 'A job with this ID already exists. Groups and jobs cannot use the same ID.';
|
||||||
|
} else {
|
||||||
|
groupsValidationError = validateGroupNames([tempNewGroupName]).message;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
tempNewGroupName,
|
tempNewGroupName,
|
||||||
groupsValidationError,
|
groupsValidationError,
|
||||||
|
@ -101,4 +110,5 @@ export class NewGroupInput extends Component {
|
||||||
|
|
||||||
NewGroupInput.propTypes = {
|
NewGroupInput.propTypes = {
|
||||||
addNewGroup: PropTypes.func.isRequired,
|
addNewGroup: PropTypes.func.isRequired,
|
||||||
|
allJobIds: PropTypes.array.isRequired,
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,6 +34,7 @@ export class MultiJobActions extends Component {
|
||||||
|
|
||||||
<GroupSelector
|
<GroupSelector
|
||||||
jobs={this.props.selectedJobs}
|
jobs={this.props.selectedJobs}
|
||||||
|
allJobIds={this.props.allJobIds}
|
||||||
refreshJobs={this.props.refreshJobs}
|
refreshJobs={this.props.refreshJobs}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -51,6 +52,7 @@ export class MultiJobActions extends Component {
|
||||||
}
|
}
|
||||||
MultiJobActions.propTypes = {
|
MultiJobActions.propTypes = {
|
||||||
selectedJobs: PropTypes.array.isRequired,
|
selectedJobs: PropTypes.array.isRequired,
|
||||||
|
allJobIds: PropTypes.array.isRequired,
|
||||||
showStartDatafeedModal: PropTypes.func.isRequired,
|
showStartDatafeedModal: PropTypes.func.isRequired,
|
||||||
showDeleteJobModal: PropTypes.func.isRequired,
|
showDeleteJobModal: PropTypes.func.isRequired,
|
||||||
refreshJobs: PropTypes.func.isRequired,
|
refreshJobs: PropTypes.func.isRequired,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue