mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
[AAE-622] No implicit returns (#5157)
* enable noImplicitReturns rule * type fixes * fix return types * fix return value * fix tests * fix visibility service * update tests * add missing types * fix test
This commit is contained in:
parent
48aca2d30f
commit
d7ab0417b8
@ -386,7 +386,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
|
||||
return node && node.list && node.list.entries.length === 0;
|
||||
}
|
||||
|
||||
onContentActionError(errors) {
|
||||
onContentActionError(errors: any) {
|
||||
const errorStatusCode = JSON.parse(errors.message).error.statusCode;
|
||||
let translatedErrorMessage: any;
|
||||
|
||||
@ -404,24 +404,24 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
|
||||
this.openSnackMessage(translatedErrorMessage);
|
||||
}
|
||||
|
||||
onContentActionSuccess(message) {
|
||||
onContentActionSuccess(message: string) {
|
||||
const translatedMessage: any = this.translateService.instant(message);
|
||||
this.openSnackMessage(translatedMessage);
|
||||
this.documentList.reload();
|
||||
}
|
||||
|
||||
onDeleteActionSuccess(message) {
|
||||
onDeleteActionSuccess(message: string) {
|
||||
this.uploadService.fileDeleted.next(message);
|
||||
this.deleteElementSuccess.emit();
|
||||
this.documentList.reload();
|
||||
this.openSnackMessage(message);
|
||||
}
|
||||
|
||||
onPermissionRequested(node) {
|
||||
onPermissionRequested(node: any) {
|
||||
this.router.navigate(['/permissions', node.value.entry.id]);
|
||||
}
|
||||
|
||||
onManageVersions(event) {
|
||||
onManageVersions(event: any) {
|
||||
const contentEntry = event.value.entry;
|
||||
const showComments = this.showVersionComments;
|
||||
const allowDownload = this.allowVersionDownload;
|
||||
@ -438,7 +438,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
onManageMetadata(event) {
|
||||
onManageMetadata(event: any) {
|
||||
const contentEntry = event.value.entry;
|
||||
|
||||
if (this.contentService.hasAllowableOperations(contentEntry, 'update')) {
|
||||
@ -499,7 +499,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
|
||||
return false;
|
||||
}
|
||||
|
||||
startProcessAction($event) {
|
||||
startProcessAction($event: any) {
|
||||
this.formValues['file'] = $event.value.entry;
|
||||
|
||||
const dialogRef = this.dialog.open(SelectAppsDialogComponent, {
|
||||
@ -588,15 +588,15 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
|
||||
return true;
|
||||
}
|
||||
|
||||
runCustomAction(event) {
|
||||
runCustomAction(event: any) {
|
||||
this.logService.log(event);
|
||||
}
|
||||
|
||||
getFileFiltering() {
|
||||
getFileFiltering(): string {
|
||||
return this.acceptedFilesTypeShow ? this.acceptedFilesType : '*';
|
||||
}
|
||||
|
||||
createLibrary() {
|
||||
createLibrary(): void {
|
||||
const dialogInstance: any = this.dialog.open(LibraryDialogComponent, {
|
||||
width: '400px'
|
||||
});
|
||||
@ -610,5 +610,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
|
||||
if (search && search.highlight) {
|
||||
return search.highlight.map((currentHighlight) => currentHighlight.snippets).join(', ');
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
@ -8,12 +8,12 @@
|
||||
CLICKED NODE: {{clickedNodeName}}
|
||||
</span>
|
||||
|
||||
<adf-tree-view-list *ngIf="!errorMessage; else erroOccurred"
|
||||
<adf-tree-view-list *ngIf="!errorMessage; else errorOccurred"
|
||||
[nodeId]="nodeIdSample"
|
||||
(nodeClicked)="onClick($event)"
|
||||
(error)="onErrorOccurred($event)">
|
||||
</adf-tree-view-list>
|
||||
<ng-template #erroOccurred>
|
||||
<ng-template #errorOccurred>
|
||||
<span>An Error Occurred </span>
|
||||
<span>{{errorMessage}}</span>
|
||||
</ng-template>
|
||||
|
@ -25,7 +25,7 @@ import { Component } from '@angular/core';
|
||||
export class TreeViewSampleComponent {
|
||||
|
||||
clickedNodeName: string = '';
|
||||
errorMessage = '';
|
||||
errorMessage: string = '';
|
||||
|
||||
nodeIdSample: string = '-my-';
|
||||
|
||||
@ -38,7 +38,7 @@ export class TreeViewSampleComponent {
|
||||
this.errorMessage = '';
|
||||
}
|
||||
|
||||
onErrorOccurred(error) {
|
||||
onErrorOccurred(error: string) {
|
||||
this.clickedNodeName = '';
|
||||
this.errorMessage = error;
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
"skipLibCheck": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noImplicitReturns": true,
|
||||
"target": "es5",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"typeRoots": [
|
||||
|
@ -38,7 +38,7 @@ export class ContentMetadataConfigFactory {
|
||||
constructor(private appConfigService: AppConfigService, private logService: LogService) {}
|
||||
|
||||
public get(presetName: string = 'default'): ContentMetadataConfig {
|
||||
let presetConfig;
|
||||
let presetConfig: PresetConfig;
|
||||
try {
|
||||
presetConfig = this.appConfigService.config['content-metadata'].presets[presetName];
|
||||
} catch {
|
||||
@ -74,7 +74,7 @@ export class ContentMetadataConfigFactory {
|
||||
return Array.isArray(presetConfig);
|
||||
}
|
||||
|
||||
private isObject(x) {
|
||||
private isObject(x: any): boolean {
|
||||
return x != null && typeof x === 'object';
|
||||
}
|
||||
}
|
||||
|
@ -608,11 +608,8 @@ describe('ContentNodeSelectorComponent', () => {
|
||||
});
|
||||
|
||||
it('should pass through the rowFilter to the documentList', () => {
|
||||
const filter = (shareDataRow: ShareDataRow) => {
|
||||
if (shareDataRow.node.entry.name === 'impossible-name') {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
const filter = (shareDataRow: ShareDataRow) =>
|
||||
shareDataRow.node.entry.name === 'impossible-name';
|
||||
|
||||
component.rowFilter = filter;
|
||||
|
||||
|
@ -37,11 +37,7 @@ describe('ContentNodeSelectorDialogComponent', () => {
|
||||
title: 'Move along citizen...',
|
||||
actionName: 'move',
|
||||
select: new EventEmitter<Node>(),
|
||||
rowFilter: (shareDataRow: ShareDataRow) => {
|
||||
if (shareDataRow.node.entry.name === 'impossible-name') {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
rowFilter: (shareDataRow: ShareDataRow) => shareDataRow.node.entry.name === 'impossible-name',
|
||||
imageResolver: () => 'piccolo',
|
||||
currentFolderId: 'cat-girl-nuku-nuku'
|
||||
};
|
||||
|
@ -37,12 +37,13 @@ describe('NameLocationCellComponent', () => {
|
||||
component = fixture.componentInstance;
|
||||
|
||||
rowData = <DataRow> {
|
||||
getValue(key) {
|
||||
getValue(key): any {
|
||||
if (key === 'name') {
|
||||
return 'file-name';
|
||||
} else if (key === 'path') {
|
||||
return { name: '/path/to/location' };
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
component.row = rowData;
|
||||
|
@ -19,6 +19,15 @@ import { Component, Inject, ViewEncapsulation, SecurityContext } from '@angular/
|
||||
import { MAT_DIALOG_DATA } from '@angular/material';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
|
||||
export interface ConfirmDialogComponentProps {
|
||||
title?: string;
|
||||
message?: string;
|
||||
yesLabel?: string;
|
||||
thirdOptionLabel?: string;
|
||||
noLabel?: string;
|
||||
htmlContent?: string;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'adf-confirm-dialog',
|
||||
templateUrl: './confirm.dialog.html',
|
||||
@ -35,7 +44,7 @@ export class ConfirmDialogComponent {
|
||||
thirdOptionLabel: string;
|
||||
htmlContent: string;
|
||||
|
||||
constructor(@Inject(MAT_DIALOG_DATA) data, private sanitizer: DomSanitizer) {
|
||||
constructor(@Inject(MAT_DIALOG_DATA) data: ConfirmDialogComponentProps, private sanitizer: DomSanitizer) {
|
||||
data = data || {};
|
||||
this.title = data.title || 'ADF_CONFIRM_DIALOG.CONFIRM';
|
||||
this.message = data.message || 'ADF_CONFIRM_DIALOG.MESSAGE';
|
||||
@ -45,7 +54,7 @@ export class ConfirmDialogComponent {
|
||||
this.htmlContent = data.htmlContent;
|
||||
}
|
||||
|
||||
public sanitizedHtmlContent() {
|
||||
sanitizedHtmlContent(): string {
|
||||
return this.sanitizer.sanitize(SecurityContext.HTML, this.htmlContent);
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
import { ContentService, TranslationService } from '@alfresco/adf-core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { NodeEntry } from '@alfresco/js-api';
|
||||
import { Observable, Subject, throwError } from 'rxjs';
|
||||
import { Observable, Subject, throwError, of } from 'rxjs';
|
||||
import { ContentActionHandler } from '../models/content-action.model';
|
||||
import { PermissionModel } from '../models/permissions.model';
|
||||
import { DocumentListService } from './document-list.service';
|
||||
@ -119,11 +119,9 @@ export class DocumentActionsService {
|
||||
}
|
||||
|
||||
private deleteNode(node: NodeEntry, _target?: any, permission?: string): Observable<any> {
|
||||
let handlerObservable;
|
||||
|
||||
if (this.canExecuteAction(node)) {
|
||||
if (this.contentService.hasAllowableOperations(node.entry, permission)) {
|
||||
handlerObservable = this.documentListService.deleteNode(node.entry.id);
|
||||
const handlerObservable = this.documentListService.deleteNode(node.entry.id);
|
||||
handlerObservable.subscribe(() => {
|
||||
const message = this.translation.instant('CORE.DELETE_NODE.SINGULAR', { name: node.entry.name });
|
||||
this.success.next(message);
|
||||
@ -141,5 +139,7 @@ export class DocumentActionsService {
|
||||
return throwError(new Error('No permission to delete'));
|
||||
}
|
||||
}
|
||||
|
||||
return of();
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
import { ContentService, TranslationService } from '@alfresco/adf-core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { NodeEntry } from '@alfresco/js-api';
|
||||
import { Observable, Subject, throwError } from 'rxjs';
|
||||
import { Observable, Subject, throwError, of } from 'rxjs';
|
||||
import { ContentActionHandler } from '../models/content-action.model';
|
||||
import { PermissionModel } from '../models/permissions.model';
|
||||
import { DocumentListService } from './document-list.service';
|
||||
@ -102,7 +102,7 @@ export class FolderActionsService {
|
||||
return actionObservable;
|
||||
}
|
||||
|
||||
private prepareHandlers(actionObservable, target?: any): void {
|
||||
private prepareHandlers(actionObservable: Observable<any>, target?: any): void {
|
||||
actionObservable.subscribe(
|
||||
(fileOperationMessage) => {
|
||||
if (target && typeof target.reload === 'function') {
|
||||
@ -115,11 +115,9 @@ export class FolderActionsService {
|
||||
}
|
||||
|
||||
private deleteNode(node: NodeEntry, target?: any, permission?: string): Observable<any> {
|
||||
let handlerObservable: Observable<any>;
|
||||
|
||||
if (this.canExecuteAction(node)) {
|
||||
if (this.contentService.hasAllowableOperations(node.entry, permission)) {
|
||||
handlerObservable = this.documentListService.deleteNode(node.entry.id);
|
||||
const handlerObservable = this.documentListService.deleteNode(node.entry.id);
|
||||
handlerObservable.subscribe(() => {
|
||||
if (target && typeof target.reload === 'function') {
|
||||
target.reload();
|
||||
@ -138,5 +136,7 @@ export class FolderActionsService {
|
||||
return throwError(new Error('No permission to delete'));
|
||||
}
|
||||
}
|
||||
|
||||
return of();
|
||||
}
|
||||
}
|
||||
|
@ -148,10 +148,13 @@ export class NodePermissionService {
|
||||
removePermission(node: Node, permissionToRemove: PermissionElement): Observable<Node> {
|
||||
const permissionBody = { permissions: { locallySet: [] } };
|
||||
const index = node.permissions.locallySet.map((permission) => permission.authorityId).indexOf(permissionToRemove.authorityId);
|
||||
|
||||
if (index !== -1) {
|
||||
node.permissions.locallySet.splice(index, 1);
|
||||
permissionBody.permissions.locallySet = node.permissions.locallySet;
|
||||
return this.nodeService.updateNode(node.id, permissionBody);
|
||||
} else {
|
||||
return of(node);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ export class FileUploadingListComponent {
|
||||
|
||||
/** Emitted when a file in the list has an error. */
|
||||
@Output()
|
||||
error: EventEmitter<any> = new EventEmitter();
|
||||
error = new EventEmitter<any>();
|
||||
|
||||
constructor(
|
||||
private uploadService: UploadService,
|
||||
@ -161,7 +161,7 @@ export class FileUploadingListComponent {
|
||||
);
|
||||
}
|
||||
|
||||
private cancelNodeVersionInstances(file) {
|
||||
private cancelNodeVersionInstances(file: FileModel) {
|
||||
this.files
|
||||
.filter(
|
||||
(item) =>
|
||||
@ -192,15 +192,12 @@ export class FileUploadingListComponent {
|
||||
this.error.emit(messageError);
|
||||
}
|
||||
|
||||
private getUploadingFiles() {
|
||||
return this.files.filter((item) => {
|
||||
if (
|
||||
private getUploadingFiles(): FileModel[] {
|
||||
return this.files.filter(
|
||||
item =>
|
||||
item.status === FileUploadStatus.Pending ||
|
||||
item.status === FileUploadStatus.Progress ||
|
||||
item.status === FileUploadStatus.Starting
|
||||
) {
|
||||
return item;
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -260,10 +260,11 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
|
||||
return rows.map((row) => new ObjectDataRow(row, row.isSelected));
|
||||
}
|
||||
|
||||
convertToDataSorting(sorting: any[]): DataSorting {
|
||||
convertToDataSorting(sorting: any[]): DataSorting | null {
|
||||
if (sorting && sorting.length > 0) {
|
||||
return new DataSorting(sorting[0], sorting[1]);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private initAndSubscribeClickStream() {
|
||||
@ -362,7 +363,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
|
||||
}
|
||||
}
|
||||
|
||||
private setTableSorting(sorting) {
|
||||
private setTableSorting(sorting: any[]) {
|
||||
if (this.data) {
|
||||
this.data.setSorting(this.convertToDataSorting(sorting));
|
||||
}
|
||||
@ -610,10 +611,12 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
|
||||
return `${row.cssClass} ${this.rowStyleClass}`;
|
||||
}
|
||||
|
||||
getSortingKey(): string {
|
||||
getSortingKey(): string | null {
|
||||
if (this.data.getSorting()) {
|
||||
return this.data.getSorting().key;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
selectRow(row: DataRow, value: boolean) {
|
||||
|
@ -258,13 +258,7 @@ describe('NodeDeleteDirective', () => {
|
||||
return Promise.reject(null);
|
||||
}
|
||||
|
||||
if (id === '2') {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
if (id === '3') {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return Promise.resolve();
|
||||
});
|
||||
|
||||
component.selection = [
|
||||
|
@ -96,7 +96,9 @@ export class NodeDeleteDirective implements OnChanges {
|
||||
const processedItems: ProcessStatus = this.processStatus(data);
|
||||
const message = this.getMessage(processedItems);
|
||||
|
||||
this.delete.emit(message);
|
||||
if (message) {
|
||||
this.delete.emit(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -108,7 +110,7 @@ export class NodeDeleteDirective implements OnChanges {
|
||||
private deleteNode(node: NodeEntry | DeletedNodeEntity): Observable<ProcessedNodeData> {
|
||||
const id = (<any> node.entry).nodeId || node.entry.id;
|
||||
|
||||
let promise;
|
||||
let promise: Promise<any>;
|
||||
|
||||
if (node.entry.hasOwnProperty('archivedAt') && node.entry['archivedAt']) {
|
||||
promise = this.alfrescoApiService.nodesApi.purgeDeletedNode(id);
|
||||
@ -166,7 +168,7 @@ export class NodeDeleteDirective implements OnChanges {
|
||||
);
|
||||
}
|
||||
|
||||
private getMessage(status): string {
|
||||
private getMessage(status: ProcessStatus): string | null {
|
||||
if (status.allFailed && !status.oneFailed) {
|
||||
return this.translation.instant(
|
||||
'CORE.DELETE_NODE.ERROR_PLURAL',
|
||||
@ -214,5 +216,7 @@ export class NodeDeleteDirective implements OnChanges {
|
||||
{ name: status.success[0].entry.name }
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -160,23 +160,17 @@ describe('NodeRestoreDirective', () => {
|
||||
it('should notify on multiple fails', (done) => {
|
||||
const error = { message: '{ "error": {} }' };
|
||||
|
||||
directiveInstance.restore.subscribe((event) => {
|
||||
directiveInstance.restore.subscribe((event: any) => {
|
||||
expect(event.message).toEqual('CORE.RESTORE_NODE.PARTIAL_PLURAL');
|
||||
done();
|
||||
});
|
||||
|
||||
restoreNodeSpy.and.callFake((id) => {
|
||||
restoreNodeSpy.and.callFake((id: string) => {
|
||||
if (id === '1') {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
if (id === '2') {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
|
||||
if (id === '3') {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
return Promise.reject(error);
|
||||
});
|
||||
|
||||
component.selection = [
|
||||
@ -232,7 +226,7 @@ describe('NodeRestoreDirective', () => {
|
||||
|
||||
restoreNodeSpy.and.returnValue(Promise.reject(error));
|
||||
|
||||
directiveInstance.restore.subscribe((event) => {
|
||||
directiveInstance.restore.subscribe((event: any) => {
|
||||
expect(event.message).toEqual('CORE.RESTORE_NODE.LOCATION_MISSING');
|
||||
done();
|
||||
});
|
||||
@ -247,20 +241,14 @@ describe('NodeRestoreDirective', () => {
|
||||
|
||||
it('should notify success when restore multiple nodes', (done) => {
|
||||
|
||||
directiveInstance.restore.subscribe((event) => {
|
||||
directiveInstance.restore.subscribe((event: any) => {
|
||||
expect(event.message).toEqual('CORE.RESTORE_NODE.PLURAL');
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
restoreNodeSpy.and.callFake((id) => {
|
||||
if (id === '1') {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
if (id === '2') {
|
||||
return Promise.resolve();
|
||||
}
|
||||
restoreNodeSpy.and.callFake(() => {
|
||||
return Promise.resolve();
|
||||
});
|
||||
|
||||
component.selection = [
|
||||
|
@ -182,7 +182,7 @@ export class NodeRestoreDirective {
|
||||
);
|
||||
}
|
||||
|
||||
private getRestoreMessage(): string {
|
||||
private getRestoreMessage(): string | null {
|
||||
const { restoreProcessStatus: status } = this;
|
||||
|
||||
if (status.someFailed && !status.oneFailed) {
|
||||
@ -233,6 +233,8 @@ export class NodeRestoreDirective {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private notification(): void {
|
||||
|
@ -98,7 +98,7 @@ export class PeopleWidgetComponent extends WidgetComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
checkUserAndValidateForm(list, value) {
|
||||
checkUserAndValidateForm(list: UserProcessModel[], value: string): void {
|
||||
const isValidUser = this.isValidUser(list, value);
|
||||
if (isValidUser || value === '') {
|
||||
this.field.validationSummary.message = '';
|
||||
@ -111,7 +111,7 @@ export class PeopleWidgetComponent extends WidgetComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
isValidUser(users: UserProcessModel[], name: string) {
|
||||
isValidUser(users: UserProcessModel[], name: string): boolean {
|
||||
if (users) {
|
||||
return users.find((user) => {
|
||||
const selectedUser = this.getDisplayName(user).toLocaleLowerCase() === name.toLocaleLowerCase();
|
||||
@ -119,8 +119,9 @@ export class PeopleWidgetComponent extends WidgetComponent implements OnInit {
|
||||
this.peopleSelected.emit(user && user.id || undefined);
|
||||
}
|
||||
return selectedUser;
|
||||
});
|
||||
}) ? true : false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
getDisplayName(model: UserProcessModel) {
|
||||
|
@ -202,7 +202,7 @@ describe('UploadWidgetComponent', () => {
|
||||
}));
|
||||
|
||||
it('should update the form after deleted a file', async(() => {
|
||||
spyOn(contentService, 'createTemporaryRawRelatedContent').and.callFake((file) => {
|
||||
spyOn(contentService, 'createTemporaryRawRelatedContent').and.callFake((file: any) => {
|
||||
if (file.name === 'file-fake.png') {
|
||||
return of(fakePngAnswer);
|
||||
}
|
||||
@ -210,6 +210,8 @@ describe('UploadWidgetComponent', () => {
|
||||
if (file.name === 'file-fake.jpg') {
|
||||
return of(fakeJpgAnswer);
|
||||
}
|
||||
|
||||
return of();
|
||||
});
|
||||
|
||||
uploadWidgetComponent.field.params.multiple = true;
|
||||
@ -230,7 +232,7 @@ describe('UploadWidgetComponent', () => {
|
||||
}));
|
||||
|
||||
it('should set has field value all the files uploaded', async(() => {
|
||||
spyOn(contentService, 'createTemporaryRawRelatedContent').and.callFake((file) => {
|
||||
spyOn(contentService, 'createTemporaryRawRelatedContent').and.callFake((file: any) => {
|
||||
if (file.name === 'file-fake.png') {
|
||||
return of(fakePngAnswer);
|
||||
}
|
||||
@ -238,6 +240,8 @@ describe('UploadWidgetComponent', () => {
|
||||
if (file.name === 'file-fake.jpg') {
|
||||
return of(fakeJpgAnswer);
|
||||
}
|
||||
|
||||
return of();
|
||||
});
|
||||
|
||||
uploadWidgetComponent.field.params.multiple = true;
|
||||
|
@ -16,90 +16,92 @@
|
||||
*/
|
||||
|
||||
export class WidgetVisibilityModel {
|
||||
rightRestResponseId?: string;
|
||||
rightFormFieldId?: string;
|
||||
leftRestResponseId?: string;
|
||||
leftFormFieldId?: string;
|
||||
operator: string;
|
||||
nextCondition: WidgetVisibilityModel;
|
||||
nextConditionOperator: string;
|
||||
rightRestResponseId?: string;
|
||||
rightFormFieldId?: string;
|
||||
leftRestResponseId?: string;
|
||||
leftFormFieldId?: string;
|
||||
operator: string;
|
||||
nextCondition: WidgetVisibilityModel;
|
||||
nextConditionOperator: string;
|
||||
|
||||
constructor(private json?: any) {
|
||||
if (json) {
|
||||
this.operator = json.operator;
|
||||
this.nextCondition = new WidgetVisibilityModel(json.nextCondition);
|
||||
this.nextConditionOperator = json.nextConditionOperator;
|
||||
this.rightRestResponseId = json.rightRestResponseId;
|
||||
this.rightFormFieldId = json.rightFormFieldId;
|
||||
this.leftFormFieldId = json.leftFormFieldId;
|
||||
this.leftRestResponseId = json.leftRestResponseId;
|
||||
} else {
|
||||
this.json = {};
|
||||
}
|
||||
constructor(private json?: any) {
|
||||
if (json) {
|
||||
this.operator = json.operator;
|
||||
this.nextCondition = new WidgetVisibilityModel(json.nextCondition);
|
||||
this.nextConditionOperator = json.nextConditionOperator;
|
||||
this.rightRestResponseId = json.rightRestResponseId;
|
||||
this.rightFormFieldId = json.rightFormFieldId;
|
||||
this.leftFormFieldId = json.leftFormFieldId;
|
||||
this.leftRestResponseId = json.leftRestResponseId;
|
||||
} else {
|
||||
this.json = {};
|
||||
}
|
||||
}
|
||||
|
||||
get leftType(): string {
|
||||
if (this.leftFormFieldId) {
|
||||
return WidgetTypeEnum.field;
|
||||
} else if (this.leftRestResponseId) {
|
||||
return WidgetTypeEnum.variable;
|
||||
} else if (!!this.json.leftType) {
|
||||
return this.json.leftType;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
set leftType(leftType: string) {
|
||||
this.json.leftType = leftType;
|
||||
}
|
||||
|
||||
get leftValue(): any {
|
||||
if (this.json.leftValue) {
|
||||
return this.json.leftValue;
|
||||
} else if (this.leftFormFieldId) {
|
||||
return this.leftFormFieldId;
|
||||
} else {
|
||||
return this.leftRestResponseId;
|
||||
}
|
||||
}
|
||||
|
||||
set leftValue(leftValue: any) {
|
||||
this.json.leftValue = leftValue;
|
||||
}
|
||||
|
||||
get rightType(): string {
|
||||
if (!!this.json.rightType) {
|
||||
return this.json.rightType;
|
||||
} else if (this.json.rightValue) {
|
||||
return WidgetTypeEnum.value;
|
||||
} else if (this.rightRestResponseId) {
|
||||
return WidgetTypeEnum.variable;
|
||||
} else if (this.rightFormFieldId) {
|
||||
return WidgetTypeEnum.field;
|
||||
}
|
||||
|
||||
set leftType(leftType: string) {
|
||||
this.json.leftType = leftType;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
set rightType(rightType: string) {
|
||||
this.json.rightType = rightType;
|
||||
}
|
||||
set rightType(rightType: string) {
|
||||
this.json.rightType = rightType;
|
||||
}
|
||||
|
||||
set leftValue(leftValue: string) {
|
||||
this.json.leftValue = leftValue;
|
||||
}
|
||||
|
||||
set rightValue(rightValue: string) {
|
||||
this.json.rightValue = rightValue;
|
||||
}
|
||||
|
||||
get leftType() {
|
||||
if (this.leftFormFieldId) {
|
||||
return WidgetTypeEnum.field;
|
||||
} else if (this.leftRestResponseId) {
|
||||
return WidgetTypeEnum.variable;
|
||||
} else if ( !!this.json.leftType) {
|
||||
return this.json.leftType;
|
||||
}
|
||||
}
|
||||
|
||||
get leftValue() {
|
||||
if ( this.json.leftValue ) {
|
||||
return this.json.leftValue;
|
||||
} else if (this.leftFormFieldId) {
|
||||
return this.leftFormFieldId;
|
||||
} else {
|
||||
return this.leftRestResponseId;
|
||||
}
|
||||
}
|
||||
|
||||
get rightType() {
|
||||
if ( !!this.json.rightType ) {
|
||||
return this.json.rightType;
|
||||
} else if (this.json.rightValue) {
|
||||
return WidgetTypeEnum.value;
|
||||
} else if (this.rightRestResponseId) {
|
||||
return WidgetTypeEnum.variable;
|
||||
} else if (this.rightFormFieldId) {
|
||||
return WidgetTypeEnum.field;
|
||||
}
|
||||
}
|
||||
|
||||
get rightValue() {
|
||||
if (this.json.rightValue) {
|
||||
return this.json.rightValue;
|
||||
} else if (this.rightFormFieldId) {
|
||||
return this.rightFormFieldId;
|
||||
} else {
|
||||
return this.rightRestResponseId;
|
||||
}
|
||||
get rightValue(): any {
|
||||
if (this.json.rightValue) {
|
||||
return this.json.rightValue;
|
||||
} else if (this.rightFormFieldId) {
|
||||
return this.rightFormFieldId;
|
||||
} else {
|
||||
return this.rightRestResponseId;
|
||||
}
|
||||
}
|
||||
|
||||
set rightValue(rightValue: any) {
|
||||
this.json.rightValue = rightValue;
|
||||
}
|
||||
}
|
||||
|
||||
export enum WidgetTypeEnum {
|
||||
field = 'field',
|
||||
variable = 'variable',
|
||||
value = 'value'
|
||||
field = 'field',
|
||||
variable = 'variable',
|
||||
value = 'value'
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ export class WidgetVisibilityService {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
evaluateLogicalOperation(logicOp, previousValue, newValue): boolean {
|
||||
evaluateLogicalOperation(logicOp: string, previousValue: any, newValue: any): boolean | undefined {
|
||||
switch (logicOp) {
|
||||
case 'and':
|
||||
return previousValue && newValue;
|
||||
@ -260,12 +260,12 @@ export class WidgetVisibilityService {
|
||||
case 'or-not':
|
||||
return previousValue || !newValue;
|
||||
default:
|
||||
this.logService.error('NO valid operation! wrong op request : ' + logicOp);
|
||||
break;
|
||||
this.logService.error(`Invalid operator: ${logicOp}`);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
evaluateCondition(leftValue, rightValue, operator): boolean {
|
||||
evaluateCondition(leftValue: any, rightValue: any, operator: string): boolean | undefined {
|
||||
switch (operator) {
|
||||
case '==':
|
||||
return leftValue + '' === rightValue + '';
|
||||
@ -284,10 +284,9 @@ export class WidgetVisibilityService {
|
||||
case '!empty':
|
||||
return leftValue ? leftValue !== '' : false;
|
||||
default:
|
||||
this.logService.error('NO valid operation!');
|
||||
break;
|
||||
this.logService.error(`Invalid operator: ${operator}`);
|
||||
return undefined;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
cleanProcessVariable() {
|
||||
|
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, Input, ViewChild, OnInit, OnDestroy, ViewEncapsulation, OnChanges } from '@angular/core';
|
||||
import { Component, Input, ViewChild, OnInit, OnDestroy, ViewEncapsulation, OnChanges, SimpleChanges } from '@angular/core';
|
||||
import { MatSidenav } from '@angular/material';
|
||||
import { sidenavAnimation, contentAnimation } from '../../helpers/animations';
|
||||
import { Direction } from '@angular/cdk/bidi';
|
||||
@ -80,7 +80,7 @@ export class LayoutContainerComponent implements OnInit, OnDestroy, OnChanges {
|
||||
this.mediaQueryList.removeListener(this.onMediaQueryChange);
|
||||
}
|
||||
|
||||
ngOnChanges(changes) {
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
if (changes && changes.direction) {
|
||||
this.contentAnimationState = this.toggledContentAnimation;
|
||||
}
|
||||
@ -99,17 +99,17 @@ export class LayoutContainerComponent implements OnInit, OnDestroy, OnChanges {
|
||||
return this.mediaQueryList.matches;
|
||||
}
|
||||
|
||||
getContentAnimationState() {
|
||||
getContentAnimationState(): any {
|
||||
return this.contentAnimationState;
|
||||
}
|
||||
|
||||
private get toggledSidenavAnimation() {
|
||||
private get toggledSidenavAnimation(): any {
|
||||
return this.sidenavAnimationState === this.SIDENAV_STATES.EXPANDED
|
||||
? this.SIDENAV_STATES.COMPACT
|
||||
: this.SIDENAV_STATES.EXPANDED;
|
||||
}
|
||||
|
||||
private get toggledContentAnimation() {
|
||||
private get toggledContentAnimation(): any {
|
||||
if (this.isMobileScreenSize) {
|
||||
return this.CONTENT_STATES.MOBILE;
|
||||
}
|
||||
@ -150,7 +150,7 @@ export class LayoutContainerComponent implements OnInit, OnDestroy, OnChanges {
|
||||
}
|
||||
}
|
||||
|
||||
private onMediaQueryChange() {
|
||||
private onMediaQueryChange(): void {
|
||||
this.sidenavAnimationState = this.SIDENAV_STATES.EXPANDED;
|
||||
this.contentAnimationState = this.toggledContentAnimation;
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ export class LoginComponent implements OnInit, OnDestroy {
|
||||
* @param values
|
||||
* @param event
|
||||
*/
|
||||
onSubmit(values: any) {
|
||||
onSubmit(values: any): void {
|
||||
this.disableError();
|
||||
|
||||
if (this.authService.isOauth() && !this.authService.isSSODiscoveryConfigured()) {
|
||||
@ -209,9 +209,7 @@ export class LoginComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
this.executeSubmit.emit(args);
|
||||
|
||||
if (args.defaultPrevented) {
|
||||
return false;
|
||||
} else {
|
||||
if (!args.defaultPrevented) {
|
||||
this.performLogin(values);
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
export class DemoForm {
|
||||
|
||||
easyForm = {
|
||||
easyForm: any = {
|
||||
'id': 1001,
|
||||
'name': 'ISSUE_FORM',
|
||||
'tabs': [],
|
||||
@ -365,7 +365,7 @@ export class DemoForm {
|
||||
'globalDateFormat': 'D-M-YYYY'
|
||||
};
|
||||
|
||||
formDefinition = {
|
||||
formDefinition: any = {
|
||||
'id': 3003,
|
||||
'name': 'demo-01',
|
||||
'taskId': '7501',
|
||||
@ -1482,7 +1482,7 @@ export class DemoForm {
|
||||
'globalDateFormat': 'D-M-YYYY'
|
||||
};
|
||||
|
||||
simpleFormDefinition = {
|
||||
simpleFormDefinition: any = {
|
||||
'id': 1001,
|
||||
'name': 'SIMPLE_FORM_EXAMPLE',
|
||||
'description': '',
|
||||
@ -1765,7 +1765,7 @@ export class DemoForm {
|
||||
}
|
||||
};
|
||||
|
||||
cloudFormDefinition = {
|
||||
cloudFormDefinition: any = {
|
||||
'formRepresentation': {
|
||||
'id': 'text-form',
|
||||
'name': 'test-start-form',
|
||||
|
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export let fakeForm = {
|
||||
export const fakeForm: any = {
|
||||
id: 1001,
|
||||
name: 'ISSUE_FORM',
|
||||
processDefinitionId: 'ISSUE_APP:1:2504',
|
||||
|
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export let formModelTabs = {
|
||||
export const formModelTabs: any = {
|
||||
id: 16,
|
||||
name: 'start event',
|
||||
description: '',
|
||||
|
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export let formDefinitionTwoTextFields = {
|
||||
export const formDefinitionTwoTextFields: any = {
|
||||
id: 20,
|
||||
name: 'formTextDefinition',
|
||||
processDefinitionId: 'textDefinition:1:153',
|
||||
@ -160,7 +160,7 @@ export let formDefinitionTwoTextFields = {
|
||||
globalDateFormat: 'D-M-YYYY'
|
||||
};
|
||||
|
||||
export let formDefinitionDropdownField = {
|
||||
export const formDefinitionDropdownField: any = {
|
||||
id: 21,
|
||||
name: 'dropdownDefinition',
|
||||
processDefinitionId: 'textDefinition:2:163',
|
||||
@ -282,7 +282,7 @@ export let formDefinitionDropdownField = {
|
||||
globalDateFormat: 'D-M-YYYY'
|
||||
};
|
||||
|
||||
export let formDefinitionRequiredField = {
|
||||
export const formDefinitionRequiredField: any = {
|
||||
id: 21,
|
||||
name: 'dropdownDefinition',
|
||||
processDefinitionId: 'textDefinition:2:163',
|
||||
|
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export let formReadonlyTwoTextFields = {
|
||||
export const formReadonlyTwoTextFields: any = {
|
||||
id: 22,
|
||||
name: 'formTextDefinition',
|
||||
processDefinitionId: 'textDefinition:3:182',
|
||||
|
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export let formDefVisibilitiFieldDependsOnNextOne = {
|
||||
export const formDefVisibilitiFieldDependsOnNextOne: any = {
|
||||
id: 19,
|
||||
processDefinitionId: 'visibility:1:148',
|
||||
processDefinitionName: 'visibility',
|
||||
@ -181,7 +181,7 @@ export let formDefVisibilitiFieldDependsOnNextOne = {
|
||||
globalDateFormat: 'D-M-YYYY'
|
||||
};
|
||||
|
||||
export let formDefVisibilitiFieldDependsOnPreviousOne = {
|
||||
export const formDefVisibilitiFieldDependsOnPreviousOne: any = {
|
||||
id: 19,
|
||||
processDefinitionId: 'visibility:1:148',
|
||||
processDefinitionName: 'visibility',
|
||||
|
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export let startFormDateWidgetMock = {
|
||||
export const startFormDateWidgetMock: any = {
|
||||
id: 4,
|
||||
name: 'Claim Review Process',
|
||||
processDefinitionId: 'ClaimReviewProcess:2: 93',
|
||||
@ -38,7 +38,7 @@ export let startFormDateWidgetMock = {
|
||||
}]
|
||||
};
|
||||
|
||||
export let startFormNumberWidgetMock = {
|
||||
export const startFormNumberWidgetMock: any = {
|
||||
id: 4,
|
||||
name: 'Claim Review Process',
|
||||
processDefinitionId: 'ClaimReviewProcess:2: 93',
|
||||
@ -61,7 +61,7 @@ export let startFormNumberWidgetMock = {
|
||||
}]
|
||||
};
|
||||
|
||||
export let startFormAmountWidgetMock = {
|
||||
export const startFormAmountWidgetMock: any = {
|
||||
id: 4,
|
||||
name: 'Claim Review Process',
|
||||
processDefinitionId: 'ClaimReviewProcess:2: 93',
|
||||
@ -84,7 +84,7 @@ export let startFormAmountWidgetMock = {
|
||||
}]
|
||||
};
|
||||
|
||||
export let startFormRadioButtonWidgetMock = {
|
||||
export const startFormRadioButtonWidgetMock: any = {
|
||||
id: 4,
|
||||
name: 'Claim Review Process',
|
||||
processDefinitionId: 'ClaimReviewProcess:2: 93',
|
||||
@ -107,7 +107,7 @@ export let startFormRadioButtonWidgetMock = {
|
||||
}]
|
||||
};
|
||||
|
||||
export let startFormTextDefinitionMock = {
|
||||
export const startFormTextDefinitionMock: any = {
|
||||
id: 4,
|
||||
name: 'Claim Review Process',
|
||||
processDefinitionId: 'ClaimReviewProcess:2: 93',
|
||||
@ -130,7 +130,7 @@ export let startFormTextDefinitionMock = {
|
||||
}]
|
||||
};
|
||||
|
||||
export let startFormDropdownDefinitionMock = {
|
||||
export const startFormDropdownDefinitionMock: any = {
|
||||
id: 4,
|
||||
name: 'Claim Review Process',
|
||||
processDefinitionId: 'ClaimReviewProcess:2: 93',
|
||||
@ -179,7 +179,7 @@ export let startFormDropdownDefinitionMock = {
|
||||
}]
|
||||
};
|
||||
|
||||
export let startMockForm = {
|
||||
export const startMockForm: any = {
|
||||
id: 4,
|
||||
name: 'Claim Review Process',
|
||||
processDefinitionId: 'ClaimReviewProcess:2: 93',
|
||||
@ -593,7 +593,7 @@ export let startMockForm = {
|
||||
globalDateFormat: 'D - M - YYYY'
|
||||
};
|
||||
|
||||
export let startMockFormWithTab = {
|
||||
export const startMockFormWithTab: any = {
|
||||
id: 4,
|
||||
taskName: 'Mock Title',
|
||||
processDefinitionId: 'ClaimReviewProcess:2: 93',
|
||||
|
@ -19,13 +19,13 @@ import { FormModel, FormValues } from '../../form/components/widgets/core/index'
|
||||
|
||||
export let formTest = new FormModel({});
|
||||
|
||||
export let fakeTaskProcessVariableModels = [
|
||||
export const fakeTaskProcessVariableModels = [
|
||||
{ id: 'TEST_VAR_1', type: 'string', value: 'test_value_1' },
|
||||
{ id: 'TEST_VAR_2', type: 'string', value: 'test_value_2' },
|
||||
{ id: 'TEST_VAR_3', type: 'string', value: 'test_value_3' }
|
||||
];
|
||||
|
||||
export let formValues: FormValues = {
|
||||
export const formValues: FormValues = {
|
||||
'test_1': 'value_1',
|
||||
'test_2': 'value_2',
|
||||
'test_3': 'value_1',
|
||||
@ -34,7 +34,7 @@ export let formValues: FormValues = {
|
||||
'dropdown': { 'id': 'dropdown_id', 'name': 'dropdown_label' }
|
||||
};
|
||||
|
||||
export let fakeFormJson = {
|
||||
export const fakeFormJson: any = {
|
||||
id: '9999',
|
||||
name: 'FORM_VISIBILITY',
|
||||
processDefinitionId: 'PROCESS_TEST:9:9999',
|
||||
@ -116,7 +116,7 @@ export let fakeFormJson = {
|
||||
]
|
||||
};
|
||||
|
||||
export let complexVisibilityJsonVisible = {
|
||||
export const complexVisibilityJsonVisible: any = {
|
||||
'id': 47591,
|
||||
'name': 'Test-visibility',
|
||||
'description': '',
|
||||
@ -481,7 +481,7 @@ export let complexVisibilityJsonVisible = {
|
||||
'gridsterForm': false
|
||||
}
|
||||
};
|
||||
export let complexVisibilityJsonNotVisible = {
|
||||
export const complexVisibilityJsonNotVisible: any = {
|
||||
'id': 47591,
|
||||
'name': 'Test-visibility',
|
||||
'description': '',
|
||||
@ -847,7 +847,7 @@ export let complexVisibilityJsonNotVisible = {
|
||||
}
|
||||
};
|
||||
|
||||
export let nextConditionForm = {
|
||||
export const nextConditionForm: any = {
|
||||
id: '9999',
|
||||
name: 'FORM_PROCESS_VARIABLE_VISIBILITY',
|
||||
processDefinitionId: 'PROCESS_TEST:9:9999',
|
||||
@ -955,7 +955,7 @@ export let nextConditionForm = {
|
||||
]
|
||||
};
|
||||
|
||||
export let headerVisibilityCond = {
|
||||
export const headerVisibilityCond: any = {
|
||||
'id': 'form-f0823c05-51eb-4703-8634-75a6d5e15df5',
|
||||
'name': 'text_form',
|
||||
'description': '',
|
||||
|
@ -19,13 +19,13 @@ import { FormModel, FormValues } from '../../form/components/widgets/core/index'
|
||||
|
||||
export let formTest = new FormModel({});
|
||||
|
||||
export let fakeTaskProcessVariableModels = [
|
||||
export const fakeTaskProcessVariableModels = [
|
||||
{ id: 'TEST_VAR_1', type: 'string', value: 'test_value_1' },
|
||||
{ id: 'TEST_VAR_2', type: 'string', value: 'test_value_2' },
|
||||
{ id: 'TEST_VAR_3', type: 'string', value: 'test_value_3' }
|
||||
];
|
||||
|
||||
export let formValues: FormValues = {
|
||||
export const formValues: FormValues = {
|
||||
'test_1': 'value_1',
|
||||
'test_2': 'value_2',
|
||||
'test_3': 'value_1',
|
||||
@ -34,7 +34,7 @@ export let formValues: FormValues = {
|
||||
'dropdown': { 'id': 'dropdown_id', 'name': 'dropdown_label' }
|
||||
};
|
||||
|
||||
export let fakeFormJson = {
|
||||
export const fakeFormJson: any = {
|
||||
id: '9999',
|
||||
name: 'FORM_VISIBILITY',
|
||||
processDefinitionId: 'PROCESS_TEST: 9: 9999',
|
||||
@ -116,7 +116,7 @@ export let fakeFormJson = {
|
||||
]
|
||||
};
|
||||
|
||||
export let complexVisibilityJsonVisible = {
|
||||
export const complexVisibilityJsonVisible: any = {
|
||||
'id': 47591,
|
||||
'name': 'Test-visibility',
|
||||
'description': '',
|
||||
@ -489,7 +489,8 @@ export let complexVisibilityJsonVisible = {
|
||||
'gridsterForm': false
|
||||
}
|
||||
};
|
||||
export let complexVisibilityJsonNotVisible = {
|
||||
|
||||
export const complexVisibilityJsonNotVisible: any = {
|
||||
'id': 47591,
|
||||
'name': 'Test-visibility',
|
||||
'description': '',
|
||||
@ -859,7 +860,7 @@ export let complexVisibilityJsonNotVisible = {
|
||||
}
|
||||
};
|
||||
|
||||
export let tabVisibilityJsonMock = {
|
||||
export const tabVisibilityJsonMock: any = {
|
||||
'id': 45231,
|
||||
'name': 'visibility-form',
|
||||
'description': '',
|
||||
@ -1000,7 +1001,7 @@ export let tabVisibilityJsonMock = {
|
||||
}
|
||||
};
|
||||
|
||||
export const tabInvalidFormVisibility = {
|
||||
export const tabInvalidFormVisibility: any = {
|
||||
'id': 'form-0668939d-34b2-440c-ab4d-01ab8b05a881',
|
||||
'name': 'tab-visibility',
|
||||
'description': '',
|
||||
|
@ -163,6 +163,7 @@ export class AuthenticationService {
|
||||
if (this.alfrescoApi.getInstance()) {
|
||||
return this.alfrescoApi.getInstance().logout();
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { throwError as observableThrowError, Observable } from 'rxjs';
|
||||
import { throwError as observableThrowError, Observable, of } from 'rxjs';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
import { Pagination } from '@alfresco/js-api';
|
||||
import { IdentityRoleModel } from '../models/identity-role.model';
|
||||
@ -90,6 +90,7 @@ export class IdentityRoleService {
|
||||
.post(`${this.identityHost}/roles`, request)
|
||||
.pipe(catchError(error => this.handleError(error)));
|
||||
}
|
||||
return of();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -119,6 +120,7 @@ export class IdentityRoleService {
|
||||
.put(`${this.identityHost}/roles-by-id/${roleId}`, request)
|
||||
.pipe(catchError(error => this.handleError(error)));
|
||||
}
|
||||
return of();
|
||||
}
|
||||
|
||||
private handleError(error: any) {
|
||||
|
@ -59,14 +59,18 @@ export class LockService {
|
||||
return node.properties['cm:lockType'] === 'WRITE_LOCK' && node.properties['cm:lockLifetime'] === 'PERSISTENT';
|
||||
}
|
||||
|
||||
private getLockExpiryTime(node: Node): Moment {
|
||||
private getLockExpiryTime(node: Node): Moment | undefined {
|
||||
if (node.properties['cm:expiryDate']) {
|
||||
return moment(node.properties['cm:expiryDate'], 'yyyy-MM-ddThh:mm:ssZ');
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
private isLockExpired(node: Node): boolean {
|
||||
const expiryLockTime = this.getLockExpiryTime(node);
|
||||
return moment().isAfter(expiryLockTime);
|
||||
if (expiryLockTime) {
|
||||
return moment().isAfter(expiryLockTime);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -139,9 +139,9 @@ export class UserPreferencesService {
|
||||
* @param property Name of the property
|
||||
* @returns True if the item is present, false otherwise
|
||||
*/
|
||||
hasItem(property: string) {
|
||||
hasItem(property: string): boolean {
|
||||
if (!property) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
return this.storage.hasItem(
|
||||
this.getPropertyKey(property)
|
||||
|
@ -50,7 +50,7 @@ export class MomentDateAdapter extends DateAdapter<Moment> {
|
||||
case 'narrow':
|
||||
return this.localeData.monthsShort().map((month) => month[0]);
|
||||
default :
|
||||
return;
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ export class MomentDateAdapter extends DateAdapter<Moment> {
|
||||
case 'narrow':
|
||||
return this.localeData.weekdaysShort();
|
||||
default :
|
||||
return;
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -336,7 +336,7 @@ describe('Test PdfViewer component', () => {
|
||||
fixtureUrlTestPasswordComponent = TestBed.createComponent(UrlTestPasswordComponent);
|
||||
componentUrlTestPasswordComponent = fixtureUrlTestPasswordComponent.componentInstance;
|
||||
|
||||
spyOn(dialog, 'open').and.callFake((_, context) => {
|
||||
spyOn(dialog, 'open').and.callFake((_: any, context: any) => {
|
||||
if (context.data.reason === pdfjsLib.PasswordResponses.NEED_PASSWORD) {
|
||||
return {
|
||||
afterClosed: () => of('wrong_password')
|
||||
@ -348,6 +348,8 @@ describe('Test PdfViewer component', () => {
|
||||
afterClosed: () => of('password')
|
||||
};
|
||||
}
|
||||
|
||||
return undefined;
|
||||
});
|
||||
|
||||
fixtureUrlTestPasswordComponent.detectChanges();
|
||||
|
@ -55,6 +55,8 @@ export class TxtViewerComponent implements OnChanges {
|
||||
if (!this.urlFile && !this.blobFile) {
|
||||
throw new Error('Attribute urlFile or blobFile is required');
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
private getUrlContent(url: string): Promise<any> {
|
||||
|
@ -126,6 +126,8 @@ export class ViewUtilService {
|
||||
return await this.waitRendition(nodeId, renditionId, retries);
|
||||
}
|
||||
}
|
||||
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
getViewerTypeByMimeType(mimeType: string): string {
|
||||
|
@ -102,7 +102,7 @@ export function reduceEmptyMenus(
|
||||
return acc.concat(el);
|
||||
}
|
||||
|
||||
export function mergeObjects(...objects): any {
|
||||
export function mergeObjects(...objects: object[]): any {
|
||||
const result = {};
|
||||
|
||||
objects.forEach((source) => {
|
||||
|
@ -62,8 +62,6 @@ export class ContentCloudNodeSelectorService {
|
||||
}
|
||||
|
||||
private isNodeFile(entry: Node): boolean {
|
||||
if (entry) {
|
||||
return entry.isFile;
|
||||
}
|
||||
return entry && entry.isFile;
|
||||
}
|
||||
}
|
||||
|
@ -221,17 +221,16 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
||||
return this.filterProperties.indexOf(EditProcessFilterCloudComponent.LAST_MODIFIED) >= 0;
|
||||
}
|
||||
|
||||
removeOrderProperty(filteredProperties: ProcessFilterProperties[]) {
|
||||
removeOrderProperty(filteredProperties: ProcessFilterProperties[]): ProcessFilterProperties[] {
|
||||
if (filteredProperties && filteredProperties.length > 0) {
|
||||
const propertiesWithOutOrderProperty = filteredProperties.filter(
|
||||
(property: ProcessFilterProperties) => {
|
||||
return property.key !== EditProcessFilterCloudComponent.ORDER;
|
||||
});
|
||||
return propertiesWithOutOrderProperty;
|
||||
return filteredProperties.filter(
|
||||
property => property.key !== EditProcessFilterCloudComponent.ORDER
|
||||
);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
get createSortProperties(): any {
|
||||
get createSortProperties(): ProcessFilterOptions[] {
|
||||
this.checkMandatorySortProperties();
|
||||
const sortProperties = this.sortProperties.map((property: string) => {
|
||||
return <ProcessFilterOptions> { label: property.charAt(0).toUpperCase() + property.slice(1), value: property };
|
||||
@ -425,6 +424,8 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
||||
if (action.actionType === EditProcessFilterCloudComponent.ACTION_DELETE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private setLastModifiedToFilter(formValues: ProcessFilterCloudModel) {
|
||||
|
@ -152,11 +152,14 @@ export class ProcessFilterCloudService {
|
||||
*/
|
||||
deleteFilter(deletedFilter: ProcessFilterCloudModel): Observable<ProcessFilterCloudModel[]> {
|
||||
const key = this.prepareKey(deletedFilter.appName);
|
||||
|
||||
return this.getProcessFiltersByKey(deletedFilter.appName, key).pipe(
|
||||
switchMap((filters: any) => {
|
||||
switchMap(filters => {
|
||||
if (filters && filters.length > 0) {
|
||||
filters = filters.filter((filter: ProcessFilterCloudModel) => filter.id !== deletedFilter.id);
|
||||
filters = filters.filter(filter => filter.id !== deletedFilter.id);
|
||||
return this.updateProcessFilters(deletedFilter.appName, key, filters);
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}),
|
||||
map((filters: ProcessFilterCloudModel[]) => {
|
||||
|
@ -57,16 +57,17 @@ export class ProcessListCloudService extends BaseCloudService {
|
||||
return throwError('Appname not configured');
|
||||
}
|
||||
}
|
||||
private buildQueryUrl(requestNode: ProcessQueryCloudRequestModel) {
|
||||
|
||||
private buildQueryUrl(requestNode: ProcessQueryCloudRequestModel): string {
|
||||
this.contextRoot = this.appConfigService.get('bpmHost', '');
|
||||
return `${this.getBasePath(requestNode.appName)}/query/v1/process-instances`;
|
||||
}
|
||||
|
||||
private isPropertyValueValid(requestNode, property) {
|
||||
private isPropertyValueValid(requestNode: any, property: string) {
|
||||
return requestNode[property] !== '' && requestNode[property] !== null && requestNode[property] !== undefined;
|
||||
}
|
||||
|
||||
private buildQueryParams(requestNode: ProcessQueryCloudRequestModel) {
|
||||
private buildQueryParams(requestNode: ProcessQueryCloudRequestModel): Object {
|
||||
const queryParam = {};
|
||||
for (const property in requestNode) {
|
||||
if (requestNode.hasOwnProperty(property) &&
|
||||
@ -78,7 +79,7 @@ export class ProcessListCloudService extends BaseCloudService {
|
||||
return queryParam;
|
||||
}
|
||||
|
||||
private isExcludedField(property) {
|
||||
private isExcludedField(property: string): boolean {
|
||||
return property === 'appName' || property === 'sorting';
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,13 @@ export class LocalPreferenceCloudService implements PreferenceCloudServiceInterf
|
||||
if (key || key === '') {
|
||||
return of(this.prepareLocalPreferenceResponse(key));
|
||||
}
|
||||
return of(
|
||||
{
|
||||
'list': {
|
||||
'entries': []
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -70,8 +77,8 @@ export class LocalPreferenceCloudService implements PreferenceCloudServiceInterf
|
||||
updatePreference(_: string, key: string, updatedPreference: any): Observable<any> {
|
||||
if (key) {
|
||||
this.storage.setItem(key, JSON.stringify(updatedPreference));
|
||||
return of(updatedPreference);
|
||||
}
|
||||
return of(updatedPreference);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -84,8 +91,8 @@ export class LocalPreferenceCloudService implements PreferenceCloudServiceInterf
|
||||
deletePreference(key: string, preferences: any): Observable<any> {
|
||||
if (key) {
|
||||
this.storage.setItem(key, JSON.stringify(preferences));
|
||||
return of(preferences);
|
||||
}
|
||||
return of(preferences);
|
||||
}
|
||||
|
||||
prepareLocalPreferenceResponse(key: string): any {
|
||||
|
@ -242,11 +242,11 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
||||
return this.filterProperties.indexOf(EditTaskFilterCloudComponent.SORT) >= 0;
|
||||
}
|
||||
|
||||
removeOrderProperty(filteredProperties: TaskFilterProperties[]) {
|
||||
removeOrderProperty(filteredProperties: TaskFilterProperties[]): TaskFilterProperties[] {
|
||||
if (filteredProperties && filteredProperties.length > 0) {
|
||||
const propertiesWithOutOrderProperty = filteredProperties.filter((property: TaskFilterProperties) => { return property.key !== EditTaskFilterCloudComponent.ORDER; });
|
||||
return propertiesWithOutOrderProperty;
|
||||
return filteredProperties.filter(property => property.key !== EditTaskFilterCloudComponent.ORDER);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
hasLastModifiedProperty(): boolean {
|
||||
@ -261,19 +261,19 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
||||
return sortProperties;
|
||||
}
|
||||
|
||||
checkMandatorySortProperties() {
|
||||
checkMandatorySortProperties(): void {
|
||||
if (this.sortProperties === undefined || this.sortProperties.length === 0) {
|
||||
this.sortProperties = EditTaskFilterCloudComponent.DEFAULT_SORT_PROPERTIES;
|
||||
}
|
||||
}
|
||||
|
||||
createAndFilterActions() {
|
||||
createAndFilterActions(): TaskFilterAction[] {
|
||||
this.checkMandatoryActions();
|
||||
const allActions = this.createFilterActions();
|
||||
return allActions.filter((action: TaskFilterAction) => this.isValidAction(this.actions, action));
|
||||
return this.createFilterActions()
|
||||
.filter(action => this.isValidAction(this.actions, action));
|
||||
}
|
||||
|
||||
checkMandatoryActions() {
|
||||
checkMandatoryActions(): void {
|
||||
if (this.actions === undefined || this.actions.length === 0) {
|
||||
this.actions = EditTaskFilterCloudComponent.DEFAULT_ACTIONS;
|
||||
}
|
||||
@ -316,9 +316,11 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
||||
return JSON.stringify(editedQuery).toLowerCase() === JSON.stringify(currentQuery).toLowerCase();
|
||||
}
|
||||
|
||||
getRunningApplications() {
|
||||
this.appsProcessCloudService.getDeployedApplicationsByStatus(EditTaskFilterCloudComponent.APP_RUNNING_STATUS)
|
||||
.pipe(takeUntil(this.onDestroy$)).subscribe((applications: ApplicationInstanceModel[]) => {
|
||||
getRunningApplications(): void {
|
||||
this.appsProcessCloudService
|
||||
.getDeployedApplicationsByStatus(EditTaskFilterCloudComponent.APP_RUNNING_STATUS)
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe((applications: ApplicationInstanceModel[]) => {
|
||||
if (applications && applications.length > 0) {
|
||||
applications.map((application) => {
|
||||
this.applicationNames.push({ label: application.name, value: application.name });
|
||||
@ -337,24 +339,28 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
||||
}
|
||||
}
|
||||
|
||||
save(saveAction: TaskFilterAction) {
|
||||
this.taskFilterCloudService.updateFilter(this.changedTaskFilter)
|
||||
.pipe(takeUntil(this.onDestroy$)).subscribe(() => {
|
||||
saveAction.filter = this.changedTaskFilter;
|
||||
this.action.emit(saveAction);
|
||||
this.formHasBeenChanged = this.compareFilters(this.changedTaskFilter, this.taskFilter);
|
||||
});
|
||||
save(saveAction: TaskFilterAction): void {
|
||||
this.taskFilterCloudService
|
||||
.updateFilter(this.changedTaskFilter)
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(() => {
|
||||
saveAction.filter = this.changedTaskFilter;
|
||||
this.action.emit(saveAction);
|
||||
this.formHasBeenChanged = this.compareFilters(this.changedTaskFilter, this.taskFilter);
|
||||
});
|
||||
}
|
||||
|
||||
delete(deleteAction: TaskFilterAction) {
|
||||
this.taskFilterCloudService.deleteFilter(this.taskFilter)
|
||||
.pipe(takeUntil(this.onDestroy$)).subscribe(() => {
|
||||
deleteAction.filter = this.taskFilter;
|
||||
this.action.emit(deleteAction);
|
||||
});
|
||||
delete(deleteAction: TaskFilterAction): void {
|
||||
this.taskFilterCloudService
|
||||
.deleteFilter(this.taskFilter)
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(() => {
|
||||
deleteAction.filter = this.taskFilter;
|
||||
this.action.emit(deleteAction);
|
||||
});
|
||||
}
|
||||
|
||||
saveAs(saveAsAction: TaskFilterAction) {
|
||||
saveAs(saveAsAction: TaskFilterAction): void {
|
||||
const dialogRef = this.dialog.open(TaskFilterDialogCloudComponent, {
|
||||
data: {
|
||||
name: this.translateService.instant(this.taskFilter.name)
|
||||
@ -404,11 +410,11 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
||||
return this.showFilterActions;
|
||||
}
|
||||
|
||||
onExpand() {
|
||||
onExpand(): void {
|
||||
this.toggleFilterActions = true;
|
||||
}
|
||||
|
||||
onClose() {
|
||||
onClose(): void {
|
||||
this.toggleFilterActions = false;
|
||||
}
|
||||
|
||||
@ -438,6 +444,8 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
||||
if (action.actionType === EditTaskFilterCloudComponent.ACTION_DELETE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
createFilterActions(): TaskFilterAction[] {
|
||||
|
@ -201,13 +201,14 @@ export class TaskFilterCloudService {
|
||||
deleteFilter(deletedFilter: TaskFilterCloudModel): Observable<TaskFilterCloudModel[]> {
|
||||
const key = this.prepareKey(deletedFilter.appName);
|
||||
return this.getTaskFiltersByKey(deletedFilter.appName, key).pipe(
|
||||
switchMap((filters: any) => {
|
||||
switchMap(filters => {
|
||||
if (filters && filters.length > 0) {
|
||||
filters = filters.filter((filter: TaskFilterCloudModel) => filter.id !== deletedFilter.id);
|
||||
filters = filters.filter(filter => filter.id !== deletedFilter.id);
|
||||
return this.updateTaskFilters(deletedFilter.appName, key, filters);
|
||||
}
|
||||
return [];
|
||||
}),
|
||||
map((filters: TaskFilterCloudModel[]) => {
|
||||
map(filters => {
|
||||
this.addFiltersToStream(filters);
|
||||
return filters;
|
||||
}),
|
||||
|
@ -65,8 +65,8 @@ export class TaskListCloudService extends BaseCloudService {
|
||||
return `${this.getBasePath(requestNode.appName)}/query/v1/tasks`;
|
||||
}
|
||||
|
||||
private buildQueryParams(requestNode: TaskQueryCloudRequestModel) {
|
||||
const queryParam = {};
|
||||
private buildQueryParams(requestNode: TaskQueryCloudRequestModel): Object {
|
||||
const queryParam: Object = {};
|
||||
for (const property in requestNode) {
|
||||
if (requestNode.hasOwnProperty(property) &&
|
||||
!this.isExcludedField(property) &&
|
||||
@ -77,11 +77,11 @@ export class TaskListCloudService extends BaseCloudService {
|
||||
return queryParam;
|
||||
}
|
||||
|
||||
private isExcludedField(property) {
|
||||
private isExcludedField(property: string): boolean {
|
||||
return property === 'appName' || property === 'sorting';
|
||||
}
|
||||
|
||||
private isPropertyValueValid(requestNode, property) {
|
||||
private isPropertyValueValid(requestNode: any, property: string): boolean {
|
||||
return requestNode[property] !== '' && requestNode[property] !== null && requestNode[property] !== undefined;
|
||||
}
|
||||
|
||||
|
@ -231,7 +231,7 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
|
||||
});
|
||||
}
|
||||
|
||||
private getDomainHost(urlToCheck) {
|
||||
private getDomainHost(urlToCheck: string): string {
|
||||
const result = urlToCheck.match('^(?:https?:\/\/)?(?:[^@\/\n]+@)?(?:www\.)?([^:\/?\n]+)');
|
||||
return result[1];
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ export class PeopleSearchComponent implements OnInit {
|
||||
this.performSearch = this.performSearchCallback.bind(this);
|
||||
}
|
||||
|
||||
private performSearchCallback(event): Observable<UserProcessModel[]> {
|
||||
private performSearchCallback(event: any): Observable<UserProcessModel[]> {
|
||||
this.searchPeople.emit(event);
|
||||
return this.filteredResults$;
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ export class ProcessFiltersComponent implements OnInit, OnChanges {
|
||||
* Pass the selected filter as next
|
||||
* @param filter
|
||||
*/
|
||||
public selectFilter(filter: ProcessInstanceFilterRepresentation) {
|
||||
selectFilter(filter: ProcessInstanceFilterRepresentation) {
|
||||
this.currentFilter = filter;
|
||||
this.filterClick.emit(filter);
|
||||
}
|
||||
@ -153,7 +153,7 @@ export class ProcessFiltersComponent implements OnInit, OnChanges {
|
||||
/**
|
||||
* Select the first filter of a list if present
|
||||
*/
|
||||
public selectProcessFilter(filterParam: FilterProcessRepresentationModel) {
|
||||
selectProcessFilter(filterParam: FilterProcessRepresentationModel) {
|
||||
if (filterParam) {
|
||||
this.filters.filter((processFilter: UserProcessInstanceFilterRepresentation, index) => {
|
||||
if (filterParam.name && filterParam.name.toLowerCase() === processFilter.name.toLowerCase() ||
|
||||
@ -172,14 +172,14 @@ export class ProcessFiltersComponent implements OnInit, OnChanges {
|
||||
/**
|
||||
* Select the Running filter
|
||||
*/
|
||||
public selectRunningFilter() {
|
||||
selectRunningFilter() {
|
||||
this.selectProcessFilter(this.processFilterService.getRunningFilterInstance(null));
|
||||
}
|
||||
|
||||
/**
|
||||
* Select as default task filter the first in the list
|
||||
*/
|
||||
public selectDefaultTaskFilter() {
|
||||
selectDefaultTaskFilter() {
|
||||
if (!this.isFilterListEmpty()) {
|
||||
this.currentFilter = this.filters[0];
|
||||
this.filterSelected.emit(this.filters[0]);
|
||||
@ -215,7 +215,7 @@ export class ProcessFiltersComponent implements OnInit, OnChanges {
|
||||
/**
|
||||
* Return current filter icon
|
||||
*/
|
||||
getFilterIcon(icon): string {
|
||||
getFilterIcon(icon: string): string {
|
||||
return this.iconsMDL.mapGlyphiconToMaterialDesignIcons(icon);
|
||||
}
|
||||
}
|
||||
|
@ -52,21 +52,21 @@ export class ProcessInstanceDetailsComponent implements OnChanges {
|
||||
|
||||
/** Emitted when the current process is cancelled by the user from within the component. */
|
||||
@Output()
|
||||
processCancelled: EventEmitter<any> = new EventEmitter<any>();
|
||||
processCancelled = new EventEmitter<any>();
|
||||
|
||||
/** Emitted when an error occurs. */
|
||||
@Output()
|
||||
error: EventEmitter<any> = new EventEmitter<any>();
|
||||
error = new EventEmitter<any>();
|
||||
|
||||
/** Emitted when a task is clicked. */
|
||||
@Output()
|
||||
taskClick: EventEmitter<TaskDetailsEvent> = new EventEmitter<TaskDetailsEvent>();
|
||||
taskClick = new EventEmitter<TaskDetailsEvent>();
|
||||
|
||||
processInstanceDetails: ProcessInstance;
|
||||
|
||||
/** Emitted when the "show diagram" button is clicked. */
|
||||
@Output()
|
||||
showProcessDiagram: EventEmitter<any> = new EventEmitter<any>();
|
||||
showProcessDiagram = new EventEmitter<any>();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -124,7 +124,7 @@ export class ProcessInstanceDetailsComponent implements OnChanges {
|
||||
this.taskClick.emit(event);
|
||||
}
|
||||
|
||||
getProcessNameOrDescription(dateFormat): string {
|
||||
getProcessNameOrDescription(dateFormat: string): string {
|
||||
let name = '';
|
||||
if (this.processInstanceDetails) {
|
||||
name = this.processInstanceDetails.name ||
|
||||
@ -133,7 +133,7 @@ export class ProcessInstanceDetailsComponent implements OnChanges {
|
||||
return name;
|
||||
}
|
||||
|
||||
getFormatDate(value, format: string) {
|
||||
getFormatDate(value: any, format: string): any {
|
||||
const datePipe = new DatePipe('en-US');
|
||||
try {
|
||||
return datePipe.transform(value, format);
|
||||
|
@ -120,6 +120,7 @@ export class ProcessInstanceHeaderComponent implements OnChanges {
|
||||
if (this.processInstance) {
|
||||
return this.isRunning() ? 'Running' : 'Completed';
|
||||
}
|
||||
return 'Unknown';
|
||||
}
|
||||
|
||||
getStartedByFullName(): string {
|
||||
|
@ -144,7 +144,7 @@ export class ProcessInstanceTasksComponent implements OnInit, OnChanges, OnDestr
|
||||
return this.processInstanceDetails && this.processInstanceDetails.startFormDefined === true;
|
||||
}
|
||||
|
||||
getUserFullName(user: any) {
|
||||
getUserFullName(user: any): string {
|
||||
if (user) {
|
||||
return (user.firstName && user.firstName !== 'null'
|
||||
? user.firstName + ' ' : '') +
|
||||
@ -153,12 +153,13 @@ export class ProcessInstanceTasksComponent implements OnInit, OnChanges, OnDestr
|
||||
return 'Nobody';
|
||||
}
|
||||
|
||||
getFormatDate(value, format: string) {
|
||||
getFormatDate(value: any, format: string): any {
|
||||
const datePipe = new DatePipe('en-US');
|
||||
try {
|
||||
return datePipe.transform(value, format);
|
||||
} catch (err) {
|
||||
this.logService.error(`ProcessListInstanceTask: error parsing date ${value} to format ${format}`);
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -292,7 +292,7 @@ export class ProcessInstanceListComponent extends DataTableSchema implements On
|
||||
return instances;
|
||||
}
|
||||
|
||||
getProcessNameOrDescription(processInstance, dateFormat): string {
|
||||
getProcessNameOrDescription(processInstance, dateFormat: string): string {
|
||||
let name = '';
|
||||
if (processInstance) {
|
||||
name = processInstance.name ||
|
||||
@ -301,7 +301,7 @@ export class ProcessInstanceListComponent extends DataTableSchema implements On
|
||||
return name;
|
||||
}
|
||||
|
||||
getFormatDate(value, format: string) {
|
||||
getFormatDate(value: any, format: string) {
|
||||
const datePipe = new DatePipe('en-US');
|
||||
try {
|
||||
return datePipe.transform(value, format);
|
||||
@ -310,7 +310,7 @@ export class ProcessInstanceListComponent extends DataTableSchema implements On
|
||||
}
|
||||
}
|
||||
|
||||
private createRequestNode() {
|
||||
private createRequestNode(): ProcessFilterParamRepresentationModel {
|
||||
const requestNode = {
|
||||
appDefinitionId: this.appId,
|
||||
processDefinitionId: this.processDefinitionId,
|
||||
|
@ -152,9 +152,11 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr
|
||||
}
|
||||
return filteredProcess;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
getSelectedProcess(selectedProcess) {
|
||||
getSelectedProcess(selectedProcess: string): ProcessDefinitionRepresentation {
|
||||
let processSelected = this.processDefinitions.find((process) => process.name.toLowerCase() === selectedProcess);
|
||||
|
||||
if (!processSelected) {
|
||||
@ -163,7 +165,7 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr
|
||||
return processSelected;
|
||||
}
|
||||
|
||||
public loadStartProcess() {
|
||||
loadStartProcess(): void {
|
||||
this.resetSelectedProcessDefinition();
|
||||
this.resetErrorMessage();
|
||||
|
||||
@ -206,7 +208,7 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr
|
||||
return alfrescoRepositoryName + 'Alfresco';
|
||||
}
|
||||
|
||||
moveNodeFromCStoPS() {
|
||||
moveNodeFromCStoPS(): void {
|
||||
const accountIdentifier = this.getAlfrescoRepositoryName();
|
||||
|
||||
for (const key in this.values) {
|
||||
@ -222,7 +224,7 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr
|
||||
}
|
||||
}
|
||||
|
||||
public startProcess(outcome?: string) {
|
||||
startProcess(outcome?: string) {
|
||||
if (this.selectedProcessDef && this.selectedProcessDef.id && this.name) {
|
||||
this.resetErrorMessage();
|
||||
const formValues = this.startForm ? this.startForm.form.values : undefined;
|
||||
@ -239,7 +241,7 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr
|
||||
}
|
||||
}
|
||||
|
||||
public cancelStartProcess() {
|
||||
cancelStartProcess(): void {
|
||||
this.cancel.emit();
|
||||
}
|
||||
|
||||
@ -247,8 +249,9 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr
|
||||
return this.selectedProcessDef && this.selectedProcessDef.hasStartForm;
|
||||
}
|
||||
|
||||
isProcessDefinitionEmpty() {
|
||||
return this.processDefinitions ? (this.processDefinitions.length > 0 || this.errorMessageId) : this.errorMessageId;
|
||||
isProcessDefinitionEmpty(): boolean {
|
||||
const hasErrorMessage = this.errorMessageId ? true : false;
|
||||
return this.processDefinitions ? (this.processDefinitions.length > 0 || hasErrorMessage) : hasErrorMessage;
|
||||
}
|
||||
|
||||
isStartFormMissingOrValid(): boolean {
|
||||
@ -279,7 +282,7 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr
|
||||
this.startProcess(outcome);
|
||||
}
|
||||
|
||||
public reset() {
|
||||
reset(): void {
|
||||
this.resetSelectedProcessDefinition();
|
||||
this.name = '';
|
||||
if (this.startForm) {
|
||||
@ -292,7 +295,7 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr
|
||||
return this.name ? true : false;
|
||||
}
|
||||
|
||||
displayFn(process: any) {
|
||||
displayFn(process: any): string {
|
||||
if (process) {
|
||||
let processName = process;
|
||||
if (typeof process !== 'string') {
|
||||
@ -300,6 +303,7 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr
|
||||
}
|
||||
return processName;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
displayDropdown(event) {
|
||||
|
@ -109,7 +109,7 @@ export class StartTaskComponent implements OnInit, OnDestroy {
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
buildForm() {
|
||||
buildForm(): void {
|
||||
this.taskForm = this.formBuilder.group({
|
||||
name: new FormControl(this.taskDetailsModel.name, [Validators.required, Validators.maxLength(this.maxTaskNameLength), this.whitespaceValidator]),
|
||||
description: new FormControl('', [this.whitespaceValidator]),
|
||||
@ -121,25 +121,26 @@ export class StartTaskComponent implements OnInit, OnDestroy {
|
||||
.subscribe(taskFormValues => this.setTaskDetails(taskFormValues));
|
||||
}
|
||||
|
||||
public whitespaceValidator(control: FormControl) {
|
||||
whitespaceValidator(control: FormControl): any {
|
||||
if (control.value) {
|
||||
const isWhitespace = (control.value || '').trim().length === 0;
|
||||
const isValid = control.value.length === 0 || !isWhitespace;
|
||||
return isValid ? null : { 'whitespace': true };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
setTaskDetails(form) {
|
||||
setTaskDetails(form: any) {
|
||||
this.taskDetailsModel.name = form.name;
|
||||
this.taskDetailsModel.description = form.description;
|
||||
this.taskDetailsModel.formKey = form.formKey ? form.formKey.toString() : null;
|
||||
}
|
||||
|
||||
isFormValid() {
|
||||
isFormValid(): boolean {
|
||||
return this.taskForm.valid && !this.dateError && !this.loading;
|
||||
}
|
||||
|
||||
public saveTask(): void {
|
||||
saveTask(): void {
|
||||
this.loading = true;
|
||||
if (this.appId) {
|
||||
this.taskDetailsModel.category = this.appId.toString();
|
||||
@ -169,7 +170,7 @@ export class StartTaskComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
getAssigneeId(userId) {
|
||||
getAssigneeId(userId: number): void {
|
||||
this.assigneeId = userId;
|
||||
}
|
||||
|
||||
@ -189,7 +190,7 @@ export class StartTaskComponent implements OnInit, OnDestroy {
|
||||
return response;
|
||||
}
|
||||
|
||||
public onCancel(): void {
|
||||
onCancel(): void {
|
||||
this.cancel.emit();
|
||||
}
|
||||
|
||||
@ -197,7 +198,7 @@ export class StartTaskComponent implements OnInit, OnDestroy {
|
||||
this.forms$ = this.taskService.getFormList();
|
||||
}
|
||||
|
||||
public isUserNameEmpty(user: UserProcessModel): boolean {
|
||||
isUserNameEmpty(user: UserProcessModel): boolean {
|
||||
return !user || (this.isEmpty(user.firstName) && this.isEmpty(user.lastName));
|
||||
}
|
||||
|
||||
@ -205,7 +206,7 @@ export class StartTaskComponent implements OnInit, OnDestroy {
|
||||
return data === undefined || data === null || data.trim().length === 0;
|
||||
}
|
||||
|
||||
public getDisplayUser(firstName: string, lastName: string, delimiter: string = '-'): string {
|
||||
getDisplayUser(firstName: string, lastName: string, delimiter: string = '-'): string {
|
||||
firstName = (firstName !== null ? firstName : '');
|
||||
lastName = (lastName !== null ? lastName : '');
|
||||
return firstName + delimiter + lastName;
|
||||
@ -215,7 +216,7 @@ export class StartTaskComponent implements OnInit, OnDestroy {
|
||||
this.dateError = false;
|
||||
|
||||
if (newDateValue) {
|
||||
let momentDate;
|
||||
let momentDate: moment.Moment;
|
||||
|
||||
if (typeof newDateValue === 'string') {
|
||||
momentDate = moment(newDateValue, this.FORMAT_DATE, true);
|
||||
|
@ -335,11 +335,11 @@ export class TaskDetailsComponent implements OnInit, OnChanges, OnDestroy {
|
||||
this.isExternalIdEqual(this.taskDetails.assignee.externalId, this.currentLoggedUser.externalId);
|
||||
}
|
||||
|
||||
private isEmailEqual(assigneeMail, currentLoggedEmail): boolean {
|
||||
private isEmailEqual(assigneeMail: string, currentLoggedEmail: string): boolean {
|
||||
return assigneeMail.toLocaleLowerCase() === currentLoggedEmail.toLocaleLowerCase();
|
||||
}
|
||||
|
||||
private isExternalIdEqual(assigneeExternalId, currentUserExternalId): boolean {
|
||||
private isExternalIdEqual(assigneeExternalId: string, currentUserExternalId: string): boolean {
|
||||
return assigneeExternalId.toLocaleLowerCase() === currentUserExternalId.toLocaleLowerCase();
|
||||
}
|
||||
|
||||
|
@ -225,10 +225,11 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
|
||||
/**
|
||||
* Return the process parent information
|
||||
*/
|
||||
getParentInfo() {
|
||||
getParentInfo(): Map<string, string> {
|
||||
if (this.taskDetails.processInstanceId && this.taskDetails.processDefinitionName) {
|
||||
return new Map([[this.taskDetails.processInstanceId, this.taskDetails.processDefinitionName]]);
|
||||
}
|
||||
return new Map();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -241,7 +242,7 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
|
||||
/**
|
||||
* Returns true if the task is assigned to logged in user
|
||||
*/
|
||||
public isAssignedTo(userId): boolean {
|
||||
public isAssignedTo(userId: number): boolean {
|
||||
return this.hasAssignee() ? this.taskDetails.assignee.id === userId : false;
|
||||
}
|
||||
|
||||
@ -255,7 +256,7 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
|
||||
/**
|
||||
* Return true if the user is a candidate member
|
||||
*/
|
||||
isCandidateMember() {
|
||||
isCandidateMember(): boolean {
|
||||
return this.taskDetails.managerOfCandidateGroup || this.taskDetails.memberOfCandidateGroup || this.taskDetails.memberOfCandidateUsers;
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@ import { FilterRepresentationModel, TaskQueryRequestRepresentationModel } from '
|
||||
import { TaskDetailsModel } from '../models/task-details.model';
|
||||
import { TaskListService } from './tasklist.service';
|
||||
import { AlfrescoApiServiceMock, LogService, AppConfigService } from '@alfresco/adf-core';
|
||||
import { TaskUpdateRepresentation } from '@alfresco/js-api';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
@ -452,8 +453,11 @@ describe('Activiti TaskList Service', () => {
|
||||
|
||||
it('should update a task', (done) => {
|
||||
const taskId = '111';
|
||||
const updated: TaskUpdateRepresentation = {
|
||||
name: 'someName'
|
||||
};
|
||||
|
||||
service.updateTask(taskId, { property: 'value' }).subscribe(() => {
|
||||
service.updateTask(taskId, updated).subscribe(() => {
|
||||
done();
|
||||
});
|
||||
|
||||
|
@ -25,7 +25,8 @@ import { TaskDetailsModel } from '../models/task-details.model';
|
||||
import { TaskListModel } from '../models/task-list.model';
|
||||
import {
|
||||
TaskQueryRepresentation,
|
||||
AssigneeIdentifierRepresentation
|
||||
AssigneeIdentifierRepresentation,
|
||||
TaskUpdateRepresentation
|
||||
} from '@alfresco/js-api';
|
||||
|
||||
@Injectable({
|
||||
@ -363,7 +364,7 @@ export class TaskListService {
|
||||
* @param updated Data to update the task (as a `TaskUpdateRepresentation` instance).
|
||||
* @returns Updated task details
|
||||
*/
|
||||
updateTask(taskId: any, updated): Observable<TaskDetailsModel> {
|
||||
updateTask(taskId: any, updated: TaskUpdateRepresentation): Observable<TaskDetailsModel> {
|
||||
return from(this.apiService.taskApi.updateTask(taskId, updated))
|
||||
.pipe(
|
||||
map((result) => <TaskDetailsModel> result),
|
||||
|
@ -13,7 +13,7 @@
|
||||
"noUnusedParameters": true,
|
||||
"noUnusedLocals": true,
|
||||
"noImplicitAny": false,
|
||||
"noImplicitReturns": false,
|
||||
"noImplicitReturns": true,
|
||||
"noImplicitUseStrict": false,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"removeComments": true,
|
||||
|
@ -11,6 +11,7 @@
|
||||
"skipLibCheck": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noImplicitReturns": true,
|
||||
"target": "es5",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"typeRoots": [
|
||||
|
Loading…
x
Reference in New Issue
Block a user