mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
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:
@@ -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]
|
||||
});
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -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,
|
||||
|
@@ -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({
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
});
|
||||
});
|
||||
|
@@ -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>
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -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);
|
||||
});
|
||||
});
|
@@ -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();
|
||||
}
|
||||
}
|
@@ -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 {}
|
@@ -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;
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -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,
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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' } = {};
|
||||
}
|
@@ -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 },
|
||||
|
@@ -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);
|
||||
|
@@ -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: [
|
||||
{
|
||||
|
@@ -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 }]
|
||||
});
|
||||
|
@@ -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 }]
|
||||
});
|
||||
|
||||
|
@@ -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());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user