mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-4389] StartProcessCloud - add validation for processName (#4707)
* [ADF-4389] StartProcessCloud - add validation for processName * [ADF-4389] - change function definition name * [ADF-4389] - add return type
This commit is contained in:
committed by
Maurizio Vitale
parent
164d398abc
commit
d1bc5a608a
@@ -55,6 +55,6 @@ export class StartProcessCloudDemoComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
openSnackMessage(event: any) {
|
openSnackMessage(event: any) {
|
||||||
this.notificationService.openSnackMessage(event.response.body.message);
|
this.notificationService.openSnackMessage(event.response.body.entry.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -122,11 +122,11 @@ export class StartProcessCloudComponent implements OnChanges, OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private getProcessDefinitionList(processDefinitionName: string): ProcessDefinitionCloud[] {
|
private getProcessDefinitionList(processDefinitionName: string): ProcessDefinitionCloud[] {
|
||||||
return this.processDefinitionList.filter((option) => option.name && option.name.toLowerCase().includes(processDefinitionName.toLowerCase()));
|
return this.processDefinitionList.filter((option) => this.isValidName(option.name) && option.name.toLowerCase().includes(processDefinitionName.toLowerCase()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private getProcessIfExists(processDefinitionName: string): ProcessDefinitionCloud {
|
private getProcessIfExists(processDefinitionName: string): ProcessDefinitionCloud {
|
||||||
let matchedProcess = this.processDefinitionList.find((option) => option.name.toLowerCase() === processDefinitionName.toLowerCase());
|
let matchedProcess = this.processDefinitionList.find((option) => this.isValidName(option.name) && option.name.toLowerCase() === processDefinitionName.toLowerCase());
|
||||||
if (!matchedProcess) {
|
if (!matchedProcess) {
|
||||||
matchedProcess = new ProcessDefinitionCloud();
|
matchedProcess = new ProcessDefinitionCloud();
|
||||||
}
|
}
|
||||||
@@ -162,6 +162,10 @@ export class StartProcessCloudComponent implements OnChanges, OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private isValidName(name: string): boolean {
|
||||||
|
return !!name;
|
||||||
|
}
|
||||||
|
|
||||||
isProcessDefinitionsEmpty(): boolean {
|
isProcessDefinitionsEmpty(): boolean {
|
||||||
return this.processDefinitionList.length === 0;
|
return this.processDefinitionList.length === 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user