mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +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:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user