code cleanup (#3210)

* code cleanup

* rollback changes

* remove dead code

* remove debug app config

* cleanup unused locales

* no-unused-vars rule

* test fixes and cleanup

* remove unnecessary translate modules
This commit is contained in:
Denys Vuika
2023-05-22 08:23:35 +01:00
committed by GitHub
parent 19e31adbb9
commit fd495f6e95
87 changed files with 197 additions and 841 deletions

View File

@@ -25,15 +25,7 @@
import { HammerModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import {
TRANSLATION_PROVIDER,
CoreModule,
AppConfigService,
DebugAppConfigService,
AuthGuardEcm,
LanguagePickerComponent,
NotificationHistoryComponent
} from '@alfresco/adf-core';
import { TRANSLATION_PROVIDER, CoreModule, AuthGuardEcm, LanguagePickerComponent, NotificationHistoryComponent } from '@alfresco/adf-core';
import {
ContentModule,
ContentVersionService,
@@ -42,7 +34,7 @@ import {
LibraryStatusColumnComponent,
TrashcanNameColumnComponent
} from '@alfresco/adf-content-services';
import { DocumentBasePageService, ExtensionsDataLoaderGuard, PageLayoutModule, RouterExtensionService, SharedModule } from '@alfresco/aca-shared';
import { DocumentBasePageService, ExtensionsDataLoaderGuard, PageLayoutModule, SharedModule } from '@alfresco/aca-shared';
import * as rules from '@alfresco/aca-shared/rules';
import { FilesComponent } from './components/files/files.component';
@@ -64,7 +56,6 @@ import { AppCommonModule } from './components/common/common.module';
import { AppSearchInputModule } from './components/search/search-input.module';
import { DocumentListCustomComponentsModule } from './components/dl-custom-components/document-list-custom-components.module';
import { AppSearchResultsModule } from './components/search/search-results.module';
import { AppNodeVersionModule } from './components/node-version/node-version.module';
import { FavoritesComponent } from './components/favorites/favorites.component';
import { RecentFilesComponent } from './components/recent-files/recent-files.component';
import { SharedFilesComponent } from './components/shared-files/shared-files.component';
@@ -73,23 +64,7 @@ import { DetailsComponent } from './components/details/details.component';
import { ContentUrlService } from './services/content-url.service';
import { HomeComponent } from './components/home/home.component';
import { CommonModule, registerLocaleData } from '@angular/common';
import localeFr from '@angular/common/locales/fr';
import localeDe from '@angular/common/locales/de';
import localeIt from '@angular/common/locales/it';
import localeEs from '@angular/common/locales/es';
import localeJa from '@angular/common/locales/ja';
import localeNl from '@angular/common/locales/nl';
import localePt from '@angular/common/locales/pt';
import localeNb from '@angular/common/locales/nb';
import localeRu from '@angular/common/locales/ru';
import localeCh from '@angular/common/locales/zh';
import localeAr from '@angular/common/locales/ar';
import localeCs from '@angular/common/locales/cs';
import localePl from '@angular/common/locales/pl';
import localeFi from '@angular/common/locales/fi';
import localeDa from '@angular/common/locales/da';
import localeSv from '@angular/common/locales/sv';
import { CommonModule } from '@angular/common';
import { LocationLinkComponent } from './components/common/location-link/location-link.component';
import { LogoutComponent } from './components/common/logout/logout.component';
import { ToggleSharedComponent } from './components/common/toggle-shared/toggle-shared.component';
@@ -120,23 +95,6 @@ import { ContentManagementService } from './services/content-management.service'
import { ShellLayoutComponent, SHELL_NAVBAR_MIN_WIDTH } from '@alfresco/adf-core/shell';
import { UserMenuComponent } from './components/sidenav/user-menu/user-menu.component';
registerLocaleData(localeFr);
registerLocaleData(localeDe);
registerLocaleData(localeIt);
registerLocaleData(localeEs);
registerLocaleData(localeJa);
registerLocaleData(localeNl);
registerLocaleData(localePt);
registerLocaleData(localeNb);
registerLocaleData(localeRu);
registerLocaleData(localeCh);
registerLocaleData(localeAr);
registerLocaleData(localeCs);
registerLocaleData(localePl);
registerLocaleData(localeFi);
registerLocaleData(localeDa);
registerLocaleData(localeSv);
@NgModule({
imports: [
CommonModule,
@@ -161,7 +119,6 @@ registerLocaleData(localeSv);
DocumentListCustomComponentsModule,
AppSearchInputModule,
AppSearchResultsModule,
AppNodeVersionModule,
HammerModule,
ViewProfileModule,
AppTrashcanModule,
@@ -181,7 +138,6 @@ registerLocaleData(localeSv);
UploadFilesDialogComponent
],
providers: [
{ provide: AppConfigService, useClass: DebugAppConfigService },
{ provide: ContentVersionService, useClass: ContentUrlService },
{ provide: DocumentBasePageService, useExisting: ContentManagementService },
{
@@ -196,7 +152,7 @@ registerLocaleData(localeSv);
]
})
export class ContentServiceExtensionModule {
constructor(public extensions: ExtensionService, public routeExtensionService: RouterExtensionService) {
constructor(public extensions: ExtensionService) {
extensions.setAuthGuards({
'app.auth': AuthGuardEcm,
'app.extensions.dataLoaderGuard': ExtensionsDataLoaderGuard

View File

@@ -26,24 +26,17 @@ import { TestBed, ComponentFixture } from '@angular/core/testing';
import { AppTestingModule } from '../../testing/app-testing.module';
import { ContextMenuItemComponent } from './context-menu-item.component';
import { ContextMenuModule } from './context-menu.module';
import { TranslateModule, TranslateLoader, TranslateFakeLoader } from '@ngx-translate/core';
import { AppExtensionService } from '@alfresco/aca-shared';
describe('ContextMenuComponent', () => {
let fixture: ComponentFixture<ContextMenuItemComponent>;
let component: ContextMenuItemComponent;
let extensionsService;
let extensionsService: AppExtensionService;
let contextItem;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
AppTestingModule,
ContextMenuModule,
TranslateModule.forRoot({
loader: { provide: TranslateLoader, useClass: TranslateFakeLoader }
})
],
imports: [AppTestingModule, ContextMenuModule],
providers: [AppExtensionService]
});

View File

@@ -22,7 +22,7 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Injectable, Injector, ComponentRef } from '@angular/core';
import { ComponentRef, Injectable, Injector } from '@angular/core';
import { Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay';
import { ComponentPortal } from '@angular/cdk/portal';
import { ContextMenuOverlayRef } from './context-menu-overlay';
@@ -97,7 +97,7 @@ export class ContextMenuService {
}
]);
const overlayConfig = new OverlayConfig({
return new OverlayConfig({
hasBackdrop: config.hasBackdrop,
backdropClass: config.backdropClass,
panelClass: config.panelClass,
@@ -105,7 +105,5 @@ export class ContextMenuService {
positionStrategy,
direction: this.direction
});
return overlayConfig;
}
}

View File

@@ -24,26 +24,34 @@
import { CreateMenuComponent } from './create-menu.component';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CoreModule } from '@alfresco/adf-core';
import { AppCreateMenuModule } from './create-menu.module';
import { OverlayContainer, OverlayModule } from '@angular/cdk/overlay';
import { AppExtensionService } from '@alfresco/aca-shared';
import { ContentActionType } from '@alfresco/adf-extensions';
import { By } from '@angular/platform-browser';
import { AppTestingModule } from '../../testing/app-testing.module';
import { MatMenuModule } from '@angular/material/menu';
import { MatButtonModule } from '@angular/material/button';
import { of } from 'rxjs';
import { getContentActionRef } from '../../testing/content-action-ref';
import { ContentActionRef, ContentActionType } from '@alfresco/adf-extensions';
describe('CreateMenuComponent', () => {
let fixture: ComponentFixture<CreateMenuComponent>;
let extensionService: AppExtensionService;
let getCreateActionsSpy: jasmine.Spy;
const getContentActionRef = (): ContentActionRef => ({
id: 'id',
type: ContentActionType.button,
title: 'ACTION_TITLE',
disabled: false,
actions: {
click: 'ACTION_CLICK'
}
});
beforeEach(() => {
TestBed.configureTestingModule({
imports: [AppTestingModule, CoreModule.forRoot(), AppCreateMenuModule, OverlayModule, MatMenuModule, MatButtonModule]
imports: [AppTestingModule, AppCreateMenuModule, OverlayModule, MatMenuModule, MatButtonModule]
});
extensionService = TestBed.inject(AppExtensionService);

View File

@@ -27,7 +27,7 @@ import { AppTestingModule } from '../../testing/app-testing.module';
import { DetailsComponent } from './details.component';
import { MetadataTabComponent } from '../info-drawer/metadata-tab/metadata-tab.component';
import { CommentsTabComponent } from '../info-drawer/comments-tab/comments-tab.component';
import { ActivatedRoute, Router } from '@angular/router';
import { ActivatedRoute } from '@angular/router';
import { of, Subject } from 'rxjs';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { Store } from '@ngrx/store';
@@ -36,16 +36,14 @@ import { AppExtensionService } from '@alfresco/adf-extensions';
import { ContentApiService } from '@alfresco/aca-shared';
import { SetSelectedNodesAction } from '@alfresco/aca-shared/store';
import { NodeEntry } from '@alfresco/js-api';
import { RouterTestingModule } from '@angular/router/testing';
describe('DetailsComponent', () => {
let component: DetailsComponent;
let fixture: ComponentFixture<DetailsComponent>;
let contentApiService: ContentApiService;
let store;
const router: any = {
url: '',
navigate: jasmine.createSpy('navigate')
};
let store: Store;
const mockStream = new Subject();
const storeMock = {
dispatch: jasmine.createSpy('dispatch'),
@@ -59,10 +57,7 @@ describe('DetailsComponent', () => {
providers: [
ContentManagementService,
AppExtensionService,
{
provide: Router,
useValue: router
},
RouterTestingModule,
{ provide: Store, useValue: storeMock },
{
provide: ActivatedRoute,

View File

@@ -26,13 +26,13 @@ import { CustomNameColumnComponent } from './name-column.component';
import { DocumentListCustomComponentsModule } from '../document-list-custom-components.module';
import { Actions } from '@ngrx/effects';
import { StoreModule } from '@ngrx/store';
import { TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CoreModule } from '@alfresco/adf-core';
import { TranslateModule } from '@ngx-translate/core';
describe('CustomNameColumnComponent', () => {
let fixture;
let component;
let fixture: ComponentFixture<CustomNameColumnComponent>;
let component: CustomNameColumnComponent;
beforeEach(() => {
TestBed.configureTestingModule({

View File

@@ -23,7 +23,7 @@
*/
import { HomeComponent } from './home.component';
import { AppConfigService, AppConfigServiceMock, setupTestBed } from '@alfresco/adf-core';
import { AppConfigService, AppConfigServiceMock } from '@alfresco/adf-core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Router } from '@angular/router';
import { HttpClientModule } from '@angular/common/http';
@@ -34,12 +34,11 @@ describe('HomeComponent', () => {
let fixture: ComponentFixture<HomeComponent>;
let router: Router;
setupTestBed({
imports: [HttpClientModule, RouterTestingModule],
providers: [{ provide: AppConfigService, useClass: AppConfigServiceMock }]
});
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientModule, RouterTestingModule],
providers: [{ provide: AppConfigService, useClass: AppConfigServiceMock }]
});
fixture = TestBed.createComponent(HomeComponent);
router = TestBed.inject(Router);
appConfig = TestBed.inject(AppConfigService);

View File

@@ -26,10 +26,10 @@ import { MetadataTabComponent } from './metadata-tab.component';
import { Node } from '@alfresco/js-api';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AppTestingModule } from '../../../testing/app-testing.module';
import { AppConfigService, setupTestBed, CoreModule } from '@alfresco/adf-core';
import { AppConfigService, CoreModule } from '@alfresco/adf-core';
import { ContentMetadataModule } from '@alfresco/adf-content-services';
import { Store } from '@ngrx/store';
import { SetInfoDrawerMetadataAspectAction, AppState } from '@alfresco/aca-shared/store';
import { AppState, SetInfoDrawerMetadataAspectAction } from '@alfresco/aca-shared/store';
import { By } from '@angular/platform-browser';
import { AppExtensionService } from '@alfresco/aca-shared';
@@ -46,9 +46,11 @@ describe('MetadataTabComponent', () => {
custom: []
};
setupTestBed({
imports: [CoreModule, AppTestingModule, ContentMetadataModule],
declarations: [MetadataTabComponent]
beforeEach(() => {
TestBed.configureTestingModule({
imports: [CoreModule, AppTestingModule, ContentMetadataModule],
declarations: [MetadataTabComponent]
});
});
afterEach(() => {
@@ -87,45 +89,37 @@ describe('MetadataTabComponent', () => {
});
it('should return true if node is not locked and has update permission', () => {
const node = {
component.node = {
isLocked: false,
allowableOperations: ['update']
} as Node;
component.node = node;
expect(component.canUpdateNode).toBe(true);
});
it('should return false if node is locked', () => {
const node = {
component.node = {
isLocked: true,
allowableOperations: ['update']
} as Node;
component.node = node;
expect(component.canUpdateNode).toBe(false);
});
it('should return false if node has no update permission', () => {
const node = {
component.node = {
isLocked: false,
allowableOperations: ['other']
} as Node;
component.node = node;
expect(component.canUpdateNode).toBe(false);
});
it('should return false if node has read only property', () => {
const node = {
component.node = {
isLocked: false,
allowableOperations: ['update'],
properties: {
'cm:lockType': 'WRITE_LOCK'
}
} as Node;
component.node = node;
expect(component.canUpdateNode).toBe(false);
});
});

View File

@@ -1,27 +0,0 @@
<form novalidate [formGroup]="form" class="form">
<p class="form__subtitle">
{{ 'VERSION.FORM.SUBTITLE' | translate }}
</p>
<mat-radio-group formControlName="version" class="form__version">
<mat-radio-button
class="form__version--option"
color="primary"
*ngFor="let option of versions"
[attr.data-automation-id]="option.value"
[value]="option.value"
>
{{ option.label | translate }}
</mat-radio-button>
</mat-radio-group>
<mat-form-field class="form__comment">
<textarea
matInput
placeholder="{{ 'VERSION.FORM.COMMENT.PLACEHOLDER' | translate }}"
rows="1"
autocomplete="off"
formControlName="comment"
></textarea>
</mat-form-field>
</form>

View File

@@ -1,21 +0,0 @@
.app-node-version-form__container {
display: flex;
max-width: 400px;
.form__version {
display: flex;
flex-direction: column;
padding: 20px 0;
}
.form__version--option:last-child {
padding-top: 20px;
}
.form {
width: 100%;
padding: 0 10px;
display: flex;
flex-direction: column;
}
}

View File

@@ -1,66 +0,0 @@
/*!
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Alfresco Example Content Application
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { AppNodeVersionFormComponent } from './node-version-form.component';
import { setupTestBed, CoreModule } from '@alfresco/adf-core';
import { TestBed } from '@angular/core/testing';
import { TranslateModule } from '@ngx-translate/core';
describe('AppNodeVersionFormComponent', () => {
let fixture;
let component;
setupTestBed({
imports: [TranslateModule.forRoot(), CoreModule.forRoot(), NoopAnimationsModule],
declarations: [AppNodeVersionFormComponent]
});
beforeEach(() => {
fixture = TestBed.createComponent(AppNodeVersionFormComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should have minor version option selected', () => {
const isSelected = fixture.debugElement.nativeElement.querySelectorAll('.form__version--option')[0].classList.contains('mat-radio-checked');
expect(isSelected).toBe(true);
});
it('should emit form state on changes', () => {
const formData = {
comment: 'some text',
version: true
};
spyOn(component.update, 'emit');
component.form.valueChanges.next(formData);
expect(component.update.emit).toHaveBeenCalledWith(formData);
});
it('form should have valid state upon initialization', () => {
expect(component.form.valid).toBe(true);
});
});

View File

@@ -1,75 +0,0 @@
/*!
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Alfresco Example Content Application
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, OnDestroy, OnInit, ViewEncapsulation, Output, EventEmitter } from '@angular/core';
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
export interface VersionFormEntry {
comment: string;
version: boolean;
}
@Component({
selector: 'app-node-version-form',
templateUrl: './node-version-form.component.html',
styleUrls: ['./node-version-form.component.scss'],
encapsulation: ViewEncapsulation.None,
host: { class: 'app-node-version-form__container' },
exportAs: 'nodeVersionForm'
})
export class AppNodeVersionFormComponent implements OnInit, OnDestroy {
@Output() update: EventEmitter<VersionFormEntry> = new EventEmitter();
form: UntypedFormGroup;
private onDestroy$: Subject<boolean> = new Subject<boolean>();
private versionOptions = [
{ label: 'VERSION.FORM.VERSION.MINOR', value: false },
{ label: 'VERSION.FORM.VERSION.MAJOR', value: true }
];
constructor(private formBuilder: UntypedFormBuilder) {}
ngOnInit() {
this.form = this.formBuilder.group({
comment: [''],
version: [this.versionOptions[0].value]
});
this.form.valueChanges.pipe(takeUntil(this.onDestroy$)).subscribe((values: VersionFormEntry) => {
this.update.emit(values);
});
}
get versions() {
return this.versionOptions;
}
ngOnDestroy() {
this.onDestroy$.next(true);
this.onDestroy$.complete();
}
}

View File

@@ -1,54 +0,0 @@
/*!
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Alfresco Example Content Application
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { AppNodeVersionFormComponent } from './node-version-form.component';
import { MatDialogModule } from '@angular/material/dialog';
import { MatButtonModule } from '@angular/material/button';
import { CoreModule } from '@alfresco/adf-core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { CommonModule } from '@angular/common';
import { MatRadioModule } from '@angular/material/radio';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { NgModule } from '@angular/core';
@NgModule({
imports: [
CoreModule,
MatButtonModule,
MatDialogModule,
FormsModule,
ReactiveFormsModule,
BrowserModule,
CommonModule,
MatRadioModule,
MatFormFieldModule,
MatInputModule
],
exports: [AppNodeVersionFormComponent],
declarations: [AppNodeVersionFormComponent]
})
export class AppNodeVersionModule {}

View File

@@ -81,14 +81,13 @@ export class SearchLibrariesQueryBuilderService {
buildQuery(): LibrarySearchQuery {
const query = this.userQuery;
if (query && query.length > 1) {
const resultQuery = {
return {
term: query,
opts: {
skipCount: this.paging && this.paging.skipCount,
maxItems: this.paging && this.paging.maxItems
}
};
return resultQuery;
}
return null;
}

View File

@@ -25,7 +25,6 @@
import { NodeEntry } from '@alfresco/js-api';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CoreModule } from '@angular/flex-layout';
import { TranslateModule } from '@ngx-translate/core';
import { AppTestingModule } from '../../../testing/app-testing.module';
import { AppSearchResultsModule } from '../search-results.module';
import { SearchResultsRowComponent } from './search-results-row.component';
@@ -45,7 +44,7 @@ describe('SearchResultsRowComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), CoreModule, AppTestingModule, AppSearchResultsModule]
imports: [CoreModule, AppTestingModule, AppSearchResultsModule]
});
fixture = TestBed.createComponent(SearchResultsRowComponent);

View File

@@ -31,7 +31,6 @@ import { NavigateToFolder, SnackbarErrorAction } from '@alfresco/aca-shared/stor
import { Pagination, SearchRequest } from '@alfresco/js-api';
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
import { ActivatedRoute, Router } from '@angular/router';
import { TranslateModule } from '@ngx-translate/core';
import { BehaviorSubject, Subject } from 'rxjs';
import { AppTestingModule } from '../../../testing/app-testing.module';
import { AppService } from '@alfresco/aca-shared';
@@ -50,7 +49,7 @@ describe('SearchComponent', () => {
beforeEach(() => {
params = new BehaviorSubject({ q: 'TYPE: "cm:folder" AND %28=cm: name: email OR cm: name: budget%29' });
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), AppTestingModule, CoreModule.forRoot(), AppSearchResultsModule],
imports: [AppTestingModule, CoreModule.forRoot(), AppSearchResultsModule],
providers: [
{
provide: AppService,

View File

@@ -26,7 +26,6 @@ import { ButtonMenuComponent } from './button-menu.component';
import { TestBed, ComponentFixture } from '@angular/core/testing';
import { AppTestingModule } from '../../../testing/app-testing.module';
import { Router } from '@angular/router';
import { TranslateModule, TranslateLoader, TranslateFakeLoader } from '@ngx-translate/core';
import { AppSidenavModule } from '../sidenav.module';
describe('ButtonMenuComponent', () => {
@@ -36,13 +35,7 @@ describe('ButtonMenuComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
AppTestingModule,
AppSidenavModule,
TranslateModule.forRoot({
loader: { provide: TranslateLoader, useClass: TranslateFakeLoader }
})
]
imports: [AppTestingModule, AppSidenavModule]
});
fixture = TestBed.createComponent(ButtonMenuComponent);

View File

@@ -26,7 +26,6 @@ import { ExpandMenuComponent } from './expand-menu.component';
import { TestBed, ComponentFixture } from '@angular/core/testing';
import { AppTestingModule } from '../../../testing/app-testing.module';
import { Router } from '@angular/router';
import { TranslateModule, TranslateLoader, TranslateFakeLoader } from '@ngx-translate/core';
import { AppSidenavModule } from '../sidenav.module';
describe('ExpandMenuComponent', () => {
@@ -36,13 +35,7 @@ describe('ExpandMenuComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
AppTestingModule,
AppSidenavModule,
TranslateModule.forRoot({
loader: { provide: TranslateLoader, useClass: TranslateFakeLoader }
})
]
imports: [AppTestingModule, AppSidenavModule]
});
fixture = TestBed.createComponent(ExpandMenuComponent);

View File

@@ -1,38 +0,0 @@
/*!
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Alfresco Example Content Application
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, Input } from '@angular/core';
/**
* This wrapper is designated to be used with 'adf-dynamic-component'.
* It forwards the dynamic component inputs to original sidenav.
*/
@Component({
selector: 'aca-sidenav-wrapper',
templateUrl: './sidenav-wrapper.component.html'
})
export class SidenavWrapperComponent {
@Input()
data: { mode?: 'collapsed' | 'expanded' } = {};
}

View File

@@ -28,6 +28,7 @@ import { PeopleContentService } from '@alfresco/adf-content-services';
import { AppTestingModule } from '../../../testing/app-testing.module';
import { UserMenuComponent } from './user-menu.component';
import { of } from 'rxjs';
import { SharedToolbarModule } from '@alfresco/aca-shared';
describe('UserMenuComponent', () => {
let component: UserMenuComponent;
@@ -106,7 +107,7 @@ describe('UserMenuComponent', () => {
};
TestBed.configureTestingModule({
imports: [AppTestingModule],
imports: [AppTestingModule, SharedToolbarModule],
declarations: [UserMenuComponent],
providers: [
{ provide: AuthenticationService, useValue: authServiceStub },

View File

@@ -25,7 +25,6 @@
import { DocumentDisplayModeComponent } from './document-display-mode.component';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CoreModule } from '@angular/flex-layout';
import { TranslateModule } from '@ngx-translate/core';
import { AppTestingModule } from '../../../testing/app-testing.module';
import { of } from 'rxjs';
@@ -35,7 +34,7 @@ describe('DocumentDisplayModeComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), CoreModule, AppTestingModule]
imports: [CoreModule, AppTestingModule]
});
fixture = TestBed.createComponent(DocumentDisplayModeComponent);

View File

@@ -30,7 +30,6 @@ import { Store } from '@ngrx/store';
import { AppTestingModule } from '../../../testing/app-testing.module';
import { of } from 'rxjs';
import { Router } from '@angular/router';
import { TranslateModule } from '@ngx-translate/core';
import { AppHookService, ContentApiService } from '@alfresco/aca-shared';
describe('ToggleFavoriteLibraryComponent', () => {
@@ -46,7 +45,7 @@ describe('ToggleFavoriteLibraryComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), CoreModule.forRoot(), AppTestingModule],
imports: [CoreModule.forRoot(), AppTestingModule],
declarations: [ToggleFavoriteLibraryComponent],
providers: [
{

View File

@@ -29,7 +29,6 @@ import { ExtensionService } from '@alfresco/adf-extensions';
import { CoreModule } from '@alfresco/adf-core';
import { Router } from '@angular/router';
import { of } from 'rxjs';
import { TranslateModule } from '@ngx-translate/core';
import { AppTestingModule } from '../../../testing/app-testing.module';
import { ContentDirectiveModule } from '@alfresco/adf-content-services';
@@ -51,7 +50,7 @@ describe('ToggleFavoriteComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), CoreModule.forRoot(), ContentDirectiveModule, AppTestingModule],
imports: [CoreModule.forRoot(), ContentDirectiveModule, AppTestingModule],
declarations: [ToggleFavoriteComponent],
providers: [ExtensionService, { provide: Store, useValue: mockStore }, { provide: Router, useValue: mockRouter }]
});

View File

@@ -25,7 +25,6 @@
import { ToggleInfoDrawerComponent } from './toggle-info-drawer.component';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CoreModule } from '@angular/flex-layout';
import { TranslateModule } from '@ngx-translate/core';
import { AppTestingModule } from '../../../testing/app-testing.module';
import { Subject } from 'rxjs';
import { Store } from '@ngrx/store';
@@ -40,7 +39,7 @@ describe('ToggleInfoDrawerComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), CoreModule, AppTestingModule],
imports: [CoreModule, AppTestingModule],
providers: [{ provide: Store, useValue: storeMock }]
});

View File

@@ -23,7 +23,7 @@
*/
import { Injectable } from '@angular/core';
import { CanActivate, ActivatedRouteSnapshot } from '@angular/router';
import { CanActivate } from '@angular/router';
import { Observable } from 'rxjs';
import { AuthenticationService } from '@alfresco/adf-core';
@@ -33,11 +33,11 @@ import { AuthenticationService } from '@alfresco/adf-core';
export class ViewProfileRuleGuard implements CanActivate {
constructor(private authService: AuthenticationService) {}
canActivate(_: ActivatedRouteSnapshot): Observable<boolean> | Promise<boolean> | boolean {
canActivate(): Observable<boolean> | Promise<boolean> | boolean {
return this.isEcmLoggedIn() || this.authService.isOauth();
}
private isEcmLoggedIn() {
private isEcmLoggedIn(): boolean {
return this.authService.isEcmLoggedIn() || (this.authService.isECMProvider() && this.authService.isKerberosEnabled());
}
}

View File

@@ -30,7 +30,6 @@ import { MatDialogModule, MAT_DIALOG_DATA, MatDialogRef } from '@angular/materia
import { Store } from '@ngrx/store';
import { CreateFromTemplate } from '@alfresco/aca-shared/store';
import { Node } from '@alfresco/js-api';
import { TranslateModule } from '@ngx-translate/core';
const text = (length: number) => new Array(length).fill(Math.random().toString().substring(2, 3)).join('');
@@ -52,7 +51,7 @@ describe('CreateFileFromTemplateDialogComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), CoreModule.forRoot(), AppTestingModule, MatDialogModule],
imports: [CoreModule.forRoot(), AppTestingModule, MatDialogModule],
declarations: [CreateFromTemplateDialogComponent],
providers: [
{

View File

@@ -23,7 +23,7 @@
*/
import { ContentServiceExtensionService } from './content-service-extension.service';
import { AppConfigService, AppConfigServiceMock, setupTestBed } from '@alfresco/adf-core';
import { AppConfigService, AppConfigServiceMock } from '@alfresco/adf-core';
import { TestBed } from '@angular/core/testing';
import { of } from 'rxjs';
import { HttpClientModule } from '@angular/common/http';
@@ -32,12 +32,11 @@ describe('ContentServiceExtensionService', () => {
let service: ContentServiceExtensionService;
let appConfig: AppConfigService;
setupTestBed({
imports: [HttpClientModule],
providers: [{ provide: AppConfigService, useClass: AppConfigServiceMock }]
});
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientModule],
providers: [{ provide: AppConfigService, useClass: AppConfigServiceMock }]
});
service = TestBed.inject(ContentServiceExtensionService);
appConfig = TestBed.inject(AppConfigService);
appConfig.config = Object.assign(appConfig.config, {

View File

@@ -876,7 +876,7 @@ describe('NodeActionsService', () => {
it('should try to move children nodes of a folder to already existing folder with same name', () => {
const parentFolderToMove = new TestNode('parent-folder', !isFile, 'conflicting-name');
const moveNodeSpy = spyOn(documentListService, 'moveNode').and.callFake((nodeId: string, _targetParentId: string) => {
const moveNodeSpy = spyOn(documentListService, 'moveNode').and.callFake((nodeId: string) => {
if (nodeId === parentFolderToMove.entry.id) {
return throwError(conflictError);
}

View File

@@ -25,7 +25,7 @@
import { Injectable } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { Observable, Subject, of, zip, from } from 'rxjs';
import { AlfrescoApiService, DataColumn, TranslationService, ThumbnailService } from '@alfresco/adf-core';
import { AlfrescoApiService, TranslationService, ThumbnailService } from '@alfresco/adf-core';
import {
DocumentListService,
ContentNodeSelectorComponent,
@@ -565,7 +565,7 @@ export class NodeActionsService {
return !node.isFile && node.nodeType !== 'app:folderlink';
}
private imageResolver(row: ShareDataRow, _: DataColumn): string | null {
private imageResolver(row: ShareDataRow): string | null {
const entry: MinimalNodeEntryEntity = row.node.entry;
if (!this.contentService.hasAllowableOperations(entry, 'update')) {
return this.thumbnailService.getMimeTypeIcon('disable/folder');

View File

@@ -44,9 +44,9 @@ import { UploadService, FileModel } from '@alfresco/adf-content-services';
@Injectable()
export class UploadEffects {
private fileInput: HTMLInputElement;
private folderInput: HTMLInputElement;
private fileVersionInput: HTMLInputElement;
private readonly fileInput: HTMLInputElement;
private readonly folderInput: HTMLInputElement;
private readonly fileVersionInput: HTMLInputElement;
private readonly uploadMenuButtonSelector = 'app-toolbar-menu button[id="app.toolbar.upload"]';
constructor(
@@ -132,7 +132,7 @@ export class UploadEffects {
this.contentService
.getNodeInfo()
.pipe(
catchError((_) => {
catchError(() => {
this.store.dispatch(new SnackbarErrorAction('VERSION.ERROR.GENERIC'));
return of(null);
})

View File

@@ -180,7 +180,7 @@ export class ViewerEffects {
let previewLocation = this.router.url;
if (previewLocation.lastIndexOf('/') > 0) {
previewLocation = previewLocation.substr(0, this.router.url.indexOf('/', 1));
previewLocation = previewLocation.substring(0, this.router.url.indexOf('/', 1));
}
previewLocation = previewLocation.replace(/\//g, '');

View File

@@ -1,34 +0,0 @@
/*!
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Alfresco Example Content Application
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { ContentActionRef } from '@alfresco/adf-extensions';
import { Observable, of } from 'rxjs';
import { getContentActionRef } from './content-action-ref';
export class AppExtensionServiceMock {
getMainAction(): Observable<ContentActionRef> {
return of(getContentActionRef());
}
runActionById(_id: string) {}
}

View File

@@ -23,7 +23,7 @@
*/
import { NgModule } from '@angular/core';
import { TranslatePipe, TranslateModule } from '@ngx-translate/core';
import { TranslateModule } from '@ngx-translate/core';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import {
TranslationService,
@@ -42,7 +42,6 @@ import { RouterTestingModule } from '@angular/router/testing';
import { EffectsModule } from '@ngrx/effects';
import { MaterialModule } from '../material.module';
import { INITIAL_STATE } from '../store/initial-state';
import { TranslatePipeMock } from './translate-pipe.directive';
import { BehaviorSubject, Observable, of } from 'rxjs';
import { ContentManagementService } from '../services/content-management.service';
import { DocumentBasePageService } from '@alfresco/aca-shared';
@@ -67,12 +66,10 @@ import { DocumentBasePageService } from '@alfresco/aca-shared';
EffectsModule.forRoot([]),
PipeModule
],
declarations: [TranslatePipeMock],
exports: [TranslatePipeMock, RouterTestingModule, MaterialModule, PipeModule],
exports: [RouterTestingModule, MaterialModule, PipeModule, TranslateModule],
providers: [
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
{ provide: TranslationService, useClass: TranslationMock },
{ provide: TranslatePipe, useClass: TranslatePipeMock },
{ provide: DocumentBasePageService, useExisting: ContentManagementService },
{
provide: DiscoveryApiService,

View File

@@ -1,38 +0,0 @@
/*!
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Alfresco Example Content Application
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { ContentActionRef, ContentActionType } from '@alfresco/adf-extensions';
export const ACTION_TITLE = 'ACTION_TITLE';
export const ACTION_CLICK = 'ACTION_CLICK';
export const getContentActionRef = (): ContentActionRef => ({
id: 'id',
type: ContentActionType.button,
title: ACTION_TITLE,
disabled: false,
actions: {
click: ACTION_CLICK
}
});

View File

@@ -1,32 +0,0 @@
/*!
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Alfresco Example Content Application
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'translate' })
export class TranslatePipeMock implements PipeTransform {
transform(value: any) {
return value;
}
}