[no issue number] fix unsubscribing in documentlist (#2740)

* fix unsubscribing in documentlist

* fix tslint errors
This commit is contained in:
Eugenio Romano 2017-11-27 17:51:18 +00:00 committed by GitHub
parent 6843a6adfd
commit 9b7e018f93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 180 additions and 148 deletions

View File

@ -43,7 +43,11 @@
"input": "../node_modules/@alfresco/adf-content-services/bundles/assets",
"output": "./assets/"
},
{ "glob": "pdf.worker.js", "input": "../node_modules/pdfjs-dist/build", "output": "./" }
{
"glob": "pdf.worker.js",
"input": "../node_modules/pdfjs-dist/build",
"output": "./"
}
],
"index": "index.html",
"main": "main.ts",
@ -126,7 +130,11 @@
"input": "../../lib/insights/i18n",
"output": "./assets/adf-insights/i18n"
},
{ "glob": "pdf.worker.js", "input": "../node_modules/pdfjs-dist/build", "output": "./" }
{
"glob": "pdf.worker.js",
"input": "../node_modules/pdfjs-dist/build",
"output": "./"
}
],
"index": "index.html",
"main": "main.ts",
@ -164,13 +172,16 @@
},
"lint": [
{
"project": "src/tsconfig.app.json"
"project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**/*"
},
{
"project": "src/tsconfig.spec.json"
"project": "src/tsconfig.spec.json",
"exclude": "**/node_modules/**/*"
},
{
"project": "e2e/tsconfig.e2e.json"
"project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**/*"
}
],
"test": {

View File

@ -6,10 +6,10 @@
"scripts": {
"ng": "ng",
"start": "npm run server-versions && rimraf dist && ng serve --host 0.0.0.0 --app dist --open --aot=false",
"start:dev": "npm run style:dev & npm run clean-lib-angular && npm run server-versions && rimraf dist && ng serve --host 0.0.0.0 --disable-host-check --app dev pp-dev --proxy-config proxy.conf.js --open",
"start:dev": "npm run lint && npm run style:dev & npm run clean-lib-angular && npm run server-versions && rimraf dist && ng serve --host 0.0.0.0 --disable-host-check --app dev pp-dev --proxy-config proxy.conf.js --open",
"start:dist": "npm run server-versions && rimraf dist && node --max_old_space_size=30000 node_modules/.bin/ng serve --prod --build-optimizer=false --aot=false --host 0.0.0.0 --disable-host-check --app dist",
"build": "npm run server-versions && rimraf dist && ng build --app dist",
"build:dev": "npm run style:dev & npm run server-versions && rimraf dist && ng build --app dev",
"build:dev": "npm run lint && npm run style:dev & npm run server-versions && rimraf dist && ng build --app dev",
"build:dist": "npm run style:dev & npm run server-versions && rimraf dist && node --max_old_space_size=30000 node_modules/.bin/ng build --prod --build-optimizer=false --aot=false --app dist",
"style:dev": "npm run webpack -- --config config/webpack.style.js --progress --profile --bail --watch",
"test": "ng test",
@ -114,7 +114,7 @@
"protractor": "~5.1.2",
"rimraf": "^2.6.2",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"tslint": "^5.7.0",
"typescript": "~2.4.2"
}
}

View File

