mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
Prettier upgrade and e2e type checks (#1522)
* upgrade prettier * noImplicitAny rule * fix type * update tsconfig * upgrade to 150 print width
This commit is contained in:
@@ -32,13 +32,7 @@ import { MaterialModule } from '../../material.module';
|
||||
import { CoreModule } from '@alfresco/adf-core';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
BrowserModule,
|
||||
CoreModule.forChild(),
|
||||
ContentModule.forChild(),
|
||||
MaterialModule,
|
||||
LockedByModule
|
||||
],
|
||||
imports: [BrowserModule, CoreModule.forChild(), ContentModule.forChild(), MaterialModule, LockedByModule],
|
||||
declarations: [CustomNameColumnComponent],
|
||||
exports: [CustomNameColumnComponent]
|
||||
})
|
||||
|
@@ -64,9 +64,7 @@ describe('CustomNameColumnComponent', () => {
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(
|
||||
fixture.debugElement.nativeElement.querySelector('aca-locked-by')
|
||||
).toBe(null);
|
||||
expect(fixture.debugElement.nativeElement.querySelector('aca-locked-by')).toBe(null);
|
||||
});
|
||||
|
||||
it('should not render lock element if node is not a file', () => {
|
||||
@@ -83,9 +81,7 @@ describe('CustomNameColumnComponent', () => {
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(
|
||||
fixture.debugElement.nativeElement.querySelector('aca-locked-by')
|
||||
).toBe(null);
|
||||
expect(fixture.debugElement.nativeElement.querySelector('aca-locked-by')).toBe(null);
|
||||
});
|
||||
|
||||
it('should render lock element if file is locked', () => {
|
||||
@@ -103,9 +99,7 @@ describe('CustomNameColumnComponent', () => {
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(
|
||||
fixture.debugElement.nativeElement.querySelector('aca-locked-by')
|
||||
).not.toBe(null);
|
||||
expect(fixture.debugElement.nativeElement.querySelector('aca-locked-by')).not.toBe(null);
|
||||
});
|
||||
|
||||
it('should call parent component onClick method', () => {
|
||||
|
@@ -25,14 +25,7 @@
|
||||
|
||||
import { NameColumnComponent } from '@alfresco/adf-content-services';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import {
|
||||
ChangeDetectorRef,
|
||||
Component,
|
||||
ElementRef,
|
||||
OnDestroy,
|
||||
OnInit,
|
||||
ViewEncapsulation
|
||||
} from '@angular/core';
|
||||
import { ChangeDetectorRef, Component, ElementRef, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { Actions, ofType } from '@ngrx/effects';
|
||||
import { Subject } from 'rxjs';
|
||||
import { filter, takeUntil } from 'rxjs/operators';
|
||||
@@ -48,43 +41,35 @@ import { isLocked } from '@alfresco/aca-shared';
|
||||
class: ' adf-datatable-content-cell adf-datatable-link adf-name-column'
|
||||
}
|
||||
})
|
||||
export class CustomNameColumnComponent extends NameColumnComponent
|
||||
implements OnInit, OnDestroy {
|
||||
export class CustomNameColumnComponent extends NameColumnComponent implements OnInit, OnDestroy {
|
||||
private onDestroy$$ = new Subject<boolean>();
|
||||
|
||||
constructor(
|
||||
element: ElementRef,
|
||||
private cd: ChangeDetectorRef,
|
||||
private actions$: Actions,
|
||||
private apiService: AlfrescoApiService
|
||||
) {
|
||||
constructor(element: ElementRef, private cd: ChangeDetectorRef, private actions$: Actions, private apiService: AlfrescoApiService) {
|
||||
super(element, apiService);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.updateValue();
|
||||
|
||||
this.apiService.nodeUpdated
|
||||
.pipe(takeUntil(this.onDestroy$$))
|
||||
.subscribe((node: any) => {
|
||||
const row = this.context.row;
|
||||
if (row) {
|
||||
const { entry } = row.node;
|
||||
const currentId = entry.nodeId || entry.id;
|
||||
const updatedId = node.nodeId || node.id;
|
||||
this.apiService.nodeUpdated.pipe(takeUntil(this.onDestroy$$)).subscribe((node: any) => {
|
||||
const row = this.context.row;
|
||||
if (row) {
|
||||
const { entry } = row.node;
|
||||
const currentId = entry.nodeId || entry.id;
|
||||
const updatedId = node.nodeId || node.id;
|
||||
|
||||
if (currentId === updatedId) {
|
||||
entry.name = node.name;
|
||||
row.node = { entry };
|
||||
this.updateValue();
|
||||
}
|
||||
if (currentId === updatedId) {
|
||||
entry.name = node.name;
|
||||
row.node = { entry };
|
||||
this.updateValue();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.actions$
|
||||
.pipe(
|
||||
ofType<any>(NodeActionTypes.EditOffline),
|
||||
filter(val => {
|
||||
filter((val) => {
|
||||
return this.node.entry.id === val.payload.entry.id;
|
||||
}),
|
||||
takeUntil(this.onDestroy$$)
|
||||
|
Reference in New Issue
Block a user