mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-4068] ProcessServices - add description validation on Edit Task Form (#4366)
* [ADF-4068] StartTaskComponent - fix name and description empty space validation * [ADF-4068] StartTakComponent - add unit test * [ADF-4068] ProcessServices - add description validaton on edit task form * [ADF-4068] ProcessServies - fix build issue
This commit is contained in:
committed by
Maurizio Vitale
parent
1fef1e14ff
commit
933a7256a3
@@ -200,6 +200,9 @@
|
|||||||
"DESCRIPTION_DEFAULT": "No description",
|
"DESCRIPTION_DEFAULT": "No description",
|
||||||
"FORM_NAME": "Form Name",
|
"FORM_NAME": "Form Name",
|
||||||
"FORM_NAME_DEFAULT": "No form"
|
"FORM_NAME_DEFAULT": "No form"
|
||||||
|
},
|
||||||
|
"FORM_VALIDATION": {
|
||||||
|
"INVALID_FIELD": "Enter a different value"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -29,6 +29,7 @@ import {
|
|||||||
} from '@alfresco/adf-core';
|
} from '@alfresco/adf-core';
|
||||||
import { TaskDetailsModel } from '../models/task-details.model';
|
import { TaskDetailsModel } from '../models/task-details.model';
|
||||||
import { TaskListService } from './../services/tasklist.service';
|
import { TaskListService } from './../services/tasklist.service';
|
||||||
|
import { TaskDescriptionValidator } from '../validators/task-description.validator';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-task-header',
|
selector: 'adf-task-header',
|
||||||
@@ -168,7 +169,8 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
|
|||||||
key: 'description',
|
key: 'description',
|
||||||
default: this.translationService.instant('ADF_TASK_LIST.PROPERTIES.DESCRIPTION_DEFAULT'),
|
default: this.translationService.instant('ADF_TASK_LIST.PROPERTIES.DESCRIPTION_DEFAULT'),
|
||||||
multiline: true,
|
multiline: true,
|
||||||
editable: true
|
editable: true,
|
||||||
|
validators: [new TaskDescriptionValidator()]
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
new CardViewTextItemModel(
|
new CardViewTextItemModel(
|
||||||
|
@@ -0,0 +1,29 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2019 Alfresco Software, Ltd.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { CardViewItemValidator } from '@alfresco/adf-core';
|
||||||
|
|
||||||
|
export class TaskDescriptionValidator implements CardViewItemValidator {
|
||||||
|
|
||||||
|
message: string = 'ADF_CLOUD_TASK_HEADER.FORM_VALIDATION.INVALID_FIELD';
|
||||||
|
|
||||||
|
isValid(value: any): boolean {
|
||||||
|
const isWhitespace = (value || '').trim().length === 0;
|
||||||
|
return value.length === 0 || !isWhitespace;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user