Skip to content

Commit

Permalink
Update task schedule validator
Browse files Browse the repository at this point in the history
Resolves #1974
  • Loading branch information
oodamien authored Nov 29, 2023
1 parent 6a9b222 commit c582b56
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ui/src/app/tasks-jobs/tasks/task-prop.validator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('tasks-jobs/tasks/task-prop.validator.ts', () => {
});
});
it('valid', () => {
['app.foo', 'deployer.foo', 'scheduler.foo'].forEach(mock => {
['app.foo', 'deployer.foo', 'scheduler.foo', 'version..foo'].forEach(mock => {
const control: UntypedFormControl = new UntypedFormControl(mock);
expect(TaskPropValidator.key(control)).toBeNull();
});
Expand Down
8 changes: 7 additions & 1 deletion ui/src/app/tasks-jobs/tasks/task-prop.validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ import {UntypedFormControl} from '@angular/forms';
export class TaskPropValidator {
static key(control: UntypedFormControl): any {
const value = control.value;
if (value && !value.startsWith('app.') && !value.startsWith('deployer.') && !value.startsWith('scheduler.')) {
if (
value &&
!value.startsWith('app.') &&
!value.startsWith('deployer.') &&
!value.startsWith('scheduler.') &&
!value.startsWith('version.')
) {
return {invalid: true};
}
return null;
Expand Down

0 comments on commit c582b56

Please sign in to comment.