pre angular 15 cleanup (#8961)

* pre angular 15 cleanup

* [ci:force] update test

* [ci:force] various updates as per migration

* [ci:force] port more changes

* [ci:force] migrate tests

* [ci:force] migrate formatting

* migrate changes

* rollback storybook
This commit is contained in:
Denys Vuika
2023-10-03 12:35:53 +01:00
committed by GitHub
parent e638b54fcd
commit 43242b1185
38 changed files with 95 additions and 156 deletions

View File

@@ -4,10 +4,7 @@
"overrides": [ "overrides": [
{ {
"files": ["*.ts"], "files": ["*.ts"],
"extends": [ "extends": ["plugin:@nrwl/nx/angular", "plugin:@angular-eslint/template/process-inline-templates"],
"plugin:@nrwl/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": { "rules": {
"prefer-arrow/prefer-arrow-functions": "off", "prefer-arrow/prefer-arrow-functions": "off",
"@typescript-eslint/no-var-requires": "off", "@typescript-eslint/no-var-requires": "off",
@@ -41,8 +38,7 @@
{ {
"files": ["*.html"], "files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"], "extends": ["plugin:@nrwl/nx/angular-template"],
"rules": { "rules": {}
}
} }
] ]
} }

View File

@@ -4,10 +4,7 @@
"overrides": [ "overrides": [
{ {
"files": ["*.ts"], "files": ["*.ts"],
"extends": [ "extends": ["plugin:@nrwl/nx/angular", "plugin:@angular-eslint/template/process-inline-templates"],
"plugin:@nrwl/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": { "rules": {
"jsdoc/newline-after-description": "warn", "jsdoc/newline-after-description": "warn",
"@typescript-eslint/naming-convention": "warn", "@typescript-eslint/naming-convention": "warn",
@@ -27,24 +24,15 @@
"error", "error",
{ {
"type": "element", "type": "element",
"prefix": [ "prefix": ["adf", "app"],
"adf",
"app"
],
"style": "kebab-case" "style": "kebab-case"
} }
], ],
"@angular-eslint/directive-selector": [ "@angular-eslint/directive-selector": [
"error", "error",
{ {
"type": [ "type": ["element", "attribute"],
"element", "prefix": ["adf", "app"],
"attribute"
],
"prefix": [
"adf",
"app"
],
"style": "kebab-case" "style": "kebab-case"
} }
], ],

View File

@@ -1,15 +1,9 @@
const rootMain = require('../../../.storybook/main'); const rootMain = require('../../../.storybook/main');
module.exports = { module.exports = {
...rootMain, ...rootMain,
core: { ...rootMain.core, builder: 'webpack5' }, core: { ...rootMain.core, builder: 'webpack5' },
stories: [ stories: [...rootMain.stories, '../**/*.stories.@(js|jsx|ts|tsx)'],
...rootMain.stories, staticDirs: [...rootMain.staticDirs, { from: __dirname + '/../src/lib/i18n', to: 'assets/adf-content-services/i18n' }],
'../**/*.stories.@(js|jsx|ts|tsx)' addons: [...rootMain.addons]
],
staticDirs: [
...rootMain.staticDirs,
{ from: __dirname + '/../src/lib/i18n', to: 'assets/adf-content-services/i18n' }
],
addons: [...rootMain.addons ]
}; };

View File

@@ -504,12 +504,16 @@ describe('CategoriesManagementComponent', () => {
describe('Errors', () => { describe('Errors', () => {
it('should display validation error when searching for empty category', fakeAsync(() => { it('should display validation error when searching for empty category', fakeAsync(() => {
typeCategory(' '); typeCategory(' ');
component.categoryNameControl.markAsTouched();
fixture.detectChanges();
expect(getFirstError()).toBe('CATEGORIES_MANAGEMENT.ERRORS.EMPTY_CATEGORY'); expect(getFirstError()).toBe('CATEGORIES_MANAGEMENT.ERRORS.EMPTY_CATEGORY');
})); }));
it('should show error for required', fakeAsync(() => { it('should show error for required', fakeAsync(() => {
typeCategory(''); typeCategory('');
component.categoryNameControl.markAsTouched();
fixture.detectChanges();
expect(getFirstError()).toBe('CATEGORIES_MANAGEMENT.ERRORS.REQUIRED'); expect(getFirstError()).toBe('CATEGORIES_MANAGEMENT.ERRORS.REQUIRED');
})); }));
@@ -534,6 +538,7 @@ describe('CategoriesManagementComponent', () => {
it('should show error for required when not typed anything and blur input', fakeAsync(() => { it('should show error for required when not typed anything and blur input', fakeAsync(() => {
typeCategory(''); typeCategory('');
getCategoryControlInput().blur(); getCategoryControlInput().blur();
component.categoryNameControl.markAsTouched();
fixture.detectChanges(); fixture.detectChanges();
expect(getFirstError()).toBe('CATEGORIES_MANAGEMENT.ERRORS.REQUIRED'); expect(getFirstError()).toBe('CATEGORIES_MANAGEMENT.ERRORS.REQUIRED');

View File

@@ -116,7 +116,7 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
displayCategories = false; displayCategories = false;
private _assignedTags: string[] = []; private _assignedTags: string[] = [];
private assignedTagsEntries: TagEntry[]; private assignedTagsEntries: TagEntry[] = [];
private _editable = false; private _editable = false;
private _tagsCreatorMode = TagsCreatorMode.CREATE_AND_ASSIGN; private _tagsCreatorMode = TagsCreatorMode.CREATE_AND_ASSIGN;
private _tags: string[] = []; private _tags: string[] = [];
@@ -318,7 +318,7 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
this._saving = false; this._saving = false;
return of(null); return of(null);
})) }))
.subscribe((result) => { .subscribe((result: any) => {
if (result) { if (result) {
this.updateUndefinedNodeProperties(result.updatedNode); this.updateUndefinedNodeProperties(result.updatedNode);
if (this.hasContentTypeChanged(this.changedProperties)) { if (this.hasContentTypeChanged(this.changedProperties)) {

View File

@@ -80,7 +80,7 @@ describe('PropertyDescriptorLoaderService', () => {
expect(data['exif:exif']).toBe(exifResponse); expect(data['exif:exif']).toBe(exifResponse);
expect(data['cm:content']).toBe(contentResponse); expect(data['cm:content']).toBe(contentResponse);
}, },
complete: done complete: () => done()
}); });
}); });
}); });

View File

@@ -296,7 +296,7 @@ describe('ContentNodeSelectorComponent', () => {
const adfUploadButton = fixture.debugElement.query(By.css('adf-upload-button')); const adfUploadButton = fixture.debugElement.query(By.css('adf-upload-button'));
expect(adfUploadButton).not.toBeNull(); expect(adfUploadButton).not.toBeNull();
expect(adfUploadButton.nativeElement.innerText).toEqual('file_uploadFORM.FIELD.UPLOAD'); expect(adfUploadButton.nativeElement.textContent).toEqual('file_uploadFORM.FIELD.UPLOAD');
}); });
it('should be able to disable UploadButton if showingSearch set to true', () => { it('should be able to disable UploadButton if showingSearch set to true', () => {

View File

@@ -31,7 +31,7 @@
[style.display]="isExpiryDateToggleChecked ? 'block' : 'none'" [style.display]="isExpiryDateToggleChecked ? 'block' : 'none'"
data-automation-id="adf-slide-toggle-checked" data-automation-id="adf-slide-toggle-checked"
class="adf-share-link__date-time-container"> class="adf-share-link__date-time-container">
<mat-form-field class="adf-full-width adf-float-label" floatLabel='never'> <mat-form-field class="adf-full-width adf-float-label">
<mat-label>{{ 'SHARE.EXPIRATION-PLACEHOLDER' | translate }}</mat-label> <mat-label>{{ 'SHARE.EXPIRATION-PLACEHOLDER' | translate }}</mat-label>
<mat-datepicker-toggle <mat-datepicker-toggle
[disabled]="time.disabled" [disabled]="time.disabled"
@@ -74,7 +74,6 @@
</div> </div>
<mat-form-field <mat-form-field
class="adf-full-width adf-float-label" class="adf-full-width adf-float-label"
floatLabel='never'
[ngClass]="isLinkWithExpiryDate? 'adf-share-link__border-color' : ''"> [ngClass]="isLinkWithExpiryDate? 'adf-share-link__border-color' : ''">
<input <input
#sharedLinkInput #sharedLinkInput

View File

@@ -18,13 +18,7 @@
import { Component, Inject, OnInit, ViewEncapsulation, ViewChild, OnDestroy } from '@angular/core'; import { Component, Inject, OnInit, ViewEncapsulation, ViewChild, OnDestroy } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog'; import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog';
import { MatSlideToggleChange } from '@angular/material/slide-toggle'; import { MatSlideToggleChange } from '@angular/material/slide-toggle';
import { import { AbstractControl, FormControl, FormGroup, Validators } from '@angular/forms';
UntypedFormGroup,
UntypedFormControl,
AbstractControl,
Validators,
ValidationErrors
} from '@angular/forms';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { ContentService } from '../common/services/content.service'; import { ContentService } from '../common/services/content.service';
import { SharedLinksApiService } from './services/shared-links-api.service'; import { SharedLinksApiService } from './services/shared-links-api.service';
@@ -44,9 +38,8 @@ type DatePickerType = 'date' | 'time' | 'month' | 'datetime';
encapsulation: ViewEncapsulation.None encapsulation: ViewEncapsulation.None
}) })
export class ShareDialogComponent implements OnInit, OnDestroy { export class ShareDialogComponent implements OnInit, OnDestroy {
private minDateValidator = (control: AbstractControl): ValidationErrors | null => { private minDateValidator = (control: AbstractControl): any =>
return isBefore(endOfDay(new Date(control.value)), this.minDate) ? {invalidDate: true} : null; isBefore(endOfDay(new Date(control.value)), this.minDate) ? { invalidDate: true } : null;
};
minDate = add(new Date(), { days: 1 }); minDate = add(new Date(), { days: 1 });
sharedId: string; sharedId: string;
@@ -55,9 +48,9 @@ export class ShareDialogComponent implements OnInit, OnDestroy {
isFileShared = false; isFileShared = false;
isDisabled = false; isDisabled = false;
isLinkWithExpiryDate = false; isLinkWithExpiryDate = false;
form: UntypedFormGroup = new UntypedFormGroup({ form: FormGroup = new FormGroup({
sharedUrl: new UntypedFormControl(''), sharedUrl: new FormControl(''),
time: new UntypedFormControl({value: '', disabled: true}, [Validators.required, this.minDateValidator]) time: new FormControl({ value: '', disabled: true }, [Validators.required, this.minDateValidator])
}); });
type: DatePickerType = 'date'; type: DatePickerType = 'date';
maxDebounceTime = 500; maxDebounceTime = 500;

View File

@@ -161,7 +161,7 @@ describe('Confirm Dialog Component', () => {
By.css('[data-automation-id="adf-confirm-dialog-confirm-all"]') By.css('[data-automation-id="adf-confirm-dialog-confirm-all"]')
); );
expect(thirdOptionElement).not.toBeNull(); expect(thirdOptionElement).not.toBeNull();
expect(thirdOptionElement.nativeElement.innerText).toBe('YES ALL'); expect(thirdOptionElement.nativeElement.innerText.toUpperCase()).toBe('YES ALL');
}); });
}); });
}); });

View File

@@ -341,7 +341,7 @@ describe('DocumentList', () => {
documentList.executeContentAction(node, action); documentList.executeContentAction(node, action);
expect(action.execute).not.toHaveBeenCalled(); expect(action.execute).not.toHaveBeenCalled();
deleteObservable.next(); deleteObservable.next(undefined);
expect(action.execute).toHaveBeenCalledWith(node); expect(action.execute).toHaveBeenCalledWith(node);
}); });

View File

@@ -21,7 +21,7 @@ import { MatCardModule } from '@angular/material/card';
import { MatCheckboxModule } from '@angular/material/checkbox'; import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatAutocompleteModule } from '@angular/material/autocomplete'; import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatChipsModule } from '@angular/material/chips'; import { MatChipsModule } from '@angular/material/chips';
import { MatOptionModule, MatRippleModule } from '@angular/material/core'; import { MatRippleModule, MatOptionModule } from '@angular/material/core';
import { MatDatepickerModule } from '@angular/material/datepicker'; import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatDialogModule } from '@angular/material/dialog'; import { MatDialogModule } from '@angular/material/dialog';
import { MatExpansionModule } from '@angular/material/expansion'; import { MatExpansionModule } from '@angular/material/expansion';

View File

@@ -83,7 +83,7 @@ describe('AddPermissionDialog', () => {
it('should show the INJECTED title', () => { it('should show the INJECTED title', () => {
const titleElement = fixture.debugElement.query(By.css('#add-permission-dialog-title')); const titleElement = fixture.debugElement.query(By.css('#add-permission-dialog-title'));
expect(titleElement).not.toBeNull(); expect(titleElement).not.toBeNull();
expect(titleElement.nativeElement.innerText).toBe('dead or alive you are coming with me'); expect(titleElement.nativeElement.innerText.trim()).toBe('dead or alive you are coming with me');
}); });
it('should close the dialog when close button is clicked', () => { it('should close the dialog when close button is clicked', () => {
@@ -128,7 +128,7 @@ describe('AddPermissionDialog', () => {
await fixture.whenStable(); await fixture.whenStable();
const selectBox = fixture.debugElement.query(By.css(('[id="adf-select-role-permission"] .mat-select-trigger'))); const selectBox = fixture.debugElement.query(By.css(('[id="adf-select-role-permission"] .mat-select-trigger')));
selectBox.triggerEventHandler('click', null); selectBox.nativeElement.dispatchEvent(new Event('click'));
fixture.detectChanges(); fixture.detectChanges();
const options = fixture.debugElement.queryAll(By.css('mat-option')); const options = fixture.debugElement.queryAll(By.css('mat-option'));
@@ -171,7 +171,7 @@ describe('AddPermissionDialog', () => {
await fixture.whenStable(); await fixture.whenStable();
const selectBox = fixture.debugElement.query(By.css(('[id="adf-bulk-select-role-permission"] .mat-select-trigger'))); const selectBox = fixture.debugElement.query(By.css(('[id="adf-bulk-select-role-permission"] .mat-select-trigger')));
selectBox.triggerEventHandler('click', null); selectBox.nativeElement.dispatchEvent(new Event('click'));
fixture.detectChanges(); fixture.detectChanges();
await fixture.whenStable(); await fixture.whenStable();
@@ -213,7 +213,7 @@ describe('AddPermissionDialog', () => {
await fixture.whenStable(); await fixture.whenStable();
const selectBox = fixture.debugElement.query(By.css(('[id="adf-select-role-permission"] .mat-select-trigger'))); const selectBox = fixture.debugElement.query(By.css(('[id="adf-select-role-permission"] .mat-select-trigger')));
selectBox.triggerEventHandler('click', null); selectBox.nativeElement.dispatchEvent(new Event('click'));
fixture.detectChanges(); fixture.detectChanges();
await fixture.whenStable(); await fixture.whenStable();

View File

@@ -41,7 +41,7 @@
<mat-list-option id="adf-add-permission-group-everyone" <mat-list-option id="adf-add-permission-group-everyone"
class="adf-list-option-item" class="adf-list-option-item"
#eveyone #eveyone
disableRipple [disableRipple]="true"
[value]="EVERYONE"> [value]="EVERYONE">
<adf-user-icon-column [node]="EVERYONE" id="add-group-icon" [selected]="eveyone.selected"></adf-user-icon-column> <adf-user-icon-column [node]="EVERYONE" id="add-group-icon" [selected]="eveyone.selected"></adf-user-icon-column>
<p class="adf-result-name"> <p class="adf-result-name">
@@ -50,7 +50,7 @@
</mat-list-option> </mat-list-option>
<mat-list-option *ngFor="let item of data?.list?.entries; let idx = index" <mat-list-option *ngFor="let item of data?.list?.entries; let idx = index"
disableRipple [disableRipple]="true"
[value]="item" [value]="item"
class="adf-list-option-item" class="adf-list-option-item"
id="result_option_{{idx}}" id="result_option_{{idx}}"

View File

@@ -21,7 +21,7 @@ import { By } from '@angular/platform-browser';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { fakeAuthorityListResult, fakeNameListResult } from '../../../mock/add-permission.component.mock'; import { fakeAuthorityListResult, fakeNameListResult } from '../../../mock/add-permission.component.mock';
import { ContentTestingModule } from '../../../testing/content.testing.module'; import { ContentTestingModule } from '../../../testing/content.testing.module';
import { SearchService } from '../../../search/services/search.service'; import { SearchService } from '../../../search/services/search.service';
import { DebugElement } from '@angular/core'; import { DebugElement } from '@angular/core';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { MatIconTestingModule } from '@angular/material/icon/testing'; import { MatIconTestingModule } from '@angular/material/icon/testing';

View File

@@ -82,7 +82,7 @@ export class PermissionListService {
toggleInherited(change: MatSlideToggleChange) { toggleInherited(change: MatSlideToggleChange) {
if (this.contentService.hasAllowableOperations(this.node, AllowableOperationsEnum.UPDATEPERMISSIONS)) { if (this.contentService.hasAllowableOperations(this.node, AllowableOperationsEnum.UPDATEPERMISSIONS)) {
let updateLocalPermission$ = of(null); let updateLocalPermission$: Observable<Node> = of(null);
const nodeBody = { const nodeBody = {
permissions: { permissions: {
isInheritanceEnabled: !this.node.permissions.isInheritanceEnabled isInheritanceEnabled: !this.node.permissions.isInheritanceEnabled

View File

@@ -72,7 +72,7 @@ export class PopOverDirective implements OnInit, OnDestroy, AfterViewInit {
ngOnDestroy(): void { ngOnDestroy(): void {
this.element.nativeElement.removeEventListener('keydown', this.preventDefaultForEnter); this.element.nativeElement.removeEventListener('keydown', this.preventDefaultForEnter);
this.detachOverlay(); this.detachOverlay();
this.destroy$.next(); this.destroy$.next(undefined);
this.destroy$.complete(); this.destroy$.complete();
} }

View File

@@ -422,7 +422,7 @@ export class SearchFacetFiltersService implements OnDestroy {
} }
ngOnDestroy(): void { ngOnDestroy(): void {
this.onDestroy$.next(); this.onDestroy$.next(undefined);
this.onDestroy$.complete(); this.onDestroy$.complete();
} }

View File

@@ -90,7 +90,7 @@ describe('TagService', () => {
}); });
describe('createTags', () => { describe('createTags', () => {
it('should call createTags on tagsApi', () => { it('should call createTags on tagsApi', (done) => {
spyOn(service.tagsApi, 'createTags').and.returnValue(Promise.resolve([])); spyOn(service.tagsApi, 'createTags').and.returnValue(Promise.resolve([]));
const tag1 = new TagBody(); const tag1 = new TagBody();
tag1.tag = 'Some tag 1'; tag1.tag = 'Some tag 1';
@@ -98,7 +98,9 @@ describe('TagService', () => {
tag2.tag = 'Some tag 2'; tag2.tag = 'Some tag 2';
const tags = [tag1, tag2]; const tags = [tag1, tag2];
service.createTags(tags); service.createTags(tags);
expect(service.tagsApi.createTags).toHaveBeenCalledWith(tags); expect(service.tagsApi.createTags).toHaveBeenCalledWith(tags);
done();
}); });
it('should emit refresh when tags creation is success', fakeAsync(() => { it('should emit refresh when tags creation is success', fakeAsync(() => {

View File

@@ -381,12 +381,15 @@ describe('TagsCreatorComponent', () => {
it('should show error for only spaces', fakeAsync(() => { it('should show error for only spaces', fakeAsync(() => {
typeTag(' '); typeTag(' ');
component.tagNameControl.markAsTouched();
fixture.detectChanges();
const error = getFirstError(); const error = getFirstError();
expect(error).toBe('TAG.TAGS_CREATOR.ERRORS.EMPTY_TAG'); expect(error).toBe('TAG.TAGS_CREATOR.ERRORS.EMPTY_TAG');
})); }));
it('should show error for only spaces if tags are changed', fakeAsync(() => { it('should show error for only spaces if tags are changed', fakeAsync(() => {
typeTag(' '); typeTag(' ');
component.tagNameControl.markAsTouched();
component.tags = ['new tag 1', 'new tag 2']; component.tags = ['new tag 1', 'new tag 2'];
fixture.detectChanges(); fixture.detectChanges();
expect(getFirstError()).toBe('TAG.TAGS_CREATOR.ERRORS.EMPTY_TAG'); expect(getFirstError()).toBe('TAG.TAGS_CREATOR.ERRORS.EMPTY_TAG');
@@ -394,12 +397,15 @@ describe('TagsCreatorComponent', () => {
it('should show error for required', fakeAsync(() => { it('should show error for required', fakeAsync(() => {
typeTag(''); typeTag('');
component.tagNameControl.markAsTouched();
fixture.detectChanges();
const error = getFirstError(); const error = getFirstError();
expect(error).toBe('TAG.TAGS_CREATOR.ERRORS.REQUIRED'); expect(error).toBe('TAG.TAGS_CREATOR.ERRORS.REQUIRED');
})); }));
it('should not show error for required if tags are changed', fakeAsync(() => { it('should not show error for required if tags are changed', fakeAsync(() => {
typeTag(''); typeTag('');
component.tagNameControl.markAsTouched();
component.tags = ['new tag 1', 'new tag 2']; component.tags = ['new tag 1', 'new tag 2'];
fixture.detectChanges(); fixture.detectChanges();
expect(getFirstError()).toBeUndefined(); expect(getFirstError()).toBeUndefined();
@@ -443,10 +449,7 @@ describe('TagsCreatorComponent', () => {
it('should error for required when not typed anything and blur input', fakeAsync(() => { it('should error for required when not typed anything and blur input', fakeAsync(() => {
component.tagNameControlVisible = true; component.tagNameControlVisible = true;
fixture.detectChanges(); component.tagNameControl.markAsTouched();
tick(100);
getNameInput().blur();
fixture.detectChanges(); fixture.detectChanges();
const error = getFirstError(); const error = getFirstError();
@@ -600,6 +603,8 @@ describe('TagsCreatorComponent', () => {
); );
typeTag('Tag'); typeTag('Tag');
component.tagNameControl.markAsTouched();
fixture.detectChanges();
const tagElements = getExistingTags(); const tagElements = getExistingTags();
expect(tagElements).toEqual([tag1, tag2]); expect(tagElements).toEqual([tag1, tag2]);
@@ -782,6 +787,8 @@ describe('TagsCreatorComponent', () => {
it('should be displayed when existing tags are loading', fakeAsync(() => { it('should be displayed when existing tags are loading', fakeAsync(() => {
typeTag('tag', 0); typeTag('tag', 0);
component.tagNameControl.markAsTouched();
fixture.detectChanges();
const spinner = getSpinner(); const spinner = getSpinner();
expect(spinner).toBeTruthy(); expect(spinner).toBeTruthy();

View File

@@ -104,9 +104,9 @@ export class FileUploadingDialogComponent implements OnInit, OnDestroy {
if (this.filesUploadingList.length && !this.isDialogActive) { if (this.filesUploadingList.length && !this.isDialogActive) {
this.isDialogActive = true; this.isDialogActive = true;
this.dialogActive.next(); this.dialogActive.next(undefined);
} else { } else {
this.dialogActive.next(); this.dialogActive.next(undefined);
} }
}); });
@@ -159,7 +159,7 @@ export class FileUploadingDialogComponent implements OnInit, OnDestroy {
this.isConfirmation = !this.isConfirmation; this.isConfirmation = !this.isConfirmation;
if (!this.isConfirmation) { if (!this.isConfirmation) {
this.dialogActive.next(); this.dialogActive.next(undefined);
} }
if (this.isDialogMinimized) { if (this.isDialogMinimized) {
@@ -172,7 +172,7 @@ export class FileUploadingDialogComponent implements OnInit, OnDestroy {
*/ */
cancelAllUploads() { cancelAllUploads() {
this.toggleConfirmation(); this.toggleConfirmation();
this.dialogActive.next(); this.dialogActive.next(undefined);
this.uploadList.cancelAllFiles(); this.uploadList.cancelAllFiles();
} }

View File

@@ -27,7 +27,7 @@ import { DiscoveryApiService } from '../common/services/discovery-api.service';
export class VersionCompatibilityService { export class VersionCompatibilityService {
private acsVersion: VersionInfo; private acsVersion: VersionInfo;
acsVersionInitialized$ = new ReplaySubject(); acsVersionInitialized$ = new ReplaySubject<void>();
constructor(private discoveryApiService: DiscoveryApiService) { constructor(private discoveryApiService: DiscoveryApiService) {
this.discoveryApiService.ecmProductInfo$ this.discoveryApiService.ecmProductInfo$
@@ -37,7 +37,7 @@ export class VersionCompatibilityService {
private initializeAcsVersion(acsVersion: VersionInfo) { private initializeAcsVersion(acsVersion: VersionInfo) {
this.acsVersion = acsVersion; this.acsVersion = acsVersion;
this.acsVersionInitialized$.next(); this.acsVersionInitialized$.next(undefined);
} }
getAcsVersion(): VersionInfo { getAcsVersion(): VersionInfo {

View File

@@ -75,7 +75,7 @@ describe('VersionUploadComponent', () => {
expect(component.disabled).toEqual(true); expect(component.disabled).toEqual(true);
}); });
uploadService.fileUploadStarting.next(); uploadService.fileUploadStarting.next(undefined);
}); });
it('should enable upload button on error', () => { it('should enable upload button on error', () => {

View File

@@ -36,7 +36,7 @@ export class VersionUploadComponent implements OnInit, OnDestroy {
comment: string; comment: string;
uploadVersion: boolean = false; uploadVersion: boolean = false;
disabled: boolean = false; disabled: boolean = false;
onDestroy$ = new Subject(); onDestroy$ = new Subject<void>();
majorVersion = '2.0'; majorVersion = '2.0';
minorVersion = '1.1'; minorVersion = '1.1';
@@ -133,7 +133,7 @@ export class VersionUploadComponent implements OnInit, OnDestroy {
} }
ngOnDestroy() { ngOnDestroy() {
this.onDestroy$.next(); this.onDestroy$.next(undefined);
this.onDestroy$.complete(); this.onDestroy$.complete();
} }

View File

@@ -170,7 +170,7 @@ export class AlfrescoViewerComponent implements OnChanges, OnInit, OnDestroy {
/** Emitted when the shared link used is not valid. */ /** Emitted when the shared link used is not valid. */
@Output() @Output()
invalidSharedLink = new EventEmitter(); invalidSharedLink = new EventEmitter<void>();
/** Emitted when user clicks 'Navigate Before' ("<") button. */ /** Emitted when user clicks 'Navigate Before' ("<") button. */
@Output() @Output()
@@ -272,7 +272,7 @@ export class AlfrescoViewerComponent implements OnChanges, OnInit, OnDestroy {
await this.setUpSharedLinkFile(sharedLinkEntry); await this.setUpSharedLinkFile(sharedLinkEntry);
} catch (error) { } catch (error) {
this.logService.error('This sharedLink does not exist'); this.logService.error('This sharedLink does not exist');
this.invalidSharedLink.next(); this.invalidSharedLink.next(undefined);
this.mimeType = 'invalid-link'; this.mimeType = 'invalid-link';
this.urlFileContent = 'invalid-file'; this.urlFileContent = 'invalid-file';
} }

View File

@@ -4,10 +4,7 @@
"overrides": [ "overrides": [
{ {
"files": ["*.ts"], "files": ["*.ts"],
"extends": [ "extends": ["plugin:@nrwl/nx/angular", "plugin:@angular-eslint/template/process-inline-templates"],
"plugin:@nrwl/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": { "rules": {
"jsdoc/newline-after-description": "warn", "jsdoc/newline-after-description": "warn",
"@typescript-eslint/naming-convention": "off", "@typescript-eslint/naming-convention": "off",
@@ -28,24 +25,15 @@
"error", "error",
{ {
"type": "element", "type": "element",
"prefix": [ "prefix": ["adf", "app"],
"adf",
"app"
],
"style": "kebab-case" "style": "kebab-case"
} }
], ],
"@angular-eslint/directive-selector": [ "@angular-eslint/directive-selector": [
"error", "error",
{ {
"type": [ "type": ["element", "attribute"],
"element", "prefix": ["adf", "app"],
"attribute"
],
"prefix": [
"adf",
"app"
],
"style": "kebab-case" "style": "kebab-case"
} }
], ],

View File

@@ -42,7 +42,7 @@ export class OIDCAuthenticationService extends BaseAuthenticationService {
this.oauthService.events.pipe( this.oauthService.events.pipe(
filter((event)=> event.type === 'token_received') filter((event)=> event.type === 'token_received')
).subscribe(()=>{ ).subscribe(()=>{
this.onLogin.next(); this.onLogin.next({});
}); });
}); });
} }

View File

@@ -264,7 +264,7 @@ export class SearchTextInputComponent implements OnInit, OnDestroy {
toggleSearchBar() { toggleSearchBar() {
if (this.toggleSearch) { if (this.toggleSearch) {
this.toggleSearch.next(); this.toggleSearch.next({});
} }
} }

View File

@@ -254,9 +254,9 @@ export class PdfViewerComponent implements OnChanges, OnDestroy {
} }
if (this.loadingTask) { if (this.loadingTask) {
this.pdfjsWorkerDestroy$.next(); this.pdfjsWorkerDestroy$.next(true);
} }
this.onDestroy$.next(); this.onDestroy$.next(true);
this.pdfjsWorkerDestroy$.complete(); this.pdfjsWorkerDestroy$.complete();
this.onDestroy$.complete(); this.onDestroy$.complete();
} }

View File

@@ -4,10 +4,7 @@
"overrides": [ "overrides": [
{ {
"files": ["*.ts"], "files": ["*.ts"],
"extends": [ "extends": ["plugin:@nrwl/nx/angular", "plugin:@angular-eslint/template/process-inline-templates"],
"plugin:@nrwl/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": { "rules": {
"no-underscore-dangle": ["error", { "allowAfterThis": true }], "no-underscore-dangle": ["error", { "allowAfterThis": true }],
@@ -15,24 +12,15 @@
"error", "error",
{ {
"type": "element", "type": "element",
"prefix": [ "prefix": ["adf", "app"],
"adf",
"app"
],
"style": "kebab-case" "style": "kebab-case"
} }
], ],
"@angular-eslint/directive-selector": [ "@angular-eslint/directive-selector": [
"error", "error",
{ {
"type": [ "type": ["element", "attribute"],
"element", "prefix": ["adf", "app"],
"attribute"
],
"prefix": [
"adf",
"app"
],
"style": "kebab-case" "style": "kebab-case"
} }
], ],

View File

@@ -138,7 +138,7 @@ export class TaskCloudService extends BaseCloudService implements TaskCloudServi
return this.post(queryUrl).pipe( return this.post(queryUrl).pipe(
map((res: any) => { map((res: any) => {
this.dataChangesDetected$.next(); this.dataChangesDetected$.next(res);
return res.entry; return res.entry;
}) })
); );
@@ -161,7 +161,7 @@ export class TaskCloudService extends BaseCloudService implements TaskCloudServi
return this.post(queryUrl).pipe( return this.post(queryUrl).pipe(
map((res: any) => { map((res: any) => {
this.dataChangesDetected$.next(); this.dataChangesDetected$.next(res);
return res.entry; return res.entry;
}) })
); );

View File

@@ -4,10 +4,7 @@
"overrides": [ "overrides": [
{ {
"files": ["*.ts"], "files": ["*.ts"],
"extends": [ "extends": ["plugin:@nrwl/nx/angular", "plugin:@angular-eslint/template/process-inline-templates"],
"plugin:@nrwl/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": { "rules": {
"jsdoc/newline-after-description": "warn", "jsdoc/newline-after-description": "warn",
"@typescript-eslint/naming-convention": "warn", "@typescript-eslint/naming-convention": "warn",

View File

@@ -45,10 +45,10 @@ const fakePngAnswer = new RelatedContentRepresentation({
thumbnailStatus: 'queued' thumbnailStatus: 'queued'
}); });
const fakeJpgAnswer = { const fakeJpgAnswer = new RelatedContentRepresentation({
id: 1156, id: 1156,
name: 'a_jpg_file.jpg', name: 'a_jpg_file.jpg',
created: '2017-07-25T17:17:37.118Z', created: new Date('2017-07-25T17:17:37.118Z'),
createdBy: {id: 1001, firstName: 'Admin', lastName: 'admin', email: 'admin'}, createdBy: {id: 1001, firstName: 'Admin', lastName: 'admin', email: 'admin'},
relatedContent: false, relatedContent: false,
contentAvailable: true, contentAvailable: true,
@@ -57,7 +57,7 @@ const fakeJpgAnswer = {
simpleType: 'image', simpleType: 'image',
previewStatus: 'queued', previewStatus: 'queued',
thumbnailStatus: 'queued' thumbnailStatus: 'queued'
}; });
describe('UploadWidgetComponent', () => { describe('UploadWidgetComponent', () => {
@@ -191,7 +191,7 @@ describe('UploadWidgetComponent', () => {
}); });
it('should show the list file after upload a new content', async () => { it('should show the list file after upload a new content', async () => {
spyOn(contentService, 'createTemporaryRawRelatedContent').and.returnValue(of(fakePngAnswer)); spyOn(contentService, 'createTemporaryRawRelatedContent').and.returnValues(of(fakePngAnswer), of(fakeJpgAnswer));
uploadWidgetComponent.field.params.multiple = false; uploadWidgetComponent.field.params.multiple = false;
@@ -207,17 +207,7 @@ describe('UploadWidgetComponent', () => {
}); });
it('should update the form after deleted a file', async () => { it('should update the form after deleted a file', async () => {
spyOn(contentService, 'createTemporaryRawRelatedContent').and.callFake((file: any) => { spyOn(contentService, 'createTemporaryRawRelatedContent').and.returnValues(of(fakePngAnswer), of(fakeJpgAnswer));
if (file.name === 'file-fake.png') {
return of(fakePngAnswer);
}
if (file.name === 'file-fake.jpg') {
return of(fakeJpgAnswer);
}
return of(null);
});
uploadWidgetComponent.field.params.multiple = true; uploadWidgetComponent.field.params.multiple = true;

View File

@@ -52,6 +52,7 @@ describe('ProcessInstanceDetailsComponent', () => {
const commentService = fixture.debugElement.injector.get(CommentProcessService); const commentService = fixture.debugElement.injector.get(CommentProcessService);
getProcessSpy = spyOn(service, 'getProcess').and.returnValue(of(exampleProcess)); getProcessSpy = spyOn(service, 'getProcess').and.returnValue(of(exampleProcess));
spyOn(service, 'getProcessTasks').and.returnValue(of());
spyOn(commentService, 'get').and.returnValue(of(mockProcessInstanceComments)); spyOn(commentService, 'get').and.returnValue(of(mockProcessInstanceComments));
}); });

View File

@@ -22,7 +22,7 @@ import {
import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation, OnDestroy } from '@angular/core'; import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation, OnDestroy } from '@angular/core';
import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core'; import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
import moment, { Moment } from 'moment'; import moment, { Moment } from 'moment';
import { Observable, of, Subject } from 'rxjs'; import { EMPTY, Observable, Subject } from 'rxjs';
import { Form } from '../models/form.model'; import { Form } from '../models/form.model';
import { TaskDetailsModel } from '../models/task-details.model'; import { TaskDetailsModel } from '../models/task-details.model';
import { TaskListService } from './../services/tasklist.service'; import { TaskListService } from './../services/tasklist.service';
@@ -226,7 +226,7 @@ export class StartTaskComponent implements OnInit, OnDestroy {
} }
private attachForm(taskId: string, formKey: string): Observable<any> { private attachForm(taskId: string, formKey: string): Observable<any> {
let response = of(); let response: any = EMPTY;
if (taskId && formKey) { if (taskId && formKey) {
response = this.taskService.attachFormToATask(taskId, parseInt(formKey, 10)); response = this.taskService.attachFormToATask(taskId, parseInt(formKey, 10));
} }
@@ -234,7 +234,7 @@ export class StartTaskComponent implements OnInit, OnDestroy {
} }
private assignTaskByUserId(taskId: string, userId: any): Observable<any> { private assignTaskByUserId(taskId: string, userId: any): Observable<any> {
let response = of(); let response: any = EMPTY;
if (taskId && userId) { if (taskId && userId) {
response = this.taskService.assignTaskByUserId(taskId, userId); response = this.taskService.assignTaskByUserId(taskId, userId);
} }

View File

@@ -67,6 +67,7 @@ describe('TaskDetailsComponent', () => {
let component: TaskDetailsComponent; let component: TaskDetailsComponent;
let fixture: ComponentFixture<TaskDetailsComponent>; let fixture: ComponentFixture<TaskDetailsComponent>;
let getTaskDetailsSpy: jasmine.Spy; let getTaskDetailsSpy: jasmine.Spy;
let getCommentsSpy: jasmine.Spy;
let getTasksSpy: jasmine.Spy; let getTasksSpy: jasmine.Spy;
let assignTaskSpy: jasmine.Spy; let assignTaskSpy: jasmine.Spy;
let logService: LogService; let logService: LogService;
@@ -101,7 +102,7 @@ describe('TaskDetailsComponent', () => {
assignTaskSpy = spyOn(taskListService, 'assignTask').and.returnValue(of(fakeTaskAssignResponse)); assignTaskSpy = spyOn(taskListService, 'assignTask').and.returnValue(of(fakeTaskAssignResponse));
taskCommentsService = TestBed.inject(TaskCommentsService); taskCommentsService = TestBed.inject(TaskCommentsService);
spyOn(taskCommentsService, 'get').and.returnValue(of([ getCommentsSpy = spyOn(taskCommentsService, 'get').and.returnValue(of([
new CommentModel({ message: 'Test1', created: new Date(), createdBy: new User({ firstName: 'Admin', lastName: 'User' }) }), new CommentModel({ message: 'Test1', created: new Date(), createdBy: new User({ firstName: 'Admin', lastName: 'User' }) }),
new CommentModel({ message: 'Test2', created: new Date(), createdBy: new User({ firstName: 'Admin', lastName: 'User' }) }), new CommentModel({ message: 'Test2', created: new Date(), createdBy: new User({ firstName: 'Admin', lastName: 'User' }) }),
new CommentModel({ message: 'Test3', created: new Date(), createdBy: new User({ firstName: 'Admin', lastName: 'User' }) }) new CommentModel({ message: 'Test3', created: new Date(), createdBy: new User({ firstName: 'Admin', lastName: 'User' }) })
@@ -114,6 +115,7 @@ describe('TaskDetailsComponent', () => {
afterEach(() => { afterEach(() => {
getTaskDetailsSpy.calls.reset(); getTaskDetailsSpy.calls.reset();
getCommentsSpy.calls.reset();
fixture.destroy(); fixture.destroy();
}); });

View File

@@ -4,10 +4,7 @@
"overrides": [ "overrides": [
{ {
"files": ["*.ts"], "files": ["*.ts"],
"extends": [ "extends": ["plugin:@nrwl/nx/angular", "plugin:@angular-eslint/template/process-inline-templates"],
"plugin:@nrwl/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": { "rules": {
"@angular-eslint/component-selector": [ "@angular-eslint/component-selector": [
"error", "error",
@@ -64,8 +61,7 @@
{ {
"files": ["*.html"], "files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"], "extends": ["plugin:@nrwl/nx/angular-template"],
"rules": { "rules": {}
}
} }
] ]
} }

View File

@@ -37,14 +37,7 @@
"@alfresco/js-api": ["node_modules/@alfresco/js-api"] "@alfresco/js-api": ["node_modules/@alfresco/js-api"]
} }
}, },
"exclude": [ "exclude": ["lib/config", "integration", "scripts", "assets", "tools", "node_modules"],
"lib/config",
"integration",
"scripts",
"assets",
"tools",
"node_modules"
],
"angularCompilerOptions": { "angularCompilerOptions": {
"fullTemplateTypeCheck": true, "fullTemplateTypeCheck": true,
"strictInjectionParameters": true, "strictInjectionParameters": true,