[AAE-1022] Fix components to work on Community environments (#5296)

* [AAE-1022] Fix components to work on Community environments

* Remove appName input
This commit is contained in:
davidcanonieto
2019-12-18 17:33:50 +00:00
committed by Eugenio Romano
parent 0897d372a6
commit dead0087f4
37 changed files with 70 additions and 87 deletions

View File

@@ -51,9 +51,9 @@ import { TaskDetailsCloudModel } from '../../task/start-task/models/task-details
})
export class FormCloudComponent extends FormBaseComponent implements OnChanges, OnDestroy {
/** App id to fetch corresponding form and values. */
/** App name to fetch corresponding form and values. */
@Input()
appName: string;
appName: string = '';
/** The application version to use when fetching data */
@Input()

View File

@@ -31,7 +31,7 @@ export class FormDefinitionSelectorCloudComponent implements OnInit {
/** Name of the application. If specified, this shows the users who have access to the app. */
@Input()
appName: string;
appName: string = '';
/** Emitted when a form is selected. */
@Output()

View File

@@ -51,7 +51,7 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
/** The name of the application. */
@Input()
appName: string;
appName: string = '';
/** Id of the process instance filter. */
@Input()

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, OnDestroy } from '@angular/core';
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, OnDestroy, OnInit } from '@angular/core';
import { Observable, Subject } from 'rxjs';
import { ProcessFilterCloudService } from '../services/process-filter-cloud.service';
import { ProcessFilterCloudModel } from '../models/process-filter-cloud.model';
@@ -28,11 +28,11 @@ import { takeUntil } from 'rxjs/operators';
templateUrl: './process-filters-cloud.component.html',
styleUrls: ['process-filters-cloud.component.scss']
})
export class ProcessFiltersCloudComponent implements OnChanges, OnDestroy {
export class ProcessFiltersCloudComponent implements OnInit, OnChanges, OnDestroy {
/** (required) The application name */
@Input()
appName: string;
appName: string = '';
/** (optional) The filter to be selected by default */
@Input()
@@ -66,6 +66,12 @@ export class ProcessFiltersCloudComponent implements OnChanges, OnDestroy {
private processFilterCloudService: ProcessFilterCloudService,
private translationService: TranslationService ) { }
ngOnInit() {
if (this.appName === '') {
this.getFilters(this.appName);
}
}
ngOnChanges(changes: SimpleChanges) {
const appName = changes['appName'];
const filter = changes['filterParam'];

View File

@@ -41,7 +41,7 @@ export class ProcessFilterCloudModel {
this.key = obj.key || null;
this.icon = obj.icon || null;
this.index = obj.index || null;
this.appName = obj.appName || null;
this.appName = obj.appName || obj.appName === '' ? obj.appName : null;
this.processInstanceId = obj.processInstanceId || null;
this.processName = obj.processName || null;
this.initiator = obj.initiator || null;

View File

@@ -30,7 +30,7 @@ export class ProcessHeaderCloudComponent implements OnChanges {
/** (Required) The name of the application. */
@Input()
appName: string;
appName: string = '';
/** (Required) The id of the process instance. */
@Input()
@@ -50,7 +50,7 @@ export class ProcessHeaderCloudComponent implements OnChanges {
}
ngOnChanges() {
if (this.appName && this.processInstanceId) {
if ((this.appName || this.appName === '') && this.processInstanceId) {
this.loadProcessInstanceDetails(this.appName, this.processInstanceId);
}
}

View File

@@ -41,7 +41,7 @@ export class ProcessHeaderCloudService extends BaseCloudService {
* @returns Process instance details
*/
getProcessInstanceById(appName: string, processInstanceId: string): Observable<ProcessInstanceCloud> {
if (appName && processInstanceId) {
if ((appName || appName === '') && processInstanceId) {
const url = `${this.getBasePath(appName)}/query/v1/process-instances/${processInstanceId}`;
return this.get(url).pipe(

View File

@@ -44,7 +44,7 @@ export class ProcessListCloudComponent extends DataTableSchema implements OnChan
/** The name of the application. */
@Input()
appName: string;
appName: string = '';
/** Name of the initiator of the process. */
@Input()
@@ -185,7 +185,7 @@ export class ProcessListCloudComponent extends DataTableSchema implements OnChan
reload() {
this.requestNode = this.createRequestNode();
if (this.requestNode.appName) {
if (this.requestNode.appName || this.requestNode.appName === '') {
this.load(this.requestNode);
} else {
this.rows = [];

View File

@@ -37,7 +37,7 @@ export class ProcessListCloudService extends BaseCloudService {
* @returns Process information
*/
getProcessByRequest(requestNode: ProcessQueryCloudRequestModel): Observable<any> {
if (requestNode.appName) {
if (requestNode.appName || requestNode.appName === '') {
const queryUrl = `${this.getBasePath(requestNode.appName)}/query/v1/process-instances`;
const queryParams = this.buildQueryParams(requestNode);
const sortingParams = this.buildSortingParam(requestNode.sorting);

View File

@@ -46,7 +46,7 @@ export class StartProcessCloudComponent implements OnChanges, OnInit, OnDestroy
/** (required) Name of the app. */
@Input()
appName: string;
appName: string = '';
/** Maximum length of the process name. */
@Input()
@@ -120,6 +120,9 @@ export class StartProcessCloudComponent implements OnChanges, OnInit, OnDestroy
ngOnChanges(changes: SimpleChanges) {
if (changes['appName'] && changes['appName'].currentValue !== changes['appName'].previousValue) {
this.appName = changes['appName'].currentValue;
}
if (this.appName || this.appName === '') {
this.loadProcessDefinitions();
}
}

View File

@@ -42,7 +42,7 @@ export class StartProcessCloudService extends BaseCloudService {
* @returns Array of process definitions
*/
getProcessDefinitions(appName: string): Observable<ProcessDefinitionCloud[]> {
if (appName) {
if (appName || appName === '') {
const url = `${this.getBasePath(appName)}/rb/v1/process-definitions`;
return this.get(url).pipe(

View File

@@ -30,7 +30,7 @@ export class ClaimTaskDirective implements OnInit {
/** (Required) The name of the application. */
@Input()
appName: string;
appName: string = '';
/** Emitted when the task is completed. */
@Output()
@@ -68,7 +68,7 @@ export class ClaimTaskDirective implements OnInit {
}
isAppValid(): boolean {
return (this.appName && this.appName.length > 0);
return !!this.appName || this.appName === '';
}
@HostListener('click')

View File

@@ -29,7 +29,7 @@ export class CompleteTaskDirective implements OnInit {
/** (Required) The name of the application. */
@Input()
appName: string;
appName: string = '';
/** Emitted when the task is completed. */
@Output()
@@ -65,7 +65,7 @@ export class CompleteTaskDirective implements OnInit {
}
isAppValid(): boolean {
return (this.appName && this.appName.length > 0);
return !!this.appName || this.appName === '';
}
@HostListener('click')

View File

@@ -29,7 +29,7 @@ export class UnClaimTaskDirective implements OnInit {
/** (Required) The name of the application. */
@Input()
appName: string;
appName: string = '';
/** Emitted when the task is completed. */
@Output()
@@ -66,7 +66,7 @@ export class UnClaimTaskDirective implements OnInit {
}
isAppValid(): boolean {
return (this.appName && this.appName.length > 0);
return !!this.appName || this.appName === '';
}
@HostListener('click')

View File

@@ -47,7 +47,7 @@ export class TaskCloudService extends BaseCloudService {
* @returns Details of the task that was completed
*/
completeTask(appName: string, taskId: string): Observable<TaskDetailsCloudModel> {
if (appName && taskId) {
if ((appName || appName === '') && taskId) {
const url = `${this.getBasePath(appName)}/rb/v1/tasks/${taskId}/complete`;
const payload = { 'payloadType': 'CompleteTaskPayload' };
@@ -103,7 +103,7 @@ export class TaskCloudService extends BaseCloudService {
* @returns Details of the claimed task
*/
claimTask(appName: string, taskId: string, assignee: string): Observable<TaskDetailsCloudModel> {
if (appName && taskId) {
if ((appName || appName === '') && taskId) {
const queryUrl = `${this.getBasePath(appName)}/rb/v1/tasks/${taskId}/claim?assignee=${assignee}`;
return this.post(queryUrl).pipe(
@@ -125,7 +125,7 @@ export class TaskCloudService extends BaseCloudService {
* @returns Details of the task that was unclaimed
*/
unclaimTask(appName: string, taskId: string): Observable<TaskDetailsCloudModel> {
if (appName && taskId) {
if ((appName || appName === '') && taskId) {
const queryUrl = `${this.getBasePath(appName)}/rb/v1/tasks/${taskId}/release`;
return this.post(queryUrl).pipe(
@@ -147,7 +147,7 @@ export class TaskCloudService extends BaseCloudService {
* @returns Task details
*/
getTaskById(appName: string, taskId: string): Observable<TaskDetailsCloudModel> {
if (appName && taskId) {
if ((appName || appName === '') && taskId) {
const queryUrl = `${this.getBasePath(appName)}/query/v1/tasks/${taskId}`;
return this.get(queryUrl).pipe(
@@ -182,7 +182,7 @@ export class TaskCloudService extends BaseCloudService {
* @returns Updated task details
*/
updateTask(appName: string, taskId: string, payload: any): Observable<TaskDetailsCloudModel> {
if (appName && taskId) {
if ((appName || appName === '') && taskId) {
payload.payloadType = 'UpdateTaskPayload';
const queryUrl = `${this.getBasePath(appName)}/rb/v1/tasks/${taskId}`;
@@ -202,7 +202,7 @@ export class TaskCloudService extends BaseCloudService {
* @returns Candidate users
*/
getCandidateUsers(appName: string, taskId: string): Observable<string[]> {
if (appName && taskId) {
if ((appName || appName === '') && taskId) {
const queryUrl = `${this.getBasePath(appName)}/query/v1/tasks/${taskId}/candidate-users`;
return this.get<string[]>(queryUrl);
} else {
@@ -218,7 +218,7 @@ export class TaskCloudService extends BaseCloudService {
* @returns Candidate groups
*/
getCandidateGroups(appName: string, taskId: string): Observable<string[]> {
if (appName && taskId) {
if ((appName || appName === '') && taskId) {
const queryUrl = `${this.getBasePath(appName)}/query/v1/tasks/${taskId}/candidate-groups`;
return this.get<string[]>(queryUrl);
} else {

View File

@@ -79,7 +79,8 @@
(selectGroup)="onCandidateGroupSelect($event)"
(removeGroup)="onCandidateGroupRemove($event)">
</adf-cloud-group>
<adf-cloud-form-definition-selector fxFlex
<adf-cloud-form-definition-selector *ngIf="appName"
fxFlex
[appName]="appName"
(selectForm)="onFormSelect($event)">
</adf-cloud-form-definition-selector>

View File

@@ -52,7 +52,7 @@ export class StartTaskCloudComponent implements OnInit, OnDestroy {
/** (required) Name of the app. */
@Input()
appName: string;
appName: string = '';
/** Maximum length of the task name. */
@Input()

View File

@@ -52,7 +52,7 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
/** (required) Name of the app. */
@Input()
appName: string;
appName: string = '';
/** (required) ID of the task filter. */
@Input()

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, OnDestroy } from '@angular/core';
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, OnDestroy, OnInit } from '@angular/core';
import { Observable, Subject } from 'rxjs';
import { TaskFilterCloudService } from '../services/task-filter-cloud.service';
import { TaskFilterCloudModel, FilterParamsModel } from '../models/filter-cloud.model';
@@ -27,10 +27,10 @@ import { takeUntil } from 'rxjs/operators';
templateUrl: './task-filters-cloud.component.html',
styleUrls: ['task-filters-cloud.component.scss']
})
export class TaskFiltersCloudComponent implements OnChanges, OnDestroy {
export class TaskFiltersCloudComponent implements OnInit, OnChanges, OnDestroy {
/** Display filters available to the current user for the application with the specified name. */
@Input()
appName: string;
appName: string = '';
/**
* Parameters to use for the task filter cloud. If there is no match then the default filter
@@ -66,6 +66,10 @@ export class TaskFiltersCloudComponent implements OnChanges, OnDestroy {
constructor(private taskFilterCloudService: TaskFilterCloudService, private translationService: TranslationService) {
}
ngOnInit() {
this.getFilters(this.appName);
}
ngOnChanges(changes: SimpleChanges) {
const appName = changes['appName'];
const filter = changes['filterParam'];

View File

@@ -46,7 +46,7 @@ export class TaskFilterCloudModel {
this.key = obj.key || null;
this.icon = obj.icon || null;
this.index = obj.index || null;
this.appName = obj.appName || null;
this.appName = obj.appName || obj.appName === '' ? obj.appName : null;
this.status = obj.status || null;
this.sort = obj.sort || null;
this.assignee = obj.assignee || null;

View File

@@ -17,7 +17,7 @@
import {
Component, EventEmitter, Input, OnChanges,
Output, SimpleChanges
Output, SimpleChanges, OnInit
} from '@angular/core';
import { TaskDetailsCloudModel } from '../../start-task/models/task-details-cloud.model';
import { TaskCloudService } from '../../services/task-cloud.service';
@@ -31,11 +31,11 @@ import { DateCloudWidgetComponent } from '../../../form/components/widgets/date/
templateUrl: './task-form-cloud.component.html',
styleUrls: ['./task-form-cloud.component.scss']
})
export class TaskFormCloudComponent implements OnChanges {
export class TaskFormCloudComponent implements OnInit, OnChanges {
/** App id to fetch corresponding form and values. */
@Input()
appName: string;
appName: string = '';
/** Task id to fetch corresponding form and values. */
@Input()
@@ -108,9 +108,15 @@ export class TaskFormCloudComponent implements OnChanges {
this.formRenderingService.setComponentTypeResolver('date', () => DateCloudWidgetComponent, true);
}
ngOnInit() {
if (this.appName === '' && this.taskId) {
this.loadTask();
}
}
ngOnChanges(changes: SimpleChanges) {
const appName = changes['appName'];
if (appName && (appName.currentValue || appName.currentValue === '') && this.taskId) {
if (appName && (appName.currentValue !== appName.previousValue) && this.taskId) {
this.loadTask();
return;
}

View File

@@ -45,7 +45,7 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
/** (Required) The name of the application. */
@Input()
appName: string;
appName: string = '';
/** (Required) The id of the task. */
@Input()
@@ -103,7 +103,7 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
ngOnChanges() {
this.taskDetails = {};
if (this.appName && this.taskId) {
if ((this.appName || this.appName === '') && this.taskId) {
this.loadTaskDetailsById(this.appName, this.taskId);
} else {
this.error.emit('App Name and Task Id are mandatory');
@@ -301,7 +301,7 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
}
isTaskValid(): boolean {
return (this.appName) && !!this.taskId;
return (this.appName || this.appName === '') && !!this.taskId;
}
isTaskAssigned(): boolean {

View File

@@ -233,7 +233,7 @@ export class TaskListCloudComponent extends DataTableSchema implements OnChanges
reload() {
this.requestNode = this.createRequestNode();
if (this.requestNode.appName) {
if (this.requestNode.appName || this.requestNode.appName === '') {
this.load(this.requestNode);
} else {
this.rows = [];

View File

@@ -38,7 +38,7 @@ export class TaskListCloudService extends BaseCloudService {
* @returns Task information
*/
getTaskByRequest(requestNode: TaskQueryCloudRequestModel): Observable<any> {
if (requestNode.appName) {
if (requestNode.appName || requestNode.appName === '') {
const queryUrl = `${this.getBasePath(requestNode.appName)}/query/v1/tasks`;
const queryParams = this.buildQueryParams(requestNode);
const sortingParams = this.buildSortingParam(requestNode.sorting);