[ADF-1873] Remove all deprecated code from ADF (#4145)

* remove deprecated code part 1

* remove deprecation step 2

* fix spellcheck

* fix

* fix lint

* fix not used import

* remove deprecation

* fix test first part after remove deprecation

* fix test

* fix sidebar demo shell
This commit is contained in:
Eugenio Romano
2019-01-15 15:36:01 +00:00
committed by GitHub
parent 24a7c939e6
commit 7d061b2c11
109 changed files with 351 additions and 1106 deletions
@@ -23,7 +23,7 @@ import moment from 'moment-es6';
import { Moment } from 'moment';
import { CardViewDateItemModel } from '../../models/card-view-dateitem.model';
import { CardViewUpdateService } from '../../services/card-view-update.service';
import { UserPreferencesService } from '../../../services/user-preferences.service';
import { UserPreferencesService, UserPreferenceValues } from '../../../services/user-preferences.service';
import { MomentDateAdapter } from '../../../utils/momentDateAdapter';
import { MOMENT_DATE_FORMATS } from '../../../utils/moment-date-formats.model';
@@ -58,13 +58,14 @@ export class CardViewDateItemComponent implements OnInit {
constructor(private cardViewUpdateService: CardViewUpdateService,
private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService) {
private userPreferencesService: UserPreferencesService) {
}
ngOnInit() {
this.preferences.locale$.subscribe((locale) => {
this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale);
});
(<MomentDateAdapter> this.dateAdapter).overrideDisplayFormat = this.SHOW_FORMAT;
if (this.property.value) {
@@ -22,11 +22,8 @@ import { MatMenuTrigger } from '@angular/material';
import { Subscription } from 'rxjs';
import { ContextMenuService } from './context-menu.service';
/**
* @deprecated: context-menu-holder is deprecated, use adf-context-menu-holder instead.
*/
@Component({
selector: 'adf-context-menu-holder, context-menu-holder',
selector: 'adf-context-menu-holder',
template: `
<button mat-button [matMenuTriggerFor]="contextMenu"></button>
<mat-menu #contextMenu="matMenu" class="context-menu">
@@ -20,9 +20,8 @@
import { Directive, HostListener, Input } from '@angular/core';
import { ContextMenuOverlayService } from './context-menu-overlay.service';
// @deprecated 2.3.0 context-menu tag removed
@Directive({
selector: '[adf-context-menu], [context-menu]'
selector: '[context-menu]'
})
export class ContextMenuDirective {
/** Items for the menu. */
@@ -40,13 +40,6 @@ export class NodeRestoreDirective {
@Input('adf-restore')
selection: DeletedNodeEntry[];
/**
* Path to restored node.
* @deprecated 2.4.0
*/
@Input()
location: string = '';
/** Emitted when restoration is complete. */
@Output()
restore: EventEmitter<RestoreMessageModel> = new EventEmitter();
+2 -3
View File
@@ -158,10 +158,9 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
/**
* Emitted when any error occurs.
* @deprecated in 2.4.0, will be renamed as "error" in 3.x.x
*/
@Output()
onError: EventEmitter<any> = new EventEmitter<any>();
error: EventEmitter<any> = new EventEmitter<any>();
debugMode: boolean = false;
@@ -458,7 +457,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
handleError(err: any): any {
this.onError.emit(err);
this.error.emit(err);
}
parseForm(json: any): FormModel {
@@ -23,7 +23,7 @@ import { DatetimeAdapter, MAT_DATETIME_FORMATS } from '@mat-datetimepicker/core'
import { MomentDatetimeAdapter, MAT_MOMENT_DATETIME_FORMATS } from '@mat-datetimepicker/moment';
import moment from 'moment-es6';
import { Moment } from 'moment';
import { UserPreferencesService } from '../../../../services/user-preferences.service';
import { UserPreferencesService, UserPreferenceValues } from '../../../../services/user-preferences.service';
import { MomentDateAdapter } from '../../../../utils/momentDateAdapter';
import { MOMENT_DATE_FORMATS } from '../../../../utils/moment-date-formats.model';
import { FormService } from './../../../services/form.service';
@@ -49,14 +49,15 @@ export class DateTimeWidgetComponent extends WidgetComponent implements OnInit {
constructor(public formService: FormService,
private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService) {
private userPreferencesService: UserPreferencesService) {
super(formService);
}
ngOnInit() {
this.preferences.locale$.subscribe((locale) => {
this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale);
});
let momentDateAdapter = <MomentDateAdapter> this.dateAdapter;
momentDateAdapter.overrideDisplayFormat = this.field.dateDisplayFormat;
@@ -17,7 +17,7 @@
/* tslint:disable:component-selector */
import { UserPreferencesService } from '../../../../services/user-preferences.service';
import { UserPreferencesService, UserPreferenceValues } from '../../../../services/user-preferences.service';
import { MomentDateAdapter } from '../../../../utils/momentDateAdapter';
import { MOMENT_DATE_FORMATS } from '../../../../utils/moment-date-formats.model';
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
@@ -46,14 +46,15 @@ export class DateWidgetComponent extends WidgetComponent implements OnInit {
constructor(public formService: FormService,
private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService) {
private userPreferencesService: UserPreferencesService) {
super(formService);
}
ngOnInit() {
this.preferences.locale$.subscribe((locale) => {
this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale);
});
let momentDateAdapter = <MomentDateAdapter> this.dateAdapter;
momentDateAdapter.overrideDisplayFormat = this.field.dateDisplayFormat;
@@ -17,7 +17,7 @@
/* tslint:disable:component-selector */
import { UserPreferencesService } from '../../../../../../services/user-preferences.service';
import { UserPreferencesService, UserPreferenceValues } from '../../../../../../services/user-preferences.service';
import { MomentDateAdapter } from '../../../../../../utils/momentDateAdapter';
import { MOMENT_DATE_FORMATS } from '../../../../../../utils/moment-date-formats.model';
import { Component, Input, OnInit } from '@angular/core';
@@ -55,13 +55,14 @@ export class DateEditorComponent implements OnInit {
maxDate: Moment;
constructor(private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService) {
private userPreferencesService: UserPreferencesService) {
}
ngOnInit() {
this.preferences.locale$.subscribe((locale) => {
this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale);
});
let momentDateAdapter = <MomentDateAdapter> this.dateAdapter;
momentDateAdapter.overrideDisplayFormat = this.DATE_FORMAT;
@@ -17,7 +17,7 @@
/* tslint:disable:component-selector */
import { UserPreferencesService } from '../../../../../../services/user-preferences.service';
import { UserPreferencesService, UserPreferenceValues } from '../../../../../../services/user-preferences.service';
import { MomentDateAdapter } from '../../../../../../utils/momentDateAdapter';
import { MOMENT_DATE_FORMATS } from '../../../../../../utils/moment-date-formats.model';
import { Component, Input, OnInit } from '@angular/core';
@@ -60,13 +60,14 @@ export class DateTimeEditorComponent implements OnInit {
maxDate: Moment;
constructor(private dateAdapter: DateAdapter<Moment>,
private preferences: UserPreferencesService) {
private userPreferencesService: UserPreferencesService) {
}
ngOnInit() {
this.preferences.locale$.subscribe((locale) => {
this.userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.dateAdapter.setLocale(locale);
});
let momentDateAdapter = <MomentDateAdapter> this.dateAdapter;
momentDateAdapter.overrideDisplayFormat = this.DATE_FORMAT;
@@ -57,7 +57,6 @@ export class WidgetComponent implements AfterViewInit {
/**
* Emitted when a field value changes.
* @deprecated Used only to trigger visibility engine; components should do that internally if needed.
*/
@Output()
fieldChanged: EventEmitter<FormFieldModel> = new EventEmitter<FormFieldModel>();
@@ -96,12 +95,10 @@ export class WidgetComponent implements AfterViewInit {
this.fieldChanged.emit(this.field);
}
/** @deprecated used only to trigger visibility engine, components should do that internally if needed */
checkVisibility(field: FormFieldModel) {
this.fieldChanged.emit(field);
}
/** @deprecated used only to trigger visibility engine, components should do that internally if needed */
onFieldChanged(field: FormFieldModel) {
this.fieldChanged.emit(field);
}
@@ -18,7 +18,6 @@
import { TestBed } from '@angular/core/testing';
import { Response, ResponseOptions } from '@angular/http';
import { AlfrescoApiService } from '../../services/alfresco-api.service';
import { FormDefinitionModel } from '../models/form-definition.model';
import { formModelTabs, AlfrescoApiServiceMock } from '../../mock';
import { FormService } from './form.service';
import { setupTestBed } from '../../testing/setupTestBed';
@@ -359,25 +358,6 @@ describe('Form service', () => {
});
});
it('should add form fields to a form', (done) => {
let formId = 100;
let name = 'testName';
let data = [{ name: 'name' }, { name: 'email' }];
let formDefinitionModel = new FormDefinitionModel(formId.toString(), name, 'testUserName', '2016-09-05T14:41:19.049Z', data);
service.addFieldsToAForm(formId, formDefinitionModel).subscribe((result) => {
expect(jasmine.Ajax.requests.mostRecent().url.endsWith('/form-models/' + formId)).toBeTruthy();
expect(JSON.parse(jasmine.Ajax.requests.mostRecent().params).formRepresentation.name).toEqual(name);
done();
});
jasmine.Ajax.requests.mostRecent().respondWith({
'status': 200,
contentType: 'application/json',
responseText: JSON.stringify(simpleResponseBody)
});
});
it('should return list of people', (done) => {
spyOn(service, 'getUserProfileImageApi').and.returnValue('/app/rest/users/2002/picture');
let fakeFilter: string = 'whatever';
+3 -14
View File
@@ -129,7 +129,9 @@ export class FormService {
this.ecmModelService.searchEcmType(formName, EcmModelService.MODEL_NAME).subscribe(
(customType) => {
let formDefinitionModel = new FormDefinitionModel(form.id, form.name, form.lastUpdatedByFullName, form.lastUpdated, customType.entry.properties);
this.addFieldsToAForm(form.id, formDefinitionModel).subscribe((formData) => {
from(
this.editorApi.saveForm(form.id, formDefinitionModel)
).subscribe((formData) => {
observer.next(formData);
observer.complete();
}, (err) => this.handleError(err));
@@ -170,19 +172,6 @@ export class FormService {
);
}
/**
* Add Fields to a form
* @deprecated in 1.7.0, use saveForm API instead
* @param formId ID of the form
* @param formModel Form definition
*/
addFieldsToAForm(formId: number, formModel: FormDefinitionModel): Observable<any> {
this.logService.log('addFieldsToAForm is deprecated in 1.7.0, use saveForm API instead');
return from(
this.editorApi.saveForm(formId, formModel)
);
}
/**
* Searches for a form by name.
* @param name The form name to search for
@@ -90,7 +90,6 @@ describe('LoginComponent', () => {
});
function loginWithCredentials(username, password, providers: string = 'ECM') {
component.providers = providers;
usernameInput.value = username;
passwordInput.value = password;
@@ -116,6 +115,8 @@ describe('LoginComponent', () => {
});
it('should redirect to previous route state on successful login', () => {
appConfigService.config.providers = 'ECM';
spyOn(authService, 'login').and.returnValue(of({ type: 'type', ticket: 'ticket' }));
const redirect = '/home';
component.successRoute = redirect;
@@ -393,7 +394,6 @@ describe('LoginComponent', () => {
it('should return success event after the login have succeeded', (done) => {
spyOn(authService, 'login').and.returnValue(of({ type: 'type', ticket: 'ticket' }));
component.providers = 'ECM';
expect(component.isError).toBe(false);
component.success.subscribe(() => {
@@ -409,7 +409,6 @@ describe('LoginComponent', () => {
});
it('should return error with a wrong username', (done) => {
component.providers = 'ECM';
component.error.subscribe(() => {
fixture.detectChanges();
@@ -424,8 +423,6 @@ describe('LoginComponent', () => {
});
it('should return error with a wrong password', (done) => {
component.providers = 'ECM';
component.error.subscribe(() => {
fixture.detectChanges();
fixture.whenStable().then(() => {
@@ -440,8 +437,6 @@ describe('LoginComponent', () => {
});
it('should return error with a wrong username and password', (done) => {
component.providers = 'ECM';
component.error.subscribe(() => {
fixture.detectChanges();
fixture.whenStable().then(() => {
@@ -462,7 +457,6 @@ describe('LoginComponent', () => {
message: 'ERROR: the network is offline, Origin is not allowed by Access-Control-Allow-Origin'
}
}));
component.providers = 'ECM';
component.error.subscribe(() => {
fixture.detectChanges();
@@ -480,7 +474,6 @@ describe('LoginComponent', () => {
it('should return CSRF error when server CSRF error occurs', async(() => {
spyOn(authService, 'login')
.and.returnValue(throwError({ message: 'ERROR: Invalid CSRF-token', status: 403 }));
component.providers = 'ECM';
component.error.subscribe(() => {
fixture.detectChanges();
@@ -502,7 +495,6 @@ describe('LoginComponent', () => {
status: 403
}
));
component.providers = 'ECM';
component.error.subscribe(() => {
fixture.detectChanges();
@@ -516,8 +508,6 @@ describe('LoginComponent', () => {
}));
it('should emit success event after the login has succeeded and discard password', async(() => {
component.providers = 'ECM';
component.success.subscribe((event) => {
fixture.detectChanges();
@@ -532,7 +522,6 @@ describe('LoginComponent', () => {
it('should emit error event after the login has failed', async(() => {
spyOn(authService, 'login').and.returnValue(throwError('Fake server error'));
component.providers = 'ECM';
component.error.subscribe((error) => {
fixture.detectChanges();
+2 -23
View File
@@ -25,7 +25,6 @@ import { AuthenticationService } from '../../services/authentication.service';
import { LogService } from '../../services/log.service';
import { TranslationService } from '../../services/translation.service';
import { UserPreferencesService } from '../../services/user-preferences.service';
import { SettingsService } from '../../services/settings.service';
import { LoginErrorEvent } from '../models/login-error.event';
import { LoginSubmitEvent } from '../models/login-submit.event';
@@ -91,24 +90,10 @@ export class LoginComponent implements OnInit {
@Input()
copyrightText: string = '\u00A9 2016 Alfresco Software, Inc. All Rights Reserved.';
/**
* Possible valid values are ECM, BPM or ALL.
* @deprecated 3.0.0 - use the providers property in the the app.config.json
*/
@Input()
providers: string;
/** Custom validation rules for the login form. */
@Input()
fieldsValidation: any;
/**
* Prevents the CSRF Token from being submitted. Only valid for Alfresco Process Services.
* @deprecated 3.0.0
*/
@Input()
disableCsrf: boolean;
/** Route to redirect to on successful login. */
@Input()
successRoute: string = null;
@@ -154,8 +139,7 @@ export class LoginComponent implements OnInit {
private logService: LogService,
private router: Router,
private appConfig: AppConfigService,
private userPreferences: UserPreferencesService,
private settingsService: SettingsService
private userPreferences: UserPreferencesService
) {
this.initFormError();
this.initFormFieldsMessages();
@@ -188,9 +172,6 @@ export class LoginComponent implements OnInit {
* @param event
*/
onSubmit(values: any) {
this.settingsService.setProviders(this.providers);
this.settingsService.csrfDisabled = this.disableCsrf;
this.disableError();
const args = new LoginSubmitEvent({
controls: { username: this.form.controls.username }
@@ -242,9 +223,7 @@ export class LoginComponent implements OnInit {
.login(values.username, values.password, this.rememberMe)
.subscribe(
(token: any) => {
const redirectUrl = this.authService.getRedirect(
this.providers
);
const redirectUrl = this.authService.getRedirect();
this.actualLoginStep = LoginSteps.Welcome;
this.userPreferences.setStoragePrefix(values.username);
-41
View File
@@ -1,41 +0,0 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { CommentRepresentation, LightUserRepresentation } from '@alfresco/js-api';
/**
* @deprecated
* CommentProcessModel
* (this model is deprecated in 2.3.0 in favour of CommentModel and will be removed in future revisions)
*/
export class CommentProcessModel implements CommentRepresentation {
id: number;
message: string;
created: Date;
createdBy: LightUserRepresentation;
isSelected: boolean;
constructor(obj?: any) {
if (obj) {
this.id = obj.id;
this.message = obj.message;
this.created = obj.created;
this.createdBy = obj.createdBy;
this.isSelected = obj.isSelected ? obj.isSelected : false;
}
}
}
-1
View File
@@ -22,6 +22,5 @@ export * from './user-process.model';
export * from './comment.model';
export * from './ecm-company.model';
export * from './redirection.model';
export * from './comment-process.model';
export * from './pagination.model';
export * from './oauth-config.model';
@@ -1,4 +1,5 @@
<div *ngIf="pagination?.hasMoreItems || isLoading" class="adf-infinite-pagination">
isLoading : {{isLoading}}
<button mat-button
*ngIf="!isLoading"
class="adf-infinite-pagination-load-more"
@@ -23,6 +23,33 @@ import { PaginatedComponent } from './paginated-component.interface';
import { BehaviorSubject } from 'rxjs';
import { setupTestBed } from '../testing/setupTestBed';
import { CoreTestingModule } from '../testing/core.testing.module';
import { Component } from '@angular/core';
import { PaginationModel } from '../models/pagination.model';
@Component({
template: ``
})
class TestPaginatedComponent implements PaginatedComponent {
private _pagination: BehaviorSubject<PaginationModel>;
get pagination(): BehaviorSubject<PaginationModel> {
if (!this._pagination) {
let defaultPagination = <PaginationModel> {
maxItems: 10,
skipCount: 0,
totalItems: 0,
hasMoreItems: false
};
this._pagination = new BehaviorSubject<PaginationModel>(defaultPagination);
}
return this._pagination;
}
updatePagination(pagination: PaginationModel) {
this.pagination.next(pagination);
}
}
describe('InfinitePaginationComponent', () => {
@@ -31,13 +58,17 @@ describe('InfinitePaginationComponent', () => {
let pagination: Pagination;
setupTestBed({
imports: [CoreTestingModule]
imports: [CoreTestingModule],
declarations: [
TestPaginatedComponent
]
});
beforeEach(() => {
fixture = TestBed.createComponent(InfinitePaginationComponent);
component = fixture.componentInstance;
component.target = TestBed.createComponent(TestPaginatedComponent).componentInstance;
pagination = {
skipCount: 0,
hasMoreItems: false
@@ -48,12 +79,12 @@ describe('InfinitePaginationComponent', () => {
fixture.destroy();
});
describe('Standalone', () => {
describe('View', () => {
it('should show the loading spinner if loading', () => {
pagination.hasMoreItems = true;
component.pagination = pagination;
component.isLoading = true;
component.target = null;
fixture.detectChanges();
let loadingSpinner = fixture.debugElement.query(By.css('[data-automation-id="adf-infinite-pagination-spinner"]'));
@@ -62,7 +93,7 @@ describe('InfinitePaginationComponent', () => {
it('should NOT show the loading spinner if NOT loading', () => {
pagination.hasMoreItems = true;
component.pagination = pagination;
component.target.updatePagination(pagination);
component.isLoading = false;
fixture.detectChanges();
@@ -72,7 +103,7 @@ describe('InfinitePaginationComponent', () => {
it('should show the load more button if NOT loading and has more items', () => {
pagination.hasMoreItems = true;
component.pagination = pagination;
component.target.updatePagination(pagination);
component.isLoading = false;
fixture.detectChanges();
@@ -82,7 +113,7 @@ describe('InfinitePaginationComponent', () => {
it('should NOT show anything if pagination has NO more items', () => {
pagination.hasMoreItems = false;
component.pagination = pagination;
component.target.updatePagination(pagination);
fixture.detectChanges();
let loadMoreButton = fixture.debugElement.query(By.css('[data-automation-id="adf-infinite-pagination-button"]'));
@@ -94,7 +125,7 @@ describe('InfinitePaginationComponent', () => {
it('should trigger the loadMore event with the proper pagination object', (done) => {
pagination.hasMoreItems = true;
pagination.skipCount = 5;
component.pagination = pagination;
component.target.updatePagination(pagination);
component.isLoading = false;
component.pageSize = 5;
fixture.detectChanges();
@@ -111,22 +142,16 @@ describe('InfinitePaginationComponent', () => {
describe('Target', () => {
let testTarget: PaginatedComponent;
let spyTarget;
beforeEach(() => {
pagination = { maxItems: 444, skipCount: 0, totalItems: 888, hasMoreItems: true };
testTarget = {
pagination: new BehaviorSubject<Pagination>(pagination),
supportedPageSizes: [],
updatePagination() {}
};
spyOn(testTarget, 'updatePagination');
spyTarget = spyOn(component.target, 'updatePagination').and.callThrough();
});
it('should subscribe to target\'s pagination observable to update pagination and pagesize correctly', () => {
component.target = testTarget;
component.target.updatePagination(pagination);
fixture.detectChanges();
expect(component.pagination).toBe(pagination);
@@ -134,32 +159,44 @@ describe('InfinitePaginationComponent', () => {
});
it('should call the target\'s updatePagination on invoking the onLoadMore', () => {
component.target = testTarget;
component.target.updatePagination(pagination);
fixture.detectChanges();
component.onLoadMore();
expect(testTarget.updatePagination).toHaveBeenCalledWith({ maxItems: 444 + 25, skipCount: 0, totalItems: 888, hasMoreItems: true, merge: true });
expect(spyTarget).toHaveBeenCalledWith({
maxItems: 444 + 25,
skipCount: 0,
totalItems: 888,
hasMoreItems: true,
merge: true
});
});
it('should call the target\'s updatePagination on invoking the onLoadMore with a specific pageSize', () => {
component.target = testTarget;
component.pageSize = 7;
component.target.updatePagination(pagination);
fixture.detectChanges();
component.onLoadMore();
expect(testTarget.updatePagination).toHaveBeenCalledWith({ maxItems: 444 + component.pageSize, skipCount: 0, totalItems: 888, hasMoreItems: true, merge: true });
expect(spyTarget).toHaveBeenCalledWith({
maxItems: 444 + component.pageSize,
skipCount: 0,
totalItems: 888,
hasMoreItems: true,
merge: true
});
});
it('should unsubscribe from the target\'s pagination on onDestroy', () => {
component.target = testTarget;
fixture.detectChanges();
fixture.destroy();
const emitNewPaginationEvent = () => {
let newPagination = { maxItems: 1, skipCount: 0, totalItems: 2, hasMoreItems: true };
testTarget.pagination.next(newPagination);
component.target.pagination.next(newPagination);
};
expect(emitNewPaginationEvent).not.toThrow();
@@ -39,24 +39,12 @@ import { UserPreferencesService } from '../services/user-preferences.service';
})
export class InfinitePaginationComponent implements OnInit, OnDestroy, PaginationComponentInterface {
/**
* @deprecated 3.0.0 - uses paginationSize's default in UserPreferencesService
*/
static DEFAULT_PAGE_SIZE: number = 25;
static DEFAULT_PAGINATION: PaginationModel = {
skipCount: 0,
hasMoreItems: false,
merge: true
};
/**
* Pagination object.
* @deprecated 2.3.0
*/
@Input()
pagination: PaginationModel;
/** Component that provides custom pagination support. */
@Input()
target: PaginatedComponent;
@@ -73,6 +61,8 @@ export class InfinitePaginationComponent implements OnInit, OnDestroy, Paginatio
@Output()
loadMore: EventEmitter<PaginationModel> = new EventEmitter<PaginationModel>();
pagination: PaginationModel;
private paginationSubscription: Subscription;
constructor(private cdr: ChangeDetectorRef, private userPreferencesService: UserPreferencesService) {
@@ -20,10 +20,5 @@ import { BehaviorSubject } from 'rxjs';
export interface PaginatedComponent {
pagination: BehaviorSubject<PaginationModel>;
/**
* @deprecated 2.3.0 : the supported page size should be retrieved via the user preferences
* and given to the pagination component, and not retrieved by the paginated object
*/
supportedPageSizes?: number[];
updatePagination(pagination: PaginationModel);
}
+2 -19
View File
@@ -50,10 +50,6 @@ export class AlfrescoApiService {
return this.getInstance().activiti.taskApi;
}
// get modelsApi(): Core.ModelsApi {
// return this.getInstance().activiti.modelsApi;
// }
get contentApi(): ContentApi {
return this.getInstance().content;
}
@@ -120,13 +116,13 @@ export class AlfrescoApiService {
}
const config = {
provider: this.getProvider(),
provider: this.appConfig.get<string>(AppConfigValues.PROVIDERS),
hostEcm: this.appConfig.get<string>(AppConfigValues.ECMHOST),
hostBpm: this.appConfig.get<string>(AppConfigValues.BPMHOST),
authType: this.appConfig.get<string>(AppConfigValues.AUTHTYPE, 'BASIC'),
contextRootBpm: this.appConfig.get<string>(AppConfigValues.CONTEXTROOTBPM),
contextRoot: this.appConfig.get<string>(AppConfigValues.CONTEXTROOTECM),
disableCsrf: this.getDisableCSRF(),
disableCsrf: this.appConfig.get<boolean>(AppConfigValues.DISABLECSRF),
oauth2: oauth
};
@@ -137,17 +133,4 @@ export class AlfrescoApiService {
}
}
// @deprecated 3.0.0 get only from app config
private getDisableCSRF(): boolean {
if (this.storage.getItem(AppConfigValues.DISABLECSRF) === 'true') {
return true;
} else {
return this.appConfig.get<boolean>(AppConfigValues.DISABLECSRF);
}
}
// @deprecated 3.0.0 get only from app config
private getProvider() {
return this.storage.getItem(AppConfigValues.PROVIDERS) || this.appConfig.get<string>(AppConfigValues.PROVIDERS);
}
}
@@ -40,6 +40,8 @@ describe('AuthGuardService BPM', () => {
authGuard = TestBed.get(AuthGuardBpm);
routerService = TestBed.get(Router);
appConfigService = TestBed.get(AppConfigService);
appConfigService.config.providers = 'BPM';
});
it('if the alfresco js api is logged in should canActivate be true', async(() => {
@@ -78,7 +80,7 @@ describe('AuthGuardService BPM', () => {
expect(authService.setRedirect).toHaveBeenCalledWith({
provider: 'BPM', url: 'some-url'
});
expect(authService.getRedirect('BPM')).toEqual('some-url');
expect(authService.getRedirect()).toEqual('some-url');
}));
it('should set redirect navigation commands with query params', async(() => {
@@ -91,7 +93,7 @@ describe('AuthGuardService BPM', () => {
expect(authService.setRedirect).toHaveBeenCalledWith({
provider: 'BPM', url: 'some-url;q=123'
});
expect(authService.getRedirect('BPM')).toEqual('some-url;q=123');
expect(authService.getRedirect()).toEqual('some-url;q=123');
}));
it('should set redirect navigation commands with query params', async(() => {
@@ -104,7 +106,7 @@ describe('AuthGuardService BPM', () => {
expect(authService.setRedirect).toHaveBeenCalledWith({
provider: 'BPM', url: '/'
});
expect(authService.getRedirect('BPM')).toEqual('/');
expect(authService.getRedirect()).toEqual('/');
}));
it('should get redirect url from config if there is one configured', async(() => {
@@ -40,6 +40,8 @@ describe('AuthGuardService ECM', () => {
authGuard = TestBed.get(AuthGuardEcm);
routerService = TestBed.get(Router);
appConfigService = TestBed.get(AppConfigService);
appConfigService.config.providers = 'ECM';
});
it('if the alfresco js api is logged in should canActivate be true', async(() => {
@@ -78,7 +80,7 @@ describe('AuthGuardService ECM', () => {
expect(authService.setRedirect).toHaveBeenCalledWith({
provider: 'ECM', url: 'some-url'
});
expect(authService.getRedirect('ECM')).toEqual('some-url');
expect(authService.getRedirect()).toEqual('some-url');
}));
it('should set redirect navigation commands with query params', async(() => {
@@ -91,7 +93,7 @@ describe('AuthGuardService ECM', () => {
expect(authService.setRedirect).toHaveBeenCalledWith({
provider: 'ECM', url: 'some-url;q=123'
});
expect(authService.getRedirect('ECM')).toEqual('some-url;q=123');
expect(authService.getRedirect()).toEqual('some-url;q=123');
}));
it('should set redirect navigation commands with query params', async(() => {
@@ -104,7 +106,7 @@ describe('AuthGuardService ECM', () => {
expect(authService.setRedirect).toHaveBeenCalledWith({
provider: 'ECM', url: '/'
});
expect(authService.getRedirect('ECM')).toEqual('/');
expect(authService.getRedirect()).toEqual('/');
}));
it('should get redirect url from config if there is one configured', async(() => {
@@ -144,19 +144,19 @@ describe('AuthenticationService', () => {
it('[ECM] should set/get redirectUrl when provider is ECM', () => {
authService.setRedirect({ provider: 'ECM', url: 'some-url' });
expect(authService.getRedirect(appConfigService.config.providers)).toEqual('some-url');
expect(authService.getRedirect()).toEqual('some-url');
});
it('[ECM] should set/get redirectUrl when provider is BPM', () => {
authService.setRedirect({ provider: 'BPM', url: 'some-url' });
expect(authService.getRedirect(appConfigService.config.providers)).toBeNull();
expect(authService.getRedirect()).toBeNull();
});
it('[ECM] should return null as redirectUrl when redirectUrl field is not set', () => {
authService.setRedirect(null);
expect(authService.getRedirect(appConfigService.config.providers)).toBeNull();
expect(authService.getRedirect()).toBeNull();
});
it('[ECM] should return isECMProvider true', () => {
@@ -260,19 +260,19 @@ describe('AuthenticationService', () => {
it('[BPM] should set/get redirectUrl when provider is BPM', () => {
authService.setRedirect({ provider: 'BPM', url: 'some-url' });
expect(authService.getRedirect(appConfigService.config.providers)).toEqual('some-url');
expect(authService.getRedirect()).toEqual('some-url');
});
it('[BPM] should set/get redirectUrl when provider is ECM', () => {
authService.setRedirect({ provider: 'ECM', url: 'some-url' });
expect(authService.getRedirect(appConfigService.config.providers)).toBeNull();
expect(authService.getRedirect()).toBeNull();
});
it('[BPM] should return null as redirectUrl when redirectUrl field is not set', () => {
authService.setRedirect(null);
expect(authService.getRedirect(appConfigService.config.providers)).toBeNull();
expect(authService.getRedirect()).toBeNull();
});
it('[BPM] should return isECMProvider false', () => {
@@ -469,25 +469,25 @@ describe('AuthenticationService', () => {
it('[ALL] should set/get redirectUrl when provider is ALL', () => {
authService.setRedirect({ provider: 'ALL', url: 'some-url' });
expect(authService.getRedirect(appConfigService.config.providers)).toEqual('some-url');
expect(authService.getRedirect()).toEqual('some-url');
});
it('[ALL] should set/get redirectUrl when provider is BPM', () => {
authService.setRedirect({ provider: 'BPM', url: 'some-url' });
expect(authService.getRedirect(appConfigService.config.providers)).toEqual('some-url');
expect(authService.getRedirect()).toEqual('some-url');
});
it('[ALL] should set/get redirectUrl when provider is ECM', () => {
authService.setRedirect({ provider: 'ECM', url: 'some-url' });
expect(authService.getRedirect(appConfigService.config.providers)).toEqual('some-url');
expect(authService.getRedirect()).toEqual('some-url');
});
it('[ALL] should return null as redirectUrl when redirectUrl field is not set', () => {
authService.setRedirect(null);
expect(authService.getRedirect(appConfigService.config.providers)).toBeNull();
expect(authService.getRedirect()).toBeNull();
});
it('[ALL] should return isECMProvider false', () => {
+2 -2
View File
@@ -244,10 +244,10 @@ export class AuthenticationService {
}
/** Gets the URL to redirect to after login.
* @param provider Service provider. Can be "ECM", "BPM" or "ALL".
* @returns The redirect URL
*/
getRedirect(provider: string): string {
getRedirect(): string {
let provider = <string> this.appConfig.get(AppConfigValues.PROVIDERS);
return this.hasValidRedirection(provider) ? this.redirectUrl.url : null;
}
+2 -8
View File
@@ -18,7 +18,6 @@
import { TestBed } from '@angular/core/testing';
import { CookieServiceMock } from '../mock/cookie.service.mock';
import { ContentService } from './content.service';
import { SettingsService } from './settings.service';
import { AppConfigService } from '../app-config/app-config.service';
import { AuthenticationService } from './authentication.service';
import { CookieService } from './cookie.service';
@@ -37,7 +36,6 @@ describe('ContentService', () => {
let contentService: ContentService;
let authService: AuthenticationService;
let settingsService: SettingsService;
let storage: StorageService;
let node: any;
@@ -56,7 +54,6 @@ describe('ContentService', () => {
beforeEach(() => {
authService = TestBed.get(AuthenticationService);
settingsService = TestBed.get(SettingsService);
contentService = TestBed.get(ContentService);
storage = TestBed.get(StorageService);
storage.clear();
@@ -71,7 +68,8 @@ describe('ContentService', () => {
let appConfig: AppConfigService = TestBed.get(AppConfigService);
appConfig.config = {
ecmHost: 'http://localhost:9876/ecm'
ecmHost: 'http://localhost:9876/ecm',
provider: 'ECM'
};
});
@@ -79,10 +77,6 @@ describe('ContentService', () => {
jasmine.Ajax.uninstall();
});
beforeEach(() => {
settingsService.setProviders('ECM');
});
it('should return a valid content URL', (done) => {
authService.login('fake-username', 'fake-password').subscribe(() => {
expect(contentService.getContentUrl(node)).toBe('http://localhost:9876/ecm/alfresco/api/' +
-1
View File
@@ -17,7 +17,6 @@
export * from './authentication.service';
export * from './alfresco-api.service';
export * from './settings.service';
export * from './content.service';
export * from './auth-guard.service';
export * from './auth-guard-ecm.service';
-8
View File
@@ -51,7 +51,6 @@ export class RenditionsService {
);
}
/** @deprecated */
isRenditionAvailable(nodeId: string, encoding: string): Observable<boolean> {
return new Observable((observer) => {
this.getRendition(nodeId, encoding).subscribe(
@@ -71,7 +70,6 @@ export class RenditionsService {
});
}
/** @deprecated */
isConversionPossible(nodeId: string, encoding: string): Observable<boolean> {
return new Observable((observer) => {
this.getRendition(nodeId, encoding).subscribe(
@@ -87,27 +85,22 @@ export class RenditionsService {
});
}
/** @deprecated */
getRenditionUrl(nodeId: string, encoding: string): string {
return this.apiService.contentApi.getRenditionUrl(nodeId, encoding);
}
/** @deprecated */
getRendition(nodeId: string, encoding: string): Observable<RenditionEntry> {
return from(this.apiService.renditionsApi.getRendition(nodeId, encoding));
}
/** @deprecated */
getRenditionsListByNodeId(nodeId: string): Observable<RenditionPaging> {
return from(this.apiService.renditionsApi.getRenditions(nodeId));
}
/** @deprecated */
createRendition(nodeId: string, encoding: string): Observable<{}> {
return from(this.apiService.renditionsApi.createRendition(nodeId, { id: encoding }));
}
/** @deprecated */
convert(nodeId: string, encoding: string, pollingInterval: number = 1000, retries: number = 5) {
return this.createRendition(nodeId, encoding)
.pipe(
@@ -115,7 +108,6 @@ export class RenditionsService {
);
}
/** @deprecated */
private pollRendition(nodeId: string, encoding: string, intervalSize: number = 1000, retries: number = 5) {
let attempts = 0;
return interval(intervalSize)
@@ -1,38 +0,0 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { TestBed } from '@angular/core/testing';
import { SettingsService } from './settings.service';
import { setupTestBed } from '../testing/setupTestBed';
import { CoreTestingModule } from '../testing/core.testing.module';
describe('SettingsService', () => {
let service: SettingsService;
setupTestBed({
imports: [CoreTestingModule]
});
beforeEach(() => {
service = TestBed.get(SettingsService);
});
it('should be exposed by the module', () => {
expect(service).toBeDefined();
});
});
-82
View File
@@ -1,82 +0,0 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Injectable } from '@angular/core';
import { AppConfigService, AppConfigValues } from '../app-config/app-config.service';
import { LogService } from './log.service';
import { StorageService } from './storage.service';
@Injectable({
providedIn: 'root'
})
export class SettingsService {
constructor(private appConfig: AppConfigService,
private logService: LogService,
private storage: StorageService) {
}
/** @deprecated in 1.6.0 */
public get ecmHost(): string {
this.logService.log('SettingsService.ecmHost is deprecated. Use AppConfigService instead.');
return this.appConfig.get<string>(AppConfigValues.ECMHOST);
}
/** @deprecated in 1.7.0 */
public set csrfDisabled(csrfDisabled: boolean) {
this.logService.log(`SettingsService.csrfDisabled is deprecated. Use UserPreferencesService.disableCSRF instead.`);
if (csrfDisabled !== null && csrfDisabled !== undefined) {
this.storage.setItem(AppConfigValues.DISABLECSRF, csrfDisabled.toString());
}
}
/** @deprecated in 1.6.0 */
public set ecmHost(ecmHostUrl: string) {
this.logService.log('SettingsService.ecmHost is deprecated. Use AppConfigService instead.');
}
/** @deprecated in 1.6.0 */
public get bpmHost(): string {
this.logService.log('SettingsService.bpmHost is deprecated. Use AppConfigService instead.');
return this.appConfig.get<string>(AppConfigValues.BPMHOST);
}
/** @deprecated in 1.6.0 */
public set bpmHost(bpmHostUrl: string) {
this.logService.log('SettingsService.bpmHost is deprecated. Use AppConfigService instead.');
}
/** @deprecated in 1.6.0 */
public getBPMApiBaseUrl(): string {
this.logService.log('SettingsService.getBPMApiBaseUrl is deprecated.');
return this.bpmHost + '/activiti-app';
}
/** @deprecated in 1.7.0 */
public getProviders(): string {
this.logService.log(`SettingsService.getProviders is deprecated. Use UserPreferencesService.authType instead.`);
return this.storage.getItem(AppConfigValues.PROVIDERS) || this.appConfig.get<string>(AppConfigValues.PROVIDERS);
}
/** @deprecated in 1.7.0 */
public setProviders(providers: string) {
this.logService.log(`SettingsService.setProviders is deprecated. Use the app-config.json`);
if (providers) {
this.storage.setItem(AppConfigValues.PROVIDERS, providers);
}
}
}
+4 -5
View File
@@ -19,7 +19,7 @@ import { Inject, Injectable, InjectionToken, Optional } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Observable } from 'rxjs';
import { TranslateLoaderService } from './translate-loader.service';
import { UserPreferencesService } from './user-preferences.service';
import { UserPreferencesService, UserPreferenceValues } from './user-preferences.service';
export const TRANSLATION_PROVIDER = new InjectionToken('Injection token for translation providers.');
@@ -37,7 +37,7 @@ export class TranslationService {
customLoader: TranslateLoaderService;
constructor(public translate: TranslateService,
userPreference: UserPreferencesService,
userPreferencesService: UserPreferencesService,
@Optional() @Inject(TRANSLATION_PROVIDER) providers: TranslationProvider[]) {
this.customLoader = <TranslateLoaderService> this.translate.currentLoader;
@@ -51,10 +51,9 @@ export class TranslationService {
}
}
userPreference.locale$.subscribe((locale) => {
userPreferencesService.select(UserPreferenceValues.Locale).subscribe((locale) => {
this.userLang = locale;
this.use(this.userLang);
});
this.use(this.userLang); });
}
/**
+2 -2
View File
@@ -103,7 +103,7 @@ export class UploadService {
/**
* Finds all the files in the queue that are not yet uploaded and uploads them into the directory folder.
* @param emitter (Deprecated) Emitter to invoke on file status change
* @param emitter Emitter to invoke on file status change
*/
uploadFilesInTheQueue(emitter?: EventEmitter<any>): void {
if (!this.activeTask) {
@@ -197,7 +197,7 @@ export class UploadService {
}
}
private beginUpload(file: FileModel, /* @deprecated */emitter: EventEmitter<any>): any {
private beginUpload(file: FileModel, emitter: EventEmitter<any>): any {
let promise = this.getUploadPromise(file);
+1 -12
View File
@@ -40,13 +40,6 @@ export class UserPreferencesService {
};
private userPreferenceStatus: any = this.defaults;
/**
* @deprecated we are grouping every value changed on the user preference in a single stream : userPreferenceValue$
*/
locale$: Observable<string>;
private localeSubject: BehaviorSubject<string>;
private onChangeSubject: BehaviorSubject<any>;
onChange: Observable<any>;
@@ -54,8 +47,6 @@ export class UserPreferencesService {
private appConfig: AppConfigService,
private storage: StorageService) {
this.appConfig.onLoad.subscribe(this.initUserPreferenceStatus.bind(this));
this.localeSubject = new BehaviorSubject(this.get(UserPreferenceValues.Locale, this.getDefaultLocale()));
this.locale$ = this.localeSubject.asObservable();
this.onChangeSubject = new BehaviorSubject(this.userPreferenceStatus);
this.onChange = this.onChangeSubject.asObservable();
}
@@ -169,12 +160,10 @@ export class UserPreferencesService {
/** Current locale setting. */
get locale(): string {
const locale = this.get(UserPreferenceValues.Locale, this.userPreferenceStatus[UserPreferenceValues.Locale]);
return locale;
return this.get(UserPreferenceValues.Locale, this.userPreferenceStatus[UserPreferenceValues.Locale]);
}
set locale(value: string) {
this.localeSubject.next(value);
this.set(UserPreferenceValues.Locale, value);
}
@@ -50,12 +50,6 @@ export class HostSettingsComponent implements OnInit {
@Output()
error = new EventEmitter<string>();
/** Emitted when the ecm host URL is changed.
* @deprecated in 2.4.0
*/
@Output()
ecmHostChange = new EventEmitter<string>();
/** Emitted when the user cancels the changes. */
@Output()
cancel = new EventEmitter<boolean>();
@@ -64,12 +58,6 @@ export class HostSettingsComponent implements OnInit {
@Output()
success = new EventEmitter<boolean>();
/** Emitted when the bpm host URL is changed.
* @deprecated in 2.4.0
*/
@Output()
bpmHostChange = new EventEmitter<string>();
constructor(private formBuilder: FormBuilder,
private storageService: StorageService,
private alfrescoApiService: AlfrescoApiService,
@@ -114,14 +114,14 @@
</mat-menu>
</ng-container>
<ng-container *ngIf="allowSidebar">
<ng-container *ngIf="allowRightSidebar">
<adf-toolbar-divider></adf-toolbar-divider>
<button
mat-icon-button
title="{{ 'ADF_VIEWER.ACTIONS.INFO' | translate }}"
data-automation-id="adf-toolbar-sidebar"
[color]="showSidebar ? 'accent' : 'default'"
[color]="showRightSidebar ? 'accent' : 'default'"
(click)="toggleSidebar()">
<mat-icon>info_outline</mat-icon>
</button>
@@ -132,12 +132,12 @@
</ng-container>
<div fxLayout="row" fxFlex="1 1 auto">
<ng-container *ngIf="allowSidebar && showSidebar">
<ng-container *ngIf="allowRightSidebar && showRightSidebar">
<div class="adf-viewer__sidebar" [ngClass]="'adf-viewer__sidebar__right'" fxFlexOrder="4" id="adf-right-sidebar" >
<ng-container *ngIf="sidebarTemplate">
<ng-container *ngTemplateOutlet="sidebarTemplate;context:sidebarTemplateContext"></ng-container>
<ng-container *ngIf="sidebarRightTemplate">
<ng-container *ngTemplateOutlet="sidebarRightTemplate;context:sidebarRightTemplateContext"></ng-container>
</ng-container>
<ng-content *ngIf="!sidebarTemplate" select="adf-viewer-sidebar"></ng-content>
<ng-content *ngIf="!sidebarRightTemplate" select="adf-viewer-sidebar"></ng-content>
</div>
</ng-container>
@@ -150,7 +150,7 @@
</div>
</ng-container>
<div *ngIf="isLoading" class="adf-viewer-main" fxFlexOrder="{{sidebarPosition !== 'left'? 1 : 4}}" fxFlex="1 1 auto">
<div *ngIf="isLoading" class="adf-viewer-main" fxFlexOrder="1" fxFlex="1 1 auto">
<div class="adf-viewer-layout-content adf-viewer__fullscreen-container">
<div class="adf-viewer-content-container">
<ng-container *ngIf="isLoading">
@@ -166,7 +166,7 @@
</div>
</div>
<div *ngIf="!isLoading" class="adf-viewer-main" fxFlexOrder="{{sidebarPosition !== 'left'? 1 : 4}}" fxFlex="1 1 auto">
<div *ngIf="!isLoading" class="adf-viewer-main" fxFlexOrder="1" fxFlex="1 1 auto">
<div class="adf-viewer-layout-content adf-viewer__fullscreen-container">
<div class="adf-viewer-content-container" [ngSwitch]="viewerType">
<ng-container *ngSwitchCase="'pdf'">
@@ -467,8 +467,8 @@ describe('ViewerComponent', () => {
describe('SideBar Test', () => {
it('should NOT display sidebar if is not allowed', (done) => {
component.showSidebar = true;
component.allowSidebar = false;
component.showRightSidebar = true;
component.allowRightSidebar = false;
fixture.detectChanges();
fixture.whenStable().then(() => {
@@ -479,8 +479,8 @@ describe('ViewerComponent', () => {
});
it('should display sidebar on the right side', (done) => {
component.allowSidebar = true;
component.showSidebar = true;
component.allowRightSidebar = true;
component.showRightSidebar = true;
fixture.detectChanges();
fixture.whenStable().then(() => {
+13 -28
View File
@@ -129,40 +129,25 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
@Input()
allowLeftSidebar = false;
/** Allow the right sidebar.
* @deprecated 2.5.0 - will be renamed allowRightSidebar in 3.0.0
*/
/** Allow the right sidebar. */
@Input()
allowSidebar = false;
allowRightSidebar = false;
/** Toggles PDF thumbnails. */
@Input()
allowThumbnails = true;
/**
* Toggles sidebar visibility. Requires `allowSidebar` to be set to `true`.
* @deprecated 2.5.0 - will be renamed showRightSidebar in 3.0.0
*/
/** Toggles right sidebar visibility. Requires `allowRightSidebar` to be set to `true`. */
@Input()
showSidebar = false;
showRightSidebar = false;
/** Toggles left sidebar visibility. Requires `allowSidebar` to be set to `true`. */
/** Toggles left sidebar visibility. Requires `allowLeftSidebar` to be set to `true`. */
@Input()
showLeftSidebar = false;
/**
* The position of the sidebar. Can be `left` or `right`.
* @deprecated 2.5.0 use sidebarTemplateLeft
*/
/** The template for the right sidebar. The template context contains the loaded node data. */
@Input()
sidebarPosition = 'right';
/**
* The template for the sidebar. The template context contains the loaded node data.
* @deprecated 2.5.0 renamed as sidebarRight
*/
@Input()
sidebarTemplate: TemplateRef<any> = null;
sidebarRightTemplate: TemplateRef<any> = null;
/** The template for the left sidebar. The template context contains the loaded node data. */
@Input()
@@ -223,7 +208,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
urlFileContent: string;
otherMenu: any;
extension: string;
sidebarTemplateContext: { node: Node } = { node: null };
sidebarRightTemplateContext: { node: Node } = { node: null };
sidebarLeftTemplateContext: { node: Node } = { node: null };
fileTitle: string;
@@ -376,7 +361,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
}
this.extensionChange.emit(this.extension);
this.sidebarTemplateContext.node = data;
this.sidebarRightTemplateContext.node = data;
this.sidebarLeftTemplateContext.node = data;
this.scrollTop();
@@ -404,18 +389,18 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
}
toggleSidebar() {
this.showSidebar = !this.showSidebar;
if (this.showSidebar && this.nodeId) {
this.showRightSidebar = !this.showRightSidebar;
if (this.showRightSidebar && this.nodeId) {
this.apiService.getInstance().nodes.getNode(this.nodeId, { include: ['allowableOperations'] })
.then((nodeEntry: NodeEntry) => {
this.sidebarTemplateContext.node = nodeEntry.entry;
this.sidebarRightTemplateContext.node = nodeEntry.entry;
});
}
}
toggleLeftSidebar() {
this.showLeftSidebar = !this.showLeftSidebar;
if (this.showSidebar && this.nodeId) {
if (this.showRightSidebar && this.nodeId) {
this.apiService.getInstance().nodes.getNode(this.nodeId, { include: ['allowableOperations'] })
.then((nodeEntry: NodeEntry) => {
this.sidebarLeftTemplateContext.node = nodeEntry.entry;