mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
Updates start process cloud component
Improves the start process cloud component by adding error handling for the start process action and enhancing the UI. Specifically, it displays error messages from the backend response and provides a more user-friendly experience. Also includes minor UI improvements for error messages and general layout.
This commit is contained in:
@@ -1,13 +1,10 @@
|
|||||||
<mat-card appearance="outlined" class="adf-start-process" *ngIf="processDefinitionLoaded; else spinner">
|
<mat-card appearance="outlined" class="adf-start-process" *ngIf="processDefinitionLoaded; else spinner">
|
||||||
|
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<mat-card-title
|
<mat-card-title *ngIf="showTitle" class="adf-title">
|
||||||
*ngIf="showTitle"
|
|
||||||
class="adf-title">
|
|
||||||
{{ 'ADF_CLOUD_PROCESS_LIST.ADF_CLOUD_START_PROCESS.FORM.TITLE' | translate }}
|
{{ 'ADF_CLOUD_PROCESS_LIST.ADF_CLOUD_START_PROCESS.FORM.TITLE' | translate }}
|
||||||
</mat-card-title>
|
</mat-card-title>
|
||||||
|
|
||||||
<mat-card-subtitle id="error-message" *ngIf="errorMessageId">
|
<mat-card-subtitle class="adf-error-message" id="error-message" *ngIf="errorMessageId">
|
||||||
{{ errorMessageId | translate }}
|
{{ errorMessageId | translate }}
|
||||||
</mat-card-subtitle>
|
</mat-card-subtitle>
|
||||||
|
|
||||||
@@ -19,24 +16,23 @@
|
|||||||
*ngIf="showSelectProcessDropdown"
|
*ngIf="showSelectProcessDropdown"
|
||||||
data-automation-id="adf-select-cloud-process-dropdown"
|
data-automation-id="adf-select-cloud-process-dropdown"
|
||||||
>
|
>
|
||||||
<mat-label class="adf-start-process-input-label">{{ 'ADF_CLOUD_PROCESS_LIST.ADF_CLOUD_START_PROCESS.FORM.LABEL.TYPE' | translate }}</mat-label>
|
<mat-label class="adf-start-process-input-label">{{
|
||||||
<input
|
'ADF_CLOUD_PROCESS_LIST.ADF_CLOUD_START_PROCESS.FORM.LABEL.TYPE' | translate
|
||||||
matInput
|
}}</mat-label>
|
||||||
formControlName="processDefinition"
|
<input matInput formControlName="processDefinition" [matAutocomplete]="auto" id="processDefinitionName" />
|
||||||
[matAutocomplete]="auto"
|
|
||||||
id="processDefinitionName"
|
|
||||||
>
|
|
||||||
|
|
||||||
<div class="adf-process-input-autocomplete">
|
<div class="adf-process-input-autocomplete">
|
||||||
<mat-autocomplete
|
<mat-autocomplete
|
||||||
#auto="matAutocomplete"
|
#auto="matAutocomplete"
|
||||||
id="processDefinitionOptions"
|
id="processDefinitionOptions"
|
||||||
[displayWith]="displayProcessNameOnDropdown"
|
[displayWith]="displayProcessNameOnDropdown"
|
||||||
(optionSelected)="setProcessDefinitionOnForm($event.option.value)" >
|
(optionSelected)="setProcessDefinitionOnForm($event.option.value)"
|
||||||
|
>
|
||||||
<mat-option
|
<mat-option
|
||||||
*ngFor="let processDef of filteredProcesses"
|
*ngFor="let processDef of filteredProcesses"
|
||||||
[value]="getProcessDefinitionValue(processDef)"
|
[value]="getProcessDefinitionValue(processDef)"
|
||||||
(click)="processDefinitionSelectionChanged(processDef)">
|
(click)="processDefinitionSelectionChanged(processDef)"
|
||||||
|
>
|
||||||
{{ getProcessDefinitionValue(processDef) }}
|
{{ getProcessDefinitionValue(processDef) }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-autocomplete>
|
</mat-autocomplete>
|
||||||
@@ -45,14 +41,12 @@
|
|||||||
id="adf-select-process-dropdown"
|
id="adf-select-process-dropdown"
|
||||||
title="{{ 'ADF_CLOUD_PROCESS_LIST.ADF_CLOUD_START_PROCESS.FORM.SELECT_PROCESS_DROPDOWN' | translate }}"
|
title="{{ 'ADF_CLOUD_PROCESS_LIST.ADF_CLOUD_START_PROCESS.FORM.SELECT_PROCESS_DROPDOWN' | translate }}"
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
(click)="displayDropdown($event)">
|
(click)="displayDropdown($event)"
|
||||||
|
>
|
||||||
<mat-icon>arrow_drop_down</mat-icon>
|
<mat-icon>arrow_drop_down</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<mat-error
|
<mat-error *ngIf="processDefinition.hasError('required')" class="adf-error-pb">
|
||||||
*ngIf="processDefinition.hasError('required')"
|
|
||||||
class="adf-error-pb">
|
|
||||||
{{ 'ADF_CLOUD_PROCESS_LIST.ADF_CLOUD_START_PROCESS.ERROR.PROCESS_DEFINITION_REQUIRED' | translate }}
|
{{ 'ADF_CLOUD_PROCESS_LIST.ADF_CLOUD_START_PROCESS.ERROR.PROCESS_DEFINITION_REQUIRED' | translate }}
|
||||||
</mat-error>
|
</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
@@ -76,7 +70,7 @@
|
|||||||
</adf-inplace-form-input>
|
</adf-inplace-form-input>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<ng-container *ngIf="hasForm else taskFormCloudButtons">
|
<ng-container *ngIf="hasForm; else taskFormCloudButtons">
|
||||||
<adf-cloud-form
|
<adf-cloud-form
|
||||||
#startForm
|
#startForm
|
||||||
[appName]="appName"
|
[appName]="appName"
|
||||||
@@ -99,19 +93,12 @@
|
|||||||
</adf-cloud-form>
|
</adf-cloud-form>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
|
|
||||||
</mat-card>
|
</mat-card>
|
||||||
|
|
||||||
<ng-template #taskFormCloudButtons>
|
<ng-template #taskFormCloudButtons>
|
||||||
<div class="adf-start-process-cloud-actions">
|
<div class="adf-start-process-cloud-actions">
|
||||||
<button
|
<button *ngIf="showCancelButton" mat-button (click)="cancelStartProcess()" id="cancel_process">
|
||||||
*ngIf="showCancelButton"
|
|
||||||
mat-button
|
|
||||||
(click)="cancelStartProcess()"
|
|
||||||
id="cancel_process"
|
|
||||||
>
|
|
||||||
{{ cancelButtonLabel }}
|
{{ cancelButtonLabel }}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
@@ -139,9 +126,6 @@
|
|||||||
|
|
||||||
<ng-template #spinner>
|
<ng-template #spinner>
|
||||||
<div class="adf-loading-container">
|
<div class="adf-loading-container">
|
||||||
<mat-progress-spinner
|
<mat-progress-spinner class="adf-loading" color="primary" mode="indeterminate" />
|
||||||
class="adf-loading"
|
|
||||||
color="primary"
|
|
||||||
mode="indeterminate" />
|
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
@@ -19,6 +19,10 @@
|
|||||||
padding-bottom: 1.25em;
|
padding-bottom: 1.25em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-error-message {
|
||||||
|
padding-left: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
&-process-input-container {
|
&-process-input-container {
|
||||||
margin: 0 7px;
|
margin: 0 7px;
|
||||||
}
|
}
|
||||||
|
@@ -457,7 +457,7 @@ export class StartProcessCloudComponent implements OnChanges, OnInit {
|
|||||||
this.isProcessStarting = false;
|
this.isProcessStarting = false;
|
||||||
},
|
},
|
||||||
error: (err) => {
|
error: (err) => {
|
||||||
this.errorMessageId = 'ADF_CLOUD_PROCESS_LIST.ADF_CLOUD_START_PROCESS.ERROR.START';
|
this.errorMessageId = err?.response?.body?.message || 'ADF_CLOUD_PROCESS_LIST.ADF_CLOUD_START_PROCESS.ERROR.START_PROCESS';
|
||||||
this.unifyErrorResponse(err?.response?.body);
|
this.unifyErrorResponse(err?.response?.body);
|
||||||
this.error.emit(err);
|
this.error.emit(err);
|
||||||
this.isProcessStarting = false;
|
this.isProcessStarting = false;
|
||||||
|
Reference in New Issue
Block a user