[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

@@ -84,10 +84,7 @@ import { environment } from '../environments/environment';
import { AppCloudSharedModule } from './components/cloud/shared/cloud.shared.module'; import { AppCloudSharedModule } from './components/cloud/shared/cloud.shared.module';
import { DemoErrorComponent } from './components/error/demo-error.component'; import { DemoErrorComponent } from './components/error/demo-error.component';
import { import {
ProcessServicesCloudModule, ProcessServicesCloudModule
UserPreferenceCloudService,
PROCESS_FILTERS_SERVICE_TOKEN,
TASK_FILTERS_SERVICE_TOKEN
} from '@alfresco/adf-process-services-cloud'; } from '@alfresco/adf-process-services-cloud';
import { registerLocaleData } from '@angular/common'; import { registerLocaleData } from '@angular/common';
@@ -199,8 +196,6 @@ registerLocaleData(localeSv);
provide: HTTP_INTERCEPTORS, useClass: provide: HTTP_INTERCEPTORS, useClass:
AuthBearerInterceptor, multi: true AuthBearerInterceptor, multi: true
}, },
{ provide: PROCESS_FILTERS_SERVICE_TOKEN, useClass: UserPreferenceCloudService },
{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: UserPreferenceCloudService },
{ provide: AppConfigService, useClass: DebugAppConfigService }, // not use this service in production { provide: AppConfigService, useClass: DebugAppConfigService }, // not use this service in production
{ {
provide: TRANSLATION_PROVIDER, provide: TRANSLATION_PROVIDER,

View File

@@ -33,8 +33,6 @@ import { CloudLayoutService } from '../services/cloud-layout.service';
}) })
export class CommunityCloudComponent { export class CommunityCloudComponent {
appName: string = '';
constructor( constructor(
private router: Router, private router: Router,
private route: ActivatedRoute, private route: ActivatedRoute,

View File

@@ -7,7 +7,6 @@
</mat-expansion-panel-header> </mat-expansion-panel-header>
<adf-cloud-task-filters <adf-cloud-task-filters
*ngIf="expandTaskFilter" *ngIf="expandTaskFilter"
[appName]="appName"
[showIcons]="true" [showIcons]="true"
[filterParam]="currentTaskFilter$ | async" [filterParam]="currentTaskFilter$ | async"
(filterClick)="onTaskFilterSelected($event)"> (filterClick)="onTaskFilterSelected($event)">
@@ -22,7 +21,6 @@
</mat-expansion-panel-header> </mat-expansion-panel-header>
<adf-cloud-process-filters <adf-cloud-process-filters
*ngIf="expandProcessFilter" *ngIf="expandProcessFilter"
[appName]="appName"
[showIcons]="true" [showIcons]="true"
[filterParam]="currentProcessFilter$ | async" [filterParam]="currentProcessFilter$ | async"
(filterClick)="onProcessFilterSelected($event)"> (filterClick)="onProcessFilterSelected($event)">

View File

@@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { Component, ViewEncapsulation, Input, OnInit } from '@angular/core'; import { Component, ViewEncapsulation, OnInit } from '@angular/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { Router, ActivatedRoute } from '@angular/router'; import { Router, ActivatedRoute } from '@angular/router';
import { CloudLayoutService } from '../services/cloud-layout.service'; import { CloudLayoutService } from '../services/cloud-layout.service';
@@ -26,9 +26,6 @@ import { CloudLayoutService } from '../services/cloud-layout.service';
}) })
export class CommunityCloudFiltersDemoComponent implements OnInit { export class CommunityCloudFiltersDemoComponent implements OnInit {
@Input()
appName: string = 'community';
currentTaskFilter$: Observable<any>; currentTaskFilter$: Observable<any>;
currentProcessFilter$: Observable<any>; currentProcessFilter$: Observable<any>;

View File

@@ -3,14 +3,13 @@
<mat-icon>arrow_back</mat-icon> Go Back <mat-icon>arrow_back</mat-icon> Go Back
</button> </button>
<h4 data-automation-id="process-details-header">Simple page to show the process instance: {{ processInstanceId }} of the app: {{ appName }}</h4> <h4 data-automation-id="process-details-header">Simple page to show the process instance: {{ processInstanceId }}</h4>
<div class="app-process-cloud-container"> <div class="app-process-cloud-container">
<adf-cloud-task-list <adf-cloud-task-list
fxFlex fxFlex
class="app-cloud-layout-overflow" class="app-cloud-layout-overflow"
[appName]="''"
[processInstanceId]="processInstanceId" [processInstanceId]="processInstanceId"
(rowClick)="onRowClick($event)" (rowClick)="onRowClick($event)"
#taskCloud> #taskCloud>
@@ -18,7 +17,6 @@
<adf-cloud-process-header <adf-cloud-process-header
class="app-process-cloud-header" class="app-process-cloud-header"
[appName]="''"
[processInstanceId]="processInstanceId"> [processInstanceId]="processInstanceId">
</adf-cloud-process-header> </adf-cloud-process-header>
</div> </div>

View File

@@ -25,16 +25,11 @@ import { ActivatedRoute, Router } from '@angular/router';
export class CommunityProcessDetailsCloudDemoComponent { export class CommunityProcessDetailsCloudDemoComponent {
processInstanceId: string; processInstanceId: string;
appName: string;
constructor(private route: ActivatedRoute, private router: Router) { constructor(private route: ActivatedRoute, private router: Router) {
this.route.params.subscribe((params) => { this.route.params.subscribe((params) => {
this.processInstanceId = params.processInstanceId; this.processInstanceId = params.processInstanceId;
}); });
this.route.parent.params.subscribe((params) => {
this.appName = params.appName;
});
} }
onGoBack() { onGoBack() {

View File

@@ -1,7 +1,6 @@
<div fxLayout="column" fxFill fxLayoutGap="2px"> <div fxLayout="column" fxFill fxLayoutGap="2px">
<adf-cloud-edit-process-filter <adf-cloud-edit-process-filter
[id]="filterId" [id]="filterId"
[appName]="'community'"
[filterProperties]="processFilterProperties.filterProperties" [filterProperties]="processFilterProperties.filterProperties"
[sortProperties]="processFilterProperties.sortProperties" [sortProperties]="processFilterProperties.sortProperties"
[actions]="processFilterProperties.actions" [actions]="processFilterProperties.actions"
@@ -11,7 +10,6 @@
<div fxLayout="column" fxFlex fxLayoutAlign="space-between" *ngIf="editedFilter"> <div fxLayout="column" fxFlex fxLayoutAlign="space-between" *ngIf="editedFilter">
<adf-cloud-process-list #processCloud <adf-cloud-process-list #processCloud
fxFlex fxFlex
[appName]="''"
class="app-cloud-layout-overflow" class="app-cloud-layout-overflow"
[initiator]="editedFilter.initiator" [initiator]="editedFilter.initiator"
[processDefinitionId]="editedFilter.processDefinitionId" [processDefinitionId]="editedFilter.processDefinitionId"

View File

@@ -44,9 +44,7 @@ export class CommunityProcessesCloudDemoComponent implements OnInit, OnDestroy {
@ViewChild('processFiltersCloud') @ViewChild('processFiltersCloud')
processFiltersCloud: ProcessFiltersCloudComponent; processFiltersCloud: ProcessFiltersCloudComponent;
appName: string = '';
isFilterLoaded: boolean; isFilterLoaded: boolean;
filterId: string = ''; filterId: string = '';
sortArray: any = []; sortArray: any = [];
selectedRow: any; selectedRow: any;
@@ -79,10 +77,6 @@ export class CommunityProcessesCloudDemoComponent implements OnInit, OnDestroy {
ngOnInit() { ngOnInit() {
this.isFilterLoaded = false; this.isFilterLoaded = false;
this.route.parent.params.subscribe((params) => {
this.appName = params.appName;
});
this.route.queryParams.subscribe((params) => { this.route.queryParams.subscribe((params) => {
if (Object.keys(params).length > 0) { if (Object.keys(params).length > 0) {
this.isFilterLoaded = true; this.isFilterLoaded = true;

View File

@@ -1,6 +1,5 @@
<adf-cloud-start-process <adf-cloud-start-process
[name]="processName" [name]="processName"
[appName]="''"
(error)="openSnackMessage($event)" (error)="openSnackMessage($event)"
(success)="onStartProcessSuccess()" (success)="onStartProcessSuccess()"
(cancel)="onCancelStartProcess()"> (cancel)="onCancelStartProcess()">

View File

@@ -1,5 +1,4 @@
<adf-cloud-start-task <adf-cloud-start-task
[appName]="''"
(error)="openSnackMessage($event)" (error)="openSnackMessage($event)"
(success)="onStartTaskSuccess()" (success)="onStartTaskSuccess()"
(cancel)="onCancelStartTask()"> (cancel)="onCancelStartTask()">

View File

@@ -1,7 +1,6 @@
<div fxLayout="column" fxFill fxLayoutGap="2px"> <div fxLayout="column" fxFill fxLayoutGap="2px">
<adf-cloud-edit-task-filter <adf-cloud-edit-task-filter
[id]="filterId" [id]="filterId"
[appName]="'community'"
[filterProperties]="taskFilterProperties.filterProperties" [filterProperties]="taskFilterProperties.filterProperties"
[sortProperties]="taskFilterProperties.sortProperties" [sortProperties]="taskFilterProperties.sortProperties"
[actions]="taskFilterProperties.actions" [actions]="taskFilterProperties.actions"
@@ -11,7 +10,6 @@
<div fxLayout="column" fxFlex fxLayoutAlign="space-between" *ngIf="editedFilter"> <div fxLayout="column" fxFlex fxLayoutAlign="space-between" *ngIf="editedFilter">
<adf-cloud-task-list #taskCloud <adf-cloud-task-list #taskCloud
fxFlex fxFlex
[appName]="''"
class="app-cloud-layout-overflow" class="app-cloud-layout-overflow"
[processDefinitionId]="editedFilter.processDefinitionId" [processDefinitionId]="editedFilter.processDefinitionId"
[processInstanceId]="editedFilter.processInstanceId" [processInstanceId]="editedFilter.processInstanceId"

View File

@@ -1,10 +1,9 @@
<h4 data-automation-id="task-details-header">Simple page to show the taskId: {{ taskId }} of the app: {{ appName }}</h4> <h4 data-automation-id="task-details-header">Simple page to show the taskId: {{ taskId }}</h4>
<div fxLayout="column" fxFill fxLayoutGap="2px"> <div fxLayout="column" fxFill fxLayoutGap="2px">
<div fxLayout="row" fxFill> <div fxLayout="row" fxFill>
<div fxLayout="column" fxFlex="80%"> <div fxLayout="column" fxFlex="80%">
<adf-cloud-task-form <adf-cloud-task-form
[appName]="''"
[taskId]="taskId" [taskId]="taskId"
(cancelClick)="goBack()" (cancelClick)="goBack()"
(taskClaimed)="onClaimTask()" (taskClaimed)="onClaimTask()"
@@ -14,7 +13,6 @@
</adf-cloud-task-form> </adf-cloud-task-form>
</div> </div>
<adf-cloud-task-header fxFlex <adf-cloud-task-header fxFlex
[appName]="''"
[taskId]="taskId"> [taskId]="taskId">
</adf-cloud-task-header> </adf-cloud-task-header>
</div> </div>

View File

@@ -26,7 +26,6 @@ import { NotificationService } from '@alfresco/adf-core';
export class CommunityTaskDetailsCloudDemoComponent { export class CommunityTaskDetailsCloudDemoComponent {
taskId: string; taskId: string;
appName: string;
constructor( constructor(
private route: ActivatedRoute, private route: ActivatedRoute,
@@ -36,13 +35,10 @@ export class CommunityTaskDetailsCloudDemoComponent {
this.route.params.subscribe((params) => { this.route.params.subscribe((params) => {
this.taskId = params.taskId; this.taskId = params.taskId;
}); });
this.route.parent.params.subscribe((params) => {
this.appName = params.appName;
});
} }
isTaskValid(): boolean { isTaskValid(): boolean {
return this.appName !== undefined && this.taskId !== undefined; return this.taskId !== undefined;
} }
goBack() { goBack() {

View File

@@ -51,9 +51,9 @@ import { TaskDetailsCloudModel } from '../../task/start-task/models/task-details
}) })
export class FormCloudComponent extends FormBaseComponent implements OnChanges, OnDestroy { 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() @Input()
appName: string; appName: string = '';
/** The application version to use when fetching data */ /** The application version to use when fetching data */
@Input() @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. */ /** Name of the application. If specified, this shows the users who have access to the app. */
@Input() @Input()
appName: string; appName: string = '';
/** Emitted when a form is selected. */ /** Emitted when a form is selected. */
@Output() @Output()

View File

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

View File

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

View File

@@ -41,7 +41,7 @@ export class ProcessFilterCloudModel {
this.key = obj.key || null; this.key = obj.key || null;
this.icon = obj.icon || null; this.icon = obj.icon || null;
this.index = obj.index || 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.processInstanceId = obj.processInstanceId || null;
this.processName = obj.processName || null; this.processName = obj.processName || null;
this.initiator = obj.initiator || null; this.initiator = obj.initiator || null;

View File

@@ -30,7 +30,7 @@ export class ProcessHeaderCloudComponent implements OnChanges {
/** (Required) The name of the application. */ /** (Required) The name of the application. */
@Input() @Input()
appName: string; appName: string = '';
/** (Required) The id of the process instance. */ /** (Required) The id of the process instance. */
@Input() @Input()
@@ -50,7 +50,7 @@ export class ProcessHeaderCloudComponent implements OnChanges {
} }
ngOnChanges() { ngOnChanges() {
if (this.appName && this.processInstanceId) { if ((this.appName || this.appName === '') && this.processInstanceId) {
this.loadProcessInstanceDetails(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 * @returns Process instance details
*/ */
getProcessInstanceById(appName: string, processInstanceId: string): Observable<ProcessInstanceCloud> { getProcessInstanceById(appName: string, processInstanceId: string): Observable<ProcessInstanceCloud> {
if (appName && processInstanceId) { if ((appName || appName === '') && processInstanceId) {
const url = `${this.getBasePath(appName)}/query/v1/process-instances/${processInstanceId}`; const url = `${this.getBasePath(appName)}/query/v1/process-instances/${processInstanceId}`;
return this.get(url).pipe( return this.get(url).pipe(

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -46,7 +46,7 @@ export class TaskFilterCloudModel {
this.key = obj.key || null; this.key = obj.key || null;
this.icon = obj.icon || null; this.icon = obj.icon || null;
this.index = obj.index || 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.status = obj.status || null;
this.sort = obj.sort || null; this.sort = obj.sort || null;
this.assignee = obj.assignee || null; this.assignee = obj.assignee || null;

View File

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

View File

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

View File

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

View File

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