@ -83,7 +83,7 @@
}
},
"document-list": {
"supportedPageSizes": [ 5, 10, 15, 20 ],
"supportedPageSizes": [ 5, 10, 15, 25 ],
"presets": {
"-trashcan-": [
{
@ -330,7 +330,7 @@
}
},
"adf-task-list": {
"supportedPageSizes": [ 5, 10, 15, 20 ],
"supportedPageSizes": [ 5, 10, 15, 25 ],
"presets": {
"default": [
{

View File

@ -26,7 +26,7 @@ import { SettingsService, PageTitleService, StorageService, TranslationService }
encapsulation: ViewEncapsulation.None
})
export class AppComponent {
searchTerm: string = '';
searchTerm = '';
constructor(private settingsService: SettingsService,
private storage: StorageService,

View File

@ -2,7 +2,6 @@ import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { FlexLayoutModule } from '@angular/flex-layout';
// import { Editor3DModule } from 'ng2-3d-editor';
import { ChartsModule } from 'ng2-charts';
import { HttpClientModule } from '@angular/common/http';
import { TranslateService } from '@ngx-translate/core';
@ -56,7 +55,6 @@ import { ProcessAttachmentsComponent } from './components/process-service/proces
MaterialModule,
ThemePickerModule,
FlexLayoutModule,
//Editor3DModule,
ChartsModule,
HttpClientModule
],

View File

@ -27,7 +27,7 @@ import {
} from '@alfresco/adf-core';
@Component({
selector: 'adf-about-page',
selector: 'app-about-page',
templateUrl: './about.component.html',
styleUrls: ['./about.component.css']
})
@ -37,11 +37,11 @@ export class AboutComponent implements OnInit {
status: ObjectDataTableAdapter;
license: ObjectDataTableAdapter;
modules: ObjectDataTableAdapter;
githubUrlCommitAlpha: string = 'https://github.com/Alfresco/alfresco-ng2-components/commits/';
githubUrlCommitAlpha = 'https://github.com/Alfresco/alfresco-ng2-components/commits/';
configFile: string = 'app.config.json';
ecmHost: string = '';
bpmHost: string = '';
configFile = 'app.config.json';
ecmHost = '';
bpmHost = '';
ecmVersion: EcmProductVersionModel = null;
bpmVersion: BpmProductVersionModel = null;
@ -94,13 +94,13 @@ export class AboutComponent implements OnInit {
}
this.http.get('/versions.json').subscribe(response => {
let regexp = new RegExp('^(@alfresco)');
const regexp = new RegExp('^(@alfresco)');
let alfrescoPackages = Object.keys(response.json().dependencies).filter((val) => {
const alfrescoPackages = Object.keys(response.json().dependencies).filter((val) => {
return regexp.test(val);
});
let alfrescoPackagesTableRepresentation = [];
const alfrescoPackagesTableRepresentation = [];
alfrescoPackages.forEach((val) => {
alfrescoPackagesTableRepresentation.push({
name: val,
@ -122,12 +122,12 @@ export class AboutComponent implements OnInit {
}
private gitHubLinkCreation(alfrescoPackagesTableRepresentation): void {
let corePackage = alfrescoPackagesTableRepresentation.find((packageUp) => {
const corePackage = alfrescoPackagesTableRepresentation.find((packageUp) => {
return packageUp.name === '@alfresco/adf-core';
});
if (corePackage) {
let commitIsh = corePackage.version.split('-');
const commitIsh = corePackage.version.split('-');
if (commitIsh.length > 1) {
this.githubUrlCommitAlpha = this.githubUrlCommitAlpha + commitIsh[1];
} else {

View File

@ -23,14 +23,14 @@
<div class="adf-app-layout-menu-spacer"></div>
<adf-search-bar fxFlex="0 1 auto"></adf-search-bar>
<app-search-bar fxFlex="0 1 auto"></app-search-bar>
<a fxFlex="0 0 auto" class="adf-toolbar-link" fxShow fxHide.lt-md="true" mat-button data-automation-id="home" href="" routerLink="/home" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }">{{'APP_LAYOUT.HOME' | translate }}</a>
<a fxFlex="0 0 auto" class="adf-toolbar-link" fxShow fxHide.lt-md="true" mat-button data-automation-id="files" href="" routerLink="/files" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }">{{'APP_LAYOUT.CONTENT_SERVICES' | translate }}</a>
<a fxFlex="0 0 auto" class="adf-toolbar-link" fxShow fxHide.lt-md="true" mat-button data-automation-id="activiti" href="" routerLink="/activiti" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }">{{'APP_LAYOUT.PROCESS_SERVICES' | translate }}</a>
<a fxFlex="0 0 auto" class="adf-toolbar-link" fxShow fxHide.lt-md="true" mat-button data-automation-id="login" href="" routerLink="/login">Login</a>
<theme-picker></theme-picker>
<app-theme-picker></app-theme-picker>
<button mat-icon-button [matMenuTriggerFor]="langMenu">
<mat-icon>language</mat-icon>
</button>

View File

@ -44,5 +44,6 @@ export class AppLayoutComponent {
{ href: '/about', icon: 'info_outline', title: 'APP_LAYOUT.ABOUT' }
];
constructor(){};
constructor() {
}
}

View File

@ -21,13 +21,13 @@ import { DataCellEvent, DataRowActionEvent, DataSorting, ObjectDataColumn, Objec
import { Observable } from 'rxjs/Observable';
@Component({
selector: 'datatable',
selector: 'app-datatable',
templateUrl: './datatable.component.html',
styleUrls: ['./datatable.component.scss']
})
export class DataTableComponent {
multiselect: boolean = false;
multiselect = false;
data: ObjectDataTableAdapter;
@Input()
@ -39,7 +39,7 @@ export class DataTableComponent {
{ value: 'multiple', viewValue: 'Multiple' }
];
private _imageUrl: string = 'http://placehold.it/140x100';
private _imageUrl = 'http://placehold.it/140x100';
private _createdBy: any = {
name: 'Denys Vuika',
email: 'denys.vuika@alfresco.com'
@ -94,8 +94,8 @@ export class DataTableComponent {
}
addRow() {
let id = this.data.getRows().length + 1;
let row = new ObjectDataRow({
const id = this.data.getRows().length + 1;
const row = new ObjectDataRow({
id: id,
name: 'Name ' + id,
createdOn: new Date(),
@ -107,7 +107,7 @@ export class DataTableComponent {
}
replaceRows() {
let objects = [
const objects = [
{
id: 10,
name: 'Name 10',
@ -137,21 +137,21 @@ export class DataTableComponent {
icon: this._imageUrl
}
];
let rows = objects.map(obj => new ObjectDataRow(obj));
const rows = objects.map(obj => new ObjectDataRow(obj));
this.data.setRows(rows);
}
replaceColumns() {
let schema = [
const schema = [
{ type: 'text', key: 'id', title: 'Id', sortable: true },
{ type: 'text', key: 'name', title: 'Name', sortable: true, cssClass: 'full-width name-column' }
];
let columns = schema.map(col => new ObjectDataColumn(col));
const columns = schema.map(col => new ObjectDataColumn(col));
this.data.setColumns(columns);
}
onShowRowActionsMenu(event: DataCellEvent) {
let myAction = {
const myAction = {
title: 'Hello'
// you custom metadata needed for onExecuteRowAction
};
@ -161,7 +161,7 @@ export class DataTableComponent {
}
onExecuteRowAction(event: DataRowActionEvent) {
let args = event.value;
const args = event.value;
this.logService.log(args.row);
this.logService.log(args.action);
window.alert(`My custom action: ${args.action.title}`);
@ -176,7 +176,7 @@ export class DataTableComponent {
}
getRowForNode() {
let opts: any = {
const opts: any = {
includeSource: true,
include: ['path', 'properties', 'allowableOperations']
};

View File

@ -33,9 +33,6 @@ export class FileViewComponent implements OnInit {
private apiService: AlfrescoApiService) {}
ngOnInit() {
this.route
.data
.subscribe(v => console.log(v));
this.route.params.subscribe(params => {
const id = params.nodeId;

View File

@ -19,7 +19,7 @@ import { Component, Input, ViewChild } from '@angular/core';
import { DocumentListComponent } from '@alfresco/adf-content-services';
@Component({
selector: 'adf-custom-sources',
selector: 'app-custom-sources',
templateUrl: 'custom-sources.component.html'
})
export class CustomSourcesComponent {

View File

@ -37,7 +37,7 @@ import { Subscription } from 'rxjs/Rx';
const DEFAULT_FOLDER_TO_SHOW = '-my-';
@Component({
selector: 'adf-files-component',
selector: 'app-files-component',
templateUrl: './files.component.html',
styleUrls: ['./files.component.scss']
})
@ -45,8 +45,8 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
errorMessage: string = null;
fileNodeId: any;
showViewer: boolean = false;
showVersions: boolean = false;
showViewer = false;
showVersions = false;
toolbarColor = 'default';
@ -67,28 +67,28 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
multiselect = false;
@Input()
multipleFileUpload: boolean = false;
multipleFileUpload = false;
@Input()
folderUpload: boolean = false;
folderUpload = false;
@Input()
acceptedFilesTypeShow: boolean = false;
acceptedFilesTypeShow = false;
@Input()
maxSizeShow: boolean = false;
maxSizeShow = false;
@Input()
versioning: boolean = false;
versioning = false;
@Input()
acceptedFilesType: string = '.jpg,.pdf,.js';
acceptedFilesType = '.jpg,.pdf,.js';
@Input()
maxFilesSize: number = null;
@Input()
enableUpload: boolean = true;
enableUpload = true;
@Input()
nodeResult: NodePaging;
@ -97,7 +97,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
pagination: Pagination;
@Input()
disableDragArea: boolean = false;
disableDragArea = false;
@Output()
documentListReady: EventEmitter<any> = new EventEmitter();
@ -124,7 +124,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
standardPagination: PaginationComponent;
permissionsStyle: PermissionStyleModel[] = [];
supportedPages: number[] = [5, 10, 15, 20];
supportedPages: number[] = [5, 10, 15, 25];
infiniteScrolling: boolean;
private onCreateFolder: Subscription;
@ -303,7 +303,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
}
onContentActionSuccess(message) {
let translatedMessage: any = this.translateService.get(message);
const translatedMessage: any = this.translateService.get(message);
this.notificationService.openSnackMessage(translatedMessage.value, 4000);
}

View File

@ -19,7 +19,7 @@ import { Component, ViewChild } from '@angular/core';
import { FormComponent, FormModel, FormService, LogService } from '@alfresco/adf-core';
@Component({
selector: 'form-list',
selector: 'app-form-list',
templateUrl: 'form-list.component.html',
styleUrls: ['form-list.component.scss']
})
@ -45,10 +45,10 @@ export class FormListComponent {
}
onRowDblClick(event: CustomEvent) {
let rowForm = event.detail.value.obj;
const rowForm = event.detail.value.obj;
this.formService.getFormDefinitionById(rowForm.id).subscribe((formModel) => {
let form = this.formService.parseForm(formModel.formDefinition);
const form = this.formService.parseForm(formModel.formDefinition);
this.form = form;
});
@ -68,7 +68,7 @@ export class FormListComponent {
}
clone(objToCopyFrom, objToCopyTo) {
for (let attribute in objToCopyFrom) {
for (const attribute in objToCopyFrom) {
if (objToCopyFrom.hasOwnProperty(attribute)) {
objToCopyTo[attribute] = objToCopyFrom[attribute];
}

View File

@ -16,12 +16,12 @@
*/
import { Component, Inject, OnInit } from '@angular/core';
import { FormModel, FormService } from '@alfresco/adf-core';
import { FormModel, FormService, FormOutcomeEvent } from '@alfresco/adf-core';
import { InMemoryFormService } from '../../services/in-memory-form.service';
import { DemoForm } from './demo-form';
@Component({
selector: 'form',
selector: 'app-form',
templateUrl: 'form.component.html',
styleUrls: ['form.component.css'],
providers: [
@ -33,14 +33,13 @@ export class FormComponent implements OnInit {
form: FormModel;
constructor(@Inject(FormService) private formService: InMemoryFormService) {
formService.executeOutcome.subscribe(e => {
e.preventDefault();
console.log(e.outcome);
formService.executeOutcome.subscribe((formOutcomeEvent: FormOutcomeEvent) => {
formOutcomeEvent.preventDefault();
});
}
ngOnInit() {
let formDefinitionJSON: any = DemoForm.getDefinition();
const formDefinitionJSON: any = DemoForm.getDefinition();
this.form = this.formService.parseForm(formDefinitionJSON);
}

View File

@ -30,7 +30,7 @@ describe('HomeComponent', () => {
});
it ('should work', () => {
let fixture = TestBed.createComponent(HomeComponent);
const fixture = TestBed.createComponent(HomeComponent);
expect(fixture.componentInstance instanceof HomeComponent).toBe(true, 'should create HomeComponent');
});
});

View File

@ -18,7 +18,7 @@
import { Component } from '@angular/core';
@Component({
selector: 'home-view',
selector: 'app-home-view',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss']
})

View File

@ -21,7 +21,7 @@ import { Router } from '@angular/router';
import { LogService, StorageService } from '@alfresco/adf-core';
@Component({
selector: 'login',
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.css']
})
@ -30,27 +30,27 @@ export class LoginComponent implements OnInit {
@ViewChild('alfrescologin')
alfrescologin: any;
providers: string = 'ECM';
providers = 'ECM';
customValidation: any;
disableCsrf: boolean = false;
isECM: boolean = true;
isBPM: boolean = false;
showFooter: boolean = true;
customMinLenght: number = 2;
disableCsrf = false;
isECM = true;
isBPM = false;
showFooter = true;
customMinLength = 2;
constructor(private router: Router,
private storage: StorageService,
private logService: LogService) {
this.customValidation = {
username: ['', Validators.compose([Validators.required, Validators.minLength(this.customMinLenght)])],
username: ['', Validators.compose([Validators.required, Validators.minLength(this.customMinLength)])],
password: ['', Validators.required]
};
}
ngOnInit() {
this.alfrescologin.addCustomValidationError('username', 'required', 'LOGIN.MESSAGES.USERNAME-REQUIRED');
this.alfrescologin.addCustomValidationError('username', 'minlength', 'LOGIN.MESSAGES.USERNAME-MIN', {minLenght: this.customMinLenght});
this.alfrescologin.addCustomValidationError('username', 'minlength', 'LOGIN.MESSAGES.USERNAME-MIN', {minLength: this.customMinLength});
this.alfrescologin.addCustomValidationError('password', 'required', 'LOGIN.MESSAGES.PASSWORD-REQUIRED');
if (this.storage.hasItem('providers')) {

View File

@ -20,7 +20,7 @@ import { ActivatedRoute } from '@angular/router';
import { Subscription } from 'rxjs/Rx';
@Component({
selector: 'form-node-viewer',
selector: 'app-form-node-viewer',
templateUrl: './form-node-viewer.component.html',
styleUrls: ['./form-node-viewer.component.css']
})

View File

@ -20,7 +20,7 @@ import { Router } from '@angular/router';
import { MinimalNodeEntity } from 'alfresco-js-api';
@Component({
selector: 'adf-search-bar',
selector: 'app-search-bar',
templateUrl: './search-bar.component.html',
styleUrls: ['./search-bar.component.scss']
})

View File

@ -5,7 +5,7 @@
#search>
</adf-search>
<adf-files-component
<app-files-component
[currentFolderId]="null"
[nodeResult]="resultNodePageList"
[disableDragArea]="true"
@ -15,4 +15,4 @@
(turnedNextPage)="refreshPage($event)"
(loadNext)="refreshPage($event)"
(turnedPreviousPage)="refreshPage($event)">
</adf-files-component>
</app-files-component>

View File

@ -22,7 +22,7 @@ import { SearchComponent } from '@alfresco/adf-content-services';
import { UserPreferencesService } from '@alfresco/adf-core';
@Component({
selector: 'adf-search-result-component',
selector: 'app-search-result-component',
templateUrl: './search-result.component.html',
styleUrls: ['./search-result.component.scss']
})
@ -33,12 +33,12 @@ export class SearchResultComponent implements OnInit {
fileNodeId: string;
queryParamName = 'q';
searchedWord: string = '';
fileShowed: boolean = false;
navigationMode: string = 'dblclick';
searchedWord = '';
fileShowed = false;
navigationMode = 'dblclick';
resultNodePageList: NodePaging;
maxItems: number;
skipCount: number = 0;
skipCount = 0;
paging: Pagination;
constructor(public router: Router,

View File

@ -18,11 +18,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'alfresco-social',
selector: 'app-social',
templateUrl: 'social.component.html',
styleUrls: ['social.component.scss']
})
export class SocialComponent {
nodeId: string = '74cd8a96-8a21-47e5-9b3b-a1b3e296787d';
nodeId = '74cd8a96-8a21-47e5-9b3b-a1b3e296787d';
}

View File

@ -18,11 +18,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'alfresco-tag',
selector: 'app-tag',
templateUrl: 'tag.component.html',
styleUrls: ['tag.component.scss']
})
export class TagComponent {
nodeId: string = '74cd8a96-8a21-47e5-9b3b-a1b3e296787d';
nodeId = '74cd8a96-8a21-47e5-9b3b-a1b3e296787d';
}

View File

@ -8,7 +8,7 @@ import { StyleManager } from './style-manager/style-manager';
import { DocsSiteTheme, ThemeStorage } from './theme-storage/theme-storage';
@Component({
selector: 'theme-picker',
selector: 'app-theme-picker',
templateUrl: 'theme-picker.html',
styleUrls: ['theme-picker.css'],
changeDetection: ChangeDetectionStrategy.OnPush,

View File

@ -19,18 +19,17 @@ import { Component } from '@angular/core';
import { LogService } from '@alfresco/adf-core';
@Component({
selector: 'alfresco-webscript',
selector: 'app-webscript',
templateUrl: 'webscript.component.html'
})
export class WebscriptComponent {
currentPath: string = '/';
authenticated: boolean;
host: string = 'http://127.0.0.1:8080';
scriptPath: string = 'sample/folder/Company%20Home';
contextRoot: string = 'alfresco';
servicePath: string = 'service';
scriptArgs: string = '';
currentPath = '/';
host = 'http://127.0.0.1:8080';
scriptPath = 'sample/folder/Company%20Home';
contextRoot = 'alfresco';
servicePath = 'service';
scriptArgs = '';
constructor(private logService: LogService) {
}

View File

@ -58,11 +58,11 @@ export class InMemoryFormService extends FormService {
this.logService.log(`getRestFieldValues: ${taskId} => ${field}`);
return new Observable<FormFieldOption[]>(observer => {
let field = this.data.rest.fields.find(
const currentField = this.data.rest.fields.find(
f => f.taskId === taskId && f.fieldId === field
);
if ( field ) {
let values: FormFieldOption[] = field.values || [];
if ( currentField ) {
const values: FormFieldOption[] = currentField.values || [];
this.logService.log(values);
observer.next(values);
}
@ -71,7 +71,7 @@ export class InMemoryFormService extends FormService {
parseForm(json: any, data?: FormValues, readOnly: boolean = false): FormModel {
if (json) {
let form = new FormModel(json, data, readOnly, this);
const form = new FormModel(json, data, readOnly, this);
if (!json.fields) {
form.outcomes = [
new FormOutcomeModel(form, {
@ -93,10 +93,10 @@ export class InMemoryFormService extends FormService {
this.logService.log(`getRestFieldValuesByProcessId: ${processDefinitionId} => ${fieldId}`);
return new Observable<FormFieldOption[]>(observer => {
let field = this.data.rest.fields.find(
const field = this.data.rest.fields.find(
f => f.processId === processDefinitionId && f.fieldId === fieldId
);
let values: FormFieldOption[] = field.values || [];
const values: FormFieldOption[] = field.values || [];
this.logService.log(values);
observer.next(values);
});

View File

@ -22,7 +22,7 @@
"label-position": true,
"max-line-length": [
true,
140
180
],
"member-access": false,
"member-ordering": [
@ -103,7 +103,6 @@
"component-selector": [true, "element", "app", "kebab-case"],
"use-input-property-decorator": true,
"use-output-property-decorator": true,
"use-host-property-decorator": true,
"no-input-rename": true,
"no-output-rename": true,
"use-life-cycle-interface": true,

View File

@ -28,7 +28,7 @@ import {
import { AlfrescoApiService, AppConfigService, DataColumnListComponent, UserPreferencesService } from '@alfresco/adf-core';
import {
AfterContentInit, Component, ContentChild, ElementRef, EventEmitter, HostListener, Input, NgZone,
OnChanges, OnInit, Output, SimpleChanges, TemplateRef, ViewChild, ViewEncapsulation
OnChanges, OnDestroy, OnInit, Output, SimpleChanges, TemplateRef, ViewChild, ViewEncapsulation
} from '@angular/core';
import {
DeletedNodesPaging,
@ -49,6 +49,7 @@ import { ContentActionModel } from './../models/content-action.model';
import { PermissionStyleModel } from './../models/permissions-style.model';
import { DocumentListService } from './../services/document-list.service';
import { NodeEntityEvent, NodeEntryEvent } from './node.event';
import { Subscription } from 'rxjs/Subscription';
export enum PaginationStrategy {
Finite,
@ -61,7 +62,7 @@ export enum PaginationStrategy {
templateUrl: './document-list.component.html',
encapsulation: ViewEncapsulation.None
})
export class DocumentListComponent implements OnInit, OnChanges, AfterContentInit, PaginatedComponent {
export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, AfterContentInit, PaginatedComponent {
static SINGLE_CLICK_NAVIGATION: string = 'click';
static DOUBLE_CLICK_NAVIGATION: string = 'dblclick';
@ -178,6 +179,8 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni
private currentNodeAllowableOperations: string[] = [];
private CREATE_PERMISSION = 'create';
private contextActionHandlerSubscription: Subscription;
constructor(private documentListService: DocumentListService,
private ngZone: NgZone,
private elementRef: ElementRef,
@ -234,7 +237,7 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni
this.data.setImageResolver(this.imageResolver);
}
this.contextActionHandler.subscribe(val => this.contextActionCallback(val));
this.contextActionHandlerSubscription = this.contextActionHandler.subscribe(val => this.contextActionCallback(val));
this.enforceSingleClickNavigationForMobile();
}
@ -867,4 +870,10 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni
this.reload(this.enableInfiniteScrolling);
}
}
ngOnDestroy() {
if (this.contextActionHandlerSubscription) {
this.contextActionHandlerSubscription.unsubscribe();
}
}
}

View File

@ -15,7 +15,16 @@
* limitations under the License.
*/
import { Component, ElementRef, EventEmitter, Input, OnInit, Output, TemplateRef, ViewEncapsulation } from '@angular/core';
import {
Component,
ElementRef,
EventEmitter,
Input,
OnInit,
Output,
TemplateRef,
ViewEncapsulation
} from '@angular/core';
import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Router } from '@angular/router';
@ -137,9 +146,11 @@ export class LoginComponent implements OnInit {
* @param event
*/
onSubmit(values: any) {
if (!this.checkRequiredParams()) {
return false;
}
this.settingsService.setProviders(this.providers);
this.settingsService.csrfDisabled = this.disableCsrf;
@ -195,10 +206,7 @@ export class LoginComponent implements OnInit {
if (redirectUrl) {
this.authService.setRedirectUrl(null);
this.router.navigate([redirectUrl]);
return false;
}
if (this.successRoute) {
} else if (this.successRoute) {
this.router.navigate([this.successRoute]);
}
},
@ -216,22 +224,17 @@ export class LoginComponent implements OnInit {
* Check and display the right error message in the UI
*/
private displayErrorMessage(err: any): void {
if (err.error && err.error.crossDomain && err.error.message.indexOf('Access-Control-Allow-Origin') !== -1) {
this.errorMsg = err.error.message;
return;
}
if (err.status === 403 && err.message.indexOf('Invalid CSRF-token') !== -1) {
} else if (err.status === 403 && err.message.indexOf('Invalid CSRF-token') !== -1) {
this.errorMsg = 'LOGIN.MESSAGES.LOGIN-ERROR-CSRF';
return;
}
if (err.status === 403 && err.message.indexOf('The system is currently in read-only mode') !== -1) {
} else if (err.status === 403 && err.message.indexOf('The system is currently in read-only mode') !== -1) {
this.errorMsg = 'LOGIN.MESSAGES.LOGIN-ECM-LICENSE';
return;
}
} else {
this.errorMsg = 'LOGIN.MESSAGES.LOGIN-ERROR-CREDENTIALS';
}
}
/**
@ -239,15 +242,19 @@ export class LoginComponent implements OnInit {
* @returns {boolean}
*/
private checkRequiredParams(): boolean {
let isAllParamPresent: boolean = true;
if (this.providers === undefined || this.providers === null || this.providers === '') {
this.errorMsg = 'LOGIN.MESSAGES.LOGIN-ERROR-PROVIDERS';
this.enableError();
let messageProviders: any;
messageProviders = this.translateService.get(this.errorMsg);
this.error.emit(new LoginErrorEvent(messageProviders.value));
return false;
isAllParamPresent = false;
}
return true;
return isAllParamPresent;
}
/**

View File

@ -23,12 +23,14 @@ import {
OnInit,
Output,
ViewEncapsulation,
ChangeDetectorRef
ChangeDetectorRef,
OnDestroy
} from '@angular/core';
import { Pagination } from 'alfresco-js-api';
import { PaginationQueryParams } from './pagination-query-params.interface';
import { PaginatedComponent } from './paginated-component.interface';
import { Subscription } from 'rxjs/Subscription';
@Component({
selector: 'adf-pagination',
@ -38,7 +40,7 @@ import { PaginatedComponent } from './paginated-component.interface';
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None
})
export class PaginationComponent implements OnInit {
export class PaginationComponent implements OnInit, OnDestroy {
static DEFAULT_PAGE_SIZE: number = 25;
@ -59,7 +61,7 @@ export class PaginationComponent implements OnInit {
target: PaginatedComponent;
@Input()
supportedPageSizes: number[] = [ 25, 50, 100 ];
supportedPageSizes: number[] = [5, 25, 50, 100];
@Input()
pagination: Pagination;
@ -79,16 +81,20 @@ export class PaginationComponent implements OnInit {
@Output()
prevPage: EventEmitter<Pagination> = new EventEmitter<Pagination>();
private paginationSubscription: Subscription;
constructor(private cdr: ChangeDetectorRef) {
}
ngOnInit() {
if (this.target) {
this.target.pagination.subscribe(page => {
this.paginationSubscription = this.target.pagination.subscribe(page => {
this.pagination = page;
this.cdr.detectChanges();
});
}
if (!this.pagination) {
this.pagination = PaginationComponent.DEFAULT_PAGINATION;
}
@ -220,4 +226,10 @@ export class PaginationComponent implements OnInit {
this.target.updatePagination(params);
}
}
ngOnDestroy() {
if (this.paginationSubscription) {
this.paginationSubscription.unsubscribe();
}
}
}

View File

@ -102,7 +102,7 @@ export class ProcessFilterService {
observer.complete();
},
(err: any) => {
this.handleProcessError(err)
this.handleProcessError(err);
});
});
}