mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[AAE-7244] fix process services cloud eslint warnings (#7503)
* fix process services cloud eslint warnings * fix export of private consts * improve constant export * fix unit tests
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { EditProcessFilterCloudComponent, ProcessFilterAction, ProcessFilterCloudModel } from '@alfresco/adf-process-services-cloud';
|
||||
import { ProcessFilterAction, ProcessFilterCloudModel, PROCESS_FILTER_ACTION_DELETE, PROCESS_FILTER_ACTION_SAVE, PROCESS_FILTER_ACTION_SAVE_AS } from '@alfresco/adf-process-services-cloud';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { UserPreferencesService, DataCellEvent } from '@alfresco/adf-core';
|
||||
import { CloudLayoutService, CloudServiceSettings } from './services/cloud-layout.service';
|
||||
@@ -124,13 +124,13 @@ export class ProcessesCloudDemoComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
onProcessFilterAction(filterAction: ProcessFilterAction) {
|
||||
if (filterAction.actionType === EditProcessFilterCloudComponent.ACTION_DELETE) {
|
||||
if (filterAction.actionType === PROCESS_FILTER_ACTION_DELETE) {
|
||||
this.cloudLayoutService.setCurrentProcessFilterParam({ index: 0 });
|
||||
} else {
|
||||
this.cloudLayoutService.setCurrentProcessFilterParam({ id: filterAction.filter.id });
|
||||
}
|
||||
|
||||
if ([EditProcessFilterCloudComponent.ACTION_SAVE, EditProcessFilterCloudComponent.ACTION_SAVE_AS].includes(filterAction.actionType)) {
|
||||
if ([PROCESS_FILTER_ACTION_SAVE, PROCESS_FILTER_ACTION_SAVE_AS].includes(filterAction.actionType)) {
|
||||
this.onFilterChange(filterAction.filter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,13 +24,14 @@
|
||||
"@typescript-eslint/naming-convention": "warn",
|
||||
"@typescript-eslint/consistent-type-assertions": "warn",
|
||||
"@typescript-eslint/prefer-for-of": "warn",
|
||||
"no-underscore-dangle": "warn",
|
||||
"@typescript-eslint/member-ordering": "off",
|
||||
"no-underscore-dangle": ["error", { "allowAfterThis": true }],
|
||||
"no-shadow": "warn",
|
||||
"quote-props": "warn",
|
||||
"object-shorthand": "warn",
|
||||
"prefer-const": "warn",
|
||||
"arrow-body-style": "warn",
|
||||
"@angular-eslint/no-output-native": "warn",
|
||||
"@angular-eslint/no-output-native": "off",
|
||||
"space-before-function-paren": "warn",
|
||||
|
||||
"@angular-eslint/component-selector": [
|
||||
|
||||
@@ -35,6 +35,7 @@ export class AppDetailsCloudComponent {
|
||||
|
||||
/**
|
||||
* Pass the selected app as next
|
||||
*
|
||||
* @param app
|
||||
*/
|
||||
onSelectApp(app: ApplicationInstanceModel): void {
|
||||
|
||||
@@ -21,7 +21,7 @@ import { setupTestBed, AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { of, throwError } from 'rxjs';
|
||||
|
||||
import { fakeApplicationInstance } from '../mock/app-model.mock';
|
||||
import { AppListCloudComponent } from './app-list-cloud.component';
|
||||
import { AppListCloudComponent, LAYOUT_GRID, LAYOUT_LIST } from './app-list-cloud.component';
|
||||
import { AppsProcessCloudService } from '../services/apps-process-cloud.service';
|
||||
import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
@@ -38,9 +38,7 @@ describe('AppListCloudComponent', () => {
|
||||
oauth2Auth: {
|
||||
callCustomApi: () => Promise.resolve(fakeApplicationInstance)
|
||||
},
|
||||
isEcmLoggedIn() {
|
||||
return false;
|
||||
},
|
||||
isEcmLoggedIn: () => false,
|
||||
reply: jasmine.createSpy('reply')
|
||||
};
|
||||
|
||||
@@ -155,7 +153,7 @@ describe('AppListCloudComponent', () => {
|
||||
});
|
||||
|
||||
it('should display a grid when configured to', () => {
|
||||
component.layoutType = AppListCloudComponent.LAYOUT_GRID;
|
||||
component.layoutType = LAYOUT_GRID;
|
||||
fixture.detectChanges();
|
||||
expect(component.isGrid()).toBe(true);
|
||||
expect(component.isList()).toBe(false);
|
||||
@@ -170,7 +168,7 @@ describe('AppListCloudComponent', () => {
|
||||
describe('List Layout ', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
component.layoutType = AppListCloudComponent.LAYOUT_LIST;
|
||||
component.layoutType = LAYOUT_LIST;
|
||||
});
|
||||
|
||||
it('should display a LIST when configured to', () => {
|
||||
|
||||
@@ -22,17 +22,16 @@ import { AppsProcessCloudService } from '../services/apps-process-cloud.service'
|
||||
import { ApplicationInstanceModel } from '../models/application-instance.model';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
|
||||
export const LAYOUT_LIST: string = 'LIST';
|
||||
export const LAYOUT_GRID: string = 'GRID';
|
||||
export const RUNNING_STATUS: string = 'RUNNING';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-cloud-app-list',
|
||||
templateUrl: './app-list-cloud.component.html',
|
||||
styleUrls: ['./app-list-cloud.component.scss']
|
||||
})
|
||||
export class AppListCloudComponent implements OnInit, AfterContentInit {
|
||||
|
||||
public static LAYOUT_LIST: string = 'LIST';
|
||||
public static LAYOUT_GRID: string = 'GRID';
|
||||
public static RUNNING_STATUS: string = 'RUNNING';
|
||||
|
||||
@ContentChild(CustomEmptyContentTemplateDirective)
|
||||
emptyCustomContent: CustomEmptyContentTemplateDirective;
|
||||
|
||||
@@ -40,7 +39,7 @@ export class AppListCloudComponent implements OnInit, AfterContentInit {
|
||||
* values, "GRID" and "LIST".
|
||||
*/
|
||||
@Input()
|
||||
layoutType: string = AppListCloudComponent.LAYOUT_GRID;
|
||||
layoutType: string = LAYOUT_GRID;
|
||||
|
||||
/** Emitted when an app entry is clicked. */
|
||||
@Output()
|
||||
@@ -57,7 +56,7 @@ export class AppListCloudComponent implements OnInit, AfterContentInit {
|
||||
this.setDefaultLayoutType();
|
||||
}
|
||||
|
||||
this.apps$ = this.appsProcessCloudService.getDeployedApplicationsByStatus(AppListCloudComponent.RUNNING_STATUS)
|
||||
this.apps$ = this.appsProcessCloudService.getDeployedApplicationsByStatus(RUNNING_STATUS)
|
||||
.pipe(
|
||||
catchError(() => {
|
||||
this.loadingError$.next(true);
|
||||
@@ -80,7 +79,7 @@ export class AppListCloudComponent implements OnInit, AfterContentInit {
|
||||
* Check if the value of the layoutType property is an allowed value
|
||||
*/
|
||||
isValidType(): boolean {
|
||||
if (this.layoutType && (this.layoutType === AppListCloudComponent.LAYOUT_LIST || this.layoutType === AppListCloudComponent.LAYOUT_GRID)) {
|
||||
if (this.layoutType && (this.layoutType === LAYOUT_LIST || this.layoutType === LAYOUT_GRID)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -90,20 +89,20 @@ export class AppListCloudComponent implements OnInit, AfterContentInit {
|
||||
* Assign the default value to LayoutType
|
||||
*/
|
||||
setDefaultLayoutType(): void {
|
||||
this.layoutType = AppListCloudComponent.LAYOUT_GRID;
|
||||
this.layoutType = LAYOUT_GRID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the layout type is LIST
|
||||
*/
|
||||
isList(): boolean {
|
||||
return this.layoutType === AppListCloudComponent.LAYOUT_LIST;
|
||||
return this.layoutType === LAYOUT_LIST;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the layout type is GRID
|
||||
*/
|
||||
isGrid(): boolean {
|
||||
return this.layoutType === AppListCloudComponent.LAYOUT_GRID;
|
||||
return this.layoutType === LAYOUT_GRID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,9 +34,7 @@ describe('AppsProcessCloudService', () => {
|
||||
oauth2Auth: {
|
||||
callCustomApi: () => Promise.resolve({list : { entries: [ {entry: fakeApplicationInstance[0]}, {entry: fakeApplicationInstance[1]}] }})
|
||||
},
|
||||
isEcmLoggedIn() {
|
||||
return false;
|
||||
},
|
||||
isEcmLoggedIn: () => false,
|
||||
reply: jasmine.createSpy('reply')
|
||||
};
|
||||
|
||||
|
||||
+4
-2
@@ -102,7 +102,7 @@ describe('DateRangeFilterComponent', () => {
|
||||
|
||||
it('should not emit any date change events when any type is selected', () => {
|
||||
spyOn(component.dateChanged, 'emit');
|
||||
const value = <MatSelectChange> { value: DateCloudFilterType.RANGE };
|
||||
const value = { value: DateCloudFilterType.RANGE } as MatSelectChange;
|
||||
component.onSelectionChange(value);
|
||||
expect(component.dateChanged.emit).not.toHaveBeenCalled();
|
||||
});
|
||||
@@ -114,7 +114,7 @@ describe('DateRangeFilterComponent', () => {
|
||||
});
|
||||
|
||||
it('should show date-range picker when type is range', async () => {
|
||||
const value = <MatSelectChange> { value: DateCloudFilterType.RANGE };
|
||||
const value = { value: DateCloudFilterType.RANGE } as MatSelectChange;
|
||||
component.onSelectionChange(value);
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -127,7 +127,9 @@ describe('DateRangeFilterComponent', () => {
|
||||
component.ngOnInit();
|
||||
fixture.detectChanges();
|
||||
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
expect(component.dateRangeForm.get('from').value).toEqual(moment(mockFilterProperty.value._startFrom));
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
expect(component.dateRangeForm.get('to').value).toEqual(moment(mockFilterProperty.value._startTo));
|
||||
});
|
||||
|
||||
|
||||
@@ -33,10 +33,10 @@ export class CloudFormRenderingService extends FormRenderingService {
|
||||
super();
|
||||
|
||||
this.register({
|
||||
'upload': () => AttachFileCloudWidgetComponent,
|
||||
'dropdown': () => DropdownCloudWidgetComponent,
|
||||
'date': () => DateCloudWidgetComponent,
|
||||
'people': () => PeopleCloudWidgetComponent,
|
||||
upload: () => AttachFileCloudWidgetComponent,
|
||||
dropdown: () => DropdownCloudWidgetComponent,
|
||||
date: () => DateCloudWidgetComponent,
|
||||
people: () => PeopleCloudWidgetComponent,
|
||||
'functional-group': () => GroupCloudWidgetComponent,
|
||||
'properties-viewer': () => PropertiesViewerWidgetComponent,
|
||||
'radio-buttons': () => RadioButtonsCloudWidgetComponent
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
|
||||
import { Component, DebugElement, SimpleChange, NgModule, Injector, ComponentFactoryResolver, ViewChild } from '@angular/core';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
@@ -85,7 +87,7 @@ describe('FormCloudComponent', () => {
|
||||
})
|
||||
class CustomUploadModule { }
|
||||
|
||||
function buildWidget(type: string, injector: Injector): any {
|
||||
const buildWidget = (type: string, injector: Injector): any => {
|
||||
const resolver = formRenderingService.getComponentTypeResolver(type);
|
||||
const widgetType = resolver(null);
|
||||
|
||||
@@ -94,7 +96,7 @@ describe('FormCloudComponent', () => {
|
||||
const componentRef = factory.create(injector);
|
||||
|
||||
return componentRef.instance;
|
||||
}
|
||||
};
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
@@ -231,14 +233,14 @@ describe('FormCloudComponent', () => {
|
||||
it('should enable custom outcome buttons', () => {
|
||||
const formModel = new FormModel();
|
||||
formComponent.form = formModel;
|
||||
const outcome = new FormOutcomeModel(<any> formModel, { id: 'action1', name: 'Action 1' });
|
||||
const outcome = new FormOutcomeModel(formModel, { id: 'action1', name: 'Action 1' });
|
||||
expect(formComponent.isOutcomeButtonVisible(outcome, formComponent.form.readOnly)).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should allow controlling [complete] button visibility', () => {
|
||||
const formModel = new FormModel();
|
||||
formComponent.form = formModel;
|
||||
const outcome = new FormOutcomeModel(<any> formModel, { id: '$save', name: FormOutcomeModel.SAVE_ACTION });
|
||||
const outcome = new FormOutcomeModel(formModel, { id: '$save', name: FormOutcomeModel.SAVE_ACTION });
|
||||
|
||||
formComponent.showSaveButton = true;
|
||||
expect(formComponent.isOutcomeButtonVisible(outcome, formComponent.form.readOnly)).toBeTruthy();
|
||||
@@ -251,7 +253,7 @@ describe('FormCloudComponent', () => {
|
||||
const formModel = new FormModel();
|
||||
formModel.readOnly = true;
|
||||
formComponent.form = formModel;
|
||||
const outcome = new FormOutcomeModel(<any> formModel, { id: '$complete', name: FormOutcomeModel.COMPLETE_ACTION });
|
||||
const outcome = new FormOutcomeModel(formModel, { id: '$complete', name: FormOutcomeModel.COMPLETE_ACTION });
|
||||
|
||||
formComponent.showCompleteButton = true;
|
||||
expect(formComponent.isOutcomeButtonVisible(outcome, formComponent.form.readOnly)).toBeTruthy();
|
||||
@@ -261,7 +263,7 @@ describe('FormCloudComponent', () => {
|
||||
const formModel = new FormModel();
|
||||
formModel.readOnly = true;
|
||||
formComponent.form = formModel;
|
||||
const outcome = new FormOutcomeModel(<any> formModel, { id: '$save', name: FormOutcomeModel.SAVE_ACTION });
|
||||
const outcome = new FormOutcomeModel(formModel, { id: '$save', name: FormOutcomeModel.SAVE_ACTION });
|
||||
|
||||
formComponent.showSaveButton = true;
|
||||
expect(formComponent.isOutcomeButtonVisible(outcome, formComponent.form.readOnly)).toBeFalsy();
|
||||
@@ -271,13 +273,13 @@ describe('FormCloudComponent', () => {
|
||||
const formModel = new FormModel({ selectedOutcome: 'custom-outcome' });
|
||||
formModel.readOnly = true;
|
||||
formComponent.form = formModel;
|
||||
let outcome = new FormOutcomeModel(<any> formModel, { id: '$customoutome', name: 'custom-outcome' });
|
||||
let outcome = new FormOutcomeModel(formModel, { id: '$customoutome', name: 'custom-outcome' });
|
||||
|
||||
formComponent.showCompleteButton = true;
|
||||
formComponent.showSaveButton = true;
|
||||
expect(formComponent.isOutcomeButtonVisible(outcome, formComponent.form.readOnly)).toBeTruthy();
|
||||
|
||||
outcome = new FormOutcomeModel(<any> formModel, { id: '$customoutome2', name: 'custom-outcome2' });
|
||||
outcome = new FormOutcomeModel(formModel, { id: '$customoutome2', name: 'custom-outcome2' });
|
||||
expect(formComponent.isOutcomeButtonVisible(outcome, formComponent.form.readOnly)).toBeFalsy();
|
||||
});
|
||||
|
||||
@@ -285,7 +287,7 @@ describe('FormCloudComponent', () => {
|
||||
const formModel = new FormModel();
|
||||
formModel.readOnly = false;
|
||||
formComponent.form = formModel;
|
||||
const outcome = new FormOutcomeModel(<any> formModel, { id: '$save', name: FormOutcomeModel.COMPLETE_ACTION });
|
||||
const outcome = new FormOutcomeModel(formModel, { id: '$save', name: FormOutcomeModel.COMPLETE_ACTION });
|
||||
|
||||
formComponent.showCompleteButton = true;
|
||||
expect(formComponent.isOutcomeButtonVisible(outcome, formComponent.form.readOnly)).toBeTruthy();
|
||||
@@ -302,20 +304,16 @@ describe('FormCloudComponent', () => {
|
||||
});
|
||||
|
||||
it('should get task variables if a task form is rendered', () => {
|
||||
spyOn(formCloudService, 'getTaskForm').and.callFake((currentTaskId) => {
|
||||
return new Observable((observer) => {
|
||||
observer.next({ formRepresentation: { taskId: currentTaskId } });
|
||||
observer.complete();
|
||||
});
|
||||
});
|
||||
spyOn(formCloudService, 'getTaskForm').and.callFake((currentTaskId) => new Observable((observer) => {
|
||||
observer.next({ formRepresentation: { taskId: currentTaskId } });
|
||||
observer.complete();
|
||||
}));
|
||||
|
||||
spyOn(formCloudService, 'getTaskVariables').and.returnValue(of([]));
|
||||
spyOn(formCloudService, 'getTask').and.callFake((currentTaskId) => {
|
||||
return new Observable((observer) => {
|
||||
observer.next({ formRepresentation: { taskId: currentTaskId } } as any);
|
||||
observer.complete();
|
||||
});
|
||||
});
|
||||
spyOn(formCloudService, 'getTask').and.callFake((currentTaskId) => new Observable((observer) => {
|
||||
observer.next({ formRepresentation: { taskId: currentTaskId } } as any);
|
||||
observer.complete();
|
||||
}));
|
||||
const taskId = '123';
|
||||
const appName = 'test-app';
|
||||
|
||||
@@ -327,12 +325,10 @@ describe('FormCloudComponent', () => {
|
||||
});
|
||||
|
||||
it('should not get task variables and form if task id is not specified', () => {
|
||||
spyOn(formCloudService, 'getTaskForm').and.callFake((currentTaskId) => {
|
||||
return new Observable((observer) => {
|
||||
observer.next({ taskId: currentTaskId });
|
||||
observer.complete();
|
||||
});
|
||||
});
|
||||
spyOn(formCloudService, 'getTaskForm').and.callFake((currentTaskId) => new Observable((observer) => {
|
||||
observer.next({ taskId: currentTaskId });
|
||||
observer.complete();
|
||||
}));
|
||||
|
||||
spyOn(formCloudService, 'getTaskVariables').and.returnValue(of([]));
|
||||
|
||||
@@ -380,7 +376,7 @@ describe('FormCloudComponent', () => {
|
||||
formComponent.appName = appName;
|
||||
formComponent.appVersion = 1;
|
||||
const change = new SimpleChange(null, taskId, true);
|
||||
formComponent.ngOnChanges({ 'taskId': change });
|
||||
formComponent.ngOnChanges({ taskId: change });
|
||||
|
||||
expect(formComponent.getFormByTaskId).toHaveBeenCalledWith(appName, taskId, 1);
|
||||
});
|
||||
@@ -393,7 +389,7 @@ describe('FormCloudComponent', () => {
|
||||
formComponent.appName = appName;
|
||||
formComponent.appVersion = 1;
|
||||
const change = new SimpleChange(null, formId, true);
|
||||
formComponent.ngOnChanges({ 'formId': change });
|
||||
formComponent.ngOnChanges({ formId: change });
|
||||
|
||||
expect(formComponent.getFormById).toHaveBeenCalledWith(appName, formId, 1);
|
||||
});
|
||||
@@ -414,7 +410,7 @@ describe('FormCloudComponent', () => {
|
||||
spyOn(formComponent, 'getFormByTaskId').and.stub();
|
||||
spyOn(formComponent, 'getFormById').and.stub();
|
||||
|
||||
formComponent.ngOnChanges({ 'tag': new SimpleChange(null, 'hello world', false) });
|
||||
formComponent.ngOnChanges({ tag: new SimpleChange(null, 'hello world', false) });
|
||||
|
||||
expect(formComponent.getFormByTaskId).not.toHaveBeenCalled();
|
||||
expect(formComponent.getFormById).not.toHaveBeenCalled();
|
||||
@@ -423,7 +419,7 @@ describe('FormCloudComponent', () => {
|
||||
it('should complete form on custom outcome click', () => {
|
||||
const formModel = new FormModel();
|
||||
const outcomeName = 'Custom Action';
|
||||
const outcome = new FormOutcomeModel(<any> formModel, { id: 'custom1', name: outcomeName });
|
||||
const outcome = new FormOutcomeModel(formModel, { id: 'custom1', name: outcomeName });
|
||||
|
||||
let saved = false;
|
||||
formComponent.form = formModel;
|
||||
@@ -438,7 +434,7 @@ describe('FormCloudComponent', () => {
|
||||
|
||||
it('should save form on [save] outcome click', () => {
|
||||
const formModel = new FormModel();
|
||||
const outcome = new FormOutcomeModel(<any> formModel, {
|
||||
const outcome = new FormOutcomeModel(formModel, {
|
||||
id: FormCloudComponent.SAVE_OUTCOME_ID,
|
||||
name: 'Save',
|
||||
isSystem: true
|
||||
@@ -454,7 +450,7 @@ describe('FormCloudComponent', () => {
|
||||
|
||||
it('should complete form on [complete] outcome click', () => {
|
||||
const formModel = new FormModel();
|
||||
const outcome = new FormOutcomeModel(<any> formModel, {
|
||||
const outcome = new FormOutcomeModel(formModel, {
|
||||
id: FormCloudComponent.COMPLETE_OUTCOME_ID,
|
||||
name: 'Complete',
|
||||
isSystem: true
|
||||
@@ -470,7 +466,7 @@ describe('FormCloudComponent', () => {
|
||||
|
||||
it('should emit form saved event on custom outcome click', () => {
|
||||
const formModel = new FormModel();
|
||||
const outcome = new FormOutcomeModel(<any> formModel, {
|
||||
const outcome = new FormOutcomeModel(formModel, {
|
||||
id: FormCloudComponent.CUSTOM_OUTCOME_ID,
|
||||
name: 'Custom',
|
||||
isSystem: true
|
||||
@@ -488,7 +484,7 @@ describe('FormCloudComponent', () => {
|
||||
it('should do nothing when clicking outcome for readonly form', () => {
|
||||
const formModel = new FormModel();
|
||||
const outcomeName = 'Custom Action';
|
||||
const outcome = new FormOutcomeModel(<any> formModel, { id: 'custom1', name: outcomeName });
|
||||
const outcome = new FormOutcomeModel(formModel, { id: 'custom1', name: outcomeName });
|
||||
|
||||
formComponent.form = formModel;
|
||||
spyOn(formComponent, 'completeTaskForm').and.stub();
|
||||
@@ -507,7 +503,7 @@ describe('FormCloudComponent', () => {
|
||||
it('should require loaded form when clicking outcome', () => {
|
||||
const formModel = new FormModel();
|
||||
const outcomeName = 'Custom Action';
|
||||
const outcome = new FormOutcomeModel(<any> formModel, { id: 'custom1', name: outcomeName });
|
||||
const outcome = new FormOutcomeModel(formModel, { id: 'custom1', name: outcomeName });
|
||||
|
||||
formComponent.readOnly = false;
|
||||
formComponent.form = null;
|
||||
@@ -516,7 +512,7 @@ describe('FormCloudComponent', () => {
|
||||
|
||||
it('should not execute unknown system outcome', () => {
|
||||
const formModel = new FormModel();
|
||||
const outcome = new FormOutcomeModel(<any> formModel, { id: 'unknown', name: 'Unknown', isSystem: true });
|
||||
const outcome = new FormOutcomeModel(formModel, { id: 'unknown', name: 'Unknown', isSystem: true });
|
||||
|
||||
formComponent.form = formModel;
|
||||
expect(formComponent.onOutcomeClicked(outcome)).toBeFalsy();
|
||||
@@ -524,12 +520,12 @@ describe('FormCloudComponent', () => {
|
||||
|
||||
it('should require custom action name to complete form', () => {
|
||||
const formModel = new FormModel();
|
||||
let outcome = new FormOutcomeModel(<any> formModel, { id: 'custom' });
|
||||
let outcome = new FormOutcomeModel(formModel, { id: 'custom' });
|
||||
|
||||
formComponent.form = formModel;
|
||||
expect(formComponent.onOutcomeClicked(outcome)).toBeFalsy();
|
||||
|
||||
outcome = new FormOutcomeModel(<any> formModel, { id: 'custom', name: 'Custom' });
|
||||
outcome = new FormOutcomeModel(formModel, { id: 'custom', name: 'Custom' });
|
||||
spyOn(formComponent, 'completeTaskForm').and.stub();
|
||||
expect(formComponent.onOutcomeClicked(outcome)).toBeTruthy();
|
||||
});
|
||||
@@ -540,7 +536,7 @@ describe('FormCloudComponent', () => {
|
||||
|
||||
spyOn(formCloudService, 'getTask').and.returnValue(of({}));
|
||||
spyOn(formCloudService, 'getTaskVariables').and.returnValue(of([]));
|
||||
spyOn(formCloudService, 'getTaskForm').and.returnValue(of({ taskId: taskId, selectedOutcome: 'custom-outcome' }));
|
||||
spyOn(formCloudService, 'getTaskForm').and.returnValue(of({ taskId, selectedOutcome: 'custom-outcome' }));
|
||||
|
||||
formComponent.formLoaded.subscribe(() => {
|
||||
expect(formCloudService.getTaskForm).toHaveBeenCalledWith(appName, taskId, 1);
|
||||
@@ -561,9 +557,7 @@ describe('FormCloudComponent', () => {
|
||||
spyOn(formCloudService, 'getTask').and.returnValue(of({}));
|
||||
spyOn(formCloudService, 'getTaskVariables').and.returnValue(of([]));
|
||||
spyOn(formComponent, 'handleError').and.stub();
|
||||
spyOn(formCloudService, 'getTaskForm').and.callFake(() => {
|
||||
return throwError(error);
|
||||
});
|
||||
spyOn(formCloudService, 'getTaskForm').and.callFake(() => throwError(error));
|
||||
|
||||
formComponent.getFormByTaskId('test-app', '123').then((_) => {
|
||||
expect(formComponent.handleError).toHaveBeenCalledWith(error);
|
||||
@@ -609,16 +603,14 @@ describe('FormCloudComponent', () => {
|
||||
const formValues: any[] = [];
|
||||
const change = new SimpleChange(null, formValues, false);
|
||||
formComponent.data = formValues;
|
||||
formComponent.ngOnChanges({ 'data': change });
|
||||
formComponent.ngOnChanges({ data: change });
|
||||
});
|
||||
|
||||
it('should save task form and raise corresponding event', () => {
|
||||
spyOn(formCloudService, 'saveTaskForm').and.callFake(() => {
|
||||
return new Observable((observer) => {
|
||||
observer.next();
|
||||
observer.complete();
|
||||
});
|
||||
});
|
||||
spyOn(formCloudService, 'saveTaskForm').and.callFake(() => new Observable((observer) => {
|
||||
observer.next();
|
||||
observer.complete();
|
||||
}));
|
||||
|
||||
let saved = false;
|
||||
let savedForm = null;
|
||||
@@ -633,7 +625,7 @@ describe('FormCloudComponent', () => {
|
||||
|
||||
const formModel = new FormModel({
|
||||
id: '23',
|
||||
taskId: taskId,
|
||||
taskId,
|
||||
fields: [
|
||||
{ id: 'field1' },
|
||||
{ id: 'field2' }
|
||||
@@ -660,7 +652,7 @@ describe('FormCloudComponent', () => {
|
||||
const appName = 'test-app';
|
||||
const formModel = new FormModel({
|
||||
id: '23',
|
||||
taskId: taskId,
|
||||
taskId,
|
||||
fields: [
|
||||
{ id: 'field1' },
|
||||
{ id: 'field2' }
|
||||
@@ -711,12 +703,10 @@ describe('FormCloudComponent', () => {
|
||||
});
|
||||
|
||||
it('should complete form and raise corresponding event', () => {
|
||||
spyOn(formCloudService, 'completeTaskForm').and.callFake(() => {
|
||||
return new Observable((observer) => {
|
||||
observer.next();
|
||||
observer.complete();
|
||||
});
|
||||
});
|
||||
spyOn(formCloudService, 'completeTaskForm').and.callFake(() => new Observable((observer) => {
|
||||
observer.next();
|
||||
observer.complete();
|
||||
}));
|
||||
|
||||
const outcome = 'complete';
|
||||
let completed = false;
|
||||
@@ -729,7 +719,7 @@ describe('FormCloudComponent', () => {
|
||||
|
||||
const formModel = new FormModel({
|
||||
id: '23',
|
||||
taskId: taskId,
|
||||
taskId,
|
||||
fields: [
|
||||
{ id: 'field1' },
|
||||
{ id: 'field2' }
|
||||
@@ -767,7 +757,7 @@ describe('FormCloudComponent', () => {
|
||||
|
||||
it('should prevent default outcome execution', () => {
|
||||
|
||||
const outcome = new FormOutcomeModel(<any> new FormModel(), {
|
||||
const outcome = new FormOutcomeModel(new FormModel(), {
|
||||
id: FormCloudComponent.CUSTOM_OUTCOME_ID,
|
||||
name: 'Custom'
|
||||
});
|
||||
@@ -784,7 +774,7 @@ describe('FormCloudComponent', () => {
|
||||
});
|
||||
|
||||
it('should not prevent default outcome execution', () => {
|
||||
const outcome = new FormOutcomeModel(<any> new FormModel(), {
|
||||
const outcome = new FormOutcomeModel(new FormModel(), {
|
||||
id: FormCloudComponent.CUSTOM_OUTCOME_ID,
|
||||
name: 'Custom'
|
||||
});
|
||||
@@ -812,7 +802,7 @@ describe('FormCloudComponent', () => {
|
||||
formComponent.checkVisibility(field);
|
||||
expect(visibilityService.refreshVisibility).not.toHaveBeenCalled();
|
||||
|
||||
field = new FormFieldModel(<any> new FormModel());
|
||||
field = new FormFieldModel(new FormModel());
|
||||
formComponent.checkVisibility(field);
|
||||
expect(visibilityService.refreshVisibility).toHaveBeenCalledWith(field.form);
|
||||
});
|
||||
@@ -822,7 +812,7 @@ describe('FormCloudComponent', () => {
|
||||
formModel.readOnly = true;
|
||||
formComponent.form = formModel;
|
||||
|
||||
const outcome = new FormOutcomeModel(<any> new FormModel(), {
|
||||
const outcome = new FormOutcomeModel(new FormModel(), {
|
||||
id: FormCloudComponent.CUSTOM_OUTCOME_ID,
|
||||
name: 'Custom'
|
||||
});
|
||||
@@ -901,7 +891,7 @@ describe('FormCloudComponent', () => {
|
||||
done();
|
||||
});
|
||||
|
||||
const outcome = new FormOutcomeModel(<any> new FormModel(), {
|
||||
const outcome = new FormOutcomeModel(new FormModel(), {
|
||||
id: FormCloudComponent.CUSTOM_OUTCOME_ID,
|
||||
name: 'Custom'
|
||||
});
|
||||
@@ -935,7 +925,7 @@ describe('FormCloudComponent', () => {
|
||||
done();
|
||||
});
|
||||
|
||||
formComponent.ngOnChanges({ 'data': change });
|
||||
formComponent.ngOnChanges({ data: change });
|
||||
});
|
||||
|
||||
it('should refresh radio buttons value when id is given to data', () => {
|
||||
@@ -947,7 +937,7 @@ describe('FormCloudComponent', () => {
|
||||
const formValues: any[] = [{ name: 'radiobuttons1', value: 'option_2' }];
|
||||
const change = new SimpleChange(null, formValues, false);
|
||||
formComponent.data = formValues;
|
||||
formComponent.ngOnChanges({ 'data': change });
|
||||
formComponent.ngOnChanges({ data: change });
|
||||
|
||||
formFields = formComponent.form.getFormFields();
|
||||
radioFieldById = formFields.find((field) => field.id === 'radiobuttons1');
|
||||
@@ -962,7 +952,7 @@ describe('FormCloudComponent', () => {
|
||||
formComponent.formId = formId;
|
||||
formComponent.appVersion = 1;
|
||||
|
||||
formComponent.ngOnChanges({ 'appName': new SimpleChange(null, appName, true) });
|
||||
formComponent.ngOnChanges({ appName: new SimpleChange(null, appName, true) });
|
||||
expect(formCloudService.getForm).toHaveBeenCalledWith(appName, formId, 1);
|
||||
|
||||
fixture.detectChanges();
|
||||
@@ -984,7 +974,7 @@ describe('FormCloudComponent', () => {
|
||||
formComponent.formId = formId;
|
||||
formComponent.appVersion = 1;
|
||||
|
||||
formComponent.ngOnChanges({ 'appName': new SimpleChange(null, appName, true) });
|
||||
formComponent.ngOnChanges({ appName: new SimpleChange(null, appName, true) });
|
||||
expect(formCloudService.getForm).toHaveBeenCalledWith(appName, formId, 1);
|
||||
|
||||
fixture.detectChanges();
|
||||
@@ -1009,7 +999,7 @@ describe('FormCloudComponent', () => {
|
||||
formComponent.formId = formId;
|
||||
formComponent.appVersion = 1;
|
||||
|
||||
formComponent.ngOnChanges({ 'appName': new SimpleChange(null, appName, true) });
|
||||
formComponent.ngOnChanges({ appName: new SimpleChange(null, appName, true) });
|
||||
expect(formCloudService.getForm).toHaveBeenCalledWith(appName, formId, 1);
|
||||
|
||||
fixture.detectChanges();
|
||||
@@ -1029,10 +1019,10 @@ describe('FormCloudComponent', () => {
|
||||
expect(getLabelValue('amountField')).toEqual('Champ Montant');
|
||||
});
|
||||
|
||||
function getLabelValue(containerId: string): string {
|
||||
const getLabelValue = (containerId: string): string => {
|
||||
const label = fixture.debugElement.nativeElement.querySelector(`[id="field-${containerId}-container"] label`);
|
||||
return label.innerText;
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1144,7 +1134,7 @@ describe('retrieve metadata on submit', () => {
|
||||
let fixture: ComponentFixture<FormCloudComponent>;
|
||||
let formService: FormService;
|
||||
|
||||
const fakeNodeWithProperties: Node = <Node> {
|
||||
const fakeNodeWithProperties = {
|
||||
id: 'fake-properties',
|
||||
name: 'fake-properties-name',
|
||||
content: {
|
||||
@@ -1154,7 +1144,7 @@ describe('retrieve metadata on submit', () => {
|
||||
'pfx:property_one': 'testValue',
|
||||
'pfx:property_two': true
|
||||
}
|
||||
};
|
||||
} as Node;
|
||||
|
||||
beforeEach(() => {
|
||||
const apiService = TestBed.inject(AlfrescoApiService);
|
||||
@@ -1225,7 +1215,7 @@ describe('retrieve metadata on submit', () => {
|
||||
});
|
||||
|
||||
it('should cancel bubbling a keydown event', () => {
|
||||
const escapeKeyboardEvent = new KeyboardEvent('keydown', { 'keyCode': ESCAPE } as any);
|
||||
const escapeKeyboardEvent = new KeyboardEvent('keydown', { keyCode: ESCAPE } as any);
|
||||
fixture.debugElement.triggerEventHandler('keydown', escapeKeyboardEvent);
|
||||
|
||||
expect(escapeKeyboardEvent.cancelBubble).toBe(true);
|
||||
|
||||
@@ -210,7 +210,7 @@ export class FormCloudComponent extends FormBaseComponent implements OnChanges,
|
||||
this.data = data[1];
|
||||
|
||||
const parsedForm = this.parseForm(this.formCloudRepresentationJSON);
|
||||
this.visibilityService.refreshVisibility(<any> parsedForm, this.data);
|
||||
this.visibilityService.refreshVisibility(parsedForm, this.data);
|
||||
parsedForm.validateForm();
|
||||
this.form = parsedForm;
|
||||
this.form.nodeId = '-my-';
|
||||
@@ -239,7 +239,7 @@ export class FormCloudComponent extends FormBaseComponent implements OnChanges,
|
||||
(form) => {
|
||||
this.formCloudRepresentationJSON = form;
|
||||
const parsedForm = this.parseForm(form);
|
||||
this.visibilityService.refreshVisibility(<any> parsedForm);
|
||||
this.visibilityService.refreshVisibility(parsedForm);
|
||||
parsedForm.validateForm();
|
||||
this.form = parsedForm;
|
||||
this.form.nodeId = '-my-';
|
||||
@@ -300,11 +300,12 @@ export class FormCloudComponent extends FormBaseComponent implements OnChanges,
|
||||
|
||||
/**
|
||||
* Get custom set of outcomes for a Form Definition.
|
||||
*
|
||||
* @param form Form definition model.
|
||||
*/
|
||||
getFormDefinitionOutcomes(form: FormModel): FormOutcomeModel[] {
|
||||
return [
|
||||
new FormOutcomeModel(<any> form, { id: '$save', name: FormOutcomeModel.SAVE_ACTION, isSystem: true })
|
||||
new FormOutcomeModel(form, { id: '$save', name: FormOutcomeModel.SAVE_ACTION, isSystem: true })
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
+31
-81
@@ -25,7 +25,6 @@ import {
|
||||
FormFieldModel,
|
||||
FormModel,
|
||||
FormFieldTypes,
|
||||
FormFieldMetadata,
|
||||
FormService,
|
||||
DownloadService,
|
||||
AppConfigService,
|
||||
@@ -84,22 +83,22 @@ describe('AttachFileCloudWidgetComponent', () => {
|
||||
let openUploadFileDialogSpy: jasmine.Spy;
|
||||
let localizedDataPipe: LocalizedDatePipe;
|
||||
|
||||
function createUploadWidgetField(form: FormModel, fieldId: string, value?: any, params?: any, multiple?: boolean, name?: string, readOnly?: boolean) {
|
||||
const createUploadWidgetField = (form: FormModel, fieldId: string, value?: any, params?: any, multiple?: boolean, name?: string, readOnly?: boolean) => {
|
||||
widget.field = new FormFieldModel(form, {
|
||||
type: FormFieldTypes.UPLOAD,
|
||||
value: value,
|
||||
value,
|
||||
id: fieldId,
|
||||
readOnly: readOnly,
|
||||
name: name,
|
||||
readOnly,
|
||||
name,
|
||||
tooltip: 'attach file widget',
|
||||
params: <FormFieldMetadata> { ...params, multiple: multiple }
|
||||
params: { ...params, multiple }
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function clickOnAttachFileWidget(id: string) {
|
||||
const clickOnAttachFileWidget = (id: string) => {
|
||||
const attachButton: HTMLButtonElement = element.querySelector(`#${id}`);
|
||||
attachButton.click();
|
||||
}
|
||||
};
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
@@ -204,7 +203,7 @@ describe('AttachFileCloudWidgetComponent', () => {
|
||||
|
||||
describe('Upload widget with displayable ContentModel properties', () => {
|
||||
|
||||
it('should display CM Properties if the file contains value', async() => {
|
||||
it('should display CM Properties if the file contains value', async () => {
|
||||
createUploadWidgetField(new FormModel(), 'attach-file-alfresco', [fakeLocalPngHavingCMProperties], displayableCMParams);
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -214,7 +213,7 @@ describe('AttachFileCloudWidgetComponent', () => {
|
||||
expect(element.querySelector('#fileProperty-1155-age').textContent).toBe('34');
|
||||
});
|
||||
|
||||
it('should display defaultValue if the file does not contain value for respective displayableCMProperties', async() => {
|
||||
it('should display defaultValue if the file does not contain value for respective displayableCMProperties', async () => {
|
||||
createUploadWidgetField(new FormModel(), 'attach-file-alfresco', [fakeLocalPngResponse], displayableCMParams);
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -223,7 +222,7 @@ describe('AttachFileCloudWidgetComponent', () => {
|
||||
expect(element.querySelector('#fileProperty-1155-age').textContent).toBe('--');
|
||||
});
|
||||
|
||||
it('should not display CM Properties in table if the field does not contain displayableCMProperties', async() => {
|
||||
it('should not display CM Properties in table if the field does not contain displayableCMProperties', async () => {
|
||||
createUploadWidgetField(new FormModel(), 'attach-file-alfresco', [fakeLocalPngHavingCMProperties], allSourceParams);
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -232,7 +231,7 @@ describe('AttachFileCloudWidgetComponent', () => {
|
||||
expect(element.querySelector('#fileProperty-1155-age')).toBeNull();
|
||||
});
|
||||
|
||||
it('should display date property in converted form based on dataType', async() => {
|
||||
it('should display date property in converted form based on dataType', async () => {
|
||||
createUploadWidgetField(new FormModel(), 'attach-file-alfresco', [fakeLocalPngHavingCMProperties], displayableCMParams);
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -366,7 +365,7 @@ describe('AttachFileCloudWidgetComponent', () => {
|
||||
appConfigService.config = Object.assign(appConfigService.config, {
|
||||
'alfresco-deployed-apps': [
|
||||
{
|
||||
'name': 'fakeapp'
|
||||
name: 'fakeapp'
|
||||
}
|
||||
]
|
||||
});
|
||||
@@ -464,10 +463,7 @@ describe('AttachFileCloudWidgetComponent', () => {
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
const menuButton = <HTMLButtonElement> (
|
||||
fixture.debugElement.query(By.css('#file-1155-option-menu'))
|
||||
.nativeElement
|
||||
);
|
||||
const menuButton = fixture.debugElement.query(By.css('#file-1155-option-menu')).nativeElement as HTMLButtonElement;
|
||||
menuButton.click();
|
||||
|
||||
fixture.detectChanges();
|
||||
@@ -498,7 +494,7 @@ describe('AttachFileCloudWidgetComponent', () => {
|
||||
value: []
|
||||
});
|
||||
widget.field.id = 'attach-file-alfresco';
|
||||
widget.field.params = <FormFieldMetadata> menuTestSourceParam;
|
||||
widget.field.params = menuTestSourceParam;
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -511,16 +507,10 @@ describe('AttachFileCloudWidgetComponent', () => {
|
||||
|
||||
it('should remove file when remove is clicked', (done) => {
|
||||
fixture.detectChanges();
|
||||
const menuButton: HTMLButtonElement = <HTMLButtonElement> (
|
||||
fixture.debugElement.query(By.css('#file-fake-properties-option-menu'))
|
||||
.nativeElement
|
||||
);
|
||||
const menuButton = fixture.debugElement.query(By.css('#file-fake-properties-option-menu')).nativeElement as HTMLButtonElement;
|
||||
menuButton.click();
|
||||
fixture.detectChanges();
|
||||
const removeOption: HTMLButtonElement = <HTMLButtonElement> (
|
||||
fixture.debugElement.query(By.css('#file-fake-properties-remove'))
|
||||
.nativeElement
|
||||
);
|
||||
const removeOption = fixture.debugElement.query(By.css('#file-fake-properties-remove')).nativeElement as HTMLButtonElement;
|
||||
removeOption.click();
|
||||
fixture.detectChanges();
|
||||
fixture.whenRenderingDone().then(() => {
|
||||
@@ -536,19 +526,11 @@ describe('AttachFileCloudWidgetComponent', () => {
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
const menuButton: HTMLButtonElement = <HTMLButtonElement> (
|
||||
fixture.debugElement.query(By.css('#file-fake-properties-option-menu'))
|
||||
.nativeElement
|
||||
);
|
||||
|
||||
const menuButton = fixture.debugElement.query(By.css('#file-fake-properties-option-menu')).nativeElement as HTMLButtonElement;
|
||||
menuButton.click();
|
||||
fixture.detectChanges();
|
||||
|
||||
const downloadOption: HTMLButtonElement = <HTMLButtonElement> (
|
||||
fixture.debugElement.query(By.css('#file-fake-properties-download-file'))
|
||||
.nativeElement
|
||||
);
|
||||
|
||||
const downloadOption = fixture.debugElement.query(By.css('#file-fake-properties-download-file')).nativeElement as HTMLButtonElement;
|
||||
downloadOption.click();
|
||||
|
||||
fixture.detectChanges();
|
||||
@@ -568,18 +550,10 @@ describe('AttachFileCloudWidgetComponent', () => {
|
||||
);
|
||||
|
||||
fixture.detectChanges();
|
||||
const menuButton: HTMLButtonElement = <HTMLButtonElement> (
|
||||
fixture.debugElement.query(
|
||||
By.css('#file-fake-properties-option-menu')
|
||||
).nativeElement
|
||||
);
|
||||
const menuButton = fixture.debugElement.query(By.css('#file-fake-properties-option-menu')).nativeElement as HTMLButtonElement;
|
||||
menuButton.click();
|
||||
fixture.detectChanges();
|
||||
const showOption: HTMLButtonElement = <HTMLButtonElement> (
|
||||
fixture.debugElement.query(
|
||||
By.css('#file-fake-properties-show-file')
|
||||
).nativeElement
|
||||
);
|
||||
const showOption = fixture.debugElement.query(By.css('#file-fake-properties-show-file')).nativeElement as HTMLButtonElement;
|
||||
showOption.click();
|
||||
});
|
||||
|
||||
@@ -588,19 +562,11 @@ describe('AttachFileCloudWidgetComponent', () => {
|
||||
widget.field.value = [fakeNodeWithProperties];
|
||||
fixture.detectChanges();
|
||||
|
||||
const menuButton: HTMLButtonElement = <HTMLButtonElement> (
|
||||
fixture.debugElement.query(By.css('#file-fake-properties-option-menu'))
|
||||
.nativeElement
|
||||
);
|
||||
|
||||
const menuButton = fixture.debugElement.query(By.css('#file-fake-properties-option-menu')).nativeElement as HTMLButtonElement;
|
||||
menuButton.click();
|
||||
fixture.detectChanges();
|
||||
|
||||
const retrieveMetadataOption: HTMLButtonElement = <HTMLButtonElement> (
|
||||
fixture.debugElement.query(By.css('#file-fake-properties-retrieve-file-metadata'))
|
||||
.nativeElement
|
||||
);
|
||||
|
||||
const retrieveMetadataOption = fixture.debugElement.query(By.css('#file-fake-properties-retrieve-file-metadata')).nativeElement as HTMLButtonElement;
|
||||
retrieveMetadataOption.click();
|
||||
expect(apiServiceSpy).toHaveBeenCalledWith(fakeNodeWithProperties.id);
|
||||
|
||||
@@ -612,7 +578,7 @@ describe('AttachFileCloudWidgetComponent', () => {
|
||||
});
|
||||
|
||||
it('should display the default menu options if no options are provided', () => {
|
||||
widget.field.params = <FormFieldMetadata> onlyLocalParams;
|
||||
widget.field.params = onlyLocalParams;
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
const inputDebugElement = fixture.debugElement.query(
|
||||
@@ -622,30 +588,14 @@ describe('AttachFileCloudWidgetComponent', () => {
|
||||
target: { files: [fakeLocalPngAnswer] }
|
||||
});
|
||||
fixture.detectChanges();
|
||||
const menuButton: HTMLButtonElement = <HTMLButtonElement> (
|
||||
fixture.debugElement.query(
|
||||
By.css('#file-1155-option-menu')
|
||||
).nativeElement
|
||||
);
|
||||
const menuButton = fixture.debugElement.query(By.css('#file-1155-option-menu')).nativeElement as HTMLButtonElement;
|
||||
menuButton.click();
|
||||
fixture.detectChanges();
|
||||
const showOption: HTMLButtonElement = <HTMLButtonElement> (
|
||||
fixture.debugElement.query(
|
||||
By.css('#file-1155-show-file')
|
||||
).nativeElement
|
||||
);
|
||||
const downloadOption: HTMLButtonElement = <HTMLButtonElement> (
|
||||
fixture.debugElement.query(By.css('#file-1155-download-file'))
|
||||
.nativeElement
|
||||
);
|
||||
const retrieveMetadataOption: HTMLButtonElement = <HTMLButtonElement> (
|
||||
fixture.debugElement.query(By.css('#file-1155-retrieve-file-metadata'))
|
||||
.nativeElement
|
||||
);
|
||||
const removeOption: HTMLButtonElement = <HTMLButtonElement> (
|
||||
fixture.debugElement.query(By.css('#file-1155-remove'))
|
||||
.nativeElement
|
||||
);
|
||||
|
||||
const showOption = fixture.debugElement.query(By.css('#file-1155-show-file')).nativeElement as HTMLButtonElement;
|
||||
const downloadOption = fixture.debugElement.query(By.css('#file-1155-download-file')).nativeElement as HTMLButtonElement;
|
||||
const retrieveMetadataOption = fixture.debugElement.query(By.css('#file-1155-retrieve-file-metadata')).nativeElement as HTMLButtonElement;
|
||||
const removeOption = fixture.debugElement.query(By.css('#file-1155-remove')).nativeElement as HTMLButtonElement;
|
||||
|
||||
expect(showOption).not.toBeNull();
|
||||
expect(downloadOption).not.toBeNull();
|
||||
@@ -668,7 +618,7 @@ describe('AttachFileCloudWidgetComponent', () => {
|
||||
});
|
||||
|
||||
widget.field.id = 'attach-file-alfresco';
|
||||
widget.field.params = <FormFieldMetadata> menuTestSourceParam;
|
||||
widget.field.params = menuTestSourceParam;
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
});
|
||||
|
||||
+15
-19
@@ -37,6 +37,12 @@ import { UploadCloudWidgetComponent } from './upload-cloud.widget';
|
||||
import { DestinationFolderPathModel, DestinationFolderPathType } from '../../../models/form-cloud-representation.model';
|
||||
import { ContentNodeSelectorPanelService } from '@alfresco/adf-content-services';
|
||||
|
||||
export const RETRIEVE_METADATA_OPTION = 'retrieveMetadata';
|
||||
export const ALIAS_ROOT_FOLDER = '-root-';
|
||||
export const ALIAS_USER_FOLDER = '-my-';
|
||||
export const APP_NAME = '-appname-';
|
||||
export const VALID_ALIAS = [ ALIAS_ROOT_FOLDER, ALIAS_USER_FOLDER, '-shared-' ];
|
||||
|
||||
@Component({
|
||||
selector: 'adf-cloud-attach-file-cloud-widget',
|
||||
templateUrl: './attach-file-cloud-widget.component.html',
|
||||
@@ -55,18 +61,8 @@ import { ContentNodeSelectorPanelService } from '@alfresco/adf-content-services'
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class AttachFileCloudWidgetComponent extends UploadCloudWidgetComponent implements OnInit, OnDestroy {
|
||||
|
||||
static ALIAS_ROOT_FOLDER = '-root-';
|
||||
static ALIAS_USER_FOLDER = '-my-';
|
||||
static APP_NAME = '-appname-';
|
||||
static VALID_ALIAS = [
|
||||
AttachFileCloudWidgetComponent.ALIAS_ROOT_FOLDER,
|
||||
AttachFileCloudWidgetComponent.ALIAS_USER_FOLDER, '-shared-'
|
||||
];
|
||||
static RETRIEVE_METADATA_OPTION = 'retrieveMetadata';
|
||||
|
||||
typeId = 'AttachFileCloudWidgetComponent';
|
||||
rootNodeId = AttachFileCloudWidgetComponent.ALIAS_USER_FOLDER;
|
||||
rootNodeId = ALIAS_USER_FOLDER;
|
||||
selectedNode: Node;
|
||||
|
||||
_nodesApi: NodesApi;
|
||||
@@ -121,9 +117,9 @@ export class AttachFileCloudWidgetComponent extends UploadCloudWidgetComponent i
|
||||
}
|
||||
|
||||
replaceAppNameAliasWithValue(path: string): string {
|
||||
if (path?.match(AttachFileCloudWidgetComponent.APP_NAME)) {
|
||||
if (path?.match(APP_NAME)) {
|
||||
const appName = this.fetchAppNameFromAppConfig();
|
||||
return path.replace(AttachFileCloudWidgetComponent.APP_NAME, appName);
|
||||
return path.replace(APP_NAME, appName);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
@@ -131,7 +127,7 @@ export class AttachFileCloudWidgetComponent extends UploadCloudWidgetComponent i
|
||||
async openSelectDialog() {
|
||||
const selectedMode = this.field.params.multiple ? 'multiple' : 'single';
|
||||
const nodeId = await this.getDestinationFolderNodeId();
|
||||
this.rootNodeId = nodeId ? nodeId : AttachFileCloudWidgetComponent.ALIAS_USER_FOLDER;
|
||||
this.rootNodeId = nodeId ? nodeId : ALIAS_USER_FOLDER;
|
||||
this.contentNodeSelectorPanelService.customModels = this.field.params.customModels;
|
||||
|
||||
this.contentNodeSelectorService
|
||||
@@ -160,7 +156,7 @@ export class AttachFileCloudWidgetComponent extends UploadCloudWidgetComponent i
|
||||
rootNodeId = await this.getNodeIdFromFolderVariableValue(this.field.params.fileSource.destinationFolderPath);
|
||||
break;
|
||||
default:
|
||||
rootNodeId = await this.getNodeIdFromPath({ type: '', value: AttachFileCloudWidgetComponent.ALIAS_USER_FOLDER });
|
||||
rootNodeId = await this.getNodeIdFromPath({ type: '', value: ALIAS_USER_FOLDER });
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -183,7 +179,7 @@ export class AttachFileCloudWidgetComponent extends UploadCloudWidgetComponent i
|
||||
async getNodeIdFromFolderVariableValue(destinationFolderPath: DestinationFolderPath): Promise<string> {
|
||||
let nodeId: string;
|
||||
try {
|
||||
nodeId = await this.contentNodeSelectorService.getNodeIdFromFolderVariableValue(destinationFolderPath.value, AttachFileCloudWidgetComponent.ALIAS_USER_FOLDER);
|
||||
nodeId = await this.contentNodeSelectorService.getNodeIdFromFolderVariableValue(destinationFolderPath.value, ALIAS_USER_FOLDER);
|
||||
} catch (error) {
|
||||
this.logService.error(error);
|
||||
}
|
||||
@@ -203,7 +199,7 @@ export class AttachFileCloudWidgetComponent extends UploadCloudWidgetComponent i
|
||||
}
|
||||
}
|
||||
|
||||
return this.isValidAlias(alias) ? { alias, path } : { alias: AttachFileCloudWidgetComponent.ALIAS_USER_FOLDER, path: undefined };
|
||||
return this.isValidAlias(alias) ? { alias, path } : { alias: ALIAS_USER_FOLDER, path: undefined };
|
||||
}
|
||||
|
||||
removeExistingSelection(selections: Node[]) {
|
||||
@@ -252,11 +248,11 @@ export class AttachFileCloudWidgetComponent extends UploadCloudWidgetComponent i
|
||||
}
|
||||
|
||||
isRetrieveMetadataOptionEnabled(): boolean {
|
||||
return this.field?.params?.menuOptions && this.field.params.menuOptions[AttachFileCloudWidgetComponent.RETRIEVE_METADATA_OPTION];
|
||||
return this.field?.params?.menuOptions && this.field.params.menuOptions[RETRIEVE_METADATA_OPTION];
|
||||
}
|
||||
|
||||
isValidAlias(alias: string): boolean {
|
||||
return alias && AttachFileCloudWidgetComponent.VALID_ALIAS.includes(alias);
|
||||
return alias && VALID_ALIAS.includes(alias);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
||||
+3
-4
@@ -21,15 +21,14 @@ import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { LocalizedDatePipe, ThumbnailService } from '@alfresco/adf-core';
|
||||
import { Node } from '@alfresco/js-api';
|
||||
|
||||
export const RETRIEVE_METADATA_OPTION = 'retrieveMetadata';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-cloud-file-properties-table',
|
||||
templateUrl: './file-properties-table-cloud.component.html',
|
||||
styleUrls: ['./file-properties-table-cloud.component.scss']
|
||||
})
|
||||
export class FilePropertiesTableCloudComponent {
|
||||
|
||||
static RETRIEVE_METADATA_OPTION = 'retrieveMetadata';
|
||||
|
||||
@Input()
|
||||
uploadedFiles;
|
||||
|
||||
@@ -109,6 +108,6 @@ export class FilePropertiesTableCloudComponent {
|
||||
}
|
||||
|
||||
displayMenuOption(option: string): boolean {
|
||||
return this.field?.params?.menuOptions ? this.field.params.menuOptions[option] : option !== FilePropertiesTableCloudComponent.RETRIEVE_METADATA_OPTION;
|
||||
return this.field?.params?.menuOptions ? this.field.params.menuOptions[option] : option !== RETRIEVE_METADATA_OPTION;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { DateCloudWidgetComponent } from './date-cloud.widget';
|
||||
import { DateCloudWidgetComponent, DATE_FORMAT_CLOUD } from './date-cloud.widget';
|
||||
import { setupTestBed, FormFieldModel, FormModel } from '@alfresco/adf-core';
|
||||
import moment from 'moment-es6';
|
||||
import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module';
|
||||
@@ -46,19 +46,19 @@ describe('DateWidgetComponent', () => {
|
||||
widget.field = new FormFieldModel(null, {
|
||||
id: 'date-id',
|
||||
name: 'date-name',
|
||||
minValue: minValue
|
||||
minValue
|
||||
});
|
||||
|
||||
widget.ngOnInit();
|
||||
|
||||
const expected = moment(minValue, widget.DATE_FORMAT_CLOUD);
|
||||
const expected = moment(minValue, DATE_FORMAT_CLOUD);
|
||||
expect(widget.minDate.isSame(expected)).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should date field be present', () => {
|
||||
const minValue = '1982-03-13';
|
||||
widget.field = new FormFieldModel(null, {
|
||||
minValue: minValue
|
||||
minValue
|
||||
});
|
||||
|
||||
fixture.detectChanges();
|
||||
@@ -70,11 +70,11 @@ describe('DateWidgetComponent', () => {
|
||||
it('should setup max value for date picker', () => {
|
||||
const maxValue = '1982-03-13';
|
||||
widget.field = new FormFieldModel(null, {
|
||||
maxValue: maxValue
|
||||
maxValue
|
||||
});
|
||||
widget.ngOnInit();
|
||||
|
||||
const expected = moment(maxValue, widget.DATE_FORMAT_CLOUD);
|
||||
const expected = moment(maxValue, DATE_FORMAT_CLOUD);
|
||||
expect(widget.maxDate.isSame(expected)).toBeTruthy();
|
||||
});
|
||||
|
||||
|
||||
+5
-5
@@ -28,6 +28,8 @@ import {
|
||||
UserPreferencesService, UserPreferenceValues, FormService
|
||||
} from '@alfresco/adf-core';
|
||||
|
||||
export const DATE_FORMAT_CLOUD = 'YYYY-MM-DD';
|
||||
|
||||
@Component({
|
||||
selector: 'date-widget',
|
||||
providers: [
|
||||
@@ -49,9 +51,7 @@ import {
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class DateCloudWidgetComponent extends WidgetComponent implements OnInit, OnDestroy {
|
||||
|
||||
typeId = 'DateCloudWidgetComponent';
|
||||
DATE_FORMAT_CLOUD = 'YYYY-MM-DD';
|
||||
|
||||
minDate: Moment;
|
||||
maxDate: Moment;
|
||||
@@ -70,16 +70,16 @@ export class DateCloudWidgetComponent extends WidgetComponent implements OnInit,
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(locale => this.dateAdapter.setLocale(locale));
|
||||
|
||||
const momentDateAdapter = <MomentDateAdapter> this.dateAdapter;
|
||||
const momentDateAdapter = this.dateAdapter as MomentDateAdapter;
|
||||
momentDateAdapter.overrideDisplayFormat = this.field.dateDisplayFormat;
|
||||
|
||||
if (this.field) {
|
||||
if (this.field.minValue) {
|
||||
this.minDate = moment(this.field.minValue, this.DATE_FORMAT_CLOUD);
|
||||
this.minDate = moment(this.field.minValue, DATE_FORMAT_CLOUD);
|
||||
}
|
||||
|
||||
if (this.field.maxValue) {
|
||||
this.maxDate = moment(this.field.maxValue, this.DATE_FORMAT_CLOUD);
|
||||
this.maxDate = moment(this.field.maxValue, DATE_FORMAT_CLOUD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-9
@@ -41,13 +41,13 @@ describe('DropdownCloudWidgetComponent', () => {
|
||||
let fixture: ComponentFixture<DropdownCloudWidgetComponent>;
|
||||
let element: HTMLElement;
|
||||
|
||||
async function openSelect(_selector?: string) {
|
||||
const openSelect = async (_selector?: string) => {
|
||||
const dropdown: HTMLElement = element.querySelector('.mat-select-trigger');
|
||||
dropdown.click();
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
fixture.detectChanges();
|
||||
}
|
||||
};
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
@@ -71,9 +71,7 @@ describe('DropdownCloudWidgetComponent', () => {
|
||||
describe('Simple Dropdown', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
spyOn(formService, 'getRestFieldValues').and.callFake(() => {
|
||||
return of(fakeOptionList);
|
||||
});
|
||||
spyOn(formService, 'getRestFieldValues').and.callFake(() => of(fakeOptionList));
|
||||
widget.field = new FormFieldModel(new FormModel({ taskId: 'fake-task-id' }), {
|
||||
id: 'dropdown-id',
|
||||
name: 'date-name',
|
||||
@@ -366,7 +364,7 @@ describe('DropdownCloudWidgetComponent', () => {
|
||||
await openSelect('child-dropdown-id');
|
||||
|
||||
const defaultOption: any = fixture.debugElement.query(By.css('[id="empty"]'));
|
||||
expect(widget.field.options).toEqual([{ 'id': 'empty', 'name': 'Choose one...' }]);
|
||||
expect(widget.field.options).toEqual([{ id: 'empty', name: 'Choose one...' }]);
|
||||
expect(defaultOption.context.value).toBe('empty');
|
||||
expect(defaultOption.context.viewValue).toBe('Choose one...');
|
||||
});
|
||||
@@ -396,11 +394,11 @@ describe('DropdownCloudWidgetComponent', () => {
|
||||
const mockParentDropdown = { id: 'parentDropdown', value: 'mock-value', validate: () => true };
|
||||
spyOn(widget.field.form, 'getFormFields').and.returnValue([mockParentDropdown]);
|
||||
|
||||
function selectParentOption(parentOptionName: string) {
|
||||
const selectParentOption = (parentOptionName: string) => {
|
||||
parentDropdown.value = parentOptionName;
|
||||
widget.selectionChangedForField(parentDropdown);
|
||||
fixture.detectChanges();
|
||||
}
|
||||
};
|
||||
|
||||
selectParentOption('UK');
|
||||
await openSelect('child-dropdown-id');
|
||||
@@ -495,7 +493,7 @@ describe('DropdownCloudWidgetComponent', () => {
|
||||
await openSelect('child-dropdown-id');
|
||||
|
||||
const defaultOption: any = fixture.debugElement.query(By.css('[id="empty"]'));
|
||||
expect(widget.field.options).toEqual([{ 'id': 'empty', 'name': 'Choose one...' }]);
|
||||
expect(widget.field.options).toEqual([{ id: 'empty', name: 'Choose one...' }]);
|
||||
expect(defaultOption.context.value).toBe('empty');
|
||||
expect(defaultOption.context.viewValue).toBe('Choose one...');
|
||||
});
|
||||
|
||||
+10
-10
@@ -31,6 +31,12 @@ import { FormCloudService } from '../../../services/form-cloud.service';
|
||||
import { BehaviorSubject, combineLatest, Observable, of, Subject } from 'rxjs';
|
||||
import { filter, map, takeUntil } from 'rxjs/operators';
|
||||
|
||||
export const DEFAULT_OPTION = {
|
||||
id: 'empty',
|
||||
name: 'Choose one...'
|
||||
};
|
||||
export const HIDE_FILTER_LIMIT = 5;
|
||||
|
||||
/* eslint-disable @angular-eslint/component-selector */
|
||||
|
||||
@Component({
|
||||
@@ -51,13 +57,7 @@ import { filter, map, takeUntil } from 'rxjs/operators';
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class DropdownCloudWidgetComponent extends WidgetComponent implements OnInit, OnDestroy {
|
||||
static DEFAULT_OPTION = {
|
||||
id: 'empty',
|
||||
name: 'Choose one...'
|
||||
};
|
||||
|
||||
typeId = 'DropdownCloudWidgetComponent';
|
||||
HIDE_FILTER_LIMIT = 5;
|
||||
showInputFilter = false;
|
||||
isRestApiFailed = false;
|
||||
restApiHostName: string;
|
||||
@@ -151,7 +151,7 @@ export class DropdownCloudWidgetComponent extends WidgetComponent implements OnI
|
||||
}
|
||||
|
||||
private isDefaultValue(value: string): boolean {
|
||||
return value === DropdownCloudWidgetComponent.DEFAULT_OPTION.id;
|
||||
return value === DEFAULT_OPTION.id;
|
||||
}
|
||||
|
||||
private getFormFieldById(fieldId): FormFieldModel {
|
||||
@@ -200,7 +200,7 @@ export class DropdownCloudWidgetComponent extends WidgetComponent implements OnI
|
||||
}
|
||||
|
||||
private addDefaultOption() {
|
||||
this.field.options = [DropdownCloudWidgetComponent.DEFAULT_OPTION];
|
||||
this.field.options = [DEFAULT_OPTION];
|
||||
this.updateOptions();
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ export class DropdownCloudWidgetComponent extends WidgetComponent implements OnI
|
||||
}
|
||||
|
||||
let optionValue: string = '';
|
||||
if (option.id === DropdownCloudWidgetComponent.DEFAULT_OPTION.id || option.name !== fieldValue) {
|
||||
if (option.id === DEFAULT_OPTION.id || option.name !== fieldValue) {
|
||||
optionValue = option.id;
|
||||
} else {
|
||||
optionValue = option.name;
|
||||
@@ -278,7 +278,7 @@ export class DropdownCloudWidgetComponent extends WidgetComponent implements OnI
|
||||
}
|
||||
|
||||
updateOptions(): void {
|
||||
this.showInputFilter = this.field.options.length > this.appConfig.get<number>('form.dropDownFilterLimit', this.HIDE_FILTER_LIMIT);
|
||||
this.showInputFilter = this.field.options.length > this.appConfig.get<number>('form.dropDownFilterLimit', HIDE_FILTER_LIMIT);
|
||||
this.list$ = combineLatest([of(this.field.options), this.filter$])
|
||||
.pipe(
|
||||
map(([items, search]) => {
|
||||
|
||||
+5
-5
@@ -60,7 +60,7 @@ describe('RadioButtonsCloudWidgetComponent', () => {
|
||||
const fieldId = '<field-id>';
|
||||
|
||||
const form = new FormModel({
|
||||
taskId: taskId
|
||||
taskId
|
||||
});
|
||||
|
||||
widget.field = new FormFieldModel(form, {
|
||||
@@ -124,13 +124,13 @@ describe('RadioButtonsCloudWidgetComponent', () => {
|
||||
expect(widgetLabel.innerText).toBe('radio-name-label*');
|
||||
expect(widget.field.isValid).toBe(false);
|
||||
|
||||
const option: HTMLElement = <HTMLElement> element.querySelector('#radio-id-opt-1 label');
|
||||
const option = element.querySelector<HTMLElement>('#radio-id-opt-1 label');
|
||||
option.click();
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
fixture.detectChanges();
|
||||
const selectedOption: HTMLElement = <HTMLElement> element.querySelector('[class*="mat-radio-checked"]');
|
||||
const selectedOption = element.querySelector<HTMLElement>('[class*="mat-radio-checked"]');
|
||||
expect(selectedOption.innerText).toBe('opt-name-1');
|
||||
expect(widget.field.isValid).toBe(true);
|
||||
});
|
||||
@@ -149,7 +149,7 @@ describe('RadioButtonsCloudWidgetComponent', () => {
|
||||
});
|
||||
|
||||
fixture.detectChanges();
|
||||
const selectedOption: HTMLElement = <HTMLElement> element.querySelector('[class*="mat-radio-checked"]');
|
||||
const selectedOption = element.querySelector<HTMLElement>('[class*="mat-radio-checked"]');
|
||||
expect(selectedOption.innerText).toBe('opt-name-2');
|
||||
expect(widget.field.isValid).toBe(true);
|
||||
});
|
||||
@@ -168,7 +168,7 @@ describe('RadioButtonsCloudWidgetComponent', () => {
|
||||
});
|
||||
|
||||
fixture.detectChanges();
|
||||
const selectedOption: HTMLElement = <HTMLElement> element.querySelector('[class*="mat-radio-checked"]');
|
||||
const selectedOption = element.querySelector<HTMLElement>('[class*="mat-radio-checked"]');
|
||||
expect(selectedOption.innerText).toBe('opt-name-1');
|
||||
expect(widget.field.isValid).toBe(true);
|
||||
});
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
|
||||
import { Node } from '@alfresco/js-api';
|
||||
import { FormFieldMetadata } from '@alfresco/adf-core';
|
||||
import { FileSourceTypes, DestinationFolderPathType } from '../models/form-cloud-representation.model';
|
||||
|
||||
export const fakeLocalPngResponse = {
|
||||
@@ -101,14 +104,14 @@ export const onlyLocalParams = {
|
||||
fileSource: {
|
||||
serviceId: 'local-file'
|
||||
}
|
||||
};
|
||||
} as FormFieldMetadata;
|
||||
|
||||
export const contentSourceParam = {
|
||||
fileSource: {
|
||||
name: 'mock-alf-content',
|
||||
serviceId: FileSourceTypes.ALFRESCO_CONTENT_SOURCES_SERVICE_ID
|
||||
}
|
||||
};
|
||||
} as FormFieldMetadata;
|
||||
|
||||
export const menuTestSourceParam = {
|
||||
fileSource: {
|
||||
@@ -121,7 +124,7 @@ export const menuTestSourceParam = {
|
||||
retrieveMetadata: true,
|
||||
remove: true
|
||||
}
|
||||
};
|
||||
} as FormFieldMetadata;
|
||||
|
||||
export const allSourceParamsWithRelativePath = {
|
||||
fileSource: {
|
||||
@@ -156,32 +159,32 @@ export const displayableCMParams = {
|
||||
},
|
||||
displayableCMProperties: [
|
||||
{
|
||||
'name': 'name',
|
||||
'prefixedName': 'a:name',
|
||||
'title': '',
|
||||
'dataType': 'd:text',
|
||||
'defaultValue': 'Bob'
|
||||
name: 'name',
|
||||
prefixedName: 'a:name',
|
||||
title: '',
|
||||
dataType: 'd:text',
|
||||
defaultValue: 'Bob'
|
||||
},
|
||||
{
|
||||
'name': 'age',
|
||||
'prefixedName': 'a:age',
|
||||
'title': 'Age',
|
||||
'dataType': 'd:text',
|
||||
'defaultValue': ''
|
||||
name: 'age',
|
||||
prefixedName: 'a:age',
|
||||
title: 'Age',
|
||||
dataType: 'd:text',
|
||||
defaultValue: ''
|
||||
},
|
||||
{
|
||||
'name': 'dob',
|
||||
'prefixedName': 'a:dob',
|
||||
'title': 'Date of Birth',
|
||||
'dataType': 'd:date',
|
||||
'defaultValue': ''
|
||||
name: 'dob',
|
||||
prefixedName: 'a:dob',
|
||||
title: 'Date of Birth',
|
||||
dataType: 'd:date',
|
||||
defaultValue: ''
|
||||
},
|
||||
{
|
||||
'name': 'doj',
|
||||
'prefixedName': 'a:doj',
|
||||
'title': 'Date of Joining',
|
||||
'dataType': 'd:datetime',
|
||||
'defaultValue': ''
|
||||
name: 'doj',
|
||||
prefixedName: 'a:doj',
|
||||
title: 'Date of Joining',
|
||||
dataType: 'd:datetime',
|
||||
defaultValue: ''
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -260,15 +263,15 @@ export const allSourceWithoutValueProperty = {
|
||||
}
|
||||
};
|
||||
|
||||
export const fakeMinimalNode: Node = <Node> {
|
||||
export const fakeMinimalNode = {
|
||||
id: 'fake',
|
||||
name: 'fake-name',
|
||||
content: {
|
||||
mimeType: 'application/pdf'
|
||||
}
|
||||
};
|
||||
} as Node;
|
||||
|
||||
export const fakeNodeWithProperties: Node = <Node> {
|
||||
export const fakeNodeWithProperties = {
|
||||
id: 'fake-properties',
|
||||
name: 'fake-properties-name',
|
||||
content: {
|
||||
@@ -278,22 +281,22 @@ export const fakeNodeWithProperties: Node = <Node> {
|
||||
'pfx:property_one': 'testValue',
|
||||
'pfx:property_two': true
|
||||
}
|
||||
};
|
||||
} as Node;
|
||||
|
||||
export const expectedValues = {
|
||||
pfx_property_one: 'testValue',
|
||||
pfx_property_two: true
|
||||
};
|
||||
|
||||
export const mockNodeId = new Promise<string>(function(resolve) {
|
||||
export const mockNodeId = new Promise<string>((resolve) => {
|
||||
resolve('mock-node-id');
|
||||
});
|
||||
|
||||
export const mockNodeIdBasedOnStringVariableValue = new Promise<string>(function(resolve) {
|
||||
export const mockNodeIdBasedOnStringVariableValue = new Promise<string>((resolve) => {
|
||||
resolve('mock-string-value-node-id');
|
||||
});
|
||||
|
||||
export const mockNodeIdBasedOnFolderVariableValue = new Promise(function(resolve) {
|
||||
export const mockNodeIdBasedOnFolderVariableValue = new Promise((resolve) => {
|
||||
resolve('mock-folder-value-node-id');
|
||||
});
|
||||
|
||||
@@ -391,61 +394,61 @@ export const mockAllFileSourceWithRenamedFolderVariablePathType = {
|
||||
|
||||
export const formVariables = [
|
||||
{
|
||||
'id': 'bfca9766-7bc1-45cc-8ecf-cdad551e36e2',
|
||||
'name': 'name1',
|
||||
'type': 'string',
|
||||
'value': 'hello'
|
||||
id: 'bfca9766-7bc1-45cc-8ecf-cdad551e36e2',
|
||||
name: 'name1',
|
||||
type: 'string',
|
||||
value: 'hello'
|
||||
},
|
||||
{
|
||||
'id': '3ed9f28a-dbae-463f-b991-47ef06658bb6',
|
||||
'name': 'name2',
|
||||
'type': 'folder'
|
||||
id: '3ed9f28a-dbae-463f-b991-47ef06658bb6',
|
||||
name: 'name2',
|
||||
type: 'folder'
|
||||
},
|
||||
{
|
||||
'id': 'booleanVar',
|
||||
'name': 'bool',
|
||||
'type': 'boolean',
|
||||
'value': 'true'
|
||||
id: 'booleanVar',
|
||||
name: 'bool',
|
||||
type: 'boolean',
|
||||
value: 'true'
|
||||
}
|
||||
];
|
||||
|
||||
export const processVariables = [
|
||||
{
|
||||
'serviceName': 'mock-variable-mapping-rb',
|
||||
'serviceFullName': 'mock-variable-mapping-rb',
|
||||
'serviceVersion': '',
|
||||
'appName': 'mock-variable-mapping',
|
||||
'appVersion': '',
|
||||
'serviceType': null,
|
||||
'id': 3,
|
||||
'type': 'string',
|
||||
'name': 'variables.name1',
|
||||
'createTime': 1566989626284,
|
||||
'lastUpdatedTime': 1566989626284,
|
||||
'executionId': null,
|
||||
'value': '-root-/pathBasedOnStringvariablevalue',
|
||||
'markedAsDeleted': false,
|
||||
'processInstanceId': '1be4785f-c982-11e9-bdd8-96d6903e4e44',
|
||||
'taskId': '1beab9f6-c982-11e9-bdd8-96d6903e4e44',
|
||||
'taskVariable': true
|
||||
serviceName: 'mock-variable-mapping-rb',
|
||||
serviceFullName: 'mock-variable-mapping-rb',
|
||||
serviceVersion: '',
|
||||
appName: 'mock-variable-mapping',
|
||||
appVersion: '',
|
||||
serviceType: null,
|
||||
id: 3,
|
||||
type: 'string',
|
||||
name: 'variables.name1',
|
||||
createTime: 1566989626284,
|
||||
lastUpdatedTime: 1566989626284,
|
||||
executionId: null,
|
||||
value: '-root-/pathBasedOnStringvariablevalue',
|
||||
markedAsDeleted: false,
|
||||
processInstanceId: '1be4785f-c982-11e9-bdd8-96d6903e4e44',
|
||||
taskId: '1beab9f6-c982-11e9-bdd8-96d6903e4e44',
|
||||
taskVariable: true
|
||||
},
|
||||
{
|
||||
'serviceName': 'mock-variable-mapping-rb',
|
||||
'serviceFullName': 'mock-variable-mapping-rb',
|
||||
'serviceVersion': '',
|
||||
'appName': 'mock-variable-mapping',
|
||||
'appVersion': '',
|
||||
'serviceType': null,
|
||||
'id': 1,
|
||||
'type': 'folder',
|
||||
'name': 'variables.name2',
|
||||
'createTime': 1566989626283,
|
||||
'lastUpdatedTime': 1566989626283,
|
||||
'executionId': null,
|
||||
'value': [{ id: 'mock-folder-id'}],
|
||||
'markedAsDeleted': false,
|
||||
'processInstanceId': '1be4785f-c982-11e9-bdd8-96d6903e4e44',
|
||||
'taskId': '1beab9f6-c982-11e9-bdd8-96d6903e4e44',
|
||||
'taskVariable': true
|
||||
serviceName: 'mock-variable-mapping-rb',
|
||||
serviceFullName: 'mock-variable-mapping-rb',
|
||||
serviceVersion: '',
|
||||
appName: 'mock-variable-mapping',
|
||||
appVersion: '',
|
||||
serviceType: null,
|
||||
id: 1,
|
||||
type: 'folder',
|
||||
name: 'variables.name2',
|
||||
createTime: 1566989626283,
|
||||
lastUpdatedTime: 1566989626283,
|
||||
executionId: null,
|
||||
value: [{ id: 'mock-folder-id'}],
|
||||
markedAsDeleted: false,
|
||||
processInstanceId: '1be4785f-c982-11e9-bdd8-96d6903e4e44',
|
||||
taskId: '1beab9f6-c982-11e9-bdd8-96d6903e4e44',
|
||||
taskVariable: true
|
||||
}
|
||||
];
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -32,22 +32,20 @@ export class FormCloudServiceMock implements FormCloudServiceInterface {
|
||||
|
||||
getTaskForm(appName: string, taskId: string, version?: number): Observable<any> {
|
||||
return this.getTask(appName, taskId).pipe(
|
||||
switchMap((task) => {
|
||||
return this.getForm(appName, task.formKey, version).pipe(
|
||||
map((form: FormContent) => {
|
||||
const flattenForm = {
|
||||
...form.formRepresentation,
|
||||
...form.formRepresentation.formDefinition,
|
||||
taskId: task.id,
|
||||
taskName: task.name,
|
||||
processDefinitionId: task.processDefinitionId,
|
||||
processInstanceId: task.processInstanceId
|
||||
};
|
||||
delete flattenForm.formDefinition;
|
||||
return flattenForm;
|
||||
})
|
||||
);
|
||||
})
|
||||
switchMap((task) => this.getForm(appName, task.formKey, version).pipe(
|
||||
map((form: FormContent) => {
|
||||
const flattenForm = {
|
||||
...form.formRepresentation,
|
||||
...form.formRepresentation.formDefinition,
|
||||
taskId: task.id,
|
||||
taskName: task.name,
|
||||
processDefinitionId: task.processDefinitionId,
|
||||
processInstanceId: task.processInstanceId
|
||||
};
|
||||
delete flattenForm.formDefinition;
|
||||
return flattenForm;
|
||||
})
|
||||
))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -27,10 +27,10 @@ import { mockFormRepresentations } from './form-representation.mock';
|
||||
export class FormDefinitionSelectorCloudServiceMock implements FormDefinitionSelectorCloudServiceInterface {
|
||||
|
||||
getForms(_appName: string): Observable<FormRepresentation[]> {
|
||||
return of(mockFormRepresentations.map(response => <FormRepresentation> response.formRepresentation));
|
||||
return of(mockFormRepresentations.map(response => response.formRepresentation));
|
||||
}
|
||||
|
||||
getStandAloneTaskForms(_appName: string): Observable<FormRepresentation[]> {
|
||||
return of(mockFormRepresentations.map(response => <FormRepresentation> response.formRepresentation).filter((form: any) => form.standalone ? form : undefined));
|
||||
return of(mockFormRepresentations.map(response => response.formRepresentation).filter((form: any) => form.standalone ? form : undefined));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* eslint-disable no-shadow */
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
export class FormCloudRepresentation {
|
||||
|
||||
id?: string;
|
||||
|
||||
@@ -77,7 +77,7 @@ describe('FormCloud', () => {
|
||||
form.fields = [];
|
||||
expect(form.hasFields()).toBeFalsy();
|
||||
|
||||
const field = new FormFieldModel(<any> form);
|
||||
const field = new FormFieldModel(form);
|
||||
form.fields = [new ContainerModel(field)];
|
||||
expect(form.hasFields()).toBeTruthy();
|
||||
});
|
||||
|
||||
+2
-2
@@ -51,7 +51,7 @@ export class ContentCloudNodeSelectorService {
|
||||
openUploadFileDialog(currentFolderId?: string, selectionMode?: string, isAllFileSources?: boolean, restrictRootToCurrentFolderId?: boolean): Observable<Node[]> {
|
||||
const select = new Subject<Node[]>();
|
||||
select.subscribe({ complete: this.close.bind(this) });
|
||||
const data = <ContentNodeSelectorComponentData> {
|
||||
const data = {
|
||||
title: 'Select a file',
|
||||
actionName: NodeAction.ATTACH,
|
||||
currentFolderId,
|
||||
@@ -62,7 +62,7 @@ export class ContentCloudNodeSelectorService {
|
||||
showFilesInResult: true,
|
||||
showDropdownSiteList: false,
|
||||
showLocalUploadButton: isAllFileSources
|
||||
};
|
||||
} as ContentNodeSelectorComponentData;
|
||||
this.openContentNodeDialog(data, 'adf-content-node-selector-dialog', '66%');
|
||||
return select;
|
||||
}
|
||||
|
||||
@@ -51,10 +51,8 @@ describe('Form Cloud service', () => {
|
||||
apiService = TestBed.inject(AlfrescoApiService);
|
||||
|
||||
spyOn(apiService, 'getInstance').and.returnValue({
|
||||
oauth2Auth: oauth2Auth,
|
||||
isEcmLoggedIn() {
|
||||
return false;
|
||||
},
|
||||
oauth2Auth,
|
||||
isEcmLoggedIn: () => false,
|
||||
reply: jasmine.createSpy('reply')
|
||||
} as any);
|
||||
});
|
||||
@@ -102,36 +100,36 @@ describe('Form Cloud service', () => {
|
||||
|
||||
it('should fetch task variables', (done) => {
|
||||
oauth2Auth.callCustomApi.and.returnValue(Promise.resolve({
|
||||
'list': {
|
||||
'entries': [
|
||||
list: {
|
||||
entries: [
|
||||
{
|
||||
'entry': {
|
||||
'serviceName': 'fake-rb',
|
||||
'serviceFullName': 'fake-rb',
|
||||
'serviceVersion': '',
|
||||
'appName': 'fake',
|
||||
'appVersion': '',
|
||||
'serviceType': null,
|
||||
'id': 25,
|
||||
'type': 'string',
|
||||
'name': 'fakeProperty',
|
||||
'createTime': 1556112661342,
|
||||
'lastUpdatedTime': 1556112661342,
|
||||
'executionId': null,
|
||||
'value': 'fakeValue',
|
||||
'markedAsDeleted': false,
|
||||
'processInstanceId': '18e16bc7-6694-11e9-9c1b-0a586460028a',
|
||||
'taskId': '18e192da-6694-11e9-9c1b-0a586460028a',
|
||||
'taskVariable': true
|
||||
entry: {
|
||||
serviceName: 'fake-rb',
|
||||
serviceFullName: 'fake-rb',
|
||||
serviceVersion: '',
|
||||
appName: 'fake',
|
||||
appVersion: '',
|
||||
serviceType: null,
|
||||
id: 25,
|
||||
type: 'string',
|
||||
name: 'fakeProperty',
|
||||
createTime: 1556112661342,
|
||||
lastUpdatedTime: 1556112661342,
|
||||
executionId: null,
|
||||
value: 'fakeValue',
|
||||
markedAsDeleted: false,
|
||||
processInstanceId: '18e16bc7-6694-11e9-9c1b-0a586460028a',
|
||||
taskId: '18e192da-6694-11e9-9c1b-0a586460028a',
|
||||
taskVariable: true
|
||||
}
|
||||
}
|
||||
],
|
||||
'pagination': {
|
||||
'skipCount': 0,
|
||||
'maxItems': 100,
|
||||
'count': 1,
|
||||
'hasMoreItems': false,
|
||||
'totalItems': 1
|
||||
pagination: {
|
||||
skipCount: 0,
|
||||
maxItems: 100,
|
||||
count: 1,
|
||||
hasMoreItems: false,
|
||||
totalItems: 1
|
||||
}
|
||||
}
|
||||
}));
|
||||
@@ -149,36 +147,36 @@ describe('Form Cloud service', () => {
|
||||
|
||||
it('should fetch result if the variable value is 0', (done) => {
|
||||
oauth2Auth.callCustomApi.and.returnValue(Promise.resolve({
|
||||
'list': {
|
||||
'entries': [
|
||||
list: {
|
||||
entries: [
|
||||
{
|
||||
'entry': {
|
||||
'serviceName': 'fake-rb',
|
||||
'serviceFullName': 'fake-rb',
|
||||
'serviceVersion': '',
|
||||
'appName': 'fake',
|
||||
'appVersion': '',
|
||||
'serviceType': null,
|
||||
'id': 25,
|
||||
'type': 'string',
|
||||
'name': 'fakeProperty',
|
||||
'createTime': 1556112661342,
|
||||
'lastUpdatedTime': 1556112661342,
|
||||
'executionId': null,
|
||||
'value': 0,
|
||||
'markedAsDeleted': false,
|
||||
'processInstanceId': '18e16bc7-6694-11e9-9c1b-0a586460028a',
|
||||
'taskId': '18e192da-6694-11e9-9c1b-0a586460028a',
|
||||
'taskVariable': true
|
||||
entry: {
|
||||
serviceName: 'fake-rb',
|
||||
serviceFullName: 'fake-rb',
|
||||
serviceVersion: '',
|
||||
appName: 'fake',
|
||||
appVersion: '',
|
||||
serviceType: null,
|
||||
id: 25,
|
||||
type: 'string',
|
||||
name: 'fakeProperty',
|
||||
createTime: 1556112661342,
|
||||
lastUpdatedTime: 1556112661342,
|
||||
executionId: null,
|
||||
value: 0,
|
||||
markedAsDeleted: false,
|
||||
processInstanceId: '18e16bc7-6694-11e9-9c1b-0a586460028a',
|
||||
taskId: '18e192da-6694-11e9-9c1b-0a586460028a',
|
||||
taskVariable: true
|
||||
}
|
||||
}
|
||||
],
|
||||
'pagination': {
|
||||
'skipCount': 0,
|
||||
'maxItems': 100,
|
||||
'count': 1,
|
||||
'hasMoreItems': false,
|
||||
'totalItems': 1
|
||||
pagination: {
|
||||
skipCount: 0,
|
||||
maxItems: 100,
|
||||
count: 1,
|
||||
hasMoreItems: false,
|
||||
totalItems: 1
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
@@ -53,6 +53,7 @@ export class FormCloudService extends BaseCloudService implements FormCloudServi
|
||||
|
||||
/**
|
||||
* Gets the form definition of a task.
|
||||
*
|
||||
* @param appName Name of the app
|
||||
* @param taskId ID of the target task
|
||||
* @param version Version of the form
|
||||
@@ -60,27 +61,26 @@ export class FormCloudService extends BaseCloudService implements FormCloudServi
|
||||
*/
|
||||
getTaskForm(appName: string, taskId: string, version?: number): Observable<any> {
|
||||
return this.getTask(appName, taskId).pipe(
|
||||
switchMap(task => {
|
||||
return this.getForm(appName, task.formKey, version).pipe(
|
||||
map((form: FormContent) => {
|
||||
const flattenForm = {
|
||||
...form.formRepresentation,
|
||||
...form.formRepresentation.formDefinition,
|
||||
taskId: task.id,
|
||||
taskName: task.name,
|
||||
processDefinitionId: task.processDefinitionId,
|
||||
processInstanceId: task.processInstanceId
|
||||
};
|
||||
delete flattenForm.formDefinition;
|
||||
return flattenForm;
|
||||
})
|
||||
);
|
||||
})
|
||||
switchMap(task => this.getForm(appName, task.formKey, version).pipe(
|
||||
map((form: FormContent) => {
|
||||
const flattenForm = {
|
||||
...form.formRepresentation,
|
||||
...form.formRepresentation.formDefinition,
|
||||
taskId: task.id,
|
||||
taskName: task.name,
|
||||
processDefinitionId: task.processDefinitionId,
|
||||
processInstanceId: task.processInstanceId
|
||||
};
|
||||
delete flattenForm.formDefinition;
|
||||
return flattenForm;
|
||||
})
|
||||
))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a task form.
|
||||
*
|
||||
* @param appName Name of the app
|
||||
* @param taskId ID of the target task
|
||||
* @param processInstanceId ID of processInstance
|
||||
@@ -120,6 +120,7 @@ export class FormCloudService extends BaseCloudService implements FormCloudServi
|
||||
|
||||
/**
|
||||
* Completes a task form.
|
||||
*
|
||||
* @param appName Name of the app
|
||||
* @param taskId ID of the target task
|
||||
* @param processInstanceId ID of processInstance
|
||||
@@ -131,11 +132,12 @@ export class FormCloudService extends BaseCloudService implements FormCloudServi
|
||||
*/
|
||||
completeTaskForm(appName: string, taskId: string, processInstanceId: string, formId: string, formValues: FormValues, outcome: string, version: number): Observable<TaskDetailsCloudModel> {
|
||||
const apiUrl = `${this.getBasePath(appName)}/form/v1/forms/${formId}/submit/versions/${version}`;
|
||||
const completeFormRepresentation = <CompleteFormRepresentation> {
|
||||
const completeFormRepresentation = {
|
||||
values: formValues,
|
||||
taskId: taskId,
|
||||
processInstanceId: processInstanceId
|
||||
};
|
||||
taskId,
|
||||
processInstanceId
|
||||
} as CompleteFormRepresentation;
|
||||
|
||||
if (outcome) {
|
||||
completeFormRepresentation.outcome = outcome;
|
||||
}
|
||||
@@ -147,6 +149,7 @@ export class FormCloudService extends BaseCloudService implements FormCloudServi
|
||||
|
||||
/**
|
||||
* Gets details of a task
|
||||
*
|
||||
* @param appName Name of the app
|
||||
* @param taskId ID of the target task
|
||||
* @returns Details of the task
|
||||
@@ -161,6 +164,7 @@ export class FormCloudService extends BaseCloudService implements FormCloudServi
|
||||
|
||||
/**
|
||||
* Gets the variables of a task.
|
||||
*
|
||||
* @param appName Name of the app
|
||||
* @param taskId ID of the target task
|
||||
* @returns Task variables
|
||||
@@ -169,14 +173,13 @@ export class FormCloudService extends BaseCloudService implements FormCloudServi
|
||||
const apiUrl = `${this.getBasePath(appName)}/query/v1/tasks/${taskId}/variables`;
|
||||
|
||||
return this.get(apiUrl).pipe(
|
||||
map((res: any) => {
|
||||
return res.list.entries.map((variable) => new TaskVariableCloud(variable.entry));
|
||||
})
|
||||
map((res: any) => res.list.entries.map((variable) => new TaskVariableCloud(variable.entry)))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a form definition.
|
||||
*
|
||||
* @param appName Name of the app
|
||||
* @param formKey key of the target task
|
||||
* @param version Version of the form
|
||||
@@ -200,6 +203,7 @@ export class FormCloudService extends BaseCloudService implements FormCloudServi
|
||||
|
||||
/**
|
||||
* Parses JSON data to create a corresponding form.
|
||||
*
|
||||
* @param json JSON data to create the form
|
||||
* @param data Values for the form's fields
|
||||
* @param readOnly Toggles whether or not the form should be read-only
|
||||
@@ -221,7 +225,7 @@ export class FormCloudService extends BaseCloudService implements FormCloudServi
|
||||
const form = new FormModel(flattenForm, formValues, readOnly);
|
||||
if (!json.fields) {
|
||||
form.outcomes = [
|
||||
new FormOutcomeModel(<any> form, {
|
||||
new FormOutcomeModel(form, {
|
||||
id: '$save',
|
||||
name: FormOutcomeModel.SAVE_ACTION,
|
||||
isSystem: true
|
||||
|
||||
+2
-4
@@ -43,10 +43,8 @@ describe('Form Definition Selector Cloud Service', () => {
|
||||
service = TestBed.inject(FormDefinitionSelectorCloudService);
|
||||
apiService = TestBed.inject(AlfrescoApiService);
|
||||
spyOn(apiService, 'getInstance').and.returnValue({
|
||||
oauth2Auth: oauth2Auth,
|
||||
isEcmLoggedIn() {
|
||||
return false;
|
||||
},
|
||||
oauth2Auth,
|
||||
isEcmLoggedIn: () => false,
|
||||
reply: jasmine.createSpy('reply')
|
||||
} as any);
|
||||
});
|
||||
|
||||
+4
-8
@@ -35,6 +35,7 @@ export class FormDefinitionSelectorCloudService extends BaseCloudService impleme
|
||||
|
||||
/**
|
||||
* Get all forms of an app.
|
||||
*
|
||||
* @param appName Name of the application
|
||||
* @returns Details of the forms
|
||||
*/
|
||||
@@ -42,24 +43,19 @@ export class FormDefinitionSelectorCloudService extends BaseCloudService impleme
|
||||
const url = `${this.getBasePath(appName)}/form/v1/forms`;
|
||||
|
||||
return this.get(url).pipe(
|
||||
map((data: any) => {
|
||||
return data.map((formData: any) => {
|
||||
return <FormRepresentation> formData.formRepresentation;
|
||||
});
|
||||
})
|
||||
map((data: any) => data.map((formData: any) => formData.formRepresentation))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all forms of an app.
|
||||
*
|
||||
* @param appName Name of the application
|
||||
* @returns Details of the forms
|
||||
*/
|
||||
getStandAloneTaskForms(appName: string): Observable<FormRepresentation[]> {
|
||||
return from(this.getForms(appName)).pipe(
|
||||
map((data: any) => {
|
||||
return data.filter((formData: any) => formData.standalone || formData.standalone === undefined);
|
||||
})
|
||||
map((data: any) => data.filter((formData: any) => formData.standalone || formData.standalone === undefined))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,12 +59,10 @@ export class ProcessCloudContentService {
|
||||
return from(
|
||||
this.uploadApi.uploadFile(file, '', nodeId, '', { overwrite: true })
|
||||
).pipe(
|
||||
map((res: any) => {
|
||||
return {
|
||||
...res.entry,
|
||||
nodeId: res.entry.id
|
||||
};
|
||||
}),
|
||||
map((res: any) => ({
|
||||
...res.entry,
|
||||
nodeId: res.entry.id
|
||||
})),
|
||||
catchError(err => this.handleError(err))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -44,14 +44,13 @@ describe('GroupCloudComponent', () => {
|
||||
oauth2Auth: {
|
||||
callCustomApi: () => Promise.resolve(mockIdentityGroups)
|
||||
},
|
||||
isEcmLoggedIn() {
|
||||
return false;
|
||||
},
|
||||
isEcmLoggedIn: () => false,
|
||||
reply: jasmine.createSpy('reply')
|
||||
};
|
||||
|
||||
// eslint-disable-next-line prefer-arrow/prefer-arrow-functions
|
||||
function getElement<T = HTMLElement>(selector: string): T {
|
||||
return <T> fixture.nativeElement.querySelector(selector);
|
||||
return fixture.nativeElement.querySelector(selector);
|
||||
}
|
||||
|
||||
setupTestBed({
|
||||
@@ -110,10 +109,10 @@ describe('GroupCloudComponent', () => {
|
||||
it('should not be able to search for a group that its name matches one of the preselected groups name', (done) => {
|
||||
component.preSelectGroups = [{ name: mockIdentityGroups[0].name }];
|
||||
const changes = new SimpleChange(null, [{ name: mockIdentityGroups[0].name }], false);
|
||||
component.ngOnChanges({ 'preSelectGroups': changes });
|
||||
component.ngOnChanges({ preSelectGroups: changes });
|
||||
fixture.detectChanges();
|
||||
|
||||
const inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
const inputHTMLElement = element.querySelector<HTMLInputElement>('input');
|
||||
inputHTMLElement.focus();
|
||||
inputHTMLElement.value = 'mock-group';
|
||||
inputHTMLElement.dispatchEvent(new Event('keyup'));
|
||||
@@ -242,7 +241,7 @@ describe('GroupCloudComponent', () => {
|
||||
component.appName = 'mock-app-name';
|
||||
|
||||
const change = new SimpleChange(null, 'mock-app-name', false);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -486,8 +485,8 @@ describe('GroupCloudComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
component.mode = 'single';
|
||||
component.preSelectGroups = <any> mockIdentityGroups;
|
||||
component.ngOnChanges({ 'preSelectGroups': changes });
|
||||
component.preSelectGroups = mockIdentityGroups;
|
||||
component.ngOnChanges({ preSelectGroups: changes });
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
@@ -503,15 +502,15 @@ describe('GroupCloudComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
component.mode = 'multiple';
|
||||
component.preSelectGroups = <any> mockIdentityGroups;
|
||||
component.ngOnChanges({ 'preSelectGroups': change });
|
||||
component.preSelectGroups = mockIdentityGroups;
|
||||
component.ngOnChanges({ preSelectGroups: change });
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should render all preselected groups', () => {
|
||||
component.mode = 'multiple';
|
||||
fixture.detectChanges();
|
||||
component.ngOnChanges({ 'preSelectGroups': change });
|
||||
component.ngOnChanges({ preSelectGroups: change });
|
||||
fixture.detectChanges();
|
||||
const chips = fixture.debugElement.queryAll(By.css('mat-chip'));
|
||||
expect(chips.length).toBe(5);
|
||||
@@ -551,7 +550,7 @@ describe('GroupCloudComponent', () => {
|
||||
];
|
||||
const change = new SimpleChange(null, component.preSelectGroups, false);
|
||||
component.mode = 'multiple';
|
||||
component.ngOnChanges({ 'preSelectGroups': change });
|
||||
component.ngOnChanges({ preSelectGroups: change });
|
||||
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -579,7 +578,7 @@ describe('GroupCloudComponent', () => {
|
||||
|
||||
const change = new SimpleChange(null, component.preSelectGroups, false);
|
||||
component.mode = 'multiple';
|
||||
component.ngOnChanges({ 'preSelectGroups': change });
|
||||
component.ngOnChanges({ preSelectGroups: change });
|
||||
|
||||
const removeGroupSpy = spyOn(component.removeGroup, 'emit');
|
||||
fixture.detectChanges();
|
||||
@@ -610,8 +609,8 @@ describe('GroupCloudComponent', () => {
|
||||
it('should chip list be disabled and show one single chip - single mode', () => {
|
||||
component.mode = 'single';
|
||||
component.readOnly = true;
|
||||
component.preSelectGroups = <any> mockIdentityGroups;
|
||||
component.ngOnChanges({ 'preSelectGroups': change });
|
||||
component.preSelectGroups = mockIdentityGroups;
|
||||
component.ngOnChanges({ preSelectGroups: change });
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
@@ -627,8 +626,8 @@ describe('GroupCloudComponent', () => {
|
||||
it('should chip list be disabled and show all the chips - multiple mode', () => {
|
||||
component.mode = 'multiple';
|
||||
component.readOnly = true;
|
||||
component.preSelectGroups = <any> mockIdentityGroups;
|
||||
component.ngOnChanges({ 'preSelectGroups': change });
|
||||
component.preSelectGroups = mockIdentityGroups;
|
||||
component.ngOnChanges({ preSelectGroups: change });
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
@@ -663,8 +662,8 @@ describe('GroupCloudComponent', () => {
|
||||
|
||||
component.mode = 'single';
|
||||
component.validate = true;
|
||||
component.preSelectGroups = <any> [mockIdentityGroups[0], mockIdentityGroups[1]];
|
||||
component.ngOnChanges({ 'preSelectGroups': new SimpleChange(null, [mockIdentityGroups[0], mockIdentityGroups[1]], false) });
|
||||
component.preSelectGroups = [mockIdentityGroups[0], mockIdentityGroups[1]];
|
||||
component.ngOnChanges({ preSelectGroups: new SimpleChange(null, [mockIdentityGroups[0], mockIdentityGroups[1]], false) });
|
||||
});
|
||||
|
||||
it('should check validation for all the groups and emit warning - multiple mode', (done) => {
|
||||
@@ -694,9 +693,9 @@ describe('GroupCloudComponent', () => {
|
||||
|
||||
component.mode = 'multiple';
|
||||
component.validate = true;
|
||||
component.preSelectGroups = <any> [mockIdentityGroups[0], mockIdentityGroups[1]];
|
||||
component.preSelectGroups = [mockIdentityGroups[0], mockIdentityGroups[1]];
|
||||
component.ngOnChanges({
|
||||
'preSelectGroups': new SimpleChange(null, [mockIdentityGroups[0], mockIdentityGroups[1]], false)
|
||||
preSelectGroups: new SimpleChange(null, [mockIdentityGroups[0], mockIdentityGroups[1]], false)
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -235,9 +235,7 @@ export class GroupCloudComponent implements OnInit, OnChanges, OnDestroy {
|
||||
|
||||
private isGroupAlreadySelected(group: IdentityGroupModel): boolean {
|
||||
if (this.selectedGroups && this.selectedGroups.length > 0) {
|
||||
const result = this.selectedGroups.find((selectedGroup: IdentityGroupModel) => {
|
||||
return selectedGroup.name === group.name;
|
||||
});
|
||||
const result = this.selectedGroups.find((selectedGroup: IdentityGroupModel) => selectedGroup.name === group.name);
|
||||
|
||||
return !!result;
|
||||
}
|
||||
@@ -317,7 +315,7 @@ export class GroupCloudComponent implements OnInit, OnChanges, OnDestroy {
|
||||
|
||||
filterGroupsByRoles(group: IdentityGroupModel): Observable<IdentityGroupModel> {
|
||||
return this.identityGroupService.checkGroupHasRole(group.id, this.roles).pipe(
|
||||
map((hasRole: boolean) => ({ hasRole: hasRole, group: group })),
|
||||
map((hasRole: boolean) => ({ hasRole, group })),
|
||||
filter((filteredGroup: { hasRole: boolean; group: IdentityGroupModel }) => filteredGroup.hasRole),
|
||||
map((filteredGroup: { hasRole: boolean; group: IdentityGroupModel }) => filteredGroup.group));
|
||||
}
|
||||
@@ -370,9 +368,7 @@ export class GroupCloudComponent implements OnInit, OnChanges, OnDestroy {
|
||||
}
|
||||
|
||||
private removeGroupFromSelected({ id, name }: IdentityGroupModel): void {
|
||||
const indexToRemove = this.selectedGroups.findIndex(group => {
|
||||
return group.id === id && group.name === name;
|
||||
});
|
||||
const indexToRemove = this.selectedGroups.findIndex(group => group.id === id && group.name === name);
|
||||
|
||||
if (indexToRemove !== -1) {
|
||||
this.selectedGroups.splice(indexToRemove, 1);
|
||||
@@ -380,9 +376,7 @@ export class GroupCloudComponent implements OnInit, OnChanges, OnDestroy {
|
||||
}
|
||||
|
||||
private removeGroupFromValidation({ id, name }: IdentityGroupModel): void {
|
||||
const indexToRemove = this.invalidGroups.findIndex(group => {
|
||||
return group.id === id && group.name === name;
|
||||
});
|
||||
const indexToRemove = this.invalidGroups.findIndex(group => group.id === id && group.name === name);
|
||||
|
||||
if (indexToRemove !== -1) {
|
||||
this.invalidGroups.splice(indexToRemove, 1);
|
||||
@@ -428,9 +422,7 @@ export class GroupCloudComponent implements OnInit, OnChanges, OnDestroy {
|
||||
|
||||
removeDuplicatedGroups(groups: IdentityGroupModel[]): IdentityGroupModel[] {
|
||||
return groups.filter((group, index, self) =>
|
||||
index === self.findIndex((auxGroup) => {
|
||||
return group.id === auxGroup.id && group.name === auxGroup.name;
|
||||
}));
|
||||
index === self.findIndex((auxGroup) => group.id === auxGroup.id && group.name === auxGroup.name));
|
||||
}
|
||||
|
||||
private hasPreSelectGroups(): boolean {
|
||||
|
||||
@@ -25,7 +25,7 @@ describe('InitialGroupNamePipe', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
pipe = new InitialGroupNamePipe();
|
||||
fakeGroup = <IdentityGroupModel> {name: 'mock'};
|
||||
fakeGroup = {name: 'mock'};
|
||||
});
|
||||
|
||||
it('should return with the group initial', () => {
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
|
||||
// eslint-disable-next-line no-shadow
|
||||
export enum DateCloudFilterType {
|
||||
NO_DATE = 'NO_DATE',
|
||||
TODAY = 'TODAY',
|
||||
|
||||
+29
-30
@@ -44,9 +44,7 @@ describe('PeopleCloudComponent', () => {
|
||||
oauth2Auth: {
|
||||
callCustomApi: () => Promise.resolve(mockUsers)
|
||||
},
|
||||
isEcmLoggedIn() {
|
||||
return false;
|
||||
},
|
||||
isEcmLoggedIn: () => false,
|
||||
reply: jasmine.createSpy('reply')
|
||||
};
|
||||
|
||||
@@ -55,8 +53,9 @@ describe('PeopleCloudComponent', () => {
|
||||
{ id: mockUsers[2].id, username: mockUsers[2].username }
|
||||
];
|
||||
|
||||
// eslint-disable-next-line prefer-arrow/prefer-arrow-functions
|
||||
function getElement<T = HTMLElement>(selector: string): T {
|
||||
return <T> fixture.nativeElement.querySelector(selector);
|
||||
return fixture.nativeElement.querySelector(selector);
|
||||
}
|
||||
|
||||
setupTestBed({
|
||||
@@ -125,10 +124,10 @@ describe('PeopleCloudComponent', () => {
|
||||
it('should not be able to search for a user that his username matches one of the preselected users username', (done) => {
|
||||
component.preSelectUsers = [{ username: mockUsers[0].username }];
|
||||
const changes = new SimpleChange(null, [{ username: mockUsers[0].username }], false);
|
||||
component.ngOnChanges({ 'preSelectUsers': changes });
|
||||
component.ngOnChanges({ preSelectUsers: changes });
|
||||
fixture.detectChanges();
|
||||
|
||||
const inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
const inputHTMLElement = element.querySelector<HTMLInputElement>('input');
|
||||
inputHTMLElement.focus();
|
||||
inputHTMLElement.value = 'first-name';
|
||||
inputHTMLElement.dispatchEvent(new Event('keyup'));
|
||||
@@ -145,10 +144,10 @@ describe('PeopleCloudComponent', () => {
|
||||
it('should not be able to search for a user that his id matches one of the preselected users id', (done) => {
|
||||
component.preSelectUsers = [{ id: mockUsers[0].id }];
|
||||
const changes = new SimpleChange(null, [{ id: mockUsers[0].id }], false);
|
||||
component.ngOnChanges({ 'preSelectUsers': changes });
|
||||
component.ngOnChanges({ preSelectUsers: changes });
|
||||
fixture.detectChanges();
|
||||
|
||||
const inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
const inputHTMLElement = element.querySelector<HTMLInputElement>('input');
|
||||
inputHTMLElement.focus();
|
||||
inputHTMLElement.value = 'first-name';
|
||||
inputHTMLElement.dispatchEvent(new Event('keyup'));
|
||||
@@ -165,10 +164,10 @@ describe('PeopleCloudComponent', () => {
|
||||
it('should not be able to search for a user that his email matches one of the preselected users email', (done) => {
|
||||
component.preSelectUsers = [{ email: mockUsers[0].email }];
|
||||
const changes = new SimpleChange(null, [{ email: mockUsers[0].email }], false);
|
||||
component.ngOnChanges({ 'preSelectUsers': changes });
|
||||
component.ngOnChanges({ preSelectUsers: changes });
|
||||
fixture.detectChanges();
|
||||
|
||||
const inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
const inputHTMLElement = element.querySelector<HTMLInputElement>('input');
|
||||
inputHTMLElement.focus();
|
||||
inputHTMLElement.value = 'first-name';
|
||||
inputHTMLElement.dispatchEvent(new Event('keyup'));
|
||||
@@ -186,7 +185,7 @@ describe('PeopleCloudComponent', () => {
|
||||
component.excludedUsers = [{ email: mockUsers[0].email }];
|
||||
fixture.detectChanges();
|
||||
|
||||
const inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
const inputHTMLElement = element.querySelector<HTMLInputElement>('input');
|
||||
inputHTMLElement.focus();
|
||||
inputHTMLElement.value = 'first-name';
|
||||
inputHTMLElement.dispatchEvent(new Event('keyup'));
|
||||
@@ -204,7 +203,7 @@ describe('PeopleCloudComponent', () => {
|
||||
component.excludedUsers = [{ email: mockUsers[0].email }];
|
||||
fixture.detectChanges();
|
||||
|
||||
const inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
const inputHTMLElement = element.querySelector<HTMLInputElement>('input');
|
||||
inputHTMLElement.focus();
|
||||
inputHTMLElement.value = 'first-name';
|
||||
inputHTMLElement.dispatchEvent(new Event('keyup'));
|
||||
@@ -222,7 +221,7 @@ describe('PeopleCloudComponent', () => {
|
||||
component.excludedUsers = [{ email: mockUsers[0].email }];
|
||||
fixture.detectChanges();
|
||||
|
||||
const inputHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
|
||||
const inputHTMLElement = element.querySelector<HTMLInputElement>('input');
|
||||
inputHTMLElement.focus();
|
||||
inputHTMLElement.value = 'first-name';
|
||||
inputHTMLElement.dispatchEvent(new Event('keyup'));
|
||||
@@ -350,7 +349,7 @@ describe('PeopleCloudComponent', () => {
|
||||
component.appName = 'mock-app-name';
|
||||
|
||||
const change = new SimpleChange(null, 'mock-app-name', false);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -592,8 +591,8 @@ describe('PeopleCloudComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
component.mode = 'single';
|
||||
component.preSelectUsers = <any> mockPreselectedUsers;
|
||||
component.ngOnChanges({ 'preSelectUsers': changes });
|
||||
component.preSelectUsers = mockPreselectedUsers;
|
||||
component.ngOnChanges({ preSelectUsers: changes });
|
||||
|
||||
fixture.detectChanges();
|
||||
element = fixture.nativeElement;
|
||||
@@ -620,8 +619,8 @@ describe('PeopleCloudComponent', () => {
|
||||
|
||||
const changes = new SimpleChange(null, mockPreselectedUsers, false);
|
||||
|
||||
component.preSelectUsers = <any> mockPreselectedUsers;
|
||||
component.ngOnChanges({ 'preSelectUsers': changes });
|
||||
component.preSelectUsers = mockPreselectedUsers;
|
||||
component.ngOnChanges({ preSelectUsers: changes });
|
||||
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -644,7 +643,7 @@ describe('PeopleCloudComponent', () => {
|
||||
];
|
||||
|
||||
const change = new SimpleChange(null, component.preSelectUsers, false);
|
||||
component.ngOnChanges({ 'preSelectUsers': change });
|
||||
component.ngOnChanges({ preSelectUsers: change });
|
||||
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -669,7 +668,7 @@ describe('PeopleCloudComponent', () => {
|
||||
];
|
||||
|
||||
const change = new SimpleChange(null, component.preSelectUsers, false);
|
||||
component.ngOnChanges({ 'preSelectUsers': change });
|
||||
component.ngOnChanges({ preSelectUsers: change });
|
||||
|
||||
const removeUserSpy = spyOn(component.removeUser, 'emit');
|
||||
|
||||
@@ -700,8 +699,8 @@ describe('PeopleCloudComponent', () => {
|
||||
it('should chip list be disabled and show one single chip - single mode', () => {
|
||||
component.mode = 'single';
|
||||
component.readOnly = true;
|
||||
component.preSelectUsers = <any> mockPreselectedUsers;
|
||||
component.ngOnChanges({ 'preSelectUsers': change });
|
||||
component.preSelectUsers = mockPreselectedUsers;
|
||||
component.ngOnChanges({ preSelectUsers: change });
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
@@ -717,8 +716,8 @@ describe('PeopleCloudComponent', () => {
|
||||
it('should chip list be disabled and show mat chips for all the preselected users - multiple mode', () => {
|
||||
component.mode = 'multiple';
|
||||
component.readOnly = true;
|
||||
component.preSelectUsers = <any> mockPreselectedUsers;
|
||||
component.ngOnChanges({ 'preSelectUsers': change });
|
||||
component.preSelectUsers = mockPreselectedUsers;
|
||||
component.ngOnChanges({ preSelectUsers: change });
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
@@ -751,9 +750,9 @@ describe('PeopleCloudComponent', () => {
|
||||
|
||||
component.mode = 'single';
|
||||
component.validate = true;
|
||||
component.preSelectUsers = <any> [mockPreselectedUsers[0], mockPreselectedUsers[1]];
|
||||
component.preSelectUsers = [mockPreselectedUsers[0], mockPreselectedUsers[1]];
|
||||
component.ngOnChanges({
|
||||
'preSelectUsers': new SimpleChange(null, [mockPreselectedUsers[0], mockPreselectedUsers[1]], false)
|
||||
preSelectUsers: new SimpleChange(null, [mockPreselectedUsers[0], mockPreselectedUsers[1]], false)
|
||||
});
|
||||
});
|
||||
|
||||
@@ -766,9 +765,9 @@ describe('PeopleCloudComponent', () => {
|
||||
component.warning.subscribe(() => warnings++);
|
||||
component.mode = 'single';
|
||||
component.validate = false;
|
||||
component.preSelectUsers = <any> [mockPreselectedUsers[0], mockPreselectedUsers[1]];
|
||||
component.preSelectUsers = [mockPreselectedUsers[0], mockPreselectedUsers[1]];
|
||||
component.ngOnChanges({
|
||||
'preSelectUsers': new SimpleChange(null, [mockPreselectedUsers[0], mockPreselectedUsers[1]], false)
|
||||
preSelectUsers: new SimpleChange(null, [mockPreselectedUsers[0], mockPreselectedUsers[1]], false)
|
||||
});
|
||||
|
||||
expect(warnings).toBe(0);
|
||||
@@ -798,9 +797,9 @@ describe('PeopleCloudComponent', () => {
|
||||
|
||||
component.mode = 'multiple';
|
||||
component.validate = true;
|
||||
component.preSelectUsers = <any> [mockPreselectedUsers[0], mockPreselectedUsers[1]];
|
||||
component.preSelectUsers = [mockPreselectedUsers[0], mockPreselectedUsers[1]];
|
||||
component.ngOnChanges({
|
||||
'preSelectUsers': new SimpleChange(null, [mockPreselectedUsers[0], mockPreselectedUsers[1]], false)
|
||||
preSelectUsers: new SimpleChange(null, [mockPreselectedUsers[0], mockPreselectedUsers[1]], false)
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -264,16 +264,14 @@ export class PeopleCloudComponent implements OnInit, OnChanges, OnDestroy {
|
||||
|
||||
filterUsersByRoles(user: IdentityUserModel): Observable<IdentityUserModel> {
|
||||
return this.identityUserService.checkUserHasRole(user.id, this.roles).pipe(
|
||||
map((hasRole: boolean) => ({ hasRole: hasRole, user: user })),
|
||||
map((hasRole: boolean) => ({ hasRole, user })),
|
||||
filter((filteredUser: { hasRole: boolean; user: IdentityUserModel }) => filteredUser.hasRole),
|
||||
map((filteredUser: { hasRole: boolean; user: IdentityUserModel }) => filteredUser.user));
|
||||
}
|
||||
|
||||
private isUserAlreadySelected(searchUser: IdentityUserModel): boolean {
|
||||
if (this.selectedUsers && this.selectedUsers.length > 0) {
|
||||
const result = this.selectedUsers.find((selectedUser) => {
|
||||
return this.compare(selectedUser, searchUser);
|
||||
});
|
||||
const result = this.selectedUsers.find((selectedUser) => this.compare(selectedUser, searchUser));
|
||||
|
||||
return !!result;
|
||||
}
|
||||
@@ -442,11 +440,9 @@ export class PeopleCloudComponent implements OnInit, OnChanges, OnDestroy {
|
||||
}
|
||||
|
||||
private removeUserFromSelected({ id, username, email }: IdentityUserModel): void {
|
||||
const indexToRemove = this.selectedUsers.findIndex(user => {
|
||||
return user.id === id
|
||||
const indexToRemove = this.selectedUsers.findIndex(user => user.id === id
|
||||
&& user.username === username
|
||||
&& user.email === email;
|
||||
});
|
||||
&& user.email === email);
|
||||
|
||||
if (indexToRemove !== -1) {
|
||||
this.selectedUsers.splice(indexToRemove, 1);
|
||||
@@ -454,11 +450,9 @@ export class PeopleCloudComponent implements OnInit, OnChanges, OnDestroy {
|
||||
}
|
||||
|
||||
private removeUserFromValidation({ id, username, email }: IdentityUserModel): void {
|
||||
const indexToRemove = this.invalidUsers.findIndex(user => {
|
||||
return user.id === id
|
||||
const indexToRemove = this.invalidUsers.findIndex(user => user.id === id
|
||||
&& user.username === username
|
||||
&& user.email === email;
|
||||
});
|
||||
&& user.email === email);
|
||||
|
||||
if (indexToRemove !== -1) {
|
||||
this.invalidUsers.splice(indexToRemove, 1);
|
||||
|
||||
@@ -20,28 +20,28 @@ import moment from 'moment-es6';
|
||||
import { LocalizedDatePipe } from '@alfresco/adf-core';
|
||||
import { ProcessInstanceCloud } from '../process/start-process/models/process-instance-cloud.model';
|
||||
|
||||
export const DATE_TIME_IDENTIFIER_REG_EXP = new RegExp('%{datetime}', 'i');
|
||||
export const PROCESS_DEFINITION_IDENTIFIER_REG_EXP = new RegExp('%{processdefinition}', 'i');
|
||||
|
||||
@Pipe({ name: 'processNameCloud' })
|
||||
export class ProcessNameCloudPipe implements PipeTransform {
|
||||
static DATE_TIME_IDENTIFIER_REG_EXP = new RegExp('%{datetime}', 'i');
|
||||
static PROCESS_DEFINITION_IDENTIFIER_REG_EXP = new RegExp('%{processdefinition}', 'i');
|
||||
|
||||
constructor(private localizedDatePipe: LocalizedDatePipe) {
|
||||
}
|
||||
|
||||
transform(processNameFormat: string, processInstance?: ProcessInstanceCloud): string {
|
||||
let processName = processNameFormat;
|
||||
if (processName.match(ProcessNameCloudPipe.DATE_TIME_IDENTIFIER_REG_EXP)) {
|
||||
if (processName.match(DATE_TIME_IDENTIFIER_REG_EXP)) {
|
||||
const presentDateTime = moment.now();
|
||||
processName = processName.replace(
|
||||
ProcessNameCloudPipe.DATE_TIME_IDENTIFIER_REG_EXP,
|
||||
DATE_TIME_IDENTIFIER_REG_EXP,
|
||||
this.localizedDatePipe.transform(presentDateTime, 'medium')
|
||||
);
|
||||
}
|
||||
|
||||
if (processName.match(ProcessNameCloudPipe.PROCESS_DEFINITION_IDENTIFIER_REG_EXP)) {
|
||||
if (processName.match(PROCESS_DEFINITION_IDENTIFIER_REG_EXP)) {
|
||||
const selectedProcessDefinitionName = processInstance ? processInstance.processDefinitionName : '';
|
||||
processName = processName.replace(
|
||||
ProcessNameCloudPipe.PROCESS_DEFINITION_IDENTIFIER_REG_EXP,
|
||||
PROCESS_DEFINITION_IDENTIFIER_REG_EXP,
|
||||
selectedProcessDefinitionName
|
||||
);
|
||||
}
|
||||
|
||||
+34
-38
@@ -69,9 +69,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
oauth2Auth: {
|
||||
callCustomApi: () => Promise.resolve(fakeApplicationInstance)
|
||||
},
|
||||
isEcmLoggedIn() {
|
||||
return false;
|
||||
},
|
||||
isEcmLoggedIn: () => false,
|
||||
reply: jasmine.createSpy('reply')
|
||||
};
|
||||
|
||||
@@ -97,13 +95,11 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||
dialog = TestBed.inject(MatDialog);
|
||||
spyOn(dialog, 'open').and.returnValue({
|
||||
afterClosed() {
|
||||
return of({
|
||||
action: ProcessFilterDialogCloudComponent.ACTION_SAVE,
|
||||
icon: 'icon',
|
||||
name: 'fake-name'
|
||||
});
|
||||
}
|
||||
afterClosed: () => of({
|
||||
action: ProcessFilterDialogCloudComponent.ACTION_SAVE,
|
||||
icon: 'icon',
|
||||
name: 'fake-name'
|
||||
})
|
||||
} as any);
|
||||
getProcessFilterByIdSpy = spyOn(service, 'getFilterById').and.returnValue(of(fakeFilter));
|
||||
getRunningApplicationsSpy = spyOn(appsService, 'getDeployedApplicationsByStatus').and.returnValue(of(fakeApplicationInstance));
|
||||
@@ -128,7 +124,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
|
||||
it('should fetch process instance filter by id', async () => {
|
||||
const processFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -144,7 +140,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
it('should display filter name as title', async () => {
|
||||
const processFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
|
||||
component.showProcessFilterName = true;
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -161,7 +157,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
it('should not display filter name as title if the flag is false', async () => {
|
||||
const processFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
|
||||
component.showProcessFilterName = false;
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -172,7 +168,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
|
||||
it('should not display mat-spinner if isloading set to false', async () => {
|
||||
const processFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -191,7 +187,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
it('should display mat-spinner if isloading set to true', async () => {
|
||||
component.isLoading = true;
|
||||
const processFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -204,7 +200,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
const processFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
@@ -288,7 +284,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
}));
|
||||
|
||||
const processFilterIdChange = new SimpleChange(null, 'filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
component.toggleFilterActions = true;
|
||||
@@ -324,7 +320,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
}));
|
||||
|
||||
const processFilterIdChange = new SimpleChange(null, 'filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
component.toggleFilterActions = true;
|
||||
@@ -466,7 +462,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
await fixture.whenStable();
|
||||
|
||||
const processFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -476,7 +472,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
expect(component.processFilterProperties[1].key).toEqual('processName');
|
||||
});
|
||||
|
||||
it('should get form attributes', async() => {
|
||||
it('should get form attributes', async () => {
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
@@ -485,7 +481,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
await fixture.whenStable();
|
||||
|
||||
const processFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -495,7 +491,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
expect(component.editProcessFilterForm.get('completedDateType')).toBeDefined();
|
||||
});
|
||||
|
||||
it('should get form attributes for suspendedData', async() => {
|
||||
it('should get form attributes for suspendedData', async () => {
|
||||
const filter = new ProcessFilterCloudModel({
|
||||
id: 'filter-id',
|
||||
name: 'ADF_CLOUD_PROCESS_FILTERS.RUNNING_PROCESSES',
|
||||
@@ -517,7 +513,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
await fixture.whenStable();
|
||||
|
||||
const processFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -535,7 +531,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
await fixture.whenStable();
|
||||
|
||||
const processFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -569,7 +565,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
await fixture.whenStable();
|
||||
|
||||
const processFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -587,7 +583,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
await fixture.whenStable();
|
||||
|
||||
const processFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -611,7 +607,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
fixture.detectChanges();
|
||||
|
||||
const processFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
const controller = component.editProcessFilterForm.get('appVersionMultiple');
|
||||
@@ -638,7 +634,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
await fixture.whenStable();
|
||||
|
||||
const processFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -659,7 +655,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
|
||||
it('should display default sort properties', async () => {
|
||||
const processFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -697,7 +693,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
await fixture.whenStable();
|
||||
|
||||
const processFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -733,7 +729,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
}));
|
||||
component.sortProperties = ['name'];
|
||||
const processFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -760,7 +756,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
const processFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
|
||||
getProcessFilterByIdSpy.and.returnValue(of(fakeFilter));
|
||||
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
@@ -882,7 +878,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
await fixture.whenStable();
|
||||
|
||||
const processFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -920,7 +916,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
component.appName = 'fake';
|
||||
component.filterProperties = ['appName', 'processInstanceId', 'priority', 'lastModified'];
|
||||
const processFilterIdChange = new SimpleChange(undefined, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
const date = moment();
|
||||
@@ -943,7 +939,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
component.appName = 'fake';
|
||||
component.filterProperties = ['appName', 'processInstanceId', 'priority', 'completedDateRange'];
|
||||
const processFilterIdChange = new SimpleChange(undefined, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
component.filterChange.subscribe(() => {
|
||||
@@ -977,7 +973,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
component.appName = 'fake';
|
||||
component.filterProperties = ['appName', 'processInstanceId', 'priority', 'completedDateRange'];
|
||||
const processFilterIdChange = new SimpleChange(undefined, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
component.filterChange.subscribe(() => {
|
||||
@@ -998,7 +994,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
component.appName = 'fake';
|
||||
component.filterProperties = ['appName', 'processInstanceId', 'priority', 'completedDateRange'];
|
||||
const processFilterIdChange = new SimpleChange(undefined, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
const dateFilter = {
|
||||
@@ -1088,7 +1084,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
component.appName = 'fake';
|
||||
component.filterProperties = ['appName', 'initiator'];
|
||||
const processFilterIdChange = new SimpleChange(undefined, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': processFilterIdChange });
|
||||
component.ngOnChanges({ id: processFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(component.initiatorOptions).toEqual([ { username: 'user1' }, { username: 'user2'} ]);
|
||||
|
||||
+26
-26
@@ -31,6 +31,13 @@ import { ProcessFilterDialogCloudComponent } from './process-filter-dialog-cloud
|
||||
import { ProcessCloudService } from '../../services/process-cloud.service';
|
||||
import { DateCloudFilterType, DateRangeFilter } from '../../../models/date-cloud-filter.model';
|
||||
|
||||
export const PROCESS_FILTER_ACTION_SAVE = 'save';
|
||||
export const PROCESS_FILTER_ACTION_SAVE_AS = 'saveAs';
|
||||
export const PROCESS_FILTER_ACTION_DELETE = 'delete';
|
||||
const DEFAULT_PROCESS_FILTER_PROPERTIES = ['status', 'sort', 'order', 'lastModified'];
|
||||
const DEFAULT_SORT_PROPERTIES = ['id', 'name', 'status', 'startDate'];
|
||||
const DEFAULT_ACTIONS = ['save', 'saveAs', 'delete'];
|
||||
|
||||
export interface DropdownOption {
|
||||
value: string;
|
||||
label: string;
|
||||
@@ -43,15 +50,6 @@ export interface DropdownOption {
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDestroy {
|
||||
|
||||
public static ACTION_SAVE = 'save';
|
||||
public static ACTION_SAVE_AS = 'saveAs';
|
||||
public static ACTION_DELETE = 'delete';
|
||||
public static DEFAULT_PROCESS_FILTER_PROPERTIES = ['status', 'sort', 'order', 'lastModified'];
|
||||
public static DEFAULT_SORT_PROPERTIES = ['id', 'name', 'status', 'startDate'];
|
||||
public static DEFAULT_ACTIONS = ['save', 'saveAs', 'delete'];
|
||||
public DATE_FORMAT: string = 'DD/MM/YYYY';
|
||||
|
||||
/** The name of the application. */
|
||||
@Input()
|
||||
appName: string = '';
|
||||
@@ -66,15 +64,15 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
||||
|
||||
/** List of process filter properties to display */
|
||||
@Input()
|
||||
filterProperties = EditProcessFilterCloudComponent.DEFAULT_PROCESS_FILTER_PROPERTIES;
|
||||
filterProperties = DEFAULT_PROCESS_FILTER_PROPERTIES;
|
||||
|
||||
/** List of sort properties to display. */
|
||||
@Input()
|
||||
sortProperties = EditProcessFilterCloudComponent.DEFAULT_SORT_PROPERTIES;
|
||||
sortProperties = DEFAULT_SORT_PROPERTIES;
|
||||
|
||||
/** List of sort actions. */
|
||||
@Input()
|
||||
actions = EditProcessFilterCloudComponent.DEFAULT_ACTIONS;
|
||||
actions = DEFAULT_ACTIONS;
|
||||
|
||||
/** Toggles editing of process filter actions. */
|
||||
@Input()
|
||||
@@ -139,8 +137,8 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
||||
{ value: 'DESC', label: 'ADF_CLOUD_PROCESS_FILTERS.DIRECTION.DESCENDING' }
|
||||
];
|
||||
actionDisabledForDefault = [
|
||||
EditProcessFilterCloudComponent.ACTION_SAVE,
|
||||
EditProcessFilterCloudComponent.ACTION_DELETE
|
||||
PROCESS_FILTER_ACTION_SAVE,
|
||||
PROCESS_FILTER_ACTION_DELETE
|
||||
];
|
||||
applicationNames: any[] = [];
|
||||
allProcessDefinitionNamesOption: DropdownOption = {
|
||||
@@ -274,7 +272,7 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
||||
|
||||
if (this.filterProperties.includes('initiator')) {
|
||||
this.initiatorOptions = !!this.processFilter.initiator
|
||||
? this.processFilter.initiator.split(',').map( username => Object.assign({}, { username: username }))
|
||||
? this.processFilter.initiator.split(',').map( username => Object.assign({}, { username }))
|
||||
: [];
|
||||
}
|
||||
|
||||
@@ -297,7 +295,7 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
||||
|
||||
checkMandatoryFilterProperties() {
|
||||
if (this.filterProperties === undefined || this.filterProperties.length === 0) {
|
||||
this.filterProperties = EditProcessFilterCloudComponent.DEFAULT_PROCESS_FILTER_PROPERTIES;
|
||||
this.filterProperties = DEFAULT_PROCESS_FILTER_PROPERTIES;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,7 +321,7 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
||||
|
||||
checkMandatorySortProperties() {
|
||||
if (this.sortProperties === undefined || this.sortProperties.length === 0) {
|
||||
this.sortProperties = EditProcessFilterCloudComponent.DEFAULT_SORT_PROPERTIES;
|
||||
this.sortProperties = DEFAULT_SORT_PROPERTIES;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -335,7 +333,7 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
||||
|
||||
checkMandatoryActions() {
|
||||
if (this.actions === undefined || this.actions.length === 0) {
|
||||
this.actions = EditProcessFilterCloudComponent.DEFAULT_ACTIONS;
|
||||
this.actions = DEFAULT_ACTIONS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,11 +417,11 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
||||
}
|
||||
|
||||
executeFilterActions(action: ProcessFilterAction): void {
|
||||
if (action.actionType === EditProcessFilterCloudComponent.ACTION_SAVE) {
|
||||
if (action.actionType === PROCESS_FILTER_ACTION_SAVE) {
|
||||
this.save(action);
|
||||
} else if (action.actionType === EditProcessFilterCloudComponent.ACTION_SAVE_AS) {
|
||||
} else if (action.actionType === PROCESS_FILTER_ACTION_SAVE_AS) {
|
||||
this.saveAs(action);
|
||||
} else if (action.actionType === EditProcessFilterCloudComponent.ACTION_DELETE) {
|
||||
} else if (action.actionType === PROCESS_FILTER_ACTION_DELETE) {
|
||||
this.delete(action);
|
||||
}
|
||||
}
|
||||
@@ -489,6 +487,7 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
||||
|
||||
/**
|
||||
* Return filter name
|
||||
*
|
||||
* @param filterName
|
||||
*/
|
||||
getSanitizeFilterName(filterName: string): string {
|
||||
@@ -498,6 +497,7 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
||||
|
||||
/**
|
||||
* Return name with hyphen
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
replaceSpaceWithHyphen(name: string): string {
|
||||
@@ -525,8 +525,8 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
||||
}
|
||||
|
||||
hasFilterChanged(action: ProcessFilterAction): boolean {
|
||||
return action.actionType === EditProcessFilterCloudComponent.ACTION_SAVE ||
|
||||
action.actionType === EditProcessFilterCloudComponent.ACTION_SAVE_AS ?
|
||||
return action.actionType === PROCESS_FILTER_ACTION_SAVE ||
|
||||
action.actionType === PROCESS_FILTER_ACTION_SAVE_AS ?
|
||||
!this.filterHasBeenChanged : false;
|
||||
}
|
||||
|
||||
@@ -545,17 +545,17 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
||||
private createFilterActions(): ProcessFilterAction[] {
|
||||
return [
|
||||
{
|
||||
actionType: EditProcessFilterCloudComponent.ACTION_SAVE,
|
||||
actionType: PROCESS_FILTER_ACTION_SAVE,
|
||||
icon: 'adf:save',
|
||||
tooltip: 'ADF_CLOUD_EDIT_PROCESS_FILTER.TOOL_TIP.SAVE'
|
||||
},
|
||||
{
|
||||
actionType: EditProcessFilterCloudComponent.ACTION_SAVE_AS,
|
||||
actionType: PROCESS_FILTER_ACTION_SAVE_AS,
|
||||
icon: 'adf:save-as',
|
||||
tooltip: 'ADF_CLOUD_EDIT_PROCESS_FILTER.TOOL_TIP.SAVE_AS'
|
||||
},
|
||||
{
|
||||
actionType: EditProcessFilterCloudComponent.ACTION_DELETE,
|
||||
actionType: PROCESS_FILTER_ACTION_DELETE,
|
||||
icon: 'delete',
|
||||
tooltip: 'ADF_CLOUD_EDIT_PROCESS_FILTER.TOOL_TIP.DELETE'
|
||||
}
|
||||
|
||||
+1
@@ -26,6 +26,7 @@ import { FormBuilder, FormGroup, AbstractControl, Validators } from '@angular/fo
|
||||
})
|
||||
export class ProcessFilterDialogCloudComponent implements OnInit {
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
public static ACTION_SAVE = 'SAVE';
|
||||
defaultIcon = 'inbox';
|
||||
|
||||
|
||||
+25
-25
@@ -60,7 +60,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
|
||||
it('should attach specific icon for each filter if hasIcon is true', async () => {
|
||||
const change = new SimpleChange(undefined, 'my-app-1', true);
|
||||
component.ngOnChanges({'appName': change});
|
||||
component.ngOnChanges({appName: change});
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -81,7 +81,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
it('should not attach icons for each filter if hasIcon is false', async () => {
|
||||
component.showIcons = false;
|
||||
const change = new SimpleChange(undefined, 'my-app-1', true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -92,7 +92,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
|
||||
it('should display the filters', async () => {
|
||||
const change = new SimpleChange(undefined, 'my-app-1', true);
|
||||
component.ngOnChanges({'appName': change});
|
||||
component.ngOnChanges({appName: change});
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -124,7 +124,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
done();
|
||||
});
|
||||
|
||||
component.ngOnChanges({'appName': change});
|
||||
component.ngOnChanges({appName: change});
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
@@ -133,7 +133,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
const appName = 'my-app-1';
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
@@ -148,7 +148,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
const appName = 'my-app-1';
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
@@ -159,7 +159,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
const change = new SimpleChange(null, { name: 'nonexistentFilter' }, true);
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
component.ngOnChanges({ filterParam: change });
|
||||
|
||||
expect(component.currentFilter).toBeUndefined();
|
||||
});
|
||||
@@ -170,7 +170,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
component.ngOnChanges({ filterParam: change });
|
||||
|
||||
expect(component.currentFilter).toEqual(mockProcessFilters[1]);
|
||||
expect(filterSelectedSpy).toHaveBeenCalledWith(mockProcessFilters[1]);
|
||||
@@ -182,7 +182,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
component.ngOnChanges({ filterParam: change });
|
||||
|
||||
expect(component.currentFilter).toEqual(mockProcessFilters[2]);
|
||||
expect(filterSelectedSpy).toHaveBeenCalledWith(mockProcessFilters[2]);
|
||||
@@ -194,7 +194,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
component.ngOnChanges({ filterParam: change });
|
||||
|
||||
expect(component.currentFilter).toEqual(mockProcessFilters[2]);
|
||||
expect(filterSelectedSpy).toHaveBeenCalledWith(mockProcessFilters[2]);
|
||||
@@ -206,7 +206,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
component.ngOnChanges({ filterParam: change });
|
||||
|
||||
expect(component.currentFilter).toEqual(mockProcessFilters[2]);
|
||||
expect(filterSelectedSpy).toHaveBeenCalledWith(mockProcessFilters[2]);
|
||||
@@ -216,7 +216,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
const filterClickedSpy = spyOn(component.filterClicked, 'emit');
|
||||
const appName = 'my-app-1';
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -234,7 +234,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
it('should reset the filter when the param is undefined', () => {
|
||||
const change = new SimpleChange(mockProcessFilters[0], undefined, false);
|
||||
component.currentFilter = mockProcessFilters[0];
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
component.ngOnChanges({ filterParam: change });
|
||||
|
||||
expect(component.currentFilter).toEqual(undefined);
|
||||
});
|
||||
@@ -245,7 +245,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
component.ngOnChanges({ filterParam: change });
|
||||
|
||||
expect(component.currentFilter).toBe(mockProcessFilters[0]);
|
||||
expect(filterClickedSpy).not.toHaveBeenCalled();
|
||||
@@ -256,7 +256,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
const appName = 'my-app-1';
|
||||
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
|
||||
expect(component.getFilters).toHaveBeenCalledWith(appName);
|
||||
});
|
||||
@@ -266,7 +266,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
const appName = null;
|
||||
|
||||
const change = new SimpleChange(undefined, appName, true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
|
||||
expect(component.getFilters).not.toHaveBeenCalledWith(appName);
|
||||
});
|
||||
@@ -276,7 +276,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
const appName = 'fake-app-name';
|
||||
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
|
||||
expect(component.getFilters).toHaveBeenCalledWith(appName);
|
||||
});
|
||||
@@ -296,21 +296,21 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
const runningProcessesFilterKey = mockProcessFilters[1].key;
|
||||
const completedProcessesFilterKey = mockProcessFilters[2].key;
|
||||
|
||||
function getActiveFilterElement(filterKey: string): Element {
|
||||
const getActiveFilterElement = (filterKey: string): Element => {
|
||||
const activeFilter = fixture.debugElement.query(By.css(`.adf-active`));
|
||||
return activeFilter.nativeElement.querySelector(`[data-automation-id="${filterKey}_filter"]`);
|
||||
}
|
||||
};
|
||||
|
||||
async function clickOnFilter(filterKey: string) {
|
||||
const clickOnFilter = async (filterKey: string) => {
|
||||
fixture.debugElement.nativeElement.querySelector(`[data-automation-id="${filterKey}_filter"]`).click();
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
}
|
||||
};
|
||||
|
||||
it('should apply active CSS class on filter click', async () => {
|
||||
component.appName = 'mock-app-name';
|
||||
const appNameChange = new SimpleChange(null, 'mock-app-name', true);
|
||||
component.ngOnChanges({ 'appName': appNameChange });
|
||||
component.ngOnChanges({ appName: appNameChange });
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
@@ -335,7 +335,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
|
||||
it('Should apply active CSS class when filterParam input changed', async () => {
|
||||
fixture.detectChanges();
|
||||
component.ngOnChanges({ 'filterParam': new SimpleChange(null, { key: allProcessesFilterKey }, true) });
|
||||
component.ngOnChanges({ filterParam: new SimpleChange(null, { key: allProcessesFilterKey }, true) });
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
@@ -343,7 +343,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
expect(getActiveFilterElement(runningProcessesFilterKey)).toBeNull();
|
||||
expect(getActiveFilterElement(completedProcessesFilterKey)).toBeNull();
|
||||
|
||||
component.ngOnChanges({ 'filterParam': new SimpleChange(null, { key: runningProcessesFilterKey }, true) });
|
||||
component.ngOnChanges({ filterParam: new SimpleChange(null, { key: runningProcessesFilterKey }, true) });
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
@@ -351,7 +351,7 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
expect(getActiveFilterElement(runningProcessesFilterKey)).toBeDefined();
|
||||
expect(getActiveFilterElement(completedProcessesFilterKey)).toBeNull();
|
||||
|
||||
component.ngOnChanges({ 'filterParam': new SimpleChange(null, { key: completedProcessesFilterKey }, true) });
|
||||
component.ngOnChanges({ filterParam: new SimpleChange(null, { key: completedProcessesFilterKey }, true) });
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
|
||||
+3
-5
@@ -111,12 +111,10 @@ export class ProcessFiltersCloudComponent implements OnInit, OnChanges, OnDestro
|
||||
*/
|
||||
public selectFilter(paramFilter: FilterParamsModel) {
|
||||
if (paramFilter) {
|
||||
this.currentFilter = this.filters.find((filter, index) => {
|
||||
return paramFilter.id === filter.id ||
|
||||
this.currentFilter = this.filters.find((filter, index) => paramFilter.id === filter.id ||
|
||||
(paramFilter.name && this.checkFilterNamesEquality(paramFilter.name, filter.name)) ||
|
||||
(paramFilter.key && (paramFilter.key === filter.key)) ||
|
||||
paramFilter.index === index;
|
||||
});
|
||||
paramFilter.index === index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +144,7 @@ export class ProcessFiltersCloudComponent implements OnInit, OnChanges, OnDestro
|
||||
* Select filter with the id
|
||||
*/
|
||||
public selectFilterById(id: string) {
|
||||
this.selectFilterAndEmit(<ProcessFilterCloudModel> {id: id});
|
||||
this.selectFilterAndEmit({id});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+4
-3
@@ -14,14 +14,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* eslint-disable no-underscore-dangle */
|
||||
|
||||
import { DateCloudFilterType } from '../../../models/date-cloud-filter.model';
|
||||
import { DateRangeFilterService } from '../../../common/date-range-filter/date-range-filter.service';
|
||||
import { ComponentSelectionMode } from '../../../types';
|
||||
|
||||
export class ProcessFilterCloudModel {
|
||||
|
||||
private dateRangeFilterService = new DateRangeFilterService();
|
||||
|
||||
id: string;
|
||||
name: string;
|
||||
key: string;
|
||||
@@ -47,6 +47,7 @@ export class ProcessFilterCloudModel {
|
||||
suspendedDateType: DateCloudFilterType;
|
||||
completedDate: Date;
|
||||
|
||||
private dateRangeFilterService = new DateRangeFilterService();
|
||||
private _completedFrom: string;
|
||||
private _completedTo: string;
|
||||
private _startFrom: string;
|
||||
|
||||
+16
-5
@@ -90,6 +90,7 @@ export class ProcessFilterCloudService {
|
||||
|
||||
/**
|
||||
* Creates and returns the default process instance filters for a app.
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @returns Observable of default process instance filters just created or created filters
|
||||
*/
|
||||
@@ -114,6 +115,7 @@ export class ProcessFilterCloudService {
|
||||
|
||||
/**
|
||||
* Gets all process instance filters for a process app.
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @returns Observable of process filters details
|
||||
*/
|
||||
@@ -124,6 +126,7 @@ export class ProcessFilterCloudService {
|
||||
|
||||
/**
|
||||
* Get process instance filter for given filter id
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @param id Id of the target process instance filter
|
||||
* @returns Observable of process instance filter details
|
||||
@@ -138,17 +141,14 @@ export class ProcessFilterCloudService {
|
||||
return of(filters);
|
||||
}
|
||||
}),
|
||||
map((filters: ProcessFilterCloudModel[]) => {
|
||||
return filters.filter((filter: ProcessFilterCloudModel) => {
|
||||
return filter.id === id;
|
||||
})[0];
|
||||
}),
|
||||
map((filters: ProcessFilterCloudModel[]) => filters.filter((filter: ProcessFilterCloudModel) => filter.id === id)[0]),
|
||||
catchError((err) => this.handleProcessError(err))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new process instance filter
|
||||
*
|
||||
* @param filter The new filter to add
|
||||
* @returns Observable of process instance filters with newly added filter
|
||||
*/
|
||||
@@ -180,6 +180,7 @@ export class ProcessFilterCloudService {
|
||||
|
||||
/**
|
||||
* Update process instance filter
|
||||
*
|
||||
* @param filter The new filter to update
|
||||
* @returns Observable of process instance filters with updated filter
|
||||
*/
|
||||
@@ -205,6 +206,7 @@ export class ProcessFilterCloudService {
|
||||
|
||||
/**
|
||||
* Delete process instance filter
|
||||
*
|
||||
* @param filter The new filter to delete
|
||||
* @returns Observable of process instance filters without deleted filter
|
||||
*/
|
||||
@@ -230,6 +232,7 @@ export class ProcessFilterCloudService {
|
||||
|
||||
/**
|
||||
* Checks if given filter is a default filter
|
||||
*
|
||||
* @param filterName Name of the target process filter
|
||||
* @returns Boolean value for whether the filter is a default filter
|
||||
*/
|
||||
@@ -240,6 +243,7 @@ export class ProcessFilterCloudService {
|
||||
|
||||
/**
|
||||
* Checks user preference are empty or not
|
||||
*
|
||||
* @param preferences User preferences of the target app
|
||||
* @returns Boolean value if the preferences are not empty
|
||||
*/
|
||||
@@ -249,6 +253,7 @@ export class ProcessFilterCloudService {
|
||||
|
||||
/**
|
||||
* Checks for process instance filters in given user preferences
|
||||
*
|
||||
* @param preferences User preferences of the target app
|
||||
* @param key Key of the process instance filters
|
||||
* @param filters Details of create filter
|
||||
@@ -261,6 +266,7 @@ export class ProcessFilterCloudService {
|
||||
|
||||
/**
|
||||
* Calls create preference api to create process instance filters
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @param key Key of the process instance filters
|
||||
* @param filters Details of new process instance filter
|
||||
@@ -272,6 +278,7 @@ export class ProcessFilterCloudService {
|
||||
|
||||
/**
|
||||
* Calls get preference api to get process instance filter by preference key
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @param key Key of the process instance filters
|
||||
* @returns Observable of process instance filters
|
||||
@@ -282,6 +289,7 @@ export class ProcessFilterCloudService {
|
||||
|
||||
/**
|
||||
* Calls update preference api to update process instance filter
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @param key Key of the process instance filters
|
||||
* @param filters Details of update filter
|
||||
@@ -293,6 +301,7 @@ export class ProcessFilterCloudService {
|
||||
|
||||
/**
|
||||
* Creates a uniq key with appName and username
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @returns String of process instance filters preference key
|
||||
*/
|
||||
@@ -303,6 +312,7 @@ export class ProcessFilterCloudService {
|
||||
|
||||
/**
|
||||
* Finds and returns the process instance filters from preferences
|
||||
*
|
||||
* @returns Array of ProcessFilterCloudModel
|
||||
* @param preferences
|
||||
* @param key
|
||||
@@ -322,6 +332,7 @@ export class ProcessFilterCloudService {
|
||||
|
||||
/**
|
||||
* Creates and returns the default filters for a process app.
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @returns Array of ProcessFilterCloudModel
|
||||
*/
|
||||
|
||||
+15
-15
@@ -84,19 +84,19 @@ describe('ProcessListCloudComponent', () => {
|
||||
component = fixture.componentInstance;
|
||||
appConfig.config = Object.assign(appConfig.config, {
|
||||
'adf-cloud-process-list': {
|
||||
'presets': {
|
||||
'fakeCustomSchema': [
|
||||
presets: {
|
||||
fakeCustomSchema: [
|
||||
{
|
||||
'key': 'fakeName',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_TASK_LIST.PROPERTIES.FAKE',
|
||||
'sortable': true
|
||||
key: 'fakeName',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.FAKE',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
'key': 'fakeTaskName',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_TASK_LIST.PROPERTIES.TASK_FAKE',
|
||||
'sortable': true
|
||||
key: 'fakeTaskName',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.TASK_FAKE',
|
||||
sortable: true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -219,7 +219,7 @@ describe('ProcessListCloudComponent', () => {
|
||||
done();
|
||||
});
|
||||
component.appName = appName.currentValue;
|
||||
component.ngOnChanges({ 'appName': appName });
|
||||
component.ngOnChanges({ appName });
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
@@ -263,9 +263,9 @@ describe('ProcessListCloudComponent', () => {
|
||||
const initiatorChange = new SimpleChange(undefined, 'mock-initiator', true);
|
||||
|
||||
component.ngOnChanges({
|
||||
'appName': appNameChange,
|
||||
'assignee': initiatorChange,
|
||||
'status': statusChange
|
||||
appName: appNameChange,
|
||||
assignee: initiatorChange,
|
||||
status: statusChange
|
||||
});
|
||||
fixture.detectChanges();
|
||||
expect(component.isListEmpty()).toBeFalsy();
|
||||
@@ -285,7 +285,7 @@ describe('ProcessListCloudComponent', () => {
|
||||
];
|
||||
const sortChange = new SimpleChange(undefined, mockSort, true);
|
||||
component.ngOnChanges({
|
||||
'sorting': sortChange
|
||||
sorting: sortChange
|
||||
});
|
||||
fixture.detectChanges();
|
||||
expect(component.formatSorting).toHaveBeenCalledWith(mockSort);
|
||||
|
||||
+5
-5
@@ -26,6 +26,8 @@ import { processCloudPresetsDefaultModel } from '../models/process-cloud-preset.
|
||||
import { ProcessQueryCloudRequestModel } from '../models/process-cloud-query-request.model';
|
||||
import { ProcessListCloudSortingModel } from '../models/process-list-sorting.model';
|
||||
|
||||
const PRESET_KEY = 'adf-cloud-process-list.presets';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-cloud-process-list',
|
||||
templateUrl: './process-list-cloud.component.html',
|
||||
@@ -33,9 +35,6 @@ import { ProcessListCloudSortingModel } from '../models/process-list-sorting.mod
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class ProcessListCloudComponent extends DataTableSchema implements OnChanges, AfterContentInit, PaginatedComponent {
|
||||
|
||||
static PRESET_KEY = 'adf-cloud-process-list.presets';
|
||||
|
||||
@ViewChild(DataTableComponent)
|
||||
dataTable: DataTableComponent;
|
||||
|
||||
@@ -198,12 +197,12 @@ export class ProcessListCloudComponent extends DataTableSchema implements OnChan
|
||||
constructor(private processListCloudService: ProcessListCloudService,
|
||||
appConfigService: AppConfigService,
|
||||
private userPreferences: UserPreferencesService) {
|
||||
super(appConfigService, ProcessListCloudComponent.PRESET_KEY, processCloudPresetsDefaultModel);
|
||||
super(appConfigService, PRESET_KEY, processCloudPresetsDefaultModel);
|
||||
this.size = userPreferences.paginationSize;
|
||||
this.userPreferences.select(UserPreferenceValues.PaginationSize).subscribe((pageSize) => {
|
||||
this.size = pageSize;
|
||||
});
|
||||
this.pagination = new BehaviorSubject<PaginationModel>(<PaginationModel> {
|
||||
this.pagination = new BehaviorSubject<PaginationModel>({
|
||||
maxItems: this.size,
|
||||
skipCount: 0,
|
||||
totalItems: 0
|
||||
@@ -282,6 +281,7 @@ export class ProcessListCloudComponent extends DataTableSchema implements OnChan
|
||||
/**
|
||||
* Resets the pagination values and
|
||||
* Reloads the process list
|
||||
*
|
||||
* @param pagination Pagination values to be set
|
||||
*/
|
||||
updatePagination(pagination: PaginationModel) {
|
||||
|
||||
+52
-52
@@ -82,85 +82,85 @@ export const fakeProcessCloudList = {
|
||||
}
|
||||
};
|
||||
|
||||
export let fakeCustomSchema =
|
||||
export const fakeCustomSchema =
|
||||
[
|
||||
new ObjectDataColumn({
|
||||
'key': 'fakeName',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_TASK_LIST.PROPERTIES.FAKE',
|
||||
'sortable': true
|
||||
key: 'fakeName',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.FAKE',
|
||||
sortable: true
|
||||
}),
|
||||
new ObjectDataColumn({
|
||||
'key': 'fakeTaskName',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_TASK_LIST.PROPERTIES.TASK_FAKE',
|
||||
'sortable': true
|
||||
key: 'fakeTaskName',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.TASK_FAKE',
|
||||
sortable: true
|
||||
})
|
||||
];
|
||||
|
||||
export const processListSchemaMock = {
|
||||
'presets': {
|
||||
'default': [
|
||||
presets: {
|
||||
default: [
|
||||
{
|
||||
'key': 'id',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.ID',
|
||||
'sortable': true
|
||||
key: 'id',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.ID',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
'key': 'name',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.NAME',
|
||||
'sortable': true
|
||||
key: 'name',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.NAME',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
'key': 'status',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.STATUS',
|
||||
'sortable': true
|
||||
key: 'status',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.STATUS',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
'key': 'startDate',
|
||||
'type': 'date',
|
||||
'title': 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.START_DATE',
|
||||
'sortable': true,
|
||||
'format': 'timeAgo'
|
||||
key: 'startDate',
|
||||
type: 'date',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.START_DATE',
|
||||
sortable: true,
|
||||
format: 'timeAgo'
|
||||
},
|
||||
{
|
||||
'key': 'appName',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.APP_NAME',
|
||||
'sortable': true
|
||||
key: 'appName',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.APP_NAME',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
'key': 'businessKey',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.BUSINESS_KEY',
|
||||
'sortable': true
|
||||
key: 'businessKey',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.BUSINESS_KEY',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
'key': 'initiator',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.INITIATOR',
|
||||
'sortable': true
|
||||
key: 'initiator',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.INITIATOR',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
'key': 'lastModified',
|
||||
'type': 'date',
|
||||
'title': 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.LAST_MODIFIED',
|
||||
'sortable': true
|
||||
key: 'lastModified',
|
||||
type: 'date',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.LAST_MODIFIED',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
'key': 'processDefinitionId',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.PROCESS_DEF_ID',
|
||||
'sortable': true
|
||||
key: 'processDefinitionId',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.PROCESS_DEF_ID',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
'key': 'processDefinitionKey',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.PROCESS_DEF_KEY',
|
||||
'sortable': true
|
||||
key: 'processDefinitionKey',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.PROCESS_DEF_KEY',
|
||||
sortable: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+12
-12
@@ -15,21 +15,21 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export let processCloudPresetsDefaultModel = {
|
||||
'default': [
|
||||
export const processCloudPresetsDefaultModel = {
|
||||
default: [
|
||||
{
|
||||
'key': 'name',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.NAME',
|
||||
'sortable': true
|
||||
key: 'name',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.NAME',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
'key': 'startDate',
|
||||
'type': 'date',
|
||||
'title': 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.START_DATE',
|
||||
'cssClass': 'hidden',
|
||||
'sortable': true,
|
||||
'format': 'timeAgo'
|
||||
key: 'startDate',
|
||||
type: 'date',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.START_DATE',
|
||||
cssClass: 'hidden',
|
||||
sortable: true,
|
||||
format: 'timeAgo'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
+12
-24
@@ -24,31 +24,19 @@ describe('ProcessListCloudService', () => {
|
||||
let service: ProcessListCloudService;
|
||||
let alfrescoApiService: AlfrescoApiService;
|
||||
|
||||
function returnCallQueryParameters(): any {
|
||||
return {
|
||||
oauth2Auth: {
|
||||
callCustomApi: (_queryUrl, _operation, _context, queryParams) => {
|
||||
return Promise.resolve(queryParams);
|
||||
}
|
||||
},
|
||||
isEcmLoggedIn() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
const returnCallQueryParameters = (): any => ({
|
||||
oauth2Auth: {
|
||||
callCustomApi: (_queryUrl, _operation, _context, queryParams) => Promise.resolve(queryParams)
|
||||
},
|
||||
isEcmLoggedIn: () => false
|
||||
});
|
||||
|
||||
function returnCallUrl(): any {
|
||||
return {
|
||||
oauth2Auth: {
|
||||
callCustomApi: (queryUrl) => {
|
||||
return Promise.resolve(queryUrl);
|
||||
}
|
||||
},
|
||||
isEcmLoggedIn() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
const returnCallUrl = (): any => ({
|
||||
oauth2Auth: {
|
||||
callCustomApi: (queryUrl) => Promise.resolve(queryUrl)
|
||||
},
|
||||
isEcmLoggedIn: () => false
|
||||
});
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
|
||||
+2
-3
@@ -33,6 +33,7 @@ export class ProcessListCloudService extends BaseCloudService {
|
||||
|
||||
/**
|
||||
* Finds a process using an object with optional query properties.
|
||||
*
|
||||
* @param requestNode Query object
|
||||
* @param queryUrl Query url
|
||||
* @returns Process information
|
||||
@@ -50,9 +51,7 @@ export class ProcessListCloudService extends BaseCloudService {
|
||||
map((response: any) => {
|
||||
const entries = response.list && response.list.entries;
|
||||
if (entries) {
|
||||
response.list.entries = entries.map((entryData) => {
|
||||
return entryData.entry;
|
||||
});
|
||||
response.list.entries = entries.map((entryData) => entryData.entry);
|
||||
}
|
||||
return response;
|
||||
})
|
||||
|
||||
@@ -40,6 +40,7 @@ export class ProcessCloudService extends BaseCloudService implements ProcessClou
|
||||
|
||||
/**
|
||||
* Gets details of a process instance.
|
||||
*
|
||||
* @param appName Name of the app
|
||||
* @param processInstanceId ID of the process instance whose details you want
|
||||
* @returns Process instance details
|
||||
@@ -62,6 +63,7 @@ export class ProcessCloudService extends BaseCloudService implements ProcessClou
|
||||
|
||||
/**
|
||||
* Gets the process definitions associated with an app.
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @returns Array of process definitions
|
||||
*/
|
||||
@@ -70,9 +72,7 @@ export class ProcessCloudService extends BaseCloudService implements ProcessClou
|
||||
const url = `${this.getBasePath(appName)}/rb/v1/process-definitions`;
|
||||
|
||||
return this.get(url).pipe(
|
||||
map((res: any) => {
|
||||
return res.list.entries.map((processDefs) => new ProcessDefinitionCloud(processDefs.entry));
|
||||
})
|
||||
map((res: any) => res.list.entries.map((processDefs) => new ProcessDefinitionCloud(processDefs.entry)))
|
||||
);
|
||||
} else {
|
||||
this.logService.error('AppName is mandatory for querying task');
|
||||
@@ -82,6 +82,7 @@ export class ProcessCloudService extends BaseCloudService implements ProcessClou
|
||||
|
||||
/**
|
||||
* Gets the application versions associated with an app.
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @returns Array of Application Version Models
|
||||
*/
|
||||
@@ -90,9 +91,7 @@ export class ProcessCloudService extends BaseCloudService implements ProcessClou
|
||||
const url = `${this.getBasePath(appName)}/query/v1/applications`;
|
||||
|
||||
return this.get<any>(url).pipe(
|
||||
map((appEntities: ApplicationVersionResponseModel) => {
|
||||
return appEntities.list.entries;
|
||||
}),
|
||||
map((appEntities: ApplicationVersionResponseModel) => appEntities.list.entries),
|
||||
catchError((err) => this.handleError(err))
|
||||
);
|
||||
} else {
|
||||
@@ -103,6 +102,7 @@ export class ProcessCloudService extends BaseCloudService implements ProcessClou
|
||||
|
||||
/**
|
||||
* Cancels a process.
|
||||
*
|
||||
* @param appName Name of the app
|
||||
* @param processInstanceId Id of the process to cancel
|
||||
* @returns Operation Information
|
||||
|
||||
+25
-25
@@ -72,11 +72,11 @@ describe('StartProcessCloudComponent', () => {
|
||||
}
|
||||
};
|
||||
|
||||
function typeValueInto(selector: any, value: string) {
|
||||
const typeValueInto = (selector: any, value: string) => {
|
||||
const inputElement = fixture.debugElement.query(By.css(`${selector}`));
|
||||
inputElement.nativeElement.value = value;
|
||||
inputElement.nativeElement.dispatchEvent(new Event('input'));
|
||||
}
|
||||
};
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
@@ -120,7 +120,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
component.appName = 'myApp';
|
||||
fixture.detectChanges();
|
||||
const change = new SimpleChange(null, 'MyApp', true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
@@ -131,7 +131,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
fixture.detectChanges();
|
||||
|
||||
const change = new SimpleChange(null, 'MyApp', true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
fixture.detectChanges();
|
||||
tick(550);
|
||||
|
||||
@@ -162,7 +162,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
const change = new SimpleChange(null, 'MyApp', false);
|
||||
fixture.detectChanges();
|
||||
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
fixture.detectChanges();
|
||||
tick();
|
||||
typeValueInto('#processName', 'OLE');
|
||||
@@ -209,24 +209,24 @@ describe('StartProcessCloudComponent', () => {
|
||||
beforeEach(() => {
|
||||
component.name = 'My new process with form';
|
||||
component.values = [{
|
||||
'id': '1',
|
||||
'type': 'string',
|
||||
'name': 'firstName',
|
||||
'value': 'FakeName',
|
||||
get 'hasValue'() {
|
||||
id: '1',
|
||||
type: 'string',
|
||||
name: 'firstName',
|
||||
value: 'FakeName',
|
||||
get hasValue() {
|
||||
return this['value'];
|
||||
},
|
||||
set 'hasValue'(value) {
|
||||
set hasValue(value) {
|
||||
this['value'] = value;
|
||||
}
|
||||
}, {
|
||||
'id': '1', 'type': 'string',
|
||||
'name': 'lastName',
|
||||
'value': 'FakeLastName',
|
||||
get 'hasValue'() {
|
||||
id: '1', type: 'string',
|
||||
name: 'lastName',
|
||||
value: 'FakeLastName',
|
||||
get hasValue() {
|
||||
return this['value'];
|
||||
},
|
||||
set 'hasValue'(value) {
|
||||
set hasValue(value) {
|
||||
this['value'] = value;
|
||||
}
|
||||
}];
|
||||
@@ -239,7 +239,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
formDefinitionSpy = spyOn(formCloudService, 'getForm').and.returnValue(of(fakeStartForm));
|
||||
|
||||
const change = new SimpleChange(null, 'MyApp', true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
fixture.detectChanges();
|
||||
tick();
|
||||
typeValueInto('#processName', 'My new process with form');
|
||||
@@ -265,7 +265,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
formDefinitionSpy = spyOn(formCloudService, 'getForm').and.returnValue(of(fakeStartFormNotValid));
|
||||
|
||||
const change = new SimpleChange(null, 'MyApp', true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
fixture.detectChanges();
|
||||
|
||||
tick();
|
||||
@@ -293,7 +293,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
formDefinitionSpy = spyOn(formCloudService, 'getForm').and.returnValue(of(fakeStartForm));
|
||||
|
||||
const change = new SimpleChange(null, 'MyApp', true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
fixture.detectChanges();
|
||||
|
||||
tick();
|
||||
@@ -323,7 +323,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
formDefinitionSpy = spyOn(formCloudService, 'getForm').and.returnValue(of(fakeStartFormNotValid));
|
||||
|
||||
const change = new SimpleChange(null, 'MyApp', true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
fixture.detectChanges();
|
||||
|
||||
tick();
|
||||
@@ -355,7 +355,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
formDefinitionSpy = spyOn(formCloudService, 'getForm').and.returnValue(of(fakeStartForm));
|
||||
|
||||
const change = new SimpleChange(null, 'MyApp', true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
fixture.detectChanges();
|
||||
tick(550);
|
||||
|
||||
@@ -382,7 +382,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
formDefinitionSpy = spyOn(formCloudService, 'getForm').and.returnValue(of(fakeStartForm));
|
||||
|
||||
const change = new SimpleChange(null, 'MyApp', true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
fixture.detectChanges();
|
||||
tick(550);
|
||||
|
||||
@@ -401,7 +401,7 @@ describe('StartProcessCloudComponent', () => {
|
||||
component.appName = 'myApp';
|
||||
fixture.detectChanges();
|
||||
const change = new SimpleChange(null, 'MyApp', true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
@@ -853,11 +853,11 @@ describe('StartProcessCloudComponent', () => {
|
||||
|
||||
component.processDefinitionName = 'fake-name';
|
||||
const change = new SimpleChange(null, 'MyApp', true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
});
|
||||
|
||||
it('should cancel bubbling a keydown event ()', () => {
|
||||
const escapeKeyboardEvent = new KeyboardEvent('keydown', { 'keyCode': ESCAPE } as any);
|
||||
const escapeKeyboardEvent = new KeyboardEvent('keydown', { keyCode: ESCAPE } as any);
|
||||
fixture.debugElement.triggerEventHandler('keydown', escapeKeyboardEvent);
|
||||
|
||||
expect(escapeKeyboardEvent.cancelBubble).toBe(true);
|
||||
|
||||
+12
-15
@@ -31,6 +31,11 @@ import { ProcessDefinitionCloud } from '../../../models/process-definition-cloud
|
||||
import { Subject, Observable } from 'rxjs';
|
||||
import { TaskVariableCloud } from '../../../form/models/task-variable-cloud.model';
|
||||
import { ProcessNameCloudPipe } from '../../../pipes/process-name-cloud.pipe';
|
||||
|
||||
const MAX_NAME_LENGTH: number = 255;
|
||||
const PROCESS_DEFINITION_DEBOUNCE: number = 300;
|
||||
const PROCESS_FORM_DEBOUNCE: number = 400;
|
||||
|
||||
@Component({
|
||||
selector: 'adf-cloud-start-process',
|
||||
templateUrl: './start-process-cloud.component.html',
|
||||
@@ -38,11 +43,6 @@ import { ProcessNameCloudPipe } from '../../../pipes/process-name-cloud.pipe';
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class StartProcessCloudComponent implements OnChanges, OnInit, OnDestroy {
|
||||
|
||||
static MAX_NAME_LENGTH: number = 255;
|
||||
static PROCESS_DEFINITION_DEBOUNCE: number = 300;
|
||||
static PROCESS_FORM_DEBOUNCE: number = 400;
|
||||
|
||||
@ViewChild(MatAutocompleteTrigger)
|
||||
inputAutocomplete: MatAutocompleteTrigger;
|
||||
|
||||
@@ -52,7 +52,7 @@ export class StartProcessCloudComponent implements OnChanges, OnInit, OnDestroy
|
||||
|
||||
/** Maximum length of the process name. */
|
||||
@Input()
|
||||
maxNameLength: number = StartProcessCloudComponent.MAX_NAME_LENGTH;
|
||||
maxNameLength: number = MAX_NAME_LENGTH;
|
||||
|
||||
/** Name of the process. */
|
||||
@Input()
|
||||
@@ -121,15 +121,15 @@ export class StartProcessCloudComponent implements OnChanges, OnInit, OnDestroy
|
||||
});
|
||||
|
||||
this.processDefinition.valueChanges
|
||||
.pipe(debounceTime(StartProcessCloudComponent.PROCESS_DEFINITION_DEBOUNCE))
|
||||
.pipe(debounceTime(PROCESS_DEFINITION_DEBOUNCE))
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe((processDefinitionName) => {
|
||||
this.selectProcessDefinitionByProcesDefinitionName(processDefinitionName);
|
||||
this.selectProcessDefinitionByProcessDefinitionName(processDefinitionName);
|
||||
});
|
||||
|
||||
this.processForm.valueChanges
|
||||
.pipe(
|
||||
debounceTime(StartProcessCloudComponent.PROCESS_FORM_DEBOUNCE),
|
||||
debounceTime(PROCESS_FORM_DEBOUNCE),
|
||||
tap(() => this.disableStartButton = true),
|
||||
distinctUntilChanged(),
|
||||
filter(() => this.isProcessSelectionValid()),
|
||||
@@ -170,8 +170,7 @@ export class StartProcessCloudComponent implements OnChanges, OnInit, OnDestroy
|
||||
}
|
||||
|
||||
private getMaxNameLength(): number {
|
||||
return this.maxNameLength > StartProcessCloudComponent.MAX_NAME_LENGTH ?
|
||||
StartProcessCloudComponent.MAX_NAME_LENGTH : this.maxNameLength;
|
||||
return this.maxNameLength > MAX_NAME_LENGTH ? MAX_NAME_LENGTH : this.maxNameLength;
|
||||
}
|
||||
|
||||
private generateProcessInstance(): Observable<ProcessInstanceCloud> {
|
||||
@@ -187,7 +186,7 @@ export class StartProcessCloudComponent implements OnChanges, OnInit, OnDestroy
|
||||
}
|
||||
}
|
||||
|
||||
private selectProcessDefinitionByProcesDefinitionName(processDefinitionName: string): void {
|
||||
private selectProcessDefinitionByProcessDefinitionName(processDefinitionName: string): void {
|
||||
this.filteredProcesses = this.getProcessDefinitionListByNameOrKey(processDefinitionName);
|
||||
|
||||
if (this.isProcessFormValid() &&
|
||||
@@ -205,9 +204,7 @@ export class StartProcessCloudComponent implements OnChanges, OnInit, OnDestroy
|
||||
}
|
||||
|
||||
private getProcessDefinitionListByNameOrKey(processDefinitionName: string): ProcessDefinitionCloud[] {
|
||||
return this.processDefinitionList.filter((processDefinitionCloud) => {
|
||||
return !processDefinitionName || this.getProcessDefinition(processDefinitionCloud, processDefinitionName);
|
||||
});
|
||||
return this.processDefinitionList.filter((processDefinitionCloud) => !processDefinitionName || this.getProcessDefinition(processDefinitionCloud, processDefinitionName));
|
||||
}
|
||||
|
||||
private getProcessIfExists(processDefinition: string): ProcessDefinitionCloud {
|
||||
|
||||
+112
-116
@@ -74,29 +74,25 @@ export const fakeProcessDefinitions: ProcessDefinitionCloud[] = [
|
||||
})
|
||||
];
|
||||
|
||||
export function fakeSingleProcessDefinition(name: string): ProcessDefinitionCloud[] {
|
||||
return [
|
||||
new ProcessDefinitionCloud({
|
||||
appName: 'startformwithoutupload',
|
||||
formKey: 'form-a5d50817-5183-4850-802d-17af54b2632f',
|
||||
id: 'd00c0237-8772-11e9-859a-428f83d5904f',
|
||||
key: 'process-5151ad1d-f992-4ee6-9742-3a04617469fe',
|
||||
name: name
|
||||
})
|
||||
];
|
||||
}
|
||||
export const fakeSingleProcessDefinition = (name: string): ProcessDefinitionCloud[] => [
|
||||
new ProcessDefinitionCloud({
|
||||
appName: 'startformwithoutupload',
|
||||
formKey: 'form-a5d50817-5183-4850-802d-17af54b2632f',
|
||||
id: 'd00c0237-8772-11e9-859a-428f83d5904f',
|
||||
key: 'process-5151ad1d-f992-4ee6-9742-3a04617469fe',
|
||||
name
|
||||
})
|
||||
];
|
||||
|
||||
export function fakeSingleProcessDefinitionWithoutForm(name: string): ProcessDefinitionCloud[] {
|
||||
return [
|
||||
new ProcessDefinitionCloud({
|
||||
appName: 'startformwithoutupload',
|
||||
formKey: '',
|
||||
id: 'd00c0237-8772-11e9-859a-428f83d5904f',
|
||||
key: 'process-5151ad1d-f992-4ee6-9742-3a04617469fe',
|
||||
name: name
|
||||
})
|
||||
];
|
||||
}
|
||||
export const fakeSingleProcessDefinitionWithoutForm = (name: string): ProcessDefinitionCloud[] => [
|
||||
new ProcessDefinitionCloud({
|
||||
appName: 'startformwithoutupload',
|
||||
formKey: '',
|
||||
id: 'd00c0237-8772-11e9-859a-428f83d5904f',
|
||||
key: 'process-5151ad1d-f992-4ee6-9742-3a04617469fe',
|
||||
name
|
||||
})
|
||||
];
|
||||
|
||||
export const fakeNoNameProcessDefinitions: ProcessDefinitionCloud[] = [
|
||||
new ProcessDefinitionCloud({
|
||||
@@ -122,129 +118,129 @@ export const fakeProcessPayload = new ProcessPayloadCloud({
|
||||
});
|
||||
|
||||
export const fakeStartForm = {
|
||||
'formRepresentation': {
|
||||
'id': 'form-de8895be-d0d7-4434-beef-559b15305d72',
|
||||
'name': 'StartEventForm',
|
||||
'description': '',
|
||||
'version': 0,
|
||||
'formDefinition': {
|
||||
'tabs': [],
|
||||
'fields': [
|
||||
formRepresentation: {
|
||||
id: 'form-de8895be-d0d7-4434-beef-559b15305d72',
|
||||
name: 'StartEventForm',
|
||||
description: '',
|
||||
version: 0,
|
||||
formDefinition: {
|
||||
tabs: [],
|
||||
fields: [
|
||||
{
|
||||
'type': 'container',
|
||||
'id': '5a6b24c1-db2b-45e9-9aff-142395433d23',
|
||||
'name': 'Label',
|
||||
'tab': null,
|
||||
'fields': {
|
||||
'1': [
|
||||
type: 'container',
|
||||
id: '5a6b24c1-db2b-45e9-9aff-142395433d23',
|
||||
name: 'Label',
|
||||
tab: null,
|
||||
fields: {
|
||||
1: [
|
||||
{
|
||||
'type': 'text',
|
||||
'id': 'firstName',
|
||||
'name': 'firstName',
|
||||
'colspan': 1,
|
||||
'params': {
|
||||
'existingColspan': 1,
|
||||
'maxColspan': 2
|
||||
type: 'text',
|
||||
id: 'firstName',
|
||||
name: 'firstName',
|
||||
colspan: 1,
|
||||
params: {
|
||||
existingColspan: 1,
|
||||
maxColspan: 2
|
||||
},
|
||||
'visibilityCondition': null,
|
||||
'placeholder': null,
|
||||
'value': null,
|
||||
'required': false,
|
||||
'minLength': 0,
|
||||
'maxLength': 0,
|
||||
'regexPattern': null
|
||||
visibilityCondition: null,
|
||||
placeholder: null,
|
||||
value: null,
|
||||
required: false,
|
||||
minLength: 0,
|
||||
maxLength: 0,
|
||||
regexPattern: null
|
||||
}
|
||||
],
|
||||
'2': [
|
||||
2: [
|
||||
{
|
||||
'type': 'text',
|
||||
'id': 'lastName',
|
||||
'name': 'lastName',
|
||||
'colspan': 1,
|
||||
'params': {
|
||||
'existingColspan': 1,
|
||||
'maxColspan': 2
|
||||
type: 'text',
|
||||
id: 'lastName',
|
||||
name: 'lastName',
|
||||
colspan: 1,
|
||||
params: {
|
||||
existingColspan: 1,
|
||||
maxColspan: 2
|
||||
},
|
||||
'visibilityCondition': null,
|
||||
'placeholder': null,
|
||||
'value': null,
|
||||
'required': false,
|
||||
'minLength': 0,
|
||||
'maxLength': 0,
|
||||
'regexPattern': null
|
||||
visibilityCondition: null,
|
||||
placeholder: null,
|
||||
value: null,
|
||||
required: false,
|
||||
minLength: 0,
|
||||
maxLength: 0,
|
||||
regexPattern: null
|
||||
}
|
||||
]
|
||||
},
|
||||
'numberOfColumns': 2
|
||||
numberOfColumns: 2
|
||||
}
|
||||
],
|
||||
'outcomes': [],
|
||||
'metadata': {},
|
||||
'variables': []
|
||||
outcomes: [],
|
||||
metadata: {},
|
||||
variables: []
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const fakeStartFormNotValid = {
|
||||
'formRepresentation': {
|
||||
'id': 'form-a5d50817-5183-4850-802d-17af54b2632f',
|
||||
'name': 'simpleform',
|
||||
'description': '',
|
||||
'version': 0,
|
||||
'formDefinition': {
|
||||
'tabs': [],
|
||||
'fields': [
|
||||
formRepresentation: {
|
||||
id: 'form-a5d50817-5183-4850-802d-17af54b2632f',
|
||||
name: 'simpleform',
|
||||
description: '',
|
||||
version: 0,
|
||||
formDefinition: {
|
||||
tabs: [],
|
||||
fields: [
|
||||
{
|
||||
'type': 'container',
|
||||
'id': '5a6b24c1-db2b-45e9-9aff-142395433d23',
|
||||
'name': 'Label',
|
||||
'tab': null,
|
||||
'fields': {
|
||||
'1': [
|
||||
type: 'container',
|
||||
id: '5a6b24c1-db2b-45e9-9aff-142395433d23',
|
||||
name: 'Label',
|
||||
tab: null,
|
||||
fields: {
|
||||
1: [
|
||||
{
|
||||
'type': 'text',
|
||||
'id': 'firstName',
|
||||
'name': 'firstName',
|
||||
'colspan': 1,
|
||||
'params': {
|
||||
'existingColspan': 1,
|
||||
'maxColspan': 2
|
||||
type: 'text',
|
||||
id: 'firstName',
|
||||
name: 'firstName',
|
||||
colspan: 1,
|
||||
params: {
|
||||
existingColspan: 1,
|
||||
maxColspan: 2
|
||||
},
|
||||
'visibilityCondition': null,
|
||||
'placeholder': null,
|
||||
'value': null,
|
||||
'required': true,
|
||||
'minLength': 15,
|
||||
'maxLength': 0,
|
||||
'regexPattern': null
|
||||
visibilityCondition: null,
|
||||
placeholder: null,
|
||||
value: null,
|
||||
required: true,
|
||||
minLength: 15,
|
||||
maxLength: 0,
|
||||
regexPattern: null
|
||||
}
|
||||
],
|
||||
'2': [
|
||||
2: [
|
||||
{
|
||||
'type': 'text',
|
||||
'id': 'lastName',
|
||||
'name': 'lastName',
|
||||
'colspan': 1,
|
||||
'params': {
|
||||
'existingColspan': 1,
|
||||
'maxColspan': 2
|
||||
type: 'text',
|
||||
id: 'lastName',
|
||||
name: 'lastName',
|
||||
colspan: 1,
|
||||
params: {
|
||||
existingColspan: 1,
|
||||
maxColspan: 2
|
||||
},
|
||||
'visibilityCondition': null,
|
||||
'placeholder': null,
|
||||
'value': null,
|
||||
'required': false,
|
||||
'minLength': 0,
|
||||
'maxLength': 0,
|
||||
'regexPattern': null
|
||||
visibilityCondition: null,
|
||||
placeholder: null,
|
||||
value: null,
|
||||
required: false,
|
||||
minLength: 0,
|
||||
maxLength: 0,
|
||||
regexPattern: null
|
||||
}
|
||||
]
|
||||
},
|
||||
'numberOfColumns': 2
|
||||
numberOfColumns: 2
|
||||
}
|
||||
],
|
||||
'outcomes': [],
|
||||
'metadata': {},
|
||||
'variables': []
|
||||
outcomes: [],
|
||||
metadata: {},
|
||||
variables: []
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
+1
-3
@@ -38,9 +38,7 @@ describe('StartProcessCloudService', () => {
|
||||
}
|
||||
})
|
||||
},
|
||||
isEcmLoggedIn() {
|
||||
return false;
|
||||
}
|
||||
isEcmLoggedIn: () => false
|
||||
};
|
||||
|
||||
setupTestBed({
|
||||
|
||||
+7
-3
@@ -37,6 +37,7 @@ export class StartProcessCloudService extends BaseCloudService {
|
||||
|
||||
/**
|
||||
* Gets the process definitions associated with an app.
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @returns Array of process definitions
|
||||
*/
|
||||
@@ -45,9 +46,7 @@ export class StartProcessCloudService extends BaseCloudService {
|
||||
const url = `${this.getBasePath(appName)}/rb/v1/process-definitions`;
|
||||
|
||||
return this.get(url).pipe(
|
||||
map((res: any) => {
|
||||
return res.list.entries.map((processDefs) => new ProcessDefinitionCloud(processDefs.entry));
|
||||
})
|
||||
map((res: any) => res.list.entries.map((processDefs) => new ProcessDefinitionCloud(processDefs.entry)))
|
||||
);
|
||||
} else {
|
||||
this.logService.error('AppName is mandatory for querying task');
|
||||
@@ -57,6 +56,7 @@ export class StartProcessCloudService extends BaseCloudService {
|
||||
|
||||
/**
|
||||
* Create a process based on a process definition, name, form values or variables.
|
||||
*
|
||||
* @param appName name of the Application
|
||||
* @param payload Details of the process (definition key, name, variables, etc)
|
||||
* @returns Details of the process instance just created
|
||||
@@ -72,6 +72,7 @@ export class StartProcessCloudService extends BaseCloudService {
|
||||
|
||||
/**
|
||||
* Starts an already created process using the process instance id.
|
||||
*
|
||||
* @param createdProcessInstanceId process instance id of the process previously created
|
||||
* @returns Details of the process instance just started
|
||||
*/
|
||||
@@ -85,6 +86,7 @@ export class StartProcessCloudService extends BaseCloudService {
|
||||
|
||||
/**
|
||||
* Starts a process based on a process definition, name, form values or variables.
|
||||
*
|
||||
* @param appName name of the Application
|
||||
* @param payload Details of the process (definition key, name, variables, etc)
|
||||
* @returns Details of the process instance just started
|
||||
@@ -98,6 +100,7 @@ export class StartProcessCloudService extends BaseCloudService {
|
||||
|
||||
/**
|
||||
* Update an existing process instance
|
||||
*
|
||||
* @param appName name of the Application
|
||||
* @param processInstanceId process instance to update
|
||||
* @param payload Details of the process (definition key, name, variables, etc)
|
||||
@@ -114,6 +117,7 @@ export class StartProcessCloudService extends BaseCloudService {
|
||||
|
||||
/**
|
||||
* Delete an existing process instance
|
||||
*
|
||||
* @param appName name of the Application
|
||||
* @param processInstanceId process instance to update
|
||||
*/
|
||||
|
||||
@@ -200,6 +200,7 @@ export interface TextField extends FormField {
|
||||
placeholder: string | null;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-shadow
|
||||
export enum PeopleModeOptions {
|
||||
single = 'single',
|
||||
multiple = 'multiple'
|
||||
@@ -210,6 +211,7 @@ export interface PeopleField extends FormField {
|
||||
optionType: PeopleModeOptions;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-shadow
|
||||
export enum FormFieldType {
|
||||
text = 'text',
|
||||
multiline = 'multi-line-text',
|
||||
|
||||
@@ -27,6 +27,7 @@ export class LocalPreferenceCloudService implements PreferenceCloudServiceInterf
|
||||
|
||||
/**
|
||||
* Gets local preferences
|
||||
*
|
||||
* @param _ Name of the target app
|
||||
* @param key Key of the target preference
|
||||
* @returns List of local preferences
|
||||
@@ -37,8 +38,8 @@ export class LocalPreferenceCloudService implements PreferenceCloudServiceInterf
|
||||
}
|
||||
return of(
|
||||
{
|
||||
'list': {
|
||||
'entries': []
|
||||
list: {
|
||||
entries: []
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -46,6 +47,7 @@ export class LocalPreferenceCloudService implements PreferenceCloudServiceInterf
|
||||
|
||||
/**
|
||||
* Gets local preference.
|
||||
*
|
||||
* @param _ Name of the target app
|
||||
* @param key Key of the target preference
|
||||
* @returns Observable of local preference
|
||||
@@ -56,6 +58,7 @@ export class LocalPreferenceCloudService implements PreferenceCloudServiceInterf
|
||||
|
||||
/**
|
||||
* Creates local preference.
|
||||
*
|
||||
* @param _ Name of the target app
|
||||
* @param key Key of the target preference
|
||||
* @param newPreference Details of new local preference
|
||||
@@ -70,6 +73,7 @@ export class LocalPreferenceCloudService implements PreferenceCloudServiceInterf
|
||||
|
||||
/**
|
||||
* Updates local preference.
|
||||
*
|
||||
* @param _ Name of the target app
|
||||
* @param key Key of the target preference
|
||||
* @param updatedPreference Details of updated preference
|
||||
@@ -84,6 +88,7 @@ export class LocalPreferenceCloudService implements PreferenceCloudServiceInterf
|
||||
|
||||
/**
|
||||
* Deletes local preference by given preference key.
|
||||
*
|
||||
* @param key Key of the target preference
|
||||
* @param preferences Details of updated preferences
|
||||
* @returns Observable of preferences without deleted preference
|
||||
@@ -97,12 +102,12 @@ export class LocalPreferenceCloudService implements PreferenceCloudServiceInterf
|
||||
|
||||
prepareLocalPreferenceResponse(key: string): any {
|
||||
return {
|
||||
'list': {
|
||||
'entries': [
|
||||
list: {
|
||||
entries: [
|
||||
{
|
||||
'entry': {
|
||||
'key': key,
|
||||
'value': this.storage.getItem(key) || '[]'
|
||||
entry: {
|
||||
key,
|
||||
value: this.storage.getItem(key) || '[]'
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -29,7 +29,7 @@ describe('NotificationCloudService', () => {
|
||||
let apolloSubscribeSpy: jasmine.Spy;
|
||||
let apiService: AlfrescoApiService;
|
||||
const useMock: any = {
|
||||
subscribe() {}
|
||||
subscribe: () => {}
|
||||
};
|
||||
|
||||
const queryMock = `
|
||||
@@ -47,9 +47,7 @@ describe('NotificationCloudService', () => {
|
||||
oauth2Auth: {
|
||||
token: '1234567'
|
||||
},
|
||||
isEcmLoggedIn() {
|
||||
return false;
|
||||
},
|
||||
isEcmLoggedIn: () => false,
|
||||
reply: jasmine.createSpy('reply')
|
||||
};
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ export class NotificationCloudService extends BaseCloudService {
|
||||
lazy: true,
|
||||
connectionParams: {
|
||||
kaInterval: 2000,
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
'X-Authorization': 'Bearer ' + this.apiService.getInstance().oauth2Auth.token
|
||||
}
|
||||
}
|
||||
@@ -84,6 +85,7 @@ export class NotificationCloudService extends BaseCloudService {
|
||||
operation.setContext({
|
||||
headers: {
|
||||
...oldHeaders,
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
'X-Authorization': 'Bearer ' + this.apiService.getInstance().oauth2Auth.token
|
||||
}
|
||||
});
|
||||
|
||||
@@ -32,27 +32,19 @@ describe('PreferenceService', () => {
|
||||
state: 404, stateText: 'Not Found'
|
||||
};
|
||||
|
||||
function apiMock(mockResponse): any {
|
||||
return {
|
||||
oauth2Auth: {
|
||||
callCustomApi: () => {
|
||||
return Promise.resolve(mockResponse);
|
||||
}
|
||||
},
|
||||
isEcmLoggedIn() {
|
||||
return false;
|
||||
},
|
||||
reply: jasmine.createSpy('reply')
|
||||
};
|
||||
}
|
||||
const apiMock = (mockResponse): any => ({
|
||||
oauth2Auth: {
|
||||
callCustomApi: () => Promise.resolve(mockResponse)
|
||||
},
|
||||
isEcmLoggedIn: () => false,
|
||||
reply: jasmine.createSpy('reply')
|
||||
});
|
||||
|
||||
const apiErrorMock: any = {
|
||||
oauth2Auth: {
|
||||
callCustomApi: () => Promise.reject(errorResponse)
|
||||
},
|
||||
isEcmLoggedIn() {
|
||||
return false;
|
||||
}
|
||||
isEcmLoggedIn:() => false
|
||||
};
|
||||
|
||||
setupTestBed({
|
||||
|
||||
@@ -33,6 +33,7 @@ export class UserPreferenceCloudService extends BaseCloudService implements Pref
|
||||
|
||||
/**
|
||||
* Gets user preferences
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @returns List of user preferences
|
||||
*/
|
||||
@@ -48,6 +49,7 @@ export class UserPreferenceCloudService extends BaseCloudService implements Pref
|
||||
|
||||
/**
|
||||
* Gets user preference.
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @param key Key of the target preference
|
||||
* @returns Observable of user preference
|
||||
@@ -64,6 +66,7 @@ export class UserPreferenceCloudService extends BaseCloudService implements Pref
|
||||
|
||||
/**
|
||||
* Creates user preference.
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @param key Key of the target preference
|
||||
* @newPreference Details of new user preference
|
||||
@@ -83,6 +86,7 @@ export class UserPreferenceCloudService extends BaseCloudService implements Pref
|
||||
|
||||
/**
|
||||
* Updates user preference.
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @param key Key of the target preference
|
||||
* @param updatedPreference Details of updated preference
|
||||
@@ -94,6 +98,7 @@ export class UserPreferenceCloudService extends BaseCloudService implements Pref
|
||||
|
||||
/**
|
||||
* Deletes user preference by given preference key.
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @param key Key of the target preference
|
||||
* @returns Observable of delete operation status
|
||||
|
||||
+6
-6
@@ -113,7 +113,7 @@ describe('Claim Task Directive validation errors', () => {
|
||||
selector: 'adf-cloud-claim-undefined-appname-component',
|
||||
template: '<button adf-cloud-claim-task [taskId]="taskMock" [appName]="appNameUndefined"></button>'
|
||||
})
|
||||
class ClaimTestInvalidAppNameUndefineddDirectiveComponent {
|
||||
class ClaimTestInvalidAppNameUndefinedDirectiveComponent {
|
||||
|
||||
appNameUndefined = undefined;
|
||||
taskMock = 'test1234';
|
||||
@@ -126,7 +126,7 @@ describe('Claim Task Directive validation errors', () => {
|
||||
selector: 'adf-cloud-claim-null-appname-component',
|
||||
template: '<button adf-cloud-claim-task [taskId]="taskMock" [appName]="appNameNull"></button>'
|
||||
})
|
||||
class ClaimTestInvalidAppNameNulldDirectiveComponent {
|
||||
class ClaimTestInvalidAppNameNullDirectiveComponent {
|
||||
|
||||
appNameNull = null;
|
||||
taskMock = 'test1234';
|
||||
@@ -144,8 +144,8 @@ describe('Claim Task Directive validation errors', () => {
|
||||
],
|
||||
declarations: [
|
||||
ClaimTestMissingTaskIdDirectiveComponent,
|
||||
ClaimTestInvalidAppNameUndefineddDirectiveComponent,
|
||||
ClaimTestInvalidAppNameNulldDirectiveComponent,
|
||||
ClaimTestInvalidAppNameUndefinedDirectiveComponent,
|
||||
ClaimTestInvalidAppNameNullDirectiveComponent,
|
||||
ClaimTestMissingInputDirectiveComponent
|
||||
]
|
||||
});
|
||||
@@ -165,12 +165,12 @@ describe('Claim Task Directive validation errors', () => {
|
||||
});
|
||||
|
||||
it('should throw error when appName is undefined', () => {
|
||||
fixture = TestBed.createComponent(ClaimTestInvalidAppNameUndefineddDirectiveComponent);
|
||||
fixture = TestBed.createComponent(ClaimTestInvalidAppNameUndefinedDirectiveComponent);
|
||||
expect( () => fixture.detectChanges()).toThrowError('Attribute appName is required');
|
||||
});
|
||||
|
||||
it('should throw error when appName is null', () => {
|
||||
fixture = TestBed.createComponent(ClaimTestInvalidAppNameUndefineddDirectiveComponent);
|
||||
fixture = TestBed.createComponent(ClaimTestInvalidAppNameUndefinedDirectiveComponent);
|
||||
expect( () => fixture.detectChanges()).toThrowError('Attribute appName is required');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -125,7 +125,7 @@ describe('Complete Task Directive validation errors', () => {
|
||||
selector: 'adf-cloud-undefined-appname-component',
|
||||
template: '<button adf-cloud-complete-task [taskId]="taskMock" [appName]="appNameUndefined" (success)="onCompleteTask($event)"></button>'
|
||||
})
|
||||
class TestInvalidAppNameUndefineddDirectiveComponent {
|
||||
class TestInvalidAppNameUndefinedDirectiveComponent {
|
||||
|
||||
appName = 'simple-app';
|
||||
taskMock = 'test1234';
|
||||
@@ -142,7 +142,7 @@ describe('Complete Task Directive validation errors', () => {
|
||||
selector: 'adf-cloud-null-appname-component',
|
||||
template: '<button adf-cloud-complete-task [taskId]="taskMock" [appName]="appNameNull" (success)="onCompleteTask($event)"></button>'
|
||||
})
|
||||
class TestInvalidAppNameNulldDirectiveComponent {
|
||||
class TestInvalidAppNameNullDirectiveComponent {
|
||||
|
||||
appName = 'simple-app';
|
||||
taskMock = 'test1234';
|
||||
@@ -164,8 +164,8 @@ describe('Complete Task Directive validation errors', () => {
|
||||
],
|
||||
declarations: [
|
||||
TestMissingTaskIdDirectiveComponent,
|
||||
TestInvalidAppNameUndefineddDirectiveComponent,
|
||||
TestInvalidAppNameNulldDirectiveComponent,
|
||||
TestInvalidAppNameUndefinedDirectiveComponent,
|
||||
TestInvalidAppNameNullDirectiveComponent,
|
||||
TestMissingInputDirectiveComponent
|
||||
]
|
||||
});
|
||||
@@ -184,12 +184,12 @@ describe('Complete Task Directive validation errors', () => {
|
||||
});
|
||||
|
||||
it('should throw error when appName is undefined', () => {
|
||||
fixture = TestBed.createComponent(TestInvalidAppNameUndefineddDirectiveComponent);
|
||||
fixture = TestBed.createComponent(TestInvalidAppNameUndefinedDirectiveComponent);
|
||||
expect( () => fixture.detectChanges()).toThrowError('Attribute appName is required');
|
||||
});
|
||||
|
||||
it('should throw error when appName is null', () => {
|
||||
fixture = TestBed.createComponent(TestInvalidAppNameUndefineddDirectiveComponent);
|
||||
fixture = TestBed.createComponent(TestInvalidAppNameUndefinedDirectiveComponent);
|
||||
expect( () => fixture.detectChanges()).toThrowError('Attribute appName is required');
|
||||
});
|
||||
});
|
||||
|
||||
+6
-6
@@ -113,7 +113,7 @@ describe('UnClaim Task Directive validation errors', () => {
|
||||
selector: 'adf-cloud-claim-undefined-appname-component',
|
||||
template: '<button adf-cloud-unclaim-task [taskId]="taskMock" [appName]="appNameUndefined"></button>'
|
||||
})
|
||||
class ClaimTestInvalidAppNameUndefineddDirectiveComponent {
|
||||
class ClaimTestInvalidAppNameUndefinedDirectiveComponent {
|
||||
|
||||
appNameUndefined = undefined;
|
||||
taskMock = 'test1234';
|
||||
@@ -126,7 +126,7 @@ describe('UnClaim Task Directive validation errors', () => {
|
||||
selector: 'adf-cloud-claim-null-appname-component',
|
||||
template: '<button adf-cloud-unclaim-task [taskId]="taskMock" [appName]="appNameNull"></button>'
|
||||
})
|
||||
class ClaimTestInvalidAppNameNulldDirectiveComponent {
|
||||
class ClaimTestInvalidAppNameNullDirectiveComponent {
|
||||
|
||||
appNameNull = null;
|
||||
taskMock = 'test1234';
|
||||
@@ -144,8 +144,8 @@ describe('UnClaim Task Directive validation errors', () => {
|
||||
],
|
||||
declarations: [
|
||||
ClaimTestMissingTaskIdDirectiveComponent,
|
||||
ClaimTestInvalidAppNameUndefineddDirectiveComponent,
|
||||
ClaimTestInvalidAppNameNulldDirectiveComponent,
|
||||
ClaimTestInvalidAppNameUndefinedDirectiveComponent,
|
||||
ClaimTestInvalidAppNameNullDirectiveComponent,
|
||||
ClaimTestMissingInputDirectiveComponent
|
||||
]
|
||||
});
|
||||
@@ -165,12 +165,12 @@ describe('UnClaim Task Directive validation errors', () => {
|
||||
});
|
||||
|
||||
it('should throw error when appName is undefined', () => {
|
||||
fixture = TestBed.createComponent(ClaimTestInvalidAppNameUndefineddDirectiveComponent);
|
||||
fixture = TestBed.createComponent(ClaimTestInvalidAppNameUndefinedDirectiveComponent);
|
||||
expect( () => fixture.detectChanges()).toThrowError('Attribute appName is required');
|
||||
});
|
||||
|
||||
it('should throw error when appName is null', () => {
|
||||
fixture = TestBed.createComponent(ClaimTestInvalidAppNameUndefineddDirectiveComponent);
|
||||
fixture = TestBed.createComponent(ClaimTestInvalidAppNameUndefinedDirectiveComponent);
|
||||
expect( () => fixture.detectChanges()).toThrowError('Attribute appName is required');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line no-shadow
|
||||
export enum ClaimTaskEnum {
|
||||
claim = 'claim',
|
||||
unclaim = 'unclaim'
|
||||
|
||||
@@ -32,75 +32,45 @@ describe('Task Cloud Service', () => {
|
||||
let identityUserService: IdentityUserService;
|
||||
let translateService: TranslationService;
|
||||
|
||||
function returnFakeTaskCompleteResults(): any {
|
||||
return {
|
||||
reply: () => {},
|
||||
oauth2Auth: {
|
||||
callCustomApi : () => {
|
||||
return Promise.resolve(taskCompleteCloudMock);
|
||||
}
|
||||
},
|
||||
isEcmLoggedIn() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
const returnFakeTaskCompleteResults = (): any => ({
|
||||
reply: () => {},
|
||||
oauth2Auth: {
|
||||
callCustomApi : () => Promise.resolve(taskCompleteCloudMock)
|
||||
},
|
||||
isEcmLoggedIn: () => false
|
||||
});
|
||||
|
||||
function returnFakeTaskCompleteResultsError(): any {
|
||||
return {
|
||||
reply: () => {},
|
||||
oauth2Auth: {
|
||||
callCustomApi : () => {
|
||||
return Promise.reject(taskCompleteCloudMock);
|
||||
}
|
||||
},
|
||||
isEcmLoggedIn() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
const returnFakeTaskCompleteResultsError = (): any => ({
|
||||
reply: () => {},
|
||||
oauth2Auth: {
|
||||
callCustomApi : () => Promise.reject(taskCompleteCloudMock)
|
||||
},
|
||||
isEcmLoggedIn: () => false
|
||||
});
|
||||
|
||||
function returnFakeTaskDetailsResults(): any {
|
||||
return {
|
||||
reply: () => {},
|
||||
oauth2Auth: {
|
||||
callCustomApi : () => {
|
||||
return Promise.resolve(fakeTaskDetailsCloud);
|
||||
}
|
||||
},
|
||||
isEcmLoggedIn() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
const returnFakeTaskDetailsResults = (): any => ({
|
||||
reply: () => {},
|
||||
oauth2Auth: {
|
||||
callCustomApi : () => Promise.resolve(fakeTaskDetailsCloud)
|
||||
},
|
||||
isEcmLoggedIn: () => false
|
||||
});
|
||||
|
||||
function returnFakeCandidateUsersResults(): any {
|
||||
return {
|
||||
reply: () => {},
|
||||
oauth2Auth: {
|
||||
callCustomApi : () => {
|
||||
return Promise.resolve(['mockuser1', 'mockuser2', 'mockuser3']);
|
||||
}
|
||||
},
|
||||
isEcmLoggedIn() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
const returnFakeCandidateUsersResults = (): any => ({
|
||||
reply: () => {},
|
||||
oauth2Auth: {
|
||||
callCustomApi : () => Promise.resolve(['mockuser1', 'mockuser2', 'mockuser3'])
|
||||
},
|
||||
isEcmLoggedIn: () => false
|
||||
});
|
||||
|
||||
function returnFakeCandidateGroupResults(): any {
|
||||
return {
|
||||
reply: () => {},
|
||||
oauth2Auth: {
|
||||
callCustomApi : () => {
|
||||
return Promise.resolve(['mockgroup1', 'mockgroup2', 'mockgroup3']);
|
||||
}
|
||||
},
|
||||
isEcmLoggedIn() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
const returnFakeCandidateGroupResults = (): any => ({
|
||||
reply: () => {},
|
||||
oauth2Auth: {
|
||||
callCustomApi : () => Promise.resolve(['mockgroup1', 'mockgroup2', 'mockgroup3'])
|
||||
},
|
||||
isEcmLoggedIn: () => false
|
||||
});
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
|
||||
@@ -45,6 +45,7 @@ export class TaskCloudService extends BaseCloudService implements TaskCloudServi
|
||||
|
||||
/**
|
||||
* Complete a task.
|
||||
*
|
||||
* @param appName Name of the app
|
||||
* @param taskId ID of the task to complete
|
||||
* @returns Details of the task that was completed
|
||||
@@ -52,7 +53,7 @@ export class TaskCloudService extends BaseCloudService implements TaskCloudServi
|
||||
completeTask(appName: string, taskId: string): Observable<TaskDetailsCloudModel> {
|
||||
if ((appName || appName === '') && taskId) {
|
||||
const url = `${this.getBasePath(appName)}/rb/v1/tasks/${taskId}/complete`;
|
||||
const payload = { 'payloadType': 'CompleteTaskPayload' };
|
||||
const payload = { payloadType: 'CompleteTaskPayload' };
|
||||
|
||||
return this.post<any, TaskDetailsCloudModel>(url, payload);
|
||||
} else {
|
||||
@@ -63,6 +64,7 @@ export class TaskCloudService extends BaseCloudService implements TaskCloudServi
|
||||
|
||||
/**
|
||||
* Validate if a task can be completed.
|
||||
*
|
||||
* @param taskDetails task details object
|
||||
* @returns Boolean value if the task can be completed
|
||||
*/
|
||||
@@ -72,6 +74,7 @@ export class TaskCloudService extends BaseCloudService implements TaskCloudServi
|
||||
|
||||
/**
|
||||
* Validate if a task is editable.
|
||||
*
|
||||
* @param taskDetails task details object
|
||||
* @returns Boolean value if the task is editable
|
||||
*/
|
||||
@@ -90,6 +93,7 @@ export class TaskCloudService extends BaseCloudService implements TaskCloudServi
|
||||
|
||||
/**
|
||||
* Validate if a task can be claimed.
|
||||
*
|
||||
* @param taskDetails task details object
|
||||
* @returns Boolean value if the task can be completed
|
||||
*/
|
||||
@@ -99,6 +103,7 @@ export class TaskCloudService extends BaseCloudService implements TaskCloudServi
|
||||
|
||||
/**
|
||||
* Validate if a task can be unclaimed.
|
||||
*
|
||||
* @param taskDetails task details object
|
||||
* @returns Boolean value if the task can be completed
|
||||
*/
|
||||
@@ -109,6 +114,7 @@ export class TaskCloudService extends BaseCloudService implements TaskCloudServi
|
||||
|
||||
/**
|
||||
* Claims a task for an assignee.
|
||||
*
|
||||
* @param appName Name of the app
|
||||
* @param taskId ID of the task to claim
|
||||
* @param assignee User to assign the task to
|
||||
@@ -132,6 +138,7 @@ export class TaskCloudService extends BaseCloudService implements TaskCloudServi
|
||||
|
||||
/**
|
||||
* Un-claims a task.
|
||||
*
|
||||
* @param appName Name of the app
|
||||
* @param taskId ID of the task to unclaim
|
||||
* @returns Details of the task that was unclaimed
|
||||
@@ -154,6 +161,7 @@ export class TaskCloudService extends BaseCloudService implements TaskCloudServi
|
||||
|
||||
/**
|
||||
* Gets details of a task.
|
||||
*
|
||||
* @param appName Name of the app
|
||||
* @param taskId ID of the task whose details you want
|
||||
* @returns Task details
|
||||
@@ -173,6 +181,7 @@ export class TaskCloudService extends BaseCloudService implements TaskCloudServi
|
||||
|
||||
/**
|
||||
* Creates a new standalone task.
|
||||
*
|
||||
* @param taskDetails Details of the task to create
|
||||
* @returns Details of the newly created task
|
||||
*/
|
||||
@@ -188,6 +197,7 @@ export class TaskCloudService extends BaseCloudService implements TaskCloudServi
|
||||
|
||||
/**
|
||||
* Updates the details (name, description, due date) for a task.
|
||||
*
|
||||
* @param appName Name of the app
|
||||
* @param taskId ID of the task to update
|
||||
* @param payload Data to update the task
|
||||
@@ -209,6 +219,7 @@ export class TaskCloudService extends BaseCloudService implements TaskCloudServi
|
||||
|
||||
/**
|
||||
* Gets candidate users of the task.
|
||||
*
|
||||
* @param appName Name of the app
|
||||
* @param taskId ID of the task
|
||||
* @returns Candidate users
|
||||
@@ -225,6 +236,7 @@ export class TaskCloudService extends BaseCloudService implements TaskCloudServi
|
||||
|
||||
/**
|
||||
* Gets candidate groups of the task.
|
||||
*
|
||||
* @param appName Name of the app
|
||||
* @param taskId ID of the task
|
||||
* @returns Candidate groups
|
||||
@@ -241,6 +253,7 @@ export class TaskCloudService extends BaseCloudService implements TaskCloudServi
|
||||
|
||||
/**
|
||||
* Gets the process definitions associated with an app.
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @returns Array of process definitions
|
||||
*/
|
||||
@@ -249,9 +262,7 @@ export class TaskCloudService extends BaseCloudService implements TaskCloudServi
|
||||
const url = `${this.getBasePath(appName)}/rb/v1/process-definitions`;
|
||||
|
||||
return this.get(url).pipe(
|
||||
map((res: any) => {
|
||||
return res.list.entries.map((processDefs) => new ProcessDefinitionCloud(processDefs.entry));
|
||||
})
|
||||
map((res: any) => res.list.entries.map((processDefs) => new ProcessDefinitionCloud(processDefs.entry)))
|
||||
);
|
||||
} else {
|
||||
this.logService.error('AppName is mandatory for querying task');
|
||||
@@ -261,6 +272,7 @@ export class TaskCloudService extends BaseCloudService implements TaskCloudServi
|
||||
|
||||
/**
|
||||
* Updates the task assignee.
|
||||
*
|
||||
* @param appName Name of the app
|
||||
* @param taskId ID of the task to update assignee
|
||||
* @param assignee assignee to update current user task assignee
|
||||
@@ -268,13 +280,11 @@ export class TaskCloudService extends BaseCloudService implements TaskCloudServi
|
||||
*/
|
||||
assign(appName: string, taskId: string, assignee: string): Observable<TaskDetailsCloudModel> {
|
||||
if (appName && taskId) {
|
||||
const payLoad = { 'assignee': assignee, 'taskId': taskId, 'payloadType': 'AssignTaskPayload' };
|
||||
const payLoad = { assignee, taskId, payloadType: 'AssignTaskPayload' };
|
||||
const url = `${this.getBasePath(appName)}/rb/v1/tasks/${taskId}/assign`;
|
||||
|
||||
return this.post(url, payLoad).pipe(
|
||||
map((res: any) => {
|
||||
return res.entry;
|
||||
})
|
||||
map((res: any) => res.entry)
|
||||
);
|
||||
} else {
|
||||
this.logService.error('AppName and TaskId are mandatory to change/update the task assignee');
|
||||
|
||||
+1
-3
@@ -42,9 +42,7 @@ describe('StartTaskCloudComponent', () => {
|
||||
oauth2Auth: {
|
||||
callCustomApi: () => Promise.resolve(taskDetailsMock)
|
||||
},
|
||||
isEcmLoggedIn() {
|
||||
return false;
|
||||
},
|
||||
isEcmLoggedIn: () => false,
|
||||
reply: jasmine.createSpy('reply')
|
||||
};
|
||||
|
||||
|
||||
+8
-14
@@ -35,6 +35,9 @@ import { StartTaskCloudRequestModel } from '../models/start-task-cloud-request.m
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { TaskPriorityOption } from '../../models/task.model';
|
||||
|
||||
const MAX_NAME_LENGTH = 255;
|
||||
const DATE_FORMAT: string = 'DD/MM/YYYY';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-cloud-start-task',
|
||||
templateUrl: './start-task-cloud.component.html',
|
||||
@@ -44,20 +47,14 @@ import { TaskPriorityOption } from '../../models/task.model';
|
||||
{ provide: MAT_DATE_FORMATS, useValue: MOMENT_DATE_FORMATS }],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
|
||||
export class StartTaskCloudComponent implements OnInit, OnDestroy {
|
||||
|
||||
static MAX_NAME_LENGTH = 255;
|
||||
|
||||
public DATE_FORMAT: string = 'DD/MM/YYYY';
|
||||
|
||||
/** (required) Name of the app. */
|
||||
@Input()
|
||||
appName: string = '';
|
||||
|
||||
/** Maximum length of the task name. */
|
||||
@Input()
|
||||
maxNameLength: number = StartTaskCloudComponent.MAX_NAME_LENGTH;
|
||||
maxNameLength: number = MAX_NAME_LENGTH;
|
||||
|
||||
/** Name of the task. */
|
||||
@Input()
|
||||
@@ -140,8 +137,7 @@ export class StartTaskCloudComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
private getMaxNameLength(): number {
|
||||
return this.maxNameLength > StartTaskCloudComponent.MAX_NAME_LENGTH ?
|
||||
StartTaskCloudComponent.MAX_NAME_LENGTH : this.maxNameLength;
|
||||
return this.maxNameLength > MAX_NAME_LENGTH ? MAX_NAME_LENGTH : this.maxNameLength;
|
||||
}
|
||||
|
||||
private loadCurrentUser() {
|
||||
@@ -186,7 +182,7 @@ export class StartTaskCloudComponent implements OnInit, OnDestroy {
|
||||
this.dateError = false;
|
||||
|
||||
if (newDateValue) {
|
||||
const momentDate = moment(newDateValue, this.DATE_FORMAT, true);
|
||||
const momentDate = moment(newDateValue, DATE_FORMAT, true);
|
||||
if (!momentDate.isValid()) {
|
||||
this.dateError = true;
|
||||
}
|
||||
@@ -209,9 +205,7 @@ export class StartTaskCloudComponent implements OnInit, OnDestroy {
|
||||
|
||||
onCandidateGroupRemove(candidateGroup: any) {
|
||||
if (candidateGroup.name) {
|
||||
this.candidateGroupNames = this.candidateGroupNames.filter((name: string) => {
|
||||
return name !== candidateGroup.name;
|
||||
});
|
||||
this.candidateGroupNames = this.candidateGroupNames.filter((name: string) => name !== candidateGroup.name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,7 +220,7 @@ export class StartTaskCloudComponent implements OnInit, OnDestroy {
|
||||
public whitespaceValidator(control: FormControl) {
|
||||
const isWhitespace = (control.value || '').trim().length === 0;
|
||||
const isValid = control.value.length === 0 || !isWhitespace;
|
||||
return isValid ? null : { 'whitespace': true };
|
||||
return isValid ? null : { whitespace: true };
|
||||
}
|
||||
|
||||
get nameController(): FormControl {
|
||||
|
||||
@@ -17,4 +17,4 @@
|
||||
|
||||
import { StartTaskCloudRequestModel } from '../models/start-task-cloud-request.model';
|
||||
|
||||
export let taskDetailsMock = new StartTaskCloudRequestModel({ assignee: 'fake-assigne', name: 'fake-name' });
|
||||
export const taskDetailsMock = new StartTaskCloudRequestModel({ assignee: 'fake-assigne', name: 'fake-name' });
|
||||
|
||||
+4
-3
@@ -29,6 +29,8 @@ import { IdentityGroupModel, IdentityUserModel, TranslationService, UserPreferen
|
||||
import { TaskFilterDialogCloudComponent } from '../task-filter-dialog/task-filter-dialog-cloud.component';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
|
||||
export interface DropdownOption {
|
||||
value: string;
|
||||
label: string;
|
||||
@@ -202,6 +204,7 @@ export abstract class BaseEditTaskFilterCloudComponent<T> implements OnInit, OnC
|
||||
|
||||
/**
|
||||
* Return filter name
|
||||
*
|
||||
* @param filterName
|
||||
*/
|
||||
getSanitizeFilterName(filterName: string): string {
|
||||
@@ -322,9 +325,7 @@ export abstract class BaseEditTaskFilterCloudComponent<T> implements OnInit, OnC
|
||||
get createSortProperties(): FilterOptions[] {
|
||||
this.checkMandatorySortProperties();
|
||||
|
||||
return this.sortProperties.map((property: string) => {
|
||||
return { label: property, value: property };
|
||||
});
|
||||
return this.sortProperties.map((property: string) => ({ label: property, value: property }));
|
||||
}
|
||||
|
||||
createAndFilterActions(): TaskFilterAction[] {
|
||||
|
||||
+20
-20
@@ -82,7 +82,7 @@ describe('EditServiceTaskFilterCloudComponent', () => {
|
||||
|
||||
it('should fetch task filter by taskId', () => {
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
expect(getTaskFilterSpy).toHaveBeenCalled();
|
||||
@@ -102,7 +102,7 @@ describe('EditServiceTaskFilterCloudComponent', () => {
|
||||
component.filterProperties = ['processDefinitionName'];
|
||||
fixture.detectChanges();
|
||||
const taskFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
const controller = component.editTaskFilterForm.get('processDefinitionName');
|
||||
|
||||
@@ -115,7 +115,7 @@ describe('EditServiceTaskFilterCloudComponent', () => {
|
||||
|
||||
it('should display filter name as title', async () => {
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -129,7 +129,7 @@ describe('EditServiceTaskFilterCloudComponent', () => {
|
||||
it('should not display filter name if showFilterName is false', async () => {
|
||||
const taskFilterIdChange = new SimpleChange(null, 'mock-task-filter-id', true);
|
||||
component.showTaskFilterName = false;
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -140,7 +140,7 @@ describe('EditServiceTaskFilterCloudComponent', () => {
|
||||
|
||||
it('should not display mat-spinner if isloading set to false', async () => {
|
||||
const taskFilterIdChange = new SimpleChange(null, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -157,7 +157,7 @@ describe('EditServiceTaskFilterCloudComponent', () => {
|
||||
it('should display mat-spinner if isloading set to true', async () => {
|
||||
component.isLoading = true;
|
||||
const taskFilterIdChange = new SimpleChange(null, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -170,7 +170,7 @@ describe('EditServiceTaskFilterCloudComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
@@ -204,7 +204,7 @@ describe('EditServiceTaskFilterCloudComponent', () => {
|
||||
}));
|
||||
|
||||
const taskFilterIdChange = new SimpleChange(null, 'filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
component.toggleFilterActions = true;
|
||||
@@ -222,7 +222,7 @@ describe('EditServiceTaskFilterCloudComponent', () => {
|
||||
|
||||
it('should enable delete button for custom task filters', async () => {
|
||||
const taskFilterIdChange = new SimpleChange(null, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
component.toggleFilterActions = true;
|
||||
@@ -240,7 +240,7 @@ describe('EditServiceTaskFilterCloudComponent', () => {
|
||||
|
||||
it('should enable save button if the filter is changed for custom task filters', (done) => {
|
||||
const taskFilterIdChange = new SimpleChange(null, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
component.toggleFilterActions = true;
|
||||
@@ -291,7 +291,7 @@ describe('EditServiceTaskFilterCloudComponent', () => {
|
||||
}));
|
||||
|
||||
const taskFilterIdChange = new SimpleChange(null, 'filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
component.toggleFilterActions = true;
|
||||
@@ -329,7 +329,7 @@ describe('EditServiceTaskFilterCloudComponent', () => {
|
||||
}));
|
||||
|
||||
const taskFilterIdChange = new SimpleChange(null, 'filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
component.toggleFilterActions = true;
|
||||
@@ -474,7 +474,7 @@ describe('EditServiceTaskFilterCloudComponent', () => {
|
||||
|
||||
it('should able to build a editTaskFilter form with default properties if input is empty', async () => {
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
component.filterProperties = [];
|
||||
|
||||
fixture.detectChanges();
|
||||
@@ -497,7 +497,7 @@ describe('EditServiceTaskFilterCloudComponent', () => {
|
||||
component.filterProperties = ['appName', 'processInstanceId', 'priority'];
|
||||
fixture.detectChanges();
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
const appController = component.editTaskFilterForm.get('appName');
|
||||
|
||||
fixture.detectChanges();
|
||||
@@ -513,7 +513,7 @@ describe('EditServiceTaskFilterCloudComponent', () => {
|
||||
|
||||
it('should display default sort properties', async () => {
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
expansionPanel.click();
|
||||
@@ -539,7 +539,7 @@ describe('EditServiceTaskFilterCloudComponent', () => {
|
||||
}));
|
||||
fixture.detectChanges();
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
expansionPanel.click();
|
||||
@@ -559,7 +559,7 @@ describe('EditServiceTaskFilterCloudComponent', () => {
|
||||
|
||||
it('should display default sort properties if input is empty', async () => {
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
component.sortProperties = [];
|
||||
fixture.detectChanges();
|
||||
@@ -584,7 +584,7 @@ describe('EditServiceTaskFilterCloudComponent', () => {
|
||||
it('should display default filter actions', async () => {
|
||||
component.toggleFilterActions = true;
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
expansionPanel.click();
|
||||
@@ -606,7 +606,7 @@ describe('EditServiceTaskFilterCloudComponent', () => {
|
||||
component.actions = ['save'];
|
||||
fixture.detectChanges();
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
component.toggleFilterActions = true;
|
||||
fixture.detectChanges();
|
||||
@@ -631,7 +631,7 @@ describe('EditServiceTaskFilterCloudComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
spyOn(component.action, 'emit').and.callThrough();
|
||||
});
|
||||
|
||||
+35
-37
@@ -57,9 +57,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
oauth2Auth: {
|
||||
callCustomApi: () => Promise.resolve(fakeApplicationInstance)
|
||||
},
|
||||
isEcmLoggedIn() {
|
||||
return false;
|
||||
},
|
||||
isEcmLoggedIn: () => false,
|
||||
reply: jasmine.createSpy('reply')
|
||||
};
|
||||
|
||||
@@ -102,7 +100,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
|
||||
it('should fetch task filter by taskId', () => {
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
expect(getTaskFilterSpy).toHaveBeenCalled();
|
||||
@@ -120,7 +118,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
component.filterProperties = ['processDefinitionName'];
|
||||
fixture.detectChanges();
|
||||
const taskFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
const controller = component.editTaskFilterForm.get('processDefinitionName');
|
||||
|
||||
@@ -133,7 +131,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
|
||||
it('should display filter name as title', async () => {
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -147,7 +145,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
it('should not display filter name if showFilterName is false', async () => {
|
||||
const taskFilterIdChange = new SimpleChange(null, 'mock-task-filter-id', true);
|
||||
component.showTaskFilterName = false;
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -158,7 +156,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
|
||||
it('should not display mat-spinner if isloading set to false', async () => {
|
||||
const taskFilterIdChange = new SimpleChange(null, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -175,7 +173,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
it('should display mat-spinner if isloading set to true', async () => {
|
||||
component.isLoading = true;
|
||||
const taskFilterIdChange = new SimpleChange(null, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -188,7 +186,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
@@ -221,7 +219,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
}));
|
||||
|
||||
const taskFilterIdChange = new SimpleChange(null, 'filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
component.toggleFilterActions = true;
|
||||
@@ -239,7 +237,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
|
||||
it('should enable delete button for custom task filters', async () => {
|
||||
const taskFilterIdChange = new SimpleChange(null, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
component.toggleFilterActions = true;
|
||||
@@ -257,7 +255,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
|
||||
it('should enable save button if the filter is changed for custom task filters', (done) => {
|
||||
const taskFilterIdChange = new SimpleChange(null, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
component.toggleFilterActions = true;
|
||||
@@ -308,7 +306,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
}));
|
||||
|
||||
const taskFilterIdChange = new SimpleChange(null, 'filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
component.toggleFilterActions = true;
|
||||
@@ -346,7 +344,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
}));
|
||||
|
||||
const taskFilterIdChange = new SimpleChange(null, 'filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
component.toggleFilterActions = true;
|
||||
@@ -469,7 +467,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
|
||||
it('should able to build a editTaskFilter form with default properties if input is empty', async () => {
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
component.filterProperties = [];
|
||||
fixture.detectChanges();
|
||||
const stateController = component.editTaskFilterForm.get('status');
|
||||
@@ -489,7 +487,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
component.filterProperties = ['appName', 'processInstanceId', 'priority'];
|
||||
fixture.detectChanges();
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
const appController = component.editTaskFilterForm.get('appName');
|
||||
|
||||
fixture.detectChanges();
|
||||
@@ -504,7 +502,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
component.filterProperties = ['appName', 'processInstanceId', 'priority', 'completedBy'];
|
||||
fixture.detectChanges();
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
const appController = component.editTaskFilterForm.get('completedBy');
|
||||
|
||||
fixture.detectChanges();
|
||||
@@ -521,7 +519,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
component.filterProperties = ['appName', 'processInstanceId', 'priority', 'completedBy'];
|
||||
fixture.detectChanges();
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -534,7 +532,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
component.appName = 'fake';
|
||||
component.filterProperties = ['appName', 'processInstanceId', 'priority', 'completedBy'];
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
const mockUser: IdentityUserModel[] = [{
|
||||
@@ -565,7 +563,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
component.appName = 'fake';
|
||||
component.filterProperties = ['appName', 'processInstanceId', 'priority', 'dueDateRange'];
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
const startedDateTypeControl: AbstractControl = component.editTaskFilterForm.get('dueDateType');
|
||||
@@ -587,7 +585,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
component.appName = 'fake';
|
||||
component.filterProperties = ['appName', 'processInstanceId', 'priority', 'dueDateRange'];
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
const stateElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-process-property-dueDateRange"] .mat-select-trigger');
|
||||
@@ -606,7 +604,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
component.appName = 'fake';
|
||||
component.filterProperties = ['appName', 'processInstanceId', 'priority', 'dueDateRange'];
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
const dateFilter = {
|
||||
@@ -643,7 +641,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
component.appName = 'fake';
|
||||
component.filterProperties = ['appName', 'processInstanceId', 'priority', 'completedDateRange'];
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
const startedDateTypeControl: AbstractControl = component.editTaskFilterForm.get('completedDateType');
|
||||
@@ -665,7 +663,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
component.appName = 'fake';
|
||||
component.filterProperties = ['appName', 'processInstanceId', 'priority', 'completedDateRange'];
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
const dateFilter = {
|
||||
@@ -701,7 +699,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
component.appName = 'fake';
|
||||
component.filterProperties = ['appName', 'processInstanceId', 'priority', 'createdDateRange'];
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
const startedDateTypeControl: AbstractControl = component.editTaskFilterForm.get('createdDateType');
|
||||
@@ -724,7 +722,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
component.appName = 'fake';
|
||||
component.filterProperties = ['assignment'];
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
const assignmentComponent = fixture.debugElement.nativeElement.querySelector('adf-cloud-task-assignment-filter');
|
||||
expect(assignmentComponent).toBeTruthy();
|
||||
@@ -735,7 +733,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
component.appName = 'fake';
|
||||
component.filterProperties = ['assignment'];
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
component.onAssignedChange(identityUserMock);
|
||||
|
||||
component.filterChange.subscribe(() => {
|
||||
@@ -749,7 +747,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
component.appName = 'fake';
|
||||
component.filterProperties = ['appName', 'processInstanceId', 'priority', 'createdDateRange'];
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
const dateFilter = {
|
||||
@@ -790,7 +788,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
component.appName = 'fake';
|
||||
component.filterProperties = ['assignment'];
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
component.onAssignedGroupsChange(identityGroupsMock);
|
||||
|
||||
@@ -806,7 +804,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
|
||||
it('should display default sort properties', async () => {
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
expansionPanel.click();
|
||||
@@ -832,7 +830,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
}));
|
||||
fixture.detectChanges();
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
expansionPanel.click();
|
||||
@@ -852,7 +850,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
|
||||
it('should display default sort properties if input is empty', async () => {
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
component.sortProperties = [];
|
||||
fixture.detectChanges();
|
||||
@@ -877,7 +875,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
it('should display default filter actions', async () => {
|
||||
component.toggleFilterActions = true;
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
|
||||
expansionPanel.click();
|
||||
@@ -899,7 +897,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
component.actions = ['save'];
|
||||
fixture.detectChanges();
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
component.toggleFilterActions = true;
|
||||
fixture.detectChanges();
|
||||
@@ -923,7 +921,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
component.appName = 'fake';
|
||||
component.filterProperties = ['appName', 'processInstanceId', 'priority', 'lastModified'];
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
|
||||
const lastModifiedToControl: AbstractControl = component.editTaskFilterForm.get('lastModifiedTo');
|
||||
@@ -949,7 +947,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||
component.ngOnChanges({ id: taskFilterIdChange });
|
||||
fixture.detectChanges();
|
||||
spyOn(component.action, 'emit').and.callThrough();
|
||||
});
|
||||
|
||||
+14
-14
@@ -62,7 +62,7 @@ describe('ServiceTaskFiltersCloudComponent', () => {
|
||||
it('should attach specific icon for each filter if hasIcon is true', async () => {
|
||||
const change = new SimpleChange(undefined, 'my-app-1', true);
|
||||
|
||||
component.ngOnChanges({'appName': change});
|
||||
component.ngOnChanges({appName: change});
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -84,7 +84,7 @@ describe('ServiceTaskFiltersCloudComponent', () => {
|
||||
it('should not attach icons for each filter if hasIcon is false', async () => {
|
||||
component.showIcons = false;
|
||||
const change = new SimpleChange(undefined, 'my-app-1', true);
|
||||
component.ngOnChanges({'appName': change});
|
||||
component.ngOnChanges({appName: change});
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -96,7 +96,7 @@ describe('ServiceTaskFiltersCloudComponent', () => {
|
||||
it('should display the filters', async () => {
|
||||
const change = new SimpleChange(undefined, 'my-app-1', true);
|
||||
|
||||
component.ngOnChanges({'appName': change});
|
||||
component.ngOnChanges({appName: change});
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -128,7 +128,7 @@ describe('ServiceTaskFiltersCloudComponent', () => {
|
||||
done();
|
||||
});
|
||||
|
||||
component.ngOnChanges({'appName': change});
|
||||
component.ngOnChanges({appName: change});
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
@@ -136,7 +136,7 @@ describe('ServiceTaskFiltersCloudComponent', () => {
|
||||
const appName = 'my-app-1';
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -150,7 +150,7 @@ describe('ServiceTaskFiltersCloudComponent', () => {
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
component.ngOnChanges({ filterParam: change });
|
||||
|
||||
expect(component.currentFilter).toEqual(fakeGlobalServiceFilters[1]);
|
||||
expect(filterSelectedSpy).toHaveBeenCalledWith(fakeGlobalServiceFilters[1]);
|
||||
@@ -160,7 +160,7 @@ describe('ServiceTaskFiltersCloudComponent', () => {
|
||||
const change = new SimpleChange(null, { name: 'nonexistentFilter' }, true);
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
component.ngOnChanges({ filterParam: change });
|
||||
|
||||
expect(component.currentFilter).toBeUndefined();
|
||||
});
|
||||
@@ -171,7 +171,7 @@ describe('ServiceTaskFiltersCloudComponent', () => {
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
component.ngOnChanges({ filterParam: change });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -186,7 +186,7 @@ describe('ServiceTaskFiltersCloudComponent', () => {
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
component.ngOnChanges({ filterParam: change });
|
||||
|
||||
expect(component.currentFilter).toEqual(fakeGlobalServiceFilters[2]);
|
||||
expect(filterSelectedSpy).toHaveBeenCalledWith(fakeGlobalServiceFilters[2]);
|
||||
@@ -198,7 +198,7 @@ describe('ServiceTaskFiltersCloudComponent', () => {
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
component.ngOnChanges({ filterParam: change });
|
||||
|
||||
expect(component.currentFilter).toEqual(fakeGlobalServiceFilters[0]);
|
||||
expect(filterSelectedSpy).toHaveBeenCalledWith(fakeGlobalServiceFilters[0]);
|
||||
@@ -225,7 +225,7 @@ describe('ServiceTaskFiltersCloudComponent', () => {
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
component.ngOnChanges({ filterParam: change });
|
||||
|
||||
expect(component.currentFilter).toBe(fakeGlobalServiceFilters[0]);
|
||||
expect(filterClickedSpy).not.toHaveBeenCalled();
|
||||
@@ -234,7 +234,7 @@ describe('ServiceTaskFiltersCloudComponent', () => {
|
||||
it('should reset the filter when the param is undefined', () => {
|
||||
const change = new SimpleChange(null, undefined, false);
|
||||
component.currentFilter = fakeGlobalServiceFilters[0];
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
component.ngOnChanges({ filterParam: change });
|
||||
|
||||
expect(component.currentFilter).toBe(undefined);
|
||||
});
|
||||
@@ -244,7 +244,7 @@ describe('ServiceTaskFiltersCloudComponent', () => {
|
||||
const appName = 'my-app-1';
|
||||
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
|
||||
expect(component.getFilters).toHaveBeenCalledWith(appName);
|
||||
});
|
||||
@@ -254,7 +254,7 @@ describe('ServiceTaskFiltersCloudComponent', () => {
|
||||
const appName = 'fake-app-name';
|
||||
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
|
||||
expect(component.getFilters).toHaveBeenCalledWith(appName);
|
||||
});
|
||||
|
||||
+1
@@ -26,6 +26,7 @@ import { FormBuilder, FormGroup, AbstractControl, Validators } from '@angular/fo
|
||||
})
|
||||
export class TaskFilterDialogCloudComponent implements OnInit {
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
public static ACTION_SAVE = 'SAVE';
|
||||
defaultIcon = 'inbox';
|
||||
|
||||
|
||||
+24
-24
@@ -67,7 +67,7 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
|
||||
it('should attach specific icon for each filter if hasIcon is true', async () => {
|
||||
const change = new SimpleChange(undefined, 'my-app-1', true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -89,7 +89,7 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
it('should not attach icons for each filter if hasIcon is false', async () => {
|
||||
component.showIcons = false;
|
||||
const change = new SimpleChange(undefined, 'my-app-1', true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -100,7 +100,7 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
|
||||
it('should display the filters', async () => {
|
||||
const change = new SimpleChange(undefined, 'my-app-1', true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -133,14 +133,14 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
done();
|
||||
});
|
||||
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
});
|
||||
|
||||
it('should display the task filters', async () => {
|
||||
const appName = 'my-app-1';
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -157,7 +157,7 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
const appName = 'my-app-1';
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
@@ -170,7 +170,7 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
component.ngOnChanges({ filterParam: change });
|
||||
|
||||
expect(component.currentFilter).toEqual(fakeGlobalFilter[2]);
|
||||
expect(filterSelectedSpy).toHaveBeenCalledWith(fakeGlobalFilter[2]);
|
||||
@@ -180,7 +180,7 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
const change = new SimpleChange(null, { name: 'nonexistentFilter' }, true);
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
component.ngOnChanges({ filterParam: change });
|
||||
|
||||
expect(component.currentFilter).toBeUndefined();
|
||||
});
|
||||
@@ -191,7 +191,7 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
component.ngOnChanges({ filterParam: change });
|
||||
|
||||
expect(component.currentFilter).toEqual(fakeGlobalFilter[2]);
|
||||
expect(filterSelectedSpy).toHaveBeenCalledWith(fakeGlobalFilter[2]);
|
||||
@@ -203,7 +203,7 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
component.ngOnChanges({ filterParam: change });
|
||||
|
||||
expect(component.currentFilter).toEqual(fakeGlobalFilter[2]);
|
||||
expect(filterSelectedSpy).toHaveBeenCalledWith(fakeGlobalFilter[2]);
|
||||
@@ -215,7 +215,7 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
component.ngOnChanges({ filterParam: change });
|
||||
|
||||
expect(component.currentFilter).toEqual(fakeGlobalFilter[2]);
|
||||
expect(filterSelectedSpy).toHaveBeenCalledWith(fakeGlobalFilter[2]);
|
||||
@@ -242,7 +242,7 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
component.ngOnChanges({ filterParam: change });
|
||||
|
||||
expect(component.currentFilter).toBe(fakeGlobalFilter[0]);
|
||||
expect(filterClickedSpy).not.toHaveBeenCalled();
|
||||
@@ -251,7 +251,7 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
it('should reset the filter when the param is undefined', () => {
|
||||
const change = new SimpleChange(fakeGlobalFilter[0], undefined, false);
|
||||
component.currentFilter = fakeGlobalFilter[0];
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
component.ngOnChanges({ filterParam: change });
|
||||
|
||||
expect(component.currentFilter).toEqual(undefined);
|
||||
});
|
||||
@@ -261,14 +261,14 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
const appName = 'my-app-1';
|
||||
|
||||
const change = new SimpleChange(null, appName, true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
|
||||
expect(component.getFilters).toHaveBeenCalledWith(appName);
|
||||
});
|
||||
|
||||
it('should display filter counter if property set to true', async () => {
|
||||
const change = new SimpleChange(undefined, 'my-app-1', true);
|
||||
component.ngOnChanges({ 'appName': change });
|
||||
component.ngOnChanges({ appName: change });
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -331,7 +331,7 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
component.currentFilter = null;
|
||||
|
||||
change = new SimpleChange(null, { key: fakeGlobalFilter[0].key }, true);
|
||||
component.ngOnChanges({ 'filterParam': change });
|
||||
component.ngOnChanges({ filterParam: change });
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
@@ -363,22 +363,22 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
const queuedTasksFilterKey = defaultTaskFiltersMock[0].key;
|
||||
const completedTasksFilterKey = defaultTaskFiltersMock[2].key;
|
||||
|
||||
function getActiveFilterElement(filterKey: string): Element {
|
||||
const getActiveFilterElement = (filterKey: string): Element => {
|
||||
const activeFilter = fixture.debugElement.query(By.css(`.adf-active`));
|
||||
return activeFilter.nativeElement.querySelector(`[data-automation-id="${filterKey}_filter"]`);
|
||||
}
|
||||
};
|
||||
|
||||
async function clickOnFilter(filterKey: string) {
|
||||
const clickOnFilter = async (filterKey: string) => {
|
||||
fixture.debugElement.nativeElement.querySelector(`[data-automation-id="${filterKey}_filter"]`).click();
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
}
|
||||
};
|
||||
|
||||
it('Should highlight task filter on filter click', async () => {
|
||||
getTaskListFiltersSpy.and.returnValue(of(defaultTaskFiltersMock));
|
||||
component.appName = 'mock-app-name';
|
||||
const appNameChange = new SimpleChange(null, 'mock-app-name', true);
|
||||
component.ngOnChanges({ 'appName': appNameChange });
|
||||
component.ngOnChanges({ appName: appNameChange });
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
@@ -405,7 +405,7 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
getTaskListFiltersSpy.and.returnValue(of(defaultTaskFiltersMock));
|
||||
fixture.detectChanges();
|
||||
|
||||
component.ngOnChanges({ 'filterParam': new SimpleChange(null, { key: assignedTasksFilterKey }, true) });
|
||||
component.ngOnChanges({ filterParam: new SimpleChange(null, { key: assignedTasksFilterKey }, true) });
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
@@ -413,7 +413,7 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
expect(getActiveFilterElement(queuedTasksFilterKey)).toBeNull();
|
||||
expect(getActiveFilterElement(completedTasksFilterKey)).toBeNull();
|
||||
|
||||
component.ngOnChanges({ 'filterParam': new SimpleChange(null, { key: queuedTasksFilterKey }, true) });
|
||||
component.ngOnChanges({ filterParam: new SimpleChange(null, { key: queuedTasksFilterKey }, true) });
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
@@ -421,7 +421,7 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
expect(getActiveFilterElement(queuedTasksFilterKey)).toBeDefined();
|
||||
expect(getActiveFilterElement(completedTasksFilterKey)).toBeNull();
|
||||
|
||||
component.ngOnChanges({ 'filterParam': new SimpleChange(null, { key: completedTasksFilterKey }, true) });
|
||||
component.ngOnChanges({ filterParam: new SimpleChange(null, { key: completedTasksFilterKey }, true) });
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* eslint-disable no-underscore-dangle */
|
||||
/* eslint-disable no-shadow */
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
|
||||
import { DateCloudFilterType } from '../../../models/date-cloud-filter.model';
|
||||
import { DateRangeFilterService } from '../../../common/date-range-filter/date-range-filter.service';
|
||||
import { ComponentSelectionMode } from '../../../types';
|
||||
|
||||
+18
-7
@@ -41,6 +41,7 @@ export class ServiceTaskFilterCloudService {
|
||||
|
||||
/**
|
||||
* Creates and returns the default task filters for an app.
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @returns Observable of default filters task filters just created or created filters
|
||||
*/
|
||||
@@ -62,6 +63,7 @@ export class ServiceTaskFilterCloudService {
|
||||
|
||||
/**
|
||||
* Checks user preference are empty or not
|
||||
*
|
||||
* @param preferences User preferences of the target app
|
||||
* @returns Boolean value if the preferences are not empty
|
||||
*/
|
||||
@@ -71,6 +73,7 @@ export class ServiceTaskFilterCloudService {
|
||||
|
||||
/**
|
||||
* Checks for task filters in given user preferences
|
||||
*
|
||||
* @param preferences User preferences of the target app
|
||||
* @param key Key of the task filters
|
||||
* @param filters Details of create filter
|
||||
@@ -83,6 +86,7 @@ export class ServiceTaskFilterCloudService {
|
||||
|
||||
/**
|
||||
* Calls create preference api to create task filters
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @param key Key of the task instance filters
|
||||
* @param filters Details of new task filter
|
||||
@@ -94,6 +98,7 @@ export class ServiceTaskFilterCloudService {
|
||||
|
||||
/**
|
||||
* Calls get preference api to get task filter by preference key
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @param key Key of the task filters
|
||||
* @returns Observable of task filters
|
||||
@@ -104,6 +109,7 @@ export class ServiceTaskFilterCloudService {
|
||||
|
||||
/**
|
||||
* Gets all task filters for a task app.
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @returns Observable of task filter details
|
||||
*/
|
||||
@@ -114,6 +120,7 @@ export class ServiceTaskFilterCloudService {
|
||||
|
||||
/**
|
||||
* Gets a task filter.
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @param id ID of the task
|
||||
* @returns Details of the task filter
|
||||
@@ -128,16 +135,13 @@ export class ServiceTaskFilterCloudService {
|
||||
return of(filters);
|
||||
}
|
||||
}),
|
||||
map((filters: any) => {
|
||||
return filters.filter((filter: ServiceTaskFilterCloudModel) => {
|
||||
return filter.id === id;
|
||||
})[0];
|
||||
})
|
||||
map((filters: any) => filters.filter((filter: ServiceTaskFilterCloudModel) => filter.id === id)[0])
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new task filter.
|
||||
*
|
||||
* @param filter The new filter to add
|
||||
* @returns Observable of task instance filters with newly added filter
|
||||
*/
|
||||
@@ -146,7 +150,7 @@ export class ServiceTaskFilterCloudService {
|
||||
return this.getTaskFiltersByKey(newFilter.appName, key).pipe(
|
||||
switchMap((filters: ServiceTaskFilterCloudModel[]) => {
|
||||
if (filters && filters.length === 0) {
|
||||
return this.createTaskFilters(newFilter.appName, key, <ServiceTaskFilterCloudModel[]> [newFilter]);
|
||||
return this.createTaskFilters(newFilter.appName, key, [newFilter]);
|
||||
} else {
|
||||
filters.push(newFilter);
|
||||
return this.preferenceService.updatePreference(newFilter.appName, key, filters);
|
||||
@@ -165,6 +169,7 @@ export class ServiceTaskFilterCloudService {
|
||||
|
||||
/**
|
||||
* Updates a task filter.
|
||||
*
|
||||
* @param filter The filter to update
|
||||
* @returns Observable of task instance filters with updated filter
|
||||
*/
|
||||
@@ -173,7 +178,7 @@ export class ServiceTaskFilterCloudService {
|
||||
return this.getTaskFiltersByKey(updatedFilter.appName, key).pipe(
|
||||
switchMap((filters: ServiceTaskFilterCloudModel[]) => {
|
||||
if (filters && filters.length === 0) {
|
||||
return this.createTaskFilters(updatedFilter.appName, key, <ServiceTaskFilterCloudModel[]> [updatedFilter]);
|
||||
return this.createTaskFilters(updatedFilter.appName, key, [updatedFilter]);
|
||||
} else {
|
||||
const itemIndex = filters.findIndex((filter: ServiceTaskFilterCloudModel) => filter.id === updatedFilter.id);
|
||||
filters[itemIndex] = updatedFilter;
|
||||
@@ -189,6 +194,7 @@ export class ServiceTaskFilterCloudService {
|
||||
|
||||
/**
|
||||
* Deletes a task filter
|
||||
*
|
||||
* @param filter The filter to delete
|
||||
* @returns Observable of task instance filters without deleted filter
|
||||
*/
|
||||
@@ -211,6 +217,7 @@ export class ServiceTaskFilterCloudService {
|
||||
|
||||
/**
|
||||
* Checks if given filter is a default filter
|
||||
*
|
||||
* @param filterName Name of the target task filter
|
||||
* @returns Boolean value for whether the filter is a default filter
|
||||
*/
|
||||
@@ -221,6 +228,7 @@ export class ServiceTaskFilterCloudService {
|
||||
|
||||
/**
|
||||
* Calls update preference api to update task filter
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @param key Key of the task filters
|
||||
* @param filters Details of update filter
|
||||
@@ -232,6 +240,7 @@ export class ServiceTaskFilterCloudService {
|
||||
|
||||
/**
|
||||
* Creates a uniq key with appName and username
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @returns String of task filters preference key
|
||||
*/
|
||||
@@ -241,6 +250,7 @@ export class ServiceTaskFilterCloudService {
|
||||
|
||||
/**
|
||||
* Finds and returns the task filters from preferences
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @returns Array of TaskFilterCloudModel
|
||||
*/
|
||||
@@ -251,6 +261,7 @@ export class ServiceTaskFilterCloudService {
|
||||
|
||||
/**
|
||||
* Creates and returns the default filters for a task app.
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @returns Array of TaskFilterCloudModel
|
||||
*/
|
||||
|
||||
+19
-7
@@ -64,6 +64,7 @@ export class TaskFilterCloudService extends BaseCloudService {
|
||||
|
||||
/**
|
||||
* Creates and returns the default task filters for an app.
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @returns Observable of default filters task filters just created or created filters
|
||||
*/
|
||||
@@ -85,6 +86,7 @@ export class TaskFilterCloudService extends BaseCloudService {
|
||||
|
||||
/**
|
||||
* Checks user preference are empty or not
|
||||
*
|
||||
* @param preferences User preferences of the target app
|
||||
* @returns Boolean value if the preferences are not empty
|
||||
*/
|
||||
@@ -94,6 +96,7 @@ export class TaskFilterCloudService extends BaseCloudService {
|
||||
|
||||
/**
|
||||
* Checks for task filters in given user preferences
|
||||
*
|
||||
* @param preferences User preferences of the target app
|
||||
* @param key Key of the task filters
|
||||
* @param filters Details of create filter
|
||||
@@ -106,6 +109,7 @@ export class TaskFilterCloudService extends BaseCloudService {
|
||||
|
||||
/**
|
||||
* Calls create preference api to create task filters
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @param key Key of the task instance filters
|
||||
* @param filters Details of new task filter
|
||||
@@ -117,6 +121,7 @@ export class TaskFilterCloudService extends BaseCloudService {
|
||||
|
||||
/**
|
||||
* Calls get preference api to get task filter by preference key
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @param key Key of the task filters
|
||||
* @returns Observable of task filters
|
||||
@@ -127,6 +132,7 @@ export class TaskFilterCloudService extends BaseCloudService {
|
||||
|
||||
/**
|
||||
* Gets all task filters for a task app.
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @returns Observable of task filter details
|
||||
*/
|
||||
@@ -137,6 +143,7 @@ export class TaskFilterCloudService extends BaseCloudService {
|
||||
|
||||
/**
|
||||
* Gets a task filter.
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @param id ID of the task
|
||||
* @returns Details of the task filter
|
||||
@@ -151,16 +158,13 @@ export class TaskFilterCloudService extends BaseCloudService {
|
||||
return of(filters);
|
||||
}
|
||||
}),
|
||||
map((filters: any) => {
|
||||
return filters.filter((filter: TaskFilterCloudModel) => {
|
||||
return filter.id === id;
|
||||
})[0];
|
||||
})
|
||||
map((filters: any) => filters.filter((filter: TaskFilterCloudModel) => filter.id === id)[0])
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new task filter.
|
||||
*
|
||||
* @param filter The new filter to add
|
||||
* @returns Observable of task instance filters with newly added filter
|
||||
*/
|
||||
@@ -169,7 +173,7 @@ export class TaskFilterCloudService extends BaseCloudService {
|
||||
return this.getTaskFiltersByKey(newFilter.appName, key).pipe(
|
||||
switchMap((filters: any) => {
|
||||
if (filters && filters.length === 0) {
|
||||
return this.createTaskFilters(newFilter.appName, key, <TaskFilterCloudModel[]> [newFilter]);
|
||||
return this.createTaskFilters(newFilter.appName, key, [newFilter]);
|
||||
} else {
|
||||
filters.push(newFilter);
|
||||
return this.preferenceService.updatePreference(newFilter.appName, key, filters);
|
||||
@@ -188,6 +192,7 @@ export class TaskFilterCloudService extends BaseCloudService {
|
||||
|
||||
/**
|
||||
* Updates a task filter.
|
||||
*
|
||||
* @param filter The filter to update
|
||||
* @returns Observable of task instance filters with updated filter
|
||||
*/
|
||||
@@ -196,7 +201,7 @@ export class TaskFilterCloudService extends BaseCloudService {
|
||||
return this.getTaskFiltersByKey(updatedFilter.appName, key).pipe(
|
||||
switchMap((filters: TaskFilterCloudModel[]) => {
|
||||
if (filters && filters.length === 0) {
|
||||
return this.createTaskFilters(updatedFilter.appName, key, <TaskFilterCloudModel[]> [updatedFilter]);
|
||||
return this.createTaskFilters(updatedFilter.appName, key, [updatedFilter]);
|
||||
} else {
|
||||
const itemIndex = filters.findIndex((filter: TaskFilterCloudModel) => filter.id === updatedFilter.id);
|
||||
filters[itemIndex] = updatedFilter;
|
||||
@@ -212,6 +217,7 @@ export class TaskFilterCloudService extends BaseCloudService {
|
||||
|
||||
/**
|
||||
* Deletes a task filter
|
||||
*
|
||||
* @param filter The filter to delete
|
||||
* @returns Observable of task instance filters without deleted filter
|
||||
*/
|
||||
@@ -234,6 +240,7 @@ export class TaskFilterCloudService extends BaseCloudService {
|
||||
|
||||
/**
|
||||
* Checks if given filter is a default filter
|
||||
*
|
||||
* @param filterName Name of the target task filter
|
||||
* @returns Boolean value for whether the filter is a default filter
|
||||
*/
|
||||
@@ -244,6 +251,7 @@ export class TaskFilterCloudService extends BaseCloudService {
|
||||
|
||||
/**
|
||||
* Finds a task using an object with optional query properties.
|
||||
*
|
||||
* @param requestNode Query object
|
||||
* @returns Task information
|
||||
*/
|
||||
@@ -266,6 +274,7 @@ export class TaskFilterCloudService extends BaseCloudService {
|
||||
|
||||
/**
|
||||
* Calls update preference api to update task filter
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @param key Key of the task filters
|
||||
* @param filters Details of update filter
|
||||
@@ -277,6 +286,7 @@ export class TaskFilterCloudService extends BaseCloudService {
|
||||
|
||||
/**
|
||||
* Creates a uniq key with appName and username
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @returns String of task filters preference key
|
||||
*/
|
||||
@@ -286,6 +296,7 @@ export class TaskFilterCloudService extends BaseCloudService {
|
||||
|
||||
/**
|
||||
* Finds and returns the task filters from preferences
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @returns Array of TaskFilterCloudModel
|
||||
*/
|
||||
@@ -296,6 +307,7 @@ export class TaskFilterCloudService extends BaseCloudService {
|
||||
|
||||
/**
|
||||
* Creates and returns the default filters for a task app.
|
||||
*
|
||||
* @param appName Name of the target app
|
||||
* @returns Array of TaskFilterCloudModel
|
||||
*/
|
||||
|
||||
+4
-6
@@ -19,7 +19,7 @@ import { TaskHeaderCloudComponent } from './task-header-cloud.component';
|
||||
import { of, throwError } from 'rxjs';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { ComponentFixture, TestBed, fakeAsync } from '@angular/core/testing';
|
||||
import { setupTestBed, AppConfigService, AlfrescoApiService, CardViewArrayItem } from '@alfresco/adf-core';
|
||||
import { setupTestBed, AppConfigService, AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module';
|
||||
import { TaskCloudService } from '../../services/task-cloud.service';
|
||||
import { TaskHeaderCloudModule } from '../task-header-cloud.module';
|
||||
@@ -53,9 +53,7 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
oauth2Auth: {
|
||||
callCustomApi: () => Promise.resolve({})
|
||||
},
|
||||
isEcmLoggedIn() {
|
||||
return false;
|
||||
},
|
||||
isEcmLoggedIn: () => false,
|
||||
reply: jasmine.createSpy('reply')
|
||||
};
|
||||
|
||||
@@ -292,7 +290,7 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
});
|
||||
|
||||
it('should not render defined edit icon for assignee property if the task in assigned state and shared among candidate groups', async () => {
|
||||
component.candidateGroups = <CardViewArrayItem[]> [{ value: 'mock-group-1', icon: 'edit' }, { value: 'mock-group-2', icon: 'edit' }];
|
||||
component.candidateGroups = [{ value: 'mock-group-1', icon: 'edit' }, { value: 'mock-group-2', icon: 'edit' }];
|
||||
component.candidateUsers = [];
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
@@ -303,7 +301,7 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
|
||||
it('should not render defined edit icon for assignee property if the task in created state and shared among condidate groups', async () => {
|
||||
getTaskByIdSpy.and.returnValue(of(createdTaskDetailsCloudMock));
|
||||
component.candidateGroups = <CardViewArrayItem[]> [{ value: 'mock-group-1', icon: 'edit' }, { value: 'mock-group-2', icon: 'edit' }];
|
||||
component.candidateGroups = [{ value: 'mock-group-1', icon: 'edit' }, { value: 'mock-group-2', icon: 'edit' }];
|
||||
component.candidateUsers = [];
|
||||
component.ngOnChanges();
|
||||
fixture.detectChanges();
|
||||
|
||||
+2
-2
@@ -127,8 +127,8 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
|
||||
finalize(() => (this.isLoading = false))
|
||||
).subscribe(([taskDetails, candidateUsers, candidateGroups]) => {
|
||||
this.taskDetails = taskDetails;
|
||||
this.candidateGroups = candidateGroups.map((user) => <CardViewArrayItem> { icon: 'group', value: user });
|
||||
this.candidateUsers = candidateUsers.map((group) => <CardViewArrayItem> { icon: 'person', value: group });
|
||||
this.candidateGroups = candidateGroups.map((user) => ({ icon: 'group', value: user } as CardViewArrayItem));
|
||||
this.candidateUsers = candidateUsers.map((group) => ({ icon: 'person', value: group } as CardViewArrayItem));
|
||||
if (this.taskDetails.parentTaskId) {
|
||||
this.loadParentName(`${this.taskDetails.parentTaskId}`);
|
||||
} else {
|
||||
|
||||
@@ -16,16 +16,16 @@
|
||||
*/
|
||||
|
||||
export const taskClaimCloudMock: any = {
|
||||
'entry': {
|
||||
'appName': 'simple-app',
|
||||
'appVersion': '',
|
||||
'serviceName': 'simple-app',
|
||||
'serviceFullName': 'simple-app',
|
||||
'serviceType': 'runtime-bundle',
|
||||
'serviceVersion': '',
|
||||
'id': '68d54a8f',
|
||||
'name': 'NXltAGmT',
|
||||
'priority': 0,
|
||||
'status': 'COMPLETED'
|
||||
entry: {
|
||||
appName: 'simple-app',
|
||||
appVersion: '',
|
||||
serviceName: 'simple-app',
|
||||
serviceFullName: 'simple-app',
|
||||
serviceType: 'runtime-bundle',
|
||||
serviceVersion: '',
|
||||
id: '68d54a8f',
|
||||
name: 'NXltAGmT',
|
||||
priority: 0,
|
||||
status: 'COMPLETED'
|
||||
}
|
||||
};
|
||||
|
||||
+11
-11
@@ -16,16 +16,16 @@
|
||||
*/
|
||||
|
||||
export const taskCompleteCloudMock: any = {
|
||||
'entry': {
|
||||
'appName': 'simple-app',
|
||||
'appVersion': '',
|
||||
'serviceName': 'simple-app',
|
||||
'serviceFullName': 'simple-app',
|
||||
'serviceType': 'runtime-bundle',
|
||||
'serviceVersion': '',
|
||||
'id': '68d54a8f',
|
||||
'name': 'NXltAGmT',
|
||||
'priority': 0,
|
||||
'status': 'COMPLETED'
|
||||
entry: {
|
||||
appName: 'simple-app',
|
||||
appVersion: '',
|
||||
serviceName: 'simple-app',
|
||||
serviceFullName: 'simple-app',
|
||||
serviceType: 'runtime-bundle',
|
||||
serviceVersion: '',
|
||||
id: '68d54a8f',
|
||||
name: 'NXltAGmT',
|
||||
priority: 0,
|
||||
status: 'COMPLETED'
|
||||
}
|
||||
};
|
||||
|
||||
+22
-22
@@ -16,27 +16,27 @@
|
||||
*/
|
||||
|
||||
export const fakeTaskDetailsCloud = {
|
||||
'entry': {
|
||||
'appName': 'task-app',
|
||||
'appVersion': '',
|
||||
'id': '68d54a8f',
|
||||
'assignee': 'Phil Woods',
|
||||
'name': 'This is a new task',
|
||||
'description': 'This is the description ',
|
||||
'createdDate': 1545048055900,
|
||||
'dueDate': 1545091200000,
|
||||
'claimedDate': 1545140162601,
|
||||
'priority': 0,
|
||||
'category': null,
|
||||
'processDefinitionId': null,
|
||||
'processInstanceId': null,
|
||||
'status': 'ASSIGNED',
|
||||
'owner': 'Phil Woods',
|
||||
'parentTaskId': null,
|
||||
'formKey': null,
|
||||
'lastModified': 1545140162601,
|
||||
'lastModifiedTo': null,
|
||||
'lastModifiedFrom': null,
|
||||
'standalone': true
|
||||
entry: {
|
||||
appName: 'task-app',
|
||||
appVersion: '',
|
||||
id: '68d54a8f',
|
||||
assignee: 'Phil Woods',
|
||||
name: 'This is a new task',
|
||||
description: 'This is the description ',
|
||||
createdDate: 1545048055900,
|
||||
dueDate: 1545091200000,
|
||||
claimedDate: 1545140162601,
|
||||
priority: 0,
|
||||
category: null,
|
||||
processDefinitionId: null,
|
||||
processInstanceId: null,
|
||||
status: 'ASSIGNED',
|
||||
owner: 'Phil Woods',
|
||||
parentTaskId: null,
|
||||
formKey: null,
|
||||
lastModified: 1545140162601,
|
||||
lastModifiedTo: null,
|
||||
lastModifiedFrom: null,
|
||||
standalone: true
|
||||
}
|
||||
};
|
||||
|
||||
+227
-227
@@ -18,263 +18,263 @@
|
||||
import { TaskDetailsCloudModel } from '../../start-task/models/task-details-cloud.model';
|
||||
|
||||
export const taskDetailsWithParentTaskIdMock: TaskDetailsCloudModel = {
|
||||
'appName': 'task-app',
|
||||
'appVersion': 1,
|
||||
'id': '68d54a8f-01f3-11e9-8e36-0a58646002ad',
|
||||
'assignee': 'AssignedTaskUser',
|
||||
'name': 'This is a parent task name ',
|
||||
'description': 'This is the description ',
|
||||
'createdDate': new Date(1545048055900),
|
||||
'dueDate': new Date(),
|
||||
'claimedDate': null,
|
||||
'priority': 5,
|
||||
'category': null,
|
||||
'processDefinitionId': null,
|
||||
'processInstanceId': null,
|
||||
'status': 'ASSIGNED',
|
||||
'owner': 'ownerUser',
|
||||
'parentTaskId': 'mock-parent-task-id',
|
||||
'formKey': null,
|
||||
'lastModified': new Date(1545048055900),
|
||||
'lastModifiedTo': null,
|
||||
'lastModifiedFrom': null,
|
||||
'standalone': true
|
||||
appName: 'task-app',
|
||||
appVersion: 1,
|
||||
id: '68d54a8f-01f3-11e9-8e36-0a58646002ad',
|
||||
assignee: 'AssignedTaskUser',
|
||||
name: 'This is a parent task name ',
|
||||
description: 'This is the description ',
|
||||
createdDate: new Date(1545048055900),
|
||||
dueDate: new Date(),
|
||||
claimedDate: null,
|
||||
priority: 5,
|
||||
category: null,
|
||||
processDefinitionId: null,
|
||||
processInstanceId: null,
|
||||
status: 'ASSIGNED',
|
||||
owner: 'ownerUser',
|
||||
parentTaskId: 'mock-parent-task-id',
|
||||
formKey: null,
|
||||
lastModified: new Date(1545048055900),
|
||||
lastModifiedTo: null,
|
||||
lastModifiedFrom: null,
|
||||
standalone: true
|
||||
};
|
||||
|
||||
export const assignedTaskDetailsCloudMock: TaskDetailsCloudModel = {
|
||||
'appName': 'task-app',
|
||||
'appVersion': 1,
|
||||
'id': '68d54a8f-01f3-11e9-8e36-0a58646002ad',
|
||||
'assignee': 'AssignedTaskUser',
|
||||
'name': 'This is a new task',
|
||||
'description': 'This is the description ',
|
||||
'createdDate': new Date(1545048055900),
|
||||
'dueDate': new Date(),
|
||||
'claimedDate': null,
|
||||
'priority': 1,
|
||||
'category': null,
|
||||
'processDefinitionId': null,
|
||||
'processInstanceId': null,
|
||||
'status': 'ASSIGNED',
|
||||
'owner': 'ownerUser',
|
||||
'parentTaskId': null,
|
||||
'formKey': null,
|
||||
'lastModified': new Date(1545048055900),
|
||||
'lastModifiedTo': null,
|
||||
'lastModifiedFrom': null,
|
||||
'standalone': true
|
||||
appName: 'task-app',
|
||||
appVersion: 1,
|
||||
id: '68d54a8f-01f3-11e9-8e36-0a58646002ad',
|
||||
assignee: 'AssignedTaskUser',
|
||||
name: 'This is a new task',
|
||||
description: 'This is the description ',
|
||||
createdDate: new Date(1545048055900),
|
||||
dueDate: new Date(),
|
||||
claimedDate: null,
|
||||
priority: 1,
|
||||
category: null,
|
||||
processDefinitionId: null,
|
||||
processInstanceId: null,
|
||||
status: 'ASSIGNED',
|
||||
owner: 'ownerUser',
|
||||
parentTaskId: null,
|
||||
formKey: null,
|
||||
lastModified: new Date(1545048055900),
|
||||
lastModifiedTo: null,
|
||||
lastModifiedFrom: null,
|
||||
standalone: true
|
||||
};
|
||||
|
||||
export const createdTaskDetailsCloudMock: TaskDetailsCloudModel = {
|
||||
'appName': 'task-app',
|
||||
'appVersion': 1,
|
||||
'id': '68d54a8f-01f3-11e9-8e36-0a58646002ad',
|
||||
'assignee': 'CreatedTaskUser',
|
||||
'name': 'This is a new task',
|
||||
'description': 'This is the description ',
|
||||
'createdDate': new Date(1545048055900),
|
||||
'dueDate': new Date(1545091200000),
|
||||
'claimedDate': null,
|
||||
'priority': 5,
|
||||
'category': null,
|
||||
'processDefinitionId': null,
|
||||
'processInstanceId': null,
|
||||
'status': 'CREATED',
|
||||
'owner': 'ownerUser',
|
||||
'parentTaskId': null,
|
||||
'formKey': null,
|
||||
'lastModified': new Date(1545048055900),
|
||||
'lastModifiedTo': null,
|
||||
'lastModifiedFrom': null,
|
||||
'standalone': true
|
||||
appName: 'task-app',
|
||||
appVersion: 1,
|
||||
id: '68d54a8f-01f3-11e9-8e36-0a58646002ad',
|
||||
assignee: 'CreatedTaskUser',
|
||||
name: 'This is a new task',
|
||||
description: 'This is the description ',
|
||||
createdDate: new Date(1545048055900),
|
||||
dueDate: new Date(1545091200000),
|
||||
claimedDate: null,
|
||||
priority: 5,
|
||||
category: null,
|
||||
processDefinitionId: null,
|
||||
processInstanceId: null,
|
||||
status: 'CREATED',
|
||||
owner: 'ownerUser',
|
||||
parentTaskId: null,
|
||||
formKey: null,
|
||||
lastModified: new Date(1545048055900),
|
||||
lastModifiedTo: null,
|
||||
lastModifiedFrom: null,
|
||||
standalone: true
|
||||
};
|
||||
|
||||
export const emptyOwnerTaskDetailsCloudMock: TaskDetailsCloudModel = {
|
||||
'appName': 'task-app',
|
||||
'appVersion': 1,
|
||||
'id': '68d54a8f-01f3-11e9-8e36-0a58646002ad',
|
||||
'assignee': 'AssignedTaskUser',
|
||||
'name': 'This is a new task',
|
||||
'description': 'This is the description ',
|
||||
'createdDate': new Date(1545048055900),
|
||||
'dueDate': new Date(1545091200000),
|
||||
'claimedDate': null,
|
||||
'priority': 5,
|
||||
'category': null,
|
||||
'processDefinitionId': null,
|
||||
'processInstanceId': null,
|
||||
'status': 'ASSIGNED',
|
||||
'owner': null,
|
||||
'parentTaskId': null,
|
||||
'formKey': null,
|
||||
'lastModified': new Date(1545048055900),
|
||||
'lastModifiedTo': null,
|
||||
'lastModifiedFrom': null,
|
||||
'standalone': true
|
||||
appName: 'task-app',
|
||||
appVersion: 1,
|
||||
id: '68d54a8f-01f3-11e9-8e36-0a58646002ad',
|
||||
assignee: 'AssignedTaskUser',
|
||||
name: 'This is a new task',
|
||||
description: 'This is the description ',
|
||||
createdDate: new Date(1545048055900),
|
||||
dueDate: new Date(1545091200000),
|
||||
claimedDate: null,
|
||||
priority: 5,
|
||||
category: null,
|
||||
processDefinitionId: null,
|
||||
processInstanceId: null,
|
||||
status: 'ASSIGNED',
|
||||
owner: null,
|
||||
parentTaskId: null,
|
||||
formKey: null,
|
||||
lastModified: new Date(1545048055900),
|
||||
lastModifiedTo: null,
|
||||
lastModifiedFrom: null,
|
||||
standalone: true
|
||||
};
|
||||
|
||||
export const createdStateTaskDetailsCloudMock: TaskDetailsCloudModel = {
|
||||
'appName': 'mock-app-name',
|
||||
'appVersion': 1,
|
||||
'id': 'mock-task-id',
|
||||
'assignee': '',
|
||||
'name': 'This is a new task',
|
||||
'description': 'This is the description ',
|
||||
'createdDate': new Date(1545048055900),
|
||||
'dueDate': new Date(1545091200000),
|
||||
'claimedDate': null,
|
||||
'priority': 5,
|
||||
'category': null,
|
||||
'processDefinitionId': null,
|
||||
'processInstanceId': null,
|
||||
'status': 'CREATED',
|
||||
'owner': 'ownerUser',
|
||||
'parentTaskId': null,
|
||||
'formKey': null,
|
||||
'lastModified': new Date(1545048055900),
|
||||
'lastModifiedTo': null,
|
||||
'lastModifiedFrom': null,
|
||||
'standalone': false
|
||||
appName: 'mock-app-name',
|
||||
appVersion: 1,
|
||||
id: 'mock-task-id',
|
||||
assignee: '',
|
||||
name: 'This is a new task',
|
||||
description: 'This is the description ',
|
||||
createdDate: new Date(1545048055900),
|
||||
dueDate: new Date(1545091200000),
|
||||
claimedDate: null,
|
||||
priority: 5,
|
||||
category: null,
|
||||
processDefinitionId: null,
|
||||
processInstanceId: null,
|
||||
status: 'CREATED',
|
||||
owner: 'ownerUser',
|
||||
parentTaskId: null,
|
||||
formKey: null,
|
||||
lastModified: new Date(1545048055900),
|
||||
lastModifiedTo: null,
|
||||
lastModifiedFrom: null,
|
||||
standalone: false
|
||||
};
|
||||
|
||||
export const completedTaskDetailsCloudMock: TaskDetailsCloudModel = {
|
||||
'appName': 'mock-app-name',
|
||||
'appVersion': 1,
|
||||
'id': 'mock-task-id',
|
||||
'assignee': 'CompletedTaskAssignee',
|
||||
'name': 'This is a new task',
|
||||
'description': 'This is the description ',
|
||||
'createdDate': new Date(1545048055900),
|
||||
'dueDate': new Date(1545091200000),
|
||||
'completedDate': new Date(1546091200000),
|
||||
'claimedDate': null,
|
||||
'priority': 5,
|
||||
'category': null,
|
||||
'processDefinitionId': null,
|
||||
'processInstanceId': null,
|
||||
'status': 'COMPLETED',
|
||||
'owner': 'ownerUser',
|
||||
'parentTaskId': null,
|
||||
'formKey': null,
|
||||
'lastModified': new Date(1545048055900),
|
||||
'lastModifiedTo': null,
|
||||
'lastModifiedFrom': null,
|
||||
'standalone': false
|
||||
appName: 'mock-app-name',
|
||||
appVersion: 1,
|
||||
id: 'mock-task-id',
|
||||
assignee: 'CompletedTaskAssignee',
|
||||
name: 'This is a new task',
|
||||
description: 'This is the description ',
|
||||
createdDate: new Date(1545048055900),
|
||||
dueDate: new Date(1545091200000),
|
||||
completedDate: new Date(1546091200000),
|
||||
claimedDate: null,
|
||||
priority: 5,
|
||||
category: null,
|
||||
processDefinitionId: null,
|
||||
processInstanceId: null,
|
||||
status: 'COMPLETED',
|
||||
owner: 'ownerUser',
|
||||
parentTaskId: null,
|
||||
formKey: null,
|
||||
lastModified: new Date(1545048055900),
|
||||
lastModifiedTo: null,
|
||||
lastModifiedFrom: null,
|
||||
standalone: false
|
||||
};
|
||||
|
||||
export const cancelledTaskDetailsCloudMock: TaskDetailsCloudModel = {
|
||||
'appName': 'mock-app-name',
|
||||
'appVersion': 1,
|
||||
'id': 'mock-task-id',
|
||||
'assignee': 'CancelledTaskAssignee',
|
||||
'name': 'This is a new task',
|
||||
'description': 'This is the description ',
|
||||
'createdDate': new Date(1545048055900),
|
||||
'dueDate': new Date(1545091200000),
|
||||
'claimedDate': null,
|
||||
'priority': 5,
|
||||
'category': null,
|
||||
'processDefinitionId': null,
|
||||
'processInstanceId': null,
|
||||
'status': 'CANCELLED',
|
||||
'owner': 'ownerUser',
|
||||
'parentTaskId': null,
|
||||
'formKey': null,
|
||||
'lastModified': new Date(1545048055900),
|
||||
'lastModifiedTo': null,
|
||||
'lastModifiedFrom': null,
|
||||
'standalone': true
|
||||
appName: 'mock-app-name',
|
||||
appVersion: 1,
|
||||
id: 'mock-task-id',
|
||||
assignee: 'CancelledTaskAssignee',
|
||||
name: 'This is a new task',
|
||||
description: 'This is the description ',
|
||||
createdDate: new Date(1545048055900),
|
||||
dueDate: new Date(1545091200000),
|
||||
claimedDate: null,
|
||||
priority: 5,
|
||||
category: null,
|
||||
processDefinitionId: null,
|
||||
processInstanceId: null,
|
||||
status: 'CANCELLED',
|
||||
owner: 'ownerUser',
|
||||
parentTaskId: null,
|
||||
formKey: null,
|
||||
lastModified: new Date(1545048055900),
|
||||
lastModifiedTo: null,
|
||||
lastModifiedFrom: null,
|
||||
standalone: true
|
||||
};
|
||||
|
||||
export const suspendedTaskDetailsCloudMock: TaskDetailsCloudModel = {
|
||||
'appName': 'mock-app-name',
|
||||
'appVersion': 1,
|
||||
'id': 'mock-task-id',
|
||||
'assignee': 'SuspendedTaskAssignee',
|
||||
'name': 'This is a new task',
|
||||
'description': 'This is the description ',
|
||||
'createdDate': new Date(1545048055900),
|
||||
'dueDate': new Date(1545091200000),
|
||||
'claimedDate': null,
|
||||
'priority': 5,
|
||||
'category': null,
|
||||
'processDefinitionId': null,
|
||||
'processInstanceId': null,
|
||||
'status': 'SUSPENDED',
|
||||
'owner': 'ownerUser',
|
||||
'parentTaskId': null,
|
||||
'formKey': null,
|
||||
'lastModified': new Date(1545048055900),
|
||||
'lastModifiedTo': null,
|
||||
'lastModifiedFrom': null,
|
||||
'standalone': true
|
||||
appName: 'mock-app-name',
|
||||
appVersion: 1,
|
||||
id: 'mock-task-id',
|
||||
assignee: 'SuspendedTaskAssignee',
|
||||
name: 'This is a new task',
|
||||
description: 'This is the description ',
|
||||
createdDate: new Date(1545048055900),
|
||||
dueDate: new Date(1545091200000),
|
||||
claimedDate: null,
|
||||
priority: 5,
|
||||
category: null,
|
||||
processDefinitionId: null,
|
||||
processInstanceId: null,
|
||||
status: 'SUSPENDED',
|
||||
owner: 'ownerUser',
|
||||
parentTaskId: null,
|
||||
formKey: null,
|
||||
lastModified: new Date(1545048055900),
|
||||
lastModifiedTo: null,
|
||||
lastModifiedFrom: null,
|
||||
standalone: true
|
||||
};
|
||||
|
||||
export const noCandidateUsersTaskDetailsCloudMock: TaskDetailsCloudModel = {
|
||||
'appName': 'mock-app-name',
|
||||
'appVersion': 1,
|
||||
'id': 'mock-task-id',
|
||||
'assignee': '',
|
||||
'name': 'This is a new task',
|
||||
'description': 'This is the description ',
|
||||
'createdDate': new Date(1545048055900),
|
||||
'dueDate': new Date(1545091200000),
|
||||
'claimedDate': null,
|
||||
'priority': 5,
|
||||
'category': null,
|
||||
'processDefinitionId': null,
|
||||
'processInstanceId': null,
|
||||
'status': 'CREATED',
|
||||
'owner': 'ownerUser',
|
||||
'candidateUsers': null,
|
||||
'parentTaskId': null,
|
||||
'formKey': null,
|
||||
'lastModified': new Date(1545048055900),
|
||||
'lastModifiedTo': null,
|
||||
'lastModifiedFrom': null,
|
||||
'standalone': false
|
||||
appName: 'mock-app-name',
|
||||
appVersion: 1,
|
||||
id: 'mock-task-id',
|
||||
assignee: '',
|
||||
name: 'This is a new task',
|
||||
description: 'This is the description ',
|
||||
createdDate: new Date(1545048055900),
|
||||
dueDate: new Date(1545091200000),
|
||||
claimedDate: null,
|
||||
priority: 5,
|
||||
category: null,
|
||||
processDefinitionId: null,
|
||||
processInstanceId: null,
|
||||
status: 'CREATED',
|
||||
owner: 'ownerUser',
|
||||
candidateUsers: null,
|
||||
parentTaskId: null,
|
||||
formKey: null,
|
||||
lastModified: new Date(1545048055900),
|
||||
lastModifiedTo: null,
|
||||
lastModifiedFrom: null,
|
||||
standalone: false
|
||||
};
|
||||
|
||||
export const noCandidateGroupsTaskDetailsCloudMock: TaskDetailsCloudModel = {
|
||||
'appName': 'mock-app-name',
|
||||
'appVersion': 1,
|
||||
'id': 'mock-task-id',
|
||||
'assignee': '',
|
||||
'name': 'This is a new task',
|
||||
'description': 'This is the description ',
|
||||
'createdDate': new Date(1545048055900),
|
||||
'dueDate': new Date(1545091200000),
|
||||
'claimedDate': null,
|
||||
'priority': 5,
|
||||
'category': null,
|
||||
'processDefinitionId': null,
|
||||
'processInstanceId': null,
|
||||
'status': 'CREATED',
|
||||
'owner': 'ownerUser',
|
||||
'candidateGroups': null,
|
||||
'parentTaskId': null,
|
||||
'formKey': null,
|
||||
'lastModified': new Date(1545048055900),
|
||||
'lastModifiedTo': null,
|
||||
'lastModifiedFrom': null,
|
||||
'standalone': false
|
||||
appName: 'mock-app-name',
|
||||
appVersion: 1,
|
||||
id: 'mock-task-id',
|
||||
assignee: '',
|
||||
name: 'This is a new task',
|
||||
description: 'This is the description ',
|
||||
createdDate: new Date(1545048055900),
|
||||
dueDate: new Date(1545091200000),
|
||||
claimedDate: null,
|
||||
priority: 5,
|
||||
category: null,
|
||||
processDefinitionId: null,
|
||||
processInstanceId: null,
|
||||
status: 'CREATED',
|
||||
owner: 'ownerUser',
|
||||
candidateGroups: null,
|
||||
parentTaskId: null,
|
||||
formKey: null,
|
||||
lastModified: new Date(1545048055900),
|
||||
lastModifiedTo: null,
|
||||
lastModifiedFrom: null,
|
||||
standalone: false
|
||||
};
|
||||
|
||||
export const taskWithFormDetailsMock: TaskDetailsCloudModel = {
|
||||
'appName': 'mock-app-name',
|
||||
'assignee': 'AssignedTaskUser',
|
||||
'completedDate': null,
|
||||
'createdDate': new Date(1555419255340),
|
||||
'dueDate': new Date(1558419255340),
|
||||
'description': null,
|
||||
'formKey': '4',
|
||||
'priority': 1,
|
||||
'parentTaskId': 'bd6b1741-6046-11e9-80f0-0a586460040d',
|
||||
'id': 'bd6b1741-6046-11e9-80f0-0a586460040d',
|
||||
'name': 'Task1',
|
||||
'owner': 'fakeAdmin',
|
||||
'standalone': true,
|
||||
'status': 'ASSIGNED'
|
||||
appName: 'mock-app-name',
|
||||
assignee: 'AssignedTaskUser',
|
||||
completedDate: null,
|
||||
createdDate: new Date(1555419255340),
|
||||
dueDate: new Date(1558419255340),
|
||||
description: null,
|
||||
formKey: '4',
|
||||
priority: 1,
|
||||
parentTaskId: 'bd6b1741-6046-11e9-80f0-0a586460040d',
|
||||
id: 'bd6b1741-6046-11e9-80f0-0a586460040d',
|
||||
name: 'Task1',
|
||||
owner: 'fakeAdmin',
|
||||
standalone: true,
|
||||
status: 'ASSIGNED'
|
||||
};
|
||||
|
||||
export const taskDetailsContainer = {
|
||||
|
||||
+2
-1
@@ -124,7 +124,7 @@ export abstract class BaseTaskListCloudComponent extends DataTableSchema impleme
|
||||
super(appConfigService, presetKey, taskPresetsCloudDefaultModel);
|
||||
this.size = userPreferences.paginationSize;
|
||||
|
||||
this.pagination = new BehaviorSubject<PaginationModel>(<PaginationModel> {
|
||||
this.pagination = new BehaviorSubject<PaginationModel>({
|
||||
maxItems: this.size,
|
||||
skipCount: 0,
|
||||
totalItems: 0
|
||||
@@ -184,6 +184,7 @@ export abstract class BaseTaskListCloudComponent extends DataTableSchema impleme
|
||||
/**
|
||||
* Resets the pagination values and
|
||||
* Reloads the task list
|
||||
*
|
||||
* @param pagination Pagination values to be set
|
||||
*/
|
||||
updatePagination(pagination: PaginationModel) {
|
||||
|
||||
+30
-30
@@ -93,19 +93,19 @@ describe('ServiceTaskListCloudComponent', () => {
|
||||
component = fixture.componentInstance;
|
||||
appConfig.config = Object.assign(appConfig.config, {
|
||||
'adf-cloud-service-task-list': {
|
||||
'presets': {
|
||||
'fakeCustomSchema': [
|
||||
presets: {
|
||||
fakeCustomSchema: [
|
||||
{
|
||||
'key': 'fakeName',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_TASK_LIST.PROPERTIES.FAKE',
|
||||
'sortable': true
|
||||
key: 'fakeName',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.FAKE',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
'key': 'fakeTaskName',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_TASK_LIST.PROPERTIES.TASK_FAKE',
|
||||
'sortable': true
|
||||
key: 'fakeTaskName',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.TASK_FAKE',
|
||||
sortable: true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -209,7 +209,7 @@ describe('ServiceTaskListCloudComponent', () => {
|
||||
done();
|
||||
});
|
||||
component.appName = appName.currentValue;
|
||||
component.ngOnChanges({ 'appName': appName });
|
||||
component.ngOnChanges({ appName });
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
@@ -257,7 +257,7 @@ describe('ServiceTaskListCloudComponent', () => {
|
||||
component.queryParams.status = 'mock-status';
|
||||
const queryParams = new SimpleChange(undefined, { status: 'mock-status' }, true);
|
||||
component.ngOnChanges({
|
||||
'queryParams': queryParams
|
||||
queryParams
|
||||
});
|
||||
fixture.detectChanges();
|
||||
expect(component.isListEmpty()).toBeFalsy();
|
||||
@@ -277,7 +277,7 @@ describe('ServiceTaskListCloudComponent', () => {
|
||||
];
|
||||
const sortChange = new SimpleChange(undefined, mockSort, true);
|
||||
component.ngOnChanges({
|
||||
'sorting': sortChange
|
||||
sorting: sortChange
|
||||
});
|
||||
fixture.detectChanges();
|
||||
expect(component.formatSorting).toHaveBeenCalledWith(mockSort);
|
||||
@@ -404,13 +404,13 @@ describe('ServiceTaskListCloudComponent', () => {
|
||||
const appName = new SimpleChange(null, 'FAKE-APP-NAME', true);
|
||||
copyFixture.whenStable().then(() => {
|
||||
copyFixture.detectChanges();
|
||||
const spanHTMLElement = <HTMLInputElement> element.querySelector('span[title="04fdf69f-4ddd-48ab-9563-da776c9b163c"]');
|
||||
const spanHTMLElement = element.querySelector<HTMLInputElement>('span[title="04fdf69f-4ddd-48ab-9563-da776c9b163c"]');
|
||||
spanHTMLElement.dispatchEvent(new Event('mouseenter'));
|
||||
copyFixture.detectChanges();
|
||||
expect(copyFixture.debugElement.nativeElement.querySelector('.adf-copy-tooltip')).not.toBeNull();
|
||||
});
|
||||
customCopyComponent.taskList.appName = appName.currentValue;
|
||||
customCopyComponent.taskList.ngOnChanges({ 'appName': appName });
|
||||
customCopyComponent.taskList.ngOnChanges({ appName });
|
||||
copyFixture.detectChanges();
|
||||
}));
|
||||
|
||||
@@ -419,7 +419,7 @@ describe('ServiceTaskListCloudComponent', () => {
|
||||
customCopyComponent.taskList.success.subscribe(() => {
|
||||
copyFixture.whenStable().then(() => {
|
||||
copyFixture.detectChanges();
|
||||
const spanHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('span[title="serviceTaskName"]');
|
||||
const spanHTMLElement = element.querySelector<HTMLInputElement>('span[title="serviceTaskName"]');
|
||||
spanHTMLElement.dispatchEvent(new Event('mouseenter'));
|
||||
copyFixture.detectChanges();
|
||||
expect(copyFixture.debugElement.nativeElement.querySelector('.adf-copy-tooltip')).toBeNull();
|
||||
@@ -427,7 +427,7 @@ describe('ServiceTaskListCloudComponent', () => {
|
||||
});
|
||||
});
|
||||
customCopyComponent.taskList.appName = appName.currentValue;
|
||||
customCopyComponent.taskList.ngOnChanges({ 'appName': appName });
|
||||
customCopyComponent.taskList.ngOnChanges({ appName });
|
||||
copyFixture.detectChanges();
|
||||
});
|
||||
});
|
||||
@@ -449,20 +449,20 @@ describe('ServiceTaskListCloudComponent', () => {
|
||||
serviceTaskListCloudService = TestBed.inject(ServiceTaskListCloudService);
|
||||
appConfig.config = Object.assign(appConfig.config, {
|
||||
'adf-cloud-service-task-list': {
|
||||
'presets': {
|
||||
'fakeCustomSchema': [
|
||||
presets: {
|
||||
fakeCustomSchema: [
|
||||
{
|
||||
'key': 'id',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_TASK_LIST.PROPERTIES.FAKE',
|
||||
'sortable': true,
|
||||
'copyContent': true
|
||||
key: 'id',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.FAKE',
|
||||
sortable: true,
|
||||
copyContent: true
|
||||
},
|
||||
{
|
||||
'key': 'activityName',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_TASK_LIST.PROPERTIES.TASK_FAKE',
|
||||
'sortable': true
|
||||
key: 'activityName',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.TASK_FAKE',
|
||||
sortable: true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -494,7 +494,7 @@ describe('ServiceTaskListCloudComponent', () => {
|
||||
|
||||
component.presetColumn = 'fakeCustomSchema';
|
||||
component.appName = appName.currentValue;
|
||||
component.ngOnChanges({ 'appName': appName });
|
||||
component.ngOnChanges({ appName });
|
||||
component.ngAfterContentInit();
|
||||
}));
|
||||
|
||||
@@ -512,7 +512,7 @@ describe('ServiceTaskListCloudComponent', () => {
|
||||
});
|
||||
component.presetColumn = 'fakeCustomSchema';
|
||||
component.appName = appName.currentValue;
|
||||
component.ngOnChanges({ 'appName': appName });
|
||||
component.ngOnChanges({ appName });
|
||||
component.ngAfterContentInit();
|
||||
}));
|
||||
});
|
||||
|
||||
+3
-4
@@ -24,6 +24,8 @@ import { BaseTaskListCloudComponent } from './base-task-list-cloud.component';
|
||||
import { ServiceTaskListCloudService } from '../services/service-task-list-cloud.service';
|
||||
import { TaskCloudService } from '../../services/task-cloud.service';
|
||||
|
||||
const PRESET_KEY = 'adf-cloud-service-task-list.presets';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-cloud-service-task-list',
|
||||
templateUrl: './base-task-list-cloud.component.html',
|
||||
@@ -31,9 +33,6 @@ import { TaskCloudService } from '../../services/task-cloud.service';
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class ServiceTaskListCloudComponent extends BaseTaskListCloudComponent {
|
||||
|
||||
static PRESET_KEY = 'adf-cloud-service-task-list.presets';
|
||||
|
||||
@Input()
|
||||
queryParams: { [key: string]: any } = {};
|
||||
|
||||
@@ -41,7 +40,7 @@ export class ServiceTaskListCloudComponent extends BaseTaskListCloudComponent {
|
||||
appConfigService: AppConfigService,
|
||||
taskCloudService: TaskCloudService,
|
||||
userPreferences: UserPreferencesService) {
|
||||
super(appConfigService, taskCloudService, userPreferences, ServiceTaskListCloudComponent.PRESET_KEY);
|
||||
super(appConfigService, taskCloudService, userPreferences, PRESET_KEY);
|
||||
}
|
||||
|
||||
load(requestNode: ServiceTaskQueryCloudRequestModel) {
|
||||
|
||||
+39
-39
@@ -98,19 +98,19 @@ describe('TaskListCloudComponent', () => {
|
||||
component = fixture.componentInstance;
|
||||
appConfig.config = Object.assign(appConfig.config, {
|
||||
'adf-cloud-task-list': {
|
||||
'presets': {
|
||||
'fakeCustomSchema': [
|
||||
presets: {
|
||||
fakeCustomSchema: [
|
||||
{
|
||||
'key': 'fakeName',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_TASK_LIST.PROPERTIES.FAKE',
|
||||
'sortable': true
|
||||
key: 'fakeName',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.FAKE',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
'key': 'fakeTaskName',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_TASK_LIST.PROPERTIES.TASK_FAKE',
|
||||
'sortable': true
|
||||
key: 'fakeTaskName',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.TASK_FAKE',
|
||||
sortable: true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -221,7 +221,7 @@ describe('TaskListCloudComponent', () => {
|
||||
done();
|
||||
});
|
||||
component.appName = appName.currentValue;
|
||||
component.ngOnChanges({ 'appName': appName });
|
||||
component.ngOnChanges({ appName });
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
@@ -275,10 +275,10 @@ describe('TaskListCloudComponent', () => {
|
||||
const lastModifiedFromChange = new SimpleChange(undefined, 'mock-lastmodified-date', true);
|
||||
const ownerChange = new SimpleChange(undefined, 'mock-owner-name', true);
|
||||
component.ngOnChanges({
|
||||
'priority': priorityChange,
|
||||
'status': statusChange,
|
||||
'lastModifiedFrom': lastModifiedFromChange,
|
||||
'owner': ownerChange
|
||||
priority: priorityChange,
|
||||
status: statusChange,
|
||||
lastModifiedFrom: lastModifiedFromChange,
|
||||
owner: ownerChange
|
||||
});
|
||||
fixture.detectChanges();
|
||||
expect(component.isListEmpty()).toBeFalsy();
|
||||
@@ -298,7 +298,7 @@ describe('TaskListCloudComponent', () => {
|
||||
];
|
||||
const sortChange = new SimpleChange(undefined, mockSort, true);
|
||||
component.ngOnChanges({
|
||||
'sorting': sortChange
|
||||
sorting: sortChange
|
||||
});
|
||||
fixture.detectChanges();
|
||||
expect(component.formatSorting).toHaveBeenCalledWith(mockSort);
|
||||
@@ -383,7 +383,7 @@ describe('TaskListCloudComponent', () => {
|
||||
let fixtureCustom: ComponentFixture<CustomTaskListComponent>;
|
||||
let componentCustom: CustomTaskListComponent;
|
||||
let customCopyComponent: CustomCopyContentTaskListComponent;
|
||||
let element: any;
|
||||
let element: HTMLElement;
|
||||
let copyFixture: ComponentFixture<CustomCopyContentTaskListComponent>;
|
||||
|
||||
setupTestBed({
|
||||
@@ -425,13 +425,13 @@ describe('TaskListCloudComponent', () => {
|
||||
const appName = new SimpleChange(null, 'FAKE-APP-NAME', true);
|
||||
copyFixture.whenStable().then(() => {
|
||||
copyFixture.detectChanges();
|
||||
const spanHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('span[title="11fe013d-c263-11e8-b75b-0a5864600540"]');
|
||||
const spanHTMLElement = element.querySelector<HTMLInputElement>('span[title="11fe013d-c263-11e8-b75b-0a5864600540"]');
|
||||
spanHTMLElement.dispatchEvent(new Event('mouseenter'));
|
||||
copyFixture.detectChanges();
|
||||
expect(copyFixture.debugElement.nativeElement.querySelector('.adf-copy-tooltip')).not.toBeNull();
|
||||
});
|
||||
customCopyComponent.taskList.appName = appName.currentValue;
|
||||
customCopyComponent.taskList.ngOnChanges({ 'appName': appName });
|
||||
customCopyComponent.taskList.ngOnChanges({ appName });
|
||||
copyFixture.detectChanges();
|
||||
}));
|
||||
|
||||
@@ -440,7 +440,7 @@ describe('TaskListCloudComponent', () => {
|
||||
customCopyComponent.taskList.success.subscribe(() => {
|
||||
copyFixture.whenStable().then(() => {
|
||||
copyFixture.detectChanges();
|
||||
const spanHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('span[title="standalone-subtask"]');
|
||||
const spanHTMLElement = element.querySelector<HTMLInputElement>('span[title="standalone-subtask"]');
|
||||
spanHTMLElement.dispatchEvent(new Event('mouseenter'));
|
||||
copyFixture.detectChanges();
|
||||
expect(copyFixture.debugElement.nativeElement.querySelector('.adf-copy-tooltip')).toBeNull();
|
||||
@@ -448,7 +448,7 @@ describe('TaskListCloudComponent', () => {
|
||||
});
|
||||
});
|
||||
customCopyComponent.taskList.appName = appName.currentValue;
|
||||
customCopyComponent.taskList.ngOnChanges({ 'appName': appName });
|
||||
customCopyComponent.taskList.ngOnChanges({ appName });
|
||||
copyFixture.detectChanges();
|
||||
});
|
||||
});
|
||||
@@ -483,7 +483,7 @@ describe('TaskListCloudComponent', () => {
|
||||
|
||||
describe('Copy cell content directive from app.config specifications', () => {
|
||||
|
||||
let element: any;
|
||||
let element: HTMLElement;
|
||||
let taskSpy: jasmine.Spy;
|
||||
|
||||
setupTestBed({
|
||||
@@ -498,26 +498,26 @@ describe('TaskListCloudComponent', () => {
|
||||
taskListCloudService = TestBed.inject(TaskListCloudService);
|
||||
appConfig.config = Object.assign(appConfig.config, {
|
||||
'adf-cloud-task-list': {
|
||||
'presets': {
|
||||
'fakeCustomSchema': [
|
||||
presets: {
|
||||
fakeCustomSchema: [
|
||||
{
|
||||
'key': 'id',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_TASK_LIST.PROPERTIES.FAKE',
|
||||
'sortable': true,
|
||||
'copyContent': true
|
||||
key: 'id',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.FAKE',
|
||||
sortable: true,
|
||||
copyContent: true
|
||||
},
|
||||
{
|
||||
'key': 'name',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_TASK_LIST.PROPERTIES.TASK_FAKE',
|
||||
'sortable': true
|
||||
key: 'name',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.TASK_FAKE',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
'key': 'entry.priority',
|
||||
'type': 'text',
|
||||
'title': 'ADF_TASK_LIST.PROPERTIES.PRIORITY',
|
||||
'sortable': true
|
||||
key: 'entry.priority',
|
||||
type: 'text',
|
||||
title: 'ADF_TASK_LIST.PROPERTIES.PRIORITY',
|
||||
sortable: true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -542,7 +542,7 @@ describe('TaskListCloudComponent', () => {
|
||||
component.success.subscribe(() => {
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
const spanHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('span[title="11fe013d-c263-11e8-b75b-0a5864600540"]');
|
||||
const spanHTMLElement = element.querySelector<HTMLInputElement>('span[title="11fe013d-c263-11e8-b75b-0a5864600540"]');
|
||||
spanHTMLElement.dispatchEvent(new Event('mouseenter'));
|
||||
fixture.detectChanges();
|
||||
expect(fixture.debugElement.nativeElement.querySelector('.adf-copy-tooltip')).not.toBeNull();
|
||||
@@ -551,7 +551,7 @@ describe('TaskListCloudComponent', () => {
|
||||
|
||||
component.presetColumn = 'fakeCustomSchema';
|
||||
component.appName = appName.currentValue;
|
||||
component.ngOnChanges({ 'appName': appName });
|
||||
component.ngOnChanges({ appName });
|
||||
component.ngAfterContentInit();
|
||||
}));
|
||||
|
||||
|
||||
+3
-4
@@ -22,6 +22,8 @@ import { TaskListCloudService } from '../services/task-list-cloud.service';
|
||||
import { BaseTaskListCloudComponent } from './base-task-list-cloud.component';
|
||||
import { TaskCloudService } from '../../services/task-cloud.service';
|
||||
|
||||
const PRESET_KEY = 'adf-cloud-task-list.presets';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-cloud-task-list',
|
||||
templateUrl: './base-task-list-cloud.component.html',
|
||||
@@ -29,9 +31,6 @@ import { TaskCloudService } from '../../services/task-cloud.service';
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class TaskListCloudComponent extends BaseTaskListCloudComponent {
|
||||
|
||||
static PRESET_KEY = 'adf-cloud-task-list.presets';
|
||||
|
||||
/**
|
||||
* The assignee of the process. Possible values are: "assignee" (the current user is the assignee),
|
||||
* "candidate" (the current user is a task candidate", "group_x" (the task is assigned to a group
|
||||
@@ -136,7 +135,7 @@ export class TaskListCloudComponent extends BaseTaskListCloudComponent {
|
||||
appConfigService: AppConfigService,
|
||||
taskCloudService: TaskCloudService,
|
||||
userPreferences: UserPreferencesService) {
|
||||
super(appConfigService, taskCloudService, userPreferences, TaskListCloudComponent.PRESET_KEY);
|
||||
super(appConfigService, taskCloudService, userPreferences, PRESET_KEY);
|
||||
}
|
||||
|
||||
load(requestNode: TaskQueryCloudRequestModel) {
|
||||
|
||||
@@ -88,15 +88,15 @@ export const fakeServiceTask = {
|
||||
export const fakeCustomSchema =
|
||||
[
|
||||
new ObjectDataColumn({
|
||||
'key': 'fakeName',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_TASK_LIST.PROPERTIES.FAKE',
|
||||
'sortable': true
|
||||
key: 'fakeName',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.FAKE',
|
||||
sortable: true
|
||||
}),
|
||||
new ObjectDataColumn({
|
||||
'key': 'fakeTaskName',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_TASK_LIST.PROPERTIES.TASK_FAKE',
|
||||
'sortable': true
|
||||
key: 'fakeTaskName',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.TASK_FAKE',
|
||||
sortable: true
|
||||
})
|
||||
];
|
||||
|
||||
+34
-34
@@ -16,57 +16,57 @@
|
||||
*/
|
||||
|
||||
export const taskPresetsCloudDefaultModel = {
|
||||
'default': [
|
||||
default: [
|
||||
{
|
||||
'key': 'name',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_TASK_LIST.PROPERTIES.NAME',
|
||||
'sortable': true
|
||||
key: 'name',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.NAME',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
'key': 'created',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_TASK_LIST.PROPERTIES.CREATED',
|
||||
'cssClass': 'hidden',
|
||||
'sortable': true
|
||||
key: 'created',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.CREATED',
|
||||
cssClass: 'hidden',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
'key': 'assignee',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_TASK_LIST.PROPERTIES.ASSIGNEE',
|
||||
'cssClass': 'hidden',
|
||||
'sortable': true
|
||||
key: 'assignee',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.ASSIGNEE',
|
||||
cssClass: 'hidden',
|
||||
sortable: true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
export const serviceTaskPresetsCloudDefaultModel = {
|
||||
'default': [
|
||||
default: [
|
||||
{
|
||||
'key': 'activityName',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_SERVICE_TASK_LIST.PROPERTIES.ACTIVITY_NAME',
|
||||
'sortable': true
|
||||
key: 'activityName',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_SERVICE_TASK_LIST.PROPERTIES.ACTIVITY_NAME',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
'key': 'status',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_SERVICE_TASK_LIST.PROPERTIES.STATUS',
|
||||
'sortable': true
|
||||
key: 'status',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_SERVICE_TASK_LIST.PROPERTIES.STATUS',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
'key': 'startedDate',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_SERVICE_TASK_LIST.PROPERTIES.STARTED_DATE',
|
||||
'cssClass': 'hidden',
|
||||
'sortable': true
|
||||
key: 'startedDate',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_SERVICE_TASK_LIST.PROPERTIES.STARTED_DATE',
|
||||
cssClass: 'hidden',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
'key': 'completedDate',
|
||||
'type': 'text',
|
||||
'title': 'ADF_CLOUD_SERVICE_TASK_LIST.PROPERTIES.COMPLETED_DATE',
|
||||
'cssClass': 'hidden',
|
||||
'sortable': true
|
||||
key: 'completedDate',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_SERVICE_TASK_LIST.PROPERTIES.COMPLETED_DATE',
|
||||
cssClass: 'hidden',
|
||||
sortable: true
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
+18
-30
@@ -26,32 +26,20 @@ describe('Activiti ServiceTaskList Cloud Service', () => {
|
||||
let service: ServiceTaskListCloudService;
|
||||
let alfrescoApiService: AlfrescoApiService;
|
||||
|
||||
function returnCallQueryParameters(): any {
|
||||
return {
|
||||
oauth2Auth: {
|
||||
callCustomApi: (_queryUrl, _operation, _context, queryParams) => {
|
||||
return Promise.resolve(queryParams);
|
||||
}
|
||||
},
|
||||
isEcmLoggedIn() {
|
||||
return false;
|
||||
},
|
||||
reply: jasmine.createSpy('reply')
|
||||
};
|
||||
}
|
||||
const returnCallQueryParameters = (): any => ({
|
||||
oauth2Auth: {
|
||||
callCustomApi: (_queryUrl, _operation, _context, queryParams) => Promise.resolve(queryParams)
|
||||
},
|
||||
isEcmLoggedIn: () => false,
|
||||
reply: jasmine.createSpy('reply')
|
||||
});
|
||||
|
||||
function returnCallUrl(): any {
|
||||
return {
|
||||
oauth2Auth: {
|
||||
callCustomApi: (queryUrl) => {
|
||||
return Promise.resolve(queryUrl);
|
||||
}
|
||||
},
|
||||
isEcmLoggedIn() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
const returnCallUrl = (): any => ({
|
||||
oauth2Auth: {
|
||||
callCustomApi: (queryUrl) => Promise.resolve(queryUrl)
|
||||
},
|
||||
isEcmLoggedIn: () => false
|
||||
});
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
@@ -65,7 +53,7 @@ describe('Activiti ServiceTaskList Cloud Service', () => {
|
||||
});
|
||||
|
||||
it('should append to the call all the parameters', (done) => {
|
||||
const taskRequest: ServiceTaskQueryCloudRequestModel = <ServiceTaskQueryCloudRequestModel> { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' };
|
||||
const taskRequest = { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' } as ServiceTaskQueryCloudRequestModel;
|
||||
spyOn(alfrescoApiService, 'getInstance').and.callFake(returnCallQueryParameters);
|
||||
service.getServiceTaskByRequest(taskRequest).subscribe((res) => {
|
||||
expect(res).toBeDefined();
|
||||
@@ -78,7 +66,7 @@ describe('Activiti ServiceTaskList Cloud Service', () => {
|
||||
});
|
||||
|
||||
it('should concat the app name to the request url', (done) => {
|
||||
const taskRequest: ServiceTaskQueryCloudRequestModel = <ServiceTaskQueryCloudRequestModel> { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' };
|
||||
const taskRequest = { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' } as ServiceTaskQueryCloudRequestModel;
|
||||
spyOn(alfrescoApiService, 'getInstance').and.callFake(returnCallUrl);
|
||||
service.getServiceTaskByRequest(taskRequest).subscribe((requestUrl) => {
|
||||
expect(requestUrl).toBeDefined();
|
||||
@@ -89,10 +77,10 @@ describe('Activiti ServiceTaskList Cloud Service', () => {
|
||||
});
|
||||
|
||||
it('should concat the sorting to append as parameters', (done) => {
|
||||
const taskRequest: ServiceTaskQueryCloudRequestModel = <ServiceTaskQueryCloudRequestModel> {
|
||||
const taskRequest = {
|
||||
appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service',
|
||||
sorting: [{ orderBy: 'NAME', direction: 'DESC' }, { orderBy: 'TITLE', direction: 'ASC' }]
|
||||
};
|
||||
} as ServiceTaskQueryCloudRequestModel;
|
||||
spyOn(alfrescoApiService, 'getInstance').and.callFake(returnCallQueryParameters);
|
||||
service.getServiceTaskByRequest(taskRequest).subscribe((res) => {
|
||||
expect(res).toBeDefined();
|
||||
@@ -103,7 +91,7 @@ describe('Activiti ServiceTaskList Cloud Service', () => {
|
||||
});
|
||||
|
||||
it('should return an error when app name is not specified', (done) => {
|
||||
const taskRequest: ServiceTaskQueryCloudRequestModel = <ServiceTaskQueryCloudRequestModel> { appName: null };
|
||||
const taskRequest = { appName: null } as ServiceTaskQueryCloudRequestModel;
|
||||
spyOn(alfrescoApiService, 'getInstance').and.callFake(returnCallUrl);
|
||||
service.getServiceTaskByRequest(taskRequest).subscribe(
|
||||
() => { },
|
||||
|
||||
+18
-30
@@ -27,32 +27,20 @@ describe('TaskListCloudService', () => {
|
||||
let service: TaskListCloudService;
|
||||
let alfrescoApiService: AlfrescoApiService;
|
||||
|
||||
function returnCallQueryParameters(): any {
|
||||
return {
|
||||
oauth2Auth: {
|
||||
callCustomApi : (_queryUrl, _operation, _context, queryParams) => {
|
||||
return Promise.resolve(queryParams);
|
||||
}
|
||||
},
|
||||
isEcmLoggedIn() {
|
||||
return false;
|
||||
},
|
||||
reply: jasmine.createSpy('reply')
|
||||
};
|
||||
}
|
||||
const returnCallQueryParameters = (): any => ({
|
||||
oauth2Auth: {
|
||||
callCustomApi : (_queryUrl, _operation, _context, queryParams) => Promise.resolve(queryParams)
|
||||
},
|
||||
isEcmLoggedIn: () => false,
|
||||
reply: jasmine.createSpy('reply')
|
||||
});
|
||||
|
||||
function returnCallUrl(): any {
|
||||
return {
|
||||
oauth2Auth: {
|
||||
callCustomApi : (queryUrl) => {
|
||||
return Promise.resolve(queryUrl);
|
||||
}
|
||||
},
|
||||
isEcmLoggedIn() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
const returnCallUrl = (): any => ({
|
||||
oauth2Auth: {
|
||||
callCustomApi : (queryUrl) => Promise.resolve(queryUrl)
|
||||
},
|
||||
isEcmLoggedIn: () => false
|
||||
});
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
@@ -67,7 +55,7 @@ describe('TaskListCloudService', () => {
|
||||
});
|
||||
|
||||
it('should append to the call all the parameters', (done) => {
|
||||
const taskRequest: TaskQueryCloudRequestModel = <TaskQueryCloudRequestModel> { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' };
|
||||
const taskRequest = { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' } as TaskQueryCloudRequestModel;
|
||||
spyOn(alfrescoApiService, 'getInstance').and.callFake(returnCallQueryParameters);
|
||||
service.getTaskByRequest(taskRequest).subscribe((res) => {
|
||||
expect(res).toBeDefined();
|
||||
@@ -80,7 +68,7 @@ describe('TaskListCloudService', () => {
|
||||
});
|
||||
|
||||
it('should concat the app name to the request url', (done) => {
|
||||
const taskRequest: TaskQueryCloudRequestModel = <TaskQueryCloudRequestModel> { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' };
|
||||
const taskRequest = { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' } as TaskQueryCloudRequestModel;
|
||||
spyOn(alfrescoApiService, 'getInstance').and.callFake(returnCallUrl);
|
||||
service.getTaskByRequest(taskRequest).subscribe((requestUrl) => {
|
||||
expect(requestUrl).toBeDefined();
|
||||
@@ -91,8 +79,8 @@ describe('TaskListCloudService', () => {
|
||||
});
|
||||
|
||||
it('should concat the sorting to append as parameters', (done) => {
|
||||
const taskRequest: TaskQueryCloudRequestModel = <TaskQueryCloudRequestModel> { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service',
|
||||
sorting: [{ orderBy: 'NAME', direction: 'DESC'}, { orderBy: 'TITLE', direction: 'ASC'}] };
|
||||
const taskRequest = { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service',
|
||||
sorting: [{ orderBy: 'NAME', direction: 'DESC'}, { orderBy: 'TITLE', direction: 'ASC'}] } as TaskQueryCloudRequestModel;
|
||||
spyOn(alfrescoApiService, 'getInstance').and.callFake(returnCallQueryParameters);
|
||||
service.getTaskByRequest(taskRequest).subscribe((res) => {
|
||||
expect(res).toBeDefined();
|
||||
@@ -103,7 +91,7 @@ describe('TaskListCloudService', () => {
|
||||
});
|
||||
|
||||
it('should return an error when app name is not specified', (done) => {
|
||||
const taskRequest: TaskQueryCloudRequestModel = <TaskQueryCloudRequestModel> { appName: null };
|
||||
const taskRequest = { appName: null } as TaskQueryCloudRequestModel;
|
||||
spyOn(alfrescoApiService, 'getInstance').and.callFake(returnCallUrl);
|
||||
service.getTaskByRequest(taskRequest).subscribe(
|
||||
() => { },
|
||||
|
||||
Reference in New Issue
Block a user