[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", "input": "../node_modules/@alfresco/adf-content-services/bundles/assets",
"output": "./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", "index": "index.html",
"main": "main.ts", "main": "main.ts",
@ -126,7 +130,11 @@
"input": "../../lib/insights/i18n", "input": "../../lib/insights/i18n",
"output": "./assets/adf-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", "index": "index.html",
"main": "main.ts", "main": "main.ts",
@ -164,13 +172,16 @@
}, },
"lint": [ "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": { "test": {

View File

@ -6,10 +6,10 @@
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "npm run server-versions && rimraf dist && ng serve --host 0.0.0.0 --app dist --open --aot=false", "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", "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": "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", "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", "style:dev": "npm run webpack -- --config config/webpack.style.js --progress --profile --bail --watch",
"test": "ng test", "test": "ng test",
@ -114,7 +114,7 @@
"protractor": "~5.1.2", "protractor": "~5.1.2",
"rimraf": "^2.6.2", "rimraf": "^2.6.2",
"ts-node": "~3.2.0", "ts-node": "~3.2.0",
"tslint": "~5.7.0", "tslint": "^5.7.0",
"typescript": "~2.4.2" "typescript": "~2.4.2"
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -23,14 +23,14 @@
<div class="adf-app-layout-menu-spacer"></div> <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="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="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="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> <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"> <button mat-icon-button [matMenuTriggerFor]="langMenu">
<mat-icon>language</mat-icon> <mat-icon>language</mat-icon>
</button> </button>

View File

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

View File

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

View File

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

View File

@ -37,7 +37,7 @@ import { Subscription } from 'rxjs/Rx';
const DEFAULT_FOLDER_TO_SHOW = '-my-'; const DEFAULT_FOLDER_TO_SHOW = '-my-';
@Component({ @Component({
selector: 'adf-files-component', selector: 'app-files-component',
templateUrl: './files.component.html', templateUrl: './files.component.html',
styleUrls: ['./files.component.scss'] styleUrls: ['./files.component.scss']
}) })
@ -45,8 +45,8 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
errorMessage: string = null; errorMessage: string = null;
fileNodeId: any; fileNodeId: any;
showViewer: boolean = false; showViewer = false;
showVersions: boolean = false; showVersions = false;
toolbarColor = 'default'; toolbarColor = 'default';
@ -67,28 +67,28 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
multiselect = false; multiselect = false;
@Input() @Input()
multipleFileUpload: boolean = false; multipleFileUpload = false;
@Input() @Input()
folderUpload: boolean = false; folderUpload = false;
@Input() @Input()
acceptedFilesTypeShow: boolean = false; acceptedFilesTypeShow = false;
@Input() @Input()
maxSizeShow: boolean = false; maxSizeShow = false;
@Input() @Input()
versioning: boolean = false; versioning = false;
@Input() @Input()
acceptedFilesType: string = '.jpg,.pdf,.js'; acceptedFilesType = '.jpg,.pdf,.js';
@Input() @Input()
maxFilesSize: number = null; maxFilesSize: number = null;
@Input() @Input()
enableUpload: boolean = true; enableUpload = true;
@Input() @Input()
nodeResult: NodePaging; nodeResult: NodePaging;
@ -97,7 +97,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
pagination: Pagination; pagination: Pagination;
@Input() @Input()
disableDragArea: boolean = false; disableDragArea = false;
@Output() @Output()
documentListReady: EventEmitter<any> = new EventEmitter(); documentListReady: EventEmitter<any> = new EventEmitter();
@ -124,7 +124,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
standardPagination: PaginationComponent; standardPagination: PaginationComponent;
permissionsStyle: PermissionStyleModel[] = []; permissionsStyle: PermissionStyleModel[] = [];
supportedPages: number[] = [5, 10, 15, 20]; supportedPages: number[] = [5, 10, 15, 25];
infiniteScrolling: boolean; infiniteScrolling: boolean;
private onCreateFolder: Subscription; private onCreateFolder: Subscription;
@ -303,7 +303,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
} }
onContentActionSuccess(message) { onContentActionSuccess(message) {
let translatedMessage: any = this.translateService.get(message); const translatedMessage: any = this.translateService.get(message);
this.notificationService.openSnackMessage(translatedMessage.value, 4000); 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'; import { FormComponent, FormModel, FormService, LogService } from '@alfresco/adf-core';
@Component({ @Component({
selector: 'form-list', selector: 'app-form-list',
templateUrl: 'form-list.component.html', templateUrl: 'form-list.component.html',
styleUrls: ['form-list.component.scss'] styleUrls: ['form-list.component.scss']
}) })
@ -45,10 +45,10 @@ export class FormListComponent {
} }
onRowDblClick(event: CustomEvent) { onRowDblClick(event: CustomEvent) {
let rowForm = event.detail.value.obj; const rowForm = event.detail.value.obj;
this.formService.getFormDefinitionById(rowForm.id).subscribe((formModel) => { this.formService.getFormDefinitionById(rowForm.id).subscribe((formModel) => {
let form = this.formService.parseForm(formModel.formDefinition); const form = this.formService.parseForm(formModel.formDefinition);
this.form = form; this.form = form;
}); });
@ -68,7 +68,7 @@ export class FormListComponent {
} }
clone(objToCopyFrom, objToCopyTo) { clone(objToCopyFrom, objToCopyTo) {
for (let attribute in objToCopyFrom) { for (const attribute in objToCopyFrom) {
if (objToCopyFrom.hasOwnProperty(attribute)) { if (objToCopyFrom.hasOwnProperty(attribute)) {
objToCopyTo[attribute] = objToCopyFrom[attribute]; objToCopyTo[attribute] = objToCopyFrom[attribute];
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@
#search> #search>
</adf-search> </adf-search>
<adf-files-component <app-files-component
[currentFolderId]="null" [currentFolderId]="null"
[nodeResult]="resultNodePageList" [nodeResult]="resultNodePageList"
[disableDragArea]="true" [disableDragArea]="true"
@ -15,4 +15,4 @@
(turnedNextPage)="refreshPage($event)" (turnedNextPage)="refreshPage($event)"
(loadNext)="refreshPage($event)" (loadNext)="refreshPage($event)"
(turnedPreviousPage)="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'; import { UserPreferencesService } from '@alfresco/adf-core';
@Component({ @Component({
selector: 'adf-search-result-component', selector: 'app-search-result-component',
templateUrl: './search-result.component.html', templateUrl: './search-result.component.html',
styleUrls: ['./search-result.component.scss'] styleUrls: ['./search-result.component.scss']
}) })
@ -33,12 +33,12 @@ export class SearchResultComponent implements OnInit {
fileNodeId: string; fileNodeId: string;
queryParamName = 'q'; queryParamName = 'q';
searchedWord: string = ''; searchedWord = '';
fileShowed: boolean = false; fileShowed = false;
navigationMode: string = 'dblclick'; navigationMode = 'dblclick';
resultNodePageList: NodePaging; resultNodePageList: NodePaging;
maxItems: number; maxItems: number;
skipCount: number = 0; skipCount = 0;
paging: Pagination; paging: Pagination;
constructor(public router: Router, constructor(public router: Router,

View File

@ -18,11 +18,11 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
@Component({ @Component({
selector: 'alfresco-social', selector: 'app-social',
templateUrl: 'social.component.html', templateUrl: 'social.component.html',
styleUrls: ['social.component.scss'] styleUrls: ['social.component.scss']
}) })
export class SocialComponent { 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'; import { Component } from '@angular/core';
@Component({ @Component({
selector: 'alfresco-tag', selector: 'app-tag',
templateUrl: 'tag.component.html', templateUrl: 'tag.component.html',
styleUrls: ['tag.component.scss'] styleUrls: ['tag.component.scss']
}) })
export class TagComponent { 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'; import { DocsSiteTheme, ThemeStorage } from './theme-storage/theme-storage';
@Component({ @Component({
selector: 'theme-picker', selector: 'app-theme-picker',
templateUrl: 'theme-picker.html', templateUrl: 'theme-picker.html',
styleUrls: ['theme-picker.css'], styleUrls: ['theme-picker.css'],
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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