fix "ng lint" command (#5012)

* update to latest js-api

* fix the "ng lint" command

* fix linting issues

* fix lint issues

* lint fixes

* code fixes

* fix html

* fix html

* update tests

* test fixes

* update tests

* fix tests and api

* fix code
This commit is contained in:
Denys Vuika
2019-08-29 16:35:30 +01:00
committed by Eugenio Romano
parent 140c64b79f
commit edc0945f39
162 changed files with 537 additions and 530 deletions

View File

@@ -136,7 +136,7 @@ export class ProcessAttachmentListComponent implements OnChanges, AfterContentIn
private deleteAttachmentById(contentId: number) {
if (contentId) {
this.activitiContentService.deleteRelatedContent(contentId).subscribe(
(res: any) => {
() => {
this.attachments = this.attachments.filter((content) => {
return content.id !== contentId;
});

View File

@@ -146,7 +146,7 @@ export class TaskAttachmentListComponent implements OnChanges, AfterContentInit
deleteAttachmentById(contentId: number) {
if (contentId) {
this.activitiContentService.deleteRelatedContent(contentId).subscribe(
(res: any) => {
() => {
this.attachments = this.attachments.filter((content) => {
return content.id !== contentId;
});

View File

@@ -30,7 +30,7 @@
mat-button
[disabled]="!chosenNode"
class="adf-choose-action"
(click)="onClick($event)"
(click)="onClick()"
data-automation-id="attach-file-dialog-actions-choose">{{ buttonActionName | translate }}
</button>

View File

@@ -68,7 +68,7 @@ export class AttachFileWidgetDialogComponent {
}
}
onClick(event: any) {
onClick() {
this.data.selected.next(this.chosenNode);
this.data.selected.complete();
}

View File

@@ -181,7 +181,7 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
(blob: Blob) => {
this.contentService.downloadBlob(blob, (<any> file).name);
},
(err) => {
() => {
this.logger.error('Impossible retrieve content for download');
}
);

View File

@@ -303,7 +303,7 @@ describe('FormComponent', () => {
let saved = false;
formComponent.form = formModel;
formComponent.formSaved.subscribe((v) => saved = true);
formComponent.formSaved.subscribe(() => saved = true);
spyOn(formComponent, 'completeTaskForm').and.stub();
const result = formComponent.onOutcomeClicked(outcome);
@@ -354,7 +354,7 @@ describe('FormComponent', () => {
let saved = false;
formComponent.form = formModel;
formComponent.formSaved.subscribe((v) => saved = true);
formComponent.formSaved.subscribe(() => saved = true);
const result = formComponent.onOutcomeClicked(outcome);
expect(result).toBeTruthy();
@@ -436,7 +436,7 @@ describe('FormComponent', () => {
spyOn(formService, 'getTask').and.returnValue(of({}));
spyOn(formComponent, 'handleError').and.stub();
spyOn(formService, 'getTaskForm').and.callFake((taskId) => {
spyOn(formService, 'getTaskForm').and.callFake(() => {
return throwError(error);
});

View File

@@ -176,7 +176,7 @@ export let fakeRepresentationFilter2: FilterRepresentationModel = new FilterRepr
}
});
export let fakeAppPromise = new Promise(function (resolve, reject) {
export let fakeAppPromise = new Promise(function (resolve) {
resolve(fakeAppFilter);
});

View File

@@ -84,20 +84,25 @@ export class PeopleComponent implements OnInit, AfterViewInit {
involveUser(user: UserProcessModel) {
if (user && user.id) {
this.peopleProcessService.involveUserWithTask(this.taskId, user.id.toString())
.subscribe(() => {
this.people = [...this.people, user];
}, (error) => this.logService.error('Impossible to involve user with task'));
this.peopleProcessService
.involveUserWithTask(this.taskId, user.id.toString())
.subscribe(
() => this.people = [...this.people, user],
() => this.logService.error('Impossible to involve user with task')
);
}
}
removeInvolvedUser(user: UserProcessModel) {
this.peopleProcessService.removeInvolvedUser(this.taskId, user.id.toString())
.subscribe(() => {
this.people = this.people.filter((involvedUser) => {
return involvedUser.id !== user.id;
});
}, (error) => this.logService.error('Impossible to remove involved user from task'));
this.peopleProcessService
.removeInvolvedUser(this.taskId, user.id.toString())
.subscribe(
() => {
this.people = this.people.filter((involvedUser) => {
return involvedUser.id !== user.id;
});
},
() => this.logService.error('Impossible to remove involved user from task'));
}
getDisplayUser(firstName: string, lastName: string, delimiter: string = '-'): string {

View File

@@ -41,12 +41,8 @@ class BasicButtonComponent {
download: boolean = false;
fileName: string;
format: string;
constructor() {
}
onAuditClick(event: any) {
}
onAuditClick() {}
}
describe('ProcessAuditDirective', () => {

View File

@@ -18,7 +18,7 @@
/* tslint:disable:no-input-rename */
import { ContentService } from '@alfresco/adf-core';
import { Directive, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
import { Directive, EventEmitter, Input, OnChanges, Output } from '@angular/core';
import { ProcessService } from './../services/process.service';
const JSON_FORMAT: string = 'json';
@@ -68,7 +68,7 @@ export class ProcessAuditDirective implements OnChanges {
private processListService: ProcessService) {
}
ngOnChanges(changes: SimpleChanges): void {
ngOnChanges(): void {
if (!this.isValidType()) {
this.setDefaultFormatType();
}

View File

@@ -109,7 +109,7 @@ describe('ProcessFiltersComponent', () => {
expect(filterList.currentFilter).toBeUndefined();
filterList.success.subscribe((res) => {
filterList.success.subscribe(() => {
filterList.selectRunningFilter();
expect(filterList.currentFilter.name).toEqual('Running');
done();

View File

@@ -7,10 +7,16 @@
<adf-process-instance-header
#processInstanceHeader
[processInstance]="processInstanceDetails"
(showProcessDiagram)="onShowProcessDiagram($event)">
(showProcessDiagram)="onShowProcessDiagram()">
</adf-process-instance-header>
<button class="adf-in-medias-res-button" mat-button id="show-diagram-button" type="button" mat-button mat-raised-button [disabled]="!isRunning()" (click)="onShowProcessDiagram(processInstanceId)">{{ 'ADF_PROCESS_LIST.DETAILS.BUTTON.SHOW_DIAGRAM' | translate }}</button>
<button
class="adf-in-medias-res-button"
mat-button id="show-diagram-button"
type="button"
mat-button mat-raised-button
[disabled]="!isRunning()"
(click)="onShowProcessDiagram()">{{ 'ADF_PROCESS_LIST.DETAILS.BUTTON.SHOW_DIAGRAM' | translate }}</button>
<mat-card>
<mat-card-content>

View File

@@ -142,7 +142,7 @@ export class ProcessInstanceDetailsComponent implements OnChanges {
}
}
onShowProcessDiagram(processInstanceId: any) {
onShowProcessDiagram() {
this.showProcessDiagram.emit({value: this.processInstanceId});
}

View File

@@ -52,7 +52,7 @@ describe('ProcessInstanceHeaderComponent', () => {
it('should display status as running when process is not complete', () => {
component.processInstance.ended = null;
component.ngOnChanges({});
component.ngOnChanges();
fixture.detectChanges();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-status"]');
expect(valueEl.innerText).toBe('Running');
@@ -60,7 +60,7 @@ describe('ProcessInstanceHeaderComponent', () => {
it('should display status as completed when process is complete', () => {
component.processInstance.ended = new Date('2016-11-03');
component.ngOnChanges({});
component.ngOnChanges();
fixture.detectChanges();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-status"]');
expect(valueEl.innerText).toBe('Completed');
@@ -68,7 +68,7 @@ describe('ProcessInstanceHeaderComponent', () => {
it('should display due date', () => {
component.processInstance.ended = new Date('2016-11-03');
component.ngOnChanges({});
component.ngOnChanges();
fixture.detectChanges();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-dateitem-ended"]');
expect(valueEl.innerText).toBe('Nov 3, 2016');
@@ -76,7 +76,7 @@ describe('ProcessInstanceHeaderComponent', () => {
it('should display placeholder if no due date', () => {
component.processInstance.ended = null;
component.ngOnChanges({});
component.ngOnChanges();
fixture.detectChanges();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-dateitem-ended"]');
expect(valueEl.innerText).toBe('ADF_PROCESS_LIST.PROPERTIES.END_DATE_DEFAULT');
@@ -84,7 +84,7 @@ describe('ProcessInstanceHeaderComponent', () => {
it('should display process category', () => {
component.processInstance.processDefinitionCategory = 'Accounts';
component.ngOnChanges({});
component.ngOnChanges();
fixture.detectChanges();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-category"]');
expect(valueEl.innerText).toBe('Accounts');
@@ -92,7 +92,7 @@ describe('ProcessInstanceHeaderComponent', () => {
it('should display placeholder if no process category', () => {
component.processInstance.processDefinitionCategory = null;
component.ngOnChanges({});
component.ngOnChanges();
fixture.detectChanges();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-category"]');
expect(valueEl.innerText).toBe('ADF_PROCESS_LIST.PROPERTIES.CATEGORY_DEFAULT');
@@ -100,7 +100,7 @@ describe('ProcessInstanceHeaderComponent', () => {
it('should display created date', () => {
component.processInstance.started = new Date('2016-11-03');
component.ngOnChanges({});
component.ngOnChanges();
fixture.detectChanges();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-dateitem-created"]');
expect(valueEl.innerText).toBe('Nov 3, 2016');
@@ -108,7 +108,7 @@ describe('ProcessInstanceHeaderComponent', () => {
it('should display started by', () => {
component.processInstance.startedBy = {firstName: 'Admin', lastName: 'User'};
component.ngOnChanges({});
component.ngOnChanges();
fixture.detectChanges();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-assignee"]');
expect(valueEl.innerText).toBe('Admin User');
@@ -116,7 +116,7 @@ describe('ProcessInstanceHeaderComponent', () => {
it('should display process instance id', () => {
component.processInstance.id = '123';
component.ngOnChanges({});
component.ngOnChanges();
fixture.detectChanges();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-id"]');
expect(valueEl.innerText).toBe('123');
@@ -124,7 +124,7 @@ describe('ProcessInstanceHeaderComponent', () => {
it('should display description', () => {
component.processInstance.processDefinitionDescription = 'Test process';
component.ngOnChanges({});
component.ngOnChanges();
fixture.detectChanges();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-description"]');
expect(valueEl.innerText).toBe('Test process');
@@ -132,7 +132,7 @@ describe('ProcessInstanceHeaderComponent', () => {
it('should display placeholder if no description', () => {
component.processInstance.processDefinitionDescription = null;
component.ngOnChanges({});
component.ngOnChanges();
fixture.detectChanges();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-description"]');
expect(valueEl.innerText).toBe('ADF_PROCESS_LIST.PROPERTIES.DESCRIPTION_DEFAULT');
@@ -140,7 +140,7 @@ describe('ProcessInstanceHeaderComponent', () => {
it('should display businessKey value', () => {
component.processInstance.businessKey = 'fakeBusinessKey';
component.ngOnChanges({});
component.ngOnChanges();
fixture.detectChanges();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-businessKey"]');
expect(valueEl.innerText).toBe('fakeBusinessKey');
@@ -148,7 +148,7 @@ describe('ProcessInstanceHeaderComponent', () => {
it('should display default key if no businessKey', () => {
component.processInstance.businessKey = null;
component.ngOnChanges({});
component.ngOnChanges();
fixture.detectChanges();
const valueEl = fixture.nativeElement.querySelector('[data-automation-id="card-textitem-value-businessKey"]');
expect(valueEl.innerText).toBe('ADF_PROCESS_LIST.PROPERTIES.BUSINESS_KEY_DEFAULT');
@@ -162,7 +162,7 @@ describe('ProcessInstanceHeaderComponent', () => {
'properties': ['status', 'ended']
}
};
component.ngOnChanges({});
component.ngOnChanges();
fixture.detectChanges();
const propertyList = fixture.nativeElement.querySelectorAll('.adf-property-list .adf-property');
expect(propertyList).toBeDefined();
@@ -174,7 +174,7 @@ describe('ProcessInstanceHeaderComponent', () => {
it('should show all the default properties if there is no configuration', async(() => {
appConfigService.config['adf-process-instance-header'] = {};
component.ngOnChanges({});
component.ngOnChanges();
fixture.detectChanges();
fixture.whenStable().then(() => {
const propertyList = fixture.nativeElement.querySelectorAll('.adf-property-list .adf-property');

View File

@@ -16,7 +16,7 @@
*/
import { AppConfigService, CardViewDateItemModel, CardViewItem, CardViewBaseItemModel, CardViewTextItemModel, TranslationService } from '@alfresco/adf-core';
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
import { Component, Input, OnChanges } from '@angular/core';
import { ProcessInstance } from '../models/process-instance.model';
@Component({
@@ -40,7 +40,7 @@ export class ProcessInstanceHeaderComponent implements OnChanges {
this.dateLocale = this.appConfig.get('dateValues.defaultDateLocale');
}
ngOnChanges(changes: SimpleChanges) {
ngOnChanges() {
this.refreshData();
}

View File

@@ -13,7 +13,7 @@
<div class="menu-container" *ngIf="activeTasks?.length > 0" data-automation-id="active-tasks">
<mat-list>
<mat-list-item class="process-tasks__task-item" *ngFor="let task of activeTasks" (click)="clickTask($event, task)">
<mat-list-item class="process-tasks__task-item" *ngFor="let task of activeTasks" (click)="clickTask(task)">
<mat-icon mat-list-icon>assignment</mat-icon>
<h3 matLine>{{task.name || 'Nameless task'}}</h3>
<span matLine>
@@ -55,7 +55,7 @@
<div class="menu-container" *ngIf="completedTasks?.length > 0" data-automation-id="completed-tasks">
<mat-list>
<mat-list-item class="process-tasks__task-item" *ngFor="let task of completedTasks" (click)="clickTask($event, task)">
<mat-list-item class="process-tasks__task-item" *ngFor="let task of completedTasks" (click)="clickTask(task)">
<mat-icon mat-list-icon>assignment</mat-icon>
<h3 matLine>{{task.name || 'Nameless task'}}</h3>
<span matLine>

View File

@@ -162,7 +162,7 @@ export class ProcessInstanceTasksComponent implements OnInit, OnChanges, OnDestr
}
}
clickTask($event: any, task: TaskDetailsModel) {
clickTask(task: TaskDetailsModel) {
const args = new TaskDetailsEvent(task);
this.taskClick.emit(args);
}

View File

@@ -145,7 +145,7 @@ describe('ProcessInstanceListComponent', () => {
getProcessInstancesSpy = getProcessInstancesSpy.and.returnValue(of(fakeProcessInstancesWithNoName));
component.appId = 1;
component.state = 'open';
component.success.subscribe( (res) => {
component.success.subscribe(() => {
expect(component.rows[0]['name']).toEqual('Fake Process Name - Nov 9, 2017, 12:36:14 PM');
expect(component.rows[1]['name']).toEqual('Fake Process Name - Nov 9, 2017, 12:37:25 PM');
});

View File

@@ -74,12 +74,12 @@ export class ChecklistComponent implements OnChanges {
ngOnChanges(changes: SimpleChanges) {
const taskId = changes['taskId'];
if (taskId && taskId.currentValue) {
this.getTaskChecklist(taskId.currentValue);
this.getTaskChecklist();
return;
}
}
public getTaskChecklist(taskId: string) {
getTaskChecklist() {
this.checklist = [];
if (this.taskId) {
this.activitiTaskList.getTaskChecklist(this.taskId).subscribe(

View File

@@ -48,12 +48,8 @@ describe('TaskAuditDirective', () => {
download: boolean = false;
fileName: string;
format: string;
constructor() {
}
onAuditClick(event: any) {
}
onAuditClick() {}
}
let fixture: ComponentFixture<BasicButtonComponent>;

View File

@@ -18,7 +18,7 @@
/* tslint:disable:no-input-rename */
import { ContentService } from '@alfresco/adf-core';
import { Directive, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
import { Directive, EventEmitter, Input, OnChanges, Output } from '@angular/core';
import { TaskListService } from './../services/tasklist.service';
const JSON_FORMAT: string = 'json';
@@ -68,7 +68,7 @@ export class TaskAuditDirective implements OnChanges {
private taskListService: TaskListService) {
}
ngOnChanges(changes: SimpleChanges): void {
ngOnChanges(): void {
if (!this.isValidType()) {
this.setDefaultFormatType();
}

View File

@@ -151,7 +151,7 @@ describe('TaskDetailsComponent', () => {
expect(fixture.debugElement.query(By.css('adf-form'))).not.toBeNull();
}));
it('should display a form in readonly when the task has an associated form and readOnlyForm is true', async((done) => {
it('should display a form in readonly when the task has an associated form and readOnlyForm is true', async(() => {
component.readOnlyForm = true;
component.taskId = '123';
fixture.detectChanges();

View File

@@ -52,7 +52,7 @@ describe('TaskFiltersComponent', () => {
filter: { state: 'open', assignment: 'fake-assignee' }
}));
const fakeGlobalFilterPromise = new Promise(function (resolve, reject) {
const fakeGlobalFilterPromise = new Promise(function (resolve) {
resolve(fakeGlobalFilter);
});
@@ -60,7 +60,7 @@ describe('TaskFiltersComponent', () => {
message: 'invalid data'
};
const fakeGlobalEmptyFilterPromise = new Promise(function (resolve, reject) {
const fakeGlobalEmptyFilterPromise = new Promise(function (resolve) {
resolve(fakeGlobalEmptyFilter);
});
@@ -126,7 +126,7 @@ describe('TaskFiltersComponent', () => {
it('should return the filter task list, filtered By Name', (done) => {
const fakeDeployedApplicationsPromise = new Promise(function (resolve, reject) {
const fakeDeployedApplicationsPromise = new Promise(function (resolve) {
resolve({});
});

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core';
import {
BpmUserService,
CardViewDateItemModel,
@@ -75,7 +75,7 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
this.loadCurrentBpmUserId();
}
ngOnChanges(changes: SimpleChanges) {
ngOnChanges() {
this.refreshData();
}

View File

@@ -249,13 +249,13 @@ export class TaskListComponent extends DataTableSchema implements OnChanges, Aft
reload(): void {
if (!this.hasCustomDataSource) {
this.requestNode = this.createRequestNode();
this.load(this.requestNode);
this.load();
} else {
this.isLoading = false;
}
}
private load(requestNode: TaskQueryRequestRepresentationModel) {
private load() {
this.isLoading = true;
this.loadTasksByState().subscribe(
(tasks) => {

View File

@@ -103,7 +103,7 @@ describe('Activiti Task filter Service', () => {
spyOn(service, 'callApiTaskFilters').and.returnValue((fakeAppPromise));
const appId = 1;
service.getTaskListFilters(appId).subscribe((res) => {
service.getTaskListFilters(appId).subscribe(() => {
expect(service.callApiTaskFilters).toHaveBeenCalledWith(appId);
done();
});