mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -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
|
||||
addNewGroup={this.addNewGroup}
|
||||
allJobIds={this.props.allJobIds}
|
||||
/>
|
||||
|
||||
<EuiHorizontalRule margin="m" />
|
||||
|
@ -254,5 +255,6 @@ export class GroupSelector extends Component {
|
|||
}
|
||||
GroupSelector.propTypes = {
|
||||
jobs: PropTypes.array.isRequired,
|
||||
allJobIds: PropTypes.array.isRequired,
|
||||
refreshJobs: PropTypes.func.isRequired,
|
||||
};
|
||||
|
|
|
@ -34,7 +34,16 @@ export class NewGroupInput extends Component {
|
|||
|
||||
changeTempNewGroup = (e) => {
|
||||
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({
|
||||
tempNewGroupName,
|
||||
groupsValidationError,
|
||||
|
@ -101,4 +110,5 @@ export class NewGroupInput extends Component {
|
|||
|
||||
NewGroupInput.propTypes = {
|
||||
addNewGroup: PropTypes.func.isRequired,
|
||||
allJobIds: PropTypes.array.isRequired,
|
||||
};
|
||||
|
|
|
@ -34,6 +34,7 @@ export class MultiJobActions extends Component {
|
|||
|
||||
<GroupSelector
|
||||
jobs={this.props.selectedJobs}
|
||||
allJobIds={this.props.allJobIds}
|
||||
refreshJobs={this.props.refreshJobs}
|
||||
/>
|
||||
|
||||
|
@ -51,6 +52,7 @@ export class MultiJobActions extends Component {
|
|||
}
|
||||
MultiJobActions.propTypes = {
|
||||
selectedJobs: PropTypes.array.isRequired,
|
||||
allJobIds: PropTypes.array.isRequired,
|
||||
showStartDatafeedModal: PropTypes.func.isRequired,
|
||||
showDeleteJobModal: PropTypes.func.isRequired,
|
||||
refreshJobs: PropTypes.func.isRequired,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue