diff --git a/demo-shell/resources/i18n/en.json b/demo-shell/resources/i18n/en.json index c5897a9ad5..684535ce1b 100644 --- a/demo-shell/resources/i18n/en.json +++ b/demo-shell/resources/i18n/en.json @@ -221,7 +221,8 @@ "ERROR_MESSAGE": { "APP_ID_REQUIRED_ERROR": "Insert App ID", "APP_ID_TYPE_ERROR": "App ID must be a number", - "NUMBER_TYPE_ERROR": "Value must be a number" + "NUMBER_TYPE_ERROR": "Value must be a number", + "NUMBER_GREATER_THAN": "Value must be greater than or equal to {{ value }}" }, "TOOLTIP_MESSAGE": { "START_INPUT": "Starting page" diff --git a/demo-shell/src/app/components/task-list-demo/task-list-demo.component.html b/demo-shell/src/app/components/task-list-demo/task-list-demo.component.html index a1c16a6d7f..b4eac64779 100644 --- a/demo-shell/src/app/components/task-list-demo/task-list-demo.component.html +++ b/demo-shell/src/app/components/task-list-demo/task-list-demo.component.html @@ -64,6 +64,12 @@ matInput class="form-control" [formControl]="taskSize"> + + {{ 'TASK_LIST_DEMO.ERROR_MESSAGE.NUMBER_GREATER_THAN' | translate: { value: minValue } }} + + + {{ 'TASK_LIST_DEMO.ERROR_MESSAGE.NUMBER_TYPE_ERROR' | translate }} + @@ -72,6 +78,12 @@ matInput class="form-control" [formControl]="taskPage"> + + {{ 'TASK_LIST_DEMO.ERROR_MESSAGE.NUMBER_GREATER_THAN' | translate: { value: minValue } }} + + + {{ 'TASK_LIST_DEMO.ERROR_MESSAGE.NUMBER_TYPE_ERROR' | translate }} + diff --git a/demo-shell/src/app/components/task-list-demo/task-list-demo.component.ts b/demo-shell/src/app/components/task-list-demo/task-list-demo.component.ts index b7ffad3641..03741882e0 100644 --- a/demo-shell/src/app/components/task-list-demo/task-list-demo.component.ts +++ b/demo-shell/src/app/components/task-list-demo/task-list-demo.component.ts @@ -31,6 +31,7 @@ export class TaskListDemoComponent implements OnInit { taskListForm: FormGroup; errorMessage: string; + minValue = 1; appId: number; defaultAppId: number; @@ -101,8 +102,8 @@ export class TaskListDemoComponent implements OnInit { taskAssignment: new FormControl(''), taskState: new FormControl(''), taskSort: new FormControl(''), - taskSize: new FormControl(''), - taskPage: new FormControl(''), + taskSize: new FormControl('', [Validators.pattern('^[0-9]*$'), Validators.min(this.minValue)]), + taskPage: new FormControl('', [Validators.pattern('^[0-9]*$'), Validators.min(this.minValue)]), taskDueAfter: new FormControl(''), taskDueBefore: new FormControl(''), taskStart: new FormControl('', [Validators.pattern('^[0-9]*$')]), @@ -130,17 +131,19 @@ export class TaskListDemoComponent implements OnInit { this.state = taskFilter.taskState; this.sort = taskFilter.taskSort; this.start = taskFilter.taskStart; + this.dueAfter = taskFilter.taskDueAfter; + this.dueBefore = taskFilter.taskDueBefore; + if (taskFilter.taskSize) { this.size = parseInt(taskFilter.taskSize, 10); } - let pageValue = parseInt(taskFilter.taskPage, 10); - if ( pageValue > 0) { - this.page = pageValue - 1; + + if (taskFilter.taskPage) { + let pageValue = parseInt(taskFilter.taskPage, 10); + this.page = pageValue > 0 ? pageValue - 1 : pageValue; } else { - this.page = pageValue; + this.page = 0; } - this.dueAfter = taskFilter.taskDueAfter; - this.dueBefore = taskFilter.taskDueBefore; this.includeProcessInstance = taskFilter.taskIncludeProcessInstance === 'include'; }