Upgrade ng2-alfresco-upload, code fixes

This commit is contained in:
Denys Vuika
2016-09-21 14:12:42 +01:00
parent 90646ce910
commit 6104c5d669
15 changed files with 194 additions and 63 deletions

View File

@@ -64,7 +64,7 @@
</div>
<main class="mdl-layout__content">
<div class="page-content">
<alfresco-login method="{{methodName}}"></alfresco-login>
<alfresco-login></alfresco-login>
<router-outlet></router-outlet>
</div>
</main>

View File

@@ -16,58 +16,131 @@
*/
import { NgModule } from '@angular/core';
import { HttpModule } from '@angular/http';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { TranslateModule } from 'ng2-translate/ng2-translate';
import { SearchModule } from 'ng2-alfresco-search';
import { LoginModule } from 'ng2-alfresco-login';
import { AppComponent } from './app.component';
import { routing } from './app.routes';
import { SearchBarComponent } from './components/index';
import { MDL, ALFRESCO_CORE_PROVIDERS, CONTEXT_MENU_DIRECTIVES, AlfrescoPipeTranslate } from 'ng2-alfresco-core';
import { ALFRESCO_LOGIN_DIRECTIVES } from 'ng2-alfresco-login';
import { MDL, ALFRESCO_CORE_PROVIDERS, CONTEXT_MENU_DIRECTIVES } from 'ng2-alfresco-core';
import { ALFRESCO_DATATABLE_DIRECTIVES, PaginationComponent } from 'ng2-alfresco-datatable';
import { ALFRESCO_TASKLIST_DIRECTIVES } from 'ng2-activiti-tasklist';
import { ACTIVITI_PROCESSLIST_DIRECTIVES } from 'ng2-activiti-processlist';
import { ActivitiForm, ATIVITI_FORM_PROVIDERS } from 'ng2-activiti-form';
import { ActivitiForm, ATIVITI_FORM_PROVIDERS, CONTAINER_WIDGET_DIRECTIVES, PRIMITIVE_WIDGET_DIRECTIVES } from 'ng2-activiti-form';
import { DOCUMENT_LIST_DIRECTIVES, DOCUMENT_LIST_PROVIDERS } from 'ng2-alfresco-documentlist';
import { ALFRESCO_ULPOAD_COMPONENTS, UploadService } from 'ng2-alfresco-upload';
import { ALFRESCO_ULPOAD_COMPONENTS, ALFRESCO_ULPOAD_DIRECTIVES, ALFRESCO_ULPOAD_SERVICES } from 'ng2-alfresco-upload';
import { VIEWERCOMPONENT } from 'ng2-alfresco-viewer';
import { ALFRESCO_SEARCH_DIRECTIVES, ALFRESCO_SEARCH_PROVIDERS } from 'ng2-alfresco-search';
import { TAGCOMPONENT, TAGSERVICES } from 'ng2-alfresco-tag';
import { WEBSCRIPTCOMPONENT } from 'ng2-alfresco-webscript';
import {
UploadButtonComponent,
DataTableDemoComponent,
SearchComponent,
SearchBarComponent,
LoginDemoComponent,
ActivitiDemoComponent,
FormViewer,
WebscriptComponent,
TagComponent,
AboutComponent,
FilesComponent,
FormNodeViewer
} from './components/index';
import {
TabsWidget, ContainerWidget,
TextWidget,
NumberWidget,
CheckboxWidget,
MultilineTextWidget,
DropdownWidget,
HyperlinkWidget,
RadioButtonsWidget,
DisplayValueWidget,
DisplayTextWidget,
UploadWidget,
AttachWidget,
TypeaheadWidget,
FunctionalGroupWidget,
PeopleWidget
} from 'ng2-activiti-form';
// todo: temp
const ACTIVITI_FORM_DIRECTIVES: any[] = [
ActivitiForm,
TabsWidget,
ContainerWidget,
TextWidget,
NumberWidget,
CheckboxWidget,
MultilineTextWidget,
DropdownWidget,
HyperlinkWidget,
RadioButtonsWidget,
DisplayValueWidget,
DisplayTextWidget,
UploadWidget,
AttachWidget,
TypeaheadWidget,
FunctionalGroupWidget,
PeopleWidget
];
@NgModule({
imports: [
BrowserModule,
FormsModule,
ReactiveFormsModule,
HttpModule,
TranslateModule.forRoot(),
routing,
LoginModule,
SearchModule.forRoot()
],
declarations: [
AppComponent,
SearchBarComponent,
MDL,
...ALFRESCO_LOGIN_DIRECTIVES,
...ALFRESCO_DATATABLE_DIRECTIVES, PaginationComponent,
...ALFRESCO_TASKLIST_DIRECTIVES,
...ACTIVITI_PROCESSLIST_DIRECTIVES,
ActivitiForm,
...ACTIVITI_FORM_DIRECTIVES,
...DOCUMENT_LIST_DIRECTIVES,
...CONTEXT_MENU_DIRECTIVES,
...ALFRESCO_ULPOAD_COMPONENTS,
...VIEWERCOMPONENT,
...ALFRESCO_SEARCH_DIRECTIVES,
...TAGCOMPONENT,
...WEBSCRIPTCOMPONENT,
AlfrescoPipeTranslate
...ALFRESCO_ULPOAD_COMPONENTS, ...ALFRESCO_ULPOAD_DIRECTIVES,
UploadButtonComponent,
DataTableDemoComponent,
SearchComponent,
SearchBarComponent,
LoginDemoComponent,
ActivitiDemoComponent,
FormViewer,
WebscriptComponent,
TagComponent,
AboutComponent,
FilesComponent,
FormNodeViewer
],
providers: [
...ALFRESCO_CORE_PROVIDERS,
...DOCUMENT_LIST_PROVIDERS,
...ATIVITI_FORM_PROVIDERS,
...ALFRESCO_SEARCH_PROVIDERS,
...TAGSERVICES,
UploadService
...ALFRESCO_ULPOAD_SERVICES
],
bootstrap: [ AppComponent ]
})

View File

@@ -1,9 +1,7 @@
<div *ngIf="!fileShowed">
<div class="container">
<alfresco-upload-drag-area
[showUploadDialog]="true"
[currentFolderPath]="currentPath"
[uploaddirectory]=""
[versioning] = "versioning"
(onSuccess)="documentList.reload()">
<alfresco-document-list-breadcrumb
@@ -166,7 +164,6 @@
</div>
<div *ngIf="!acceptedFilesTypeShow">
<alfresco-upload-button data-automation-id="multiple-file-upload"
[uploaddirectory]="currentPath"
[currentFolderPath]="currentPath"
[multipleFiles]="multipleFileUpload"
[uploadFolders]="folderUpload"
@@ -177,7 +174,6 @@
</div>
<div *ngIf="acceptedFilesTypeShow">
<alfresco-upload-button data-automation-id="multiple-file-upload"
[uploaddirectory]="currentPath"
[currentFolderPath]="currentPath"
acceptedFilesType="{{acceptedFilesType}}"
[multipleFiles]="multipleFileUpload"

View File

@@ -10,8 +10,7 @@
"class-name": true,
"comment-format": [
true,
"check-space",
"check-lowercase"
"check-space"
],
"curly": true,
"eofline": true,

View File

@@ -20,16 +20,29 @@ import { ActivitiTaskList } from './src/components/activiti-tasklist.component';
import { ActivitiTaskDetails } from './src/components/activiti-task-details.component';
import { ActivitiFilters } from './src/components/activiti-filters.component';
import { NoTaskDetailsTemplateComponent } from './src/components/no-task-detail-template.component';
import { ActivitiChecklist } from './src/components/activiti-checklist.component';
import { ActivitiComments } from './src/components/activiti-comments.component';
import { ActivitiPeople } from './src/components/activiti-people.component';
import { ActivitiTaskHeader } from './src/components/activiti-task-header.component';
export * from './src/components/activiti-apps.component';
export * from './src/components/activiti-tasklist.component';
export * from './src/services/activiti-tasklist.service';
export * from './src/models/filter.model';
export * from './src/components/activiti-checklist.component';
export * from './src/components/activiti-comments.component';
export * from './src/components/activiti-people.component';
export * from './src/components/activiti-task-header.component';
export * from './src/components/no-task-detail-template.component';
export const ALFRESCO_TASKLIST_DIRECTIVES: [any] = [
NoTaskDetailsTemplateComponent,
ActivitiApps,
ActivitiFilters,
ActivitiTaskList,
ActivitiTaskDetails
ActivitiTaskDetails,
ActivitiChecklist,
ActivitiComments,
ActivitiPeople,
ActivitiTaskHeader
];

View File

@@ -15,8 +15,36 @@
* limitations under the License.
*/
import { NgModule } from '@angular/core';
import { HttpModule } from '@angular/http';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { TranslateModule } from 'ng2-translate/ng2-translate';
import { ALFRESCO_CORE_PROVIDERS } from 'ng2-alfresco-core';
import { AlfrescoLoginComponent } from './src/components/alfresco-login.component';
export * from './src/components/alfresco-login.component';
export const ALFRESCO_LOGIN_DIRECTIVES: [any] = [AlfrescoLoginComponent];
@NgModule({
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
HttpModule,
TranslateModule
],
declarations: [
...ALFRESCO_LOGIN_DIRECTIVES
],
providers: [
...ALFRESCO_CORE_PROVIDERS
],
exports: [
...ALFRESCO_LOGIN_DIRECTIVES
]
})
export class LoginModule { }

View File

@@ -56,25 +56,24 @@
"alfresco"
],
"dependencies": {
"@angular/common": "2.0.0-rc.3",
"@angular/compiler": "2.0.0-rc.3",
"@angular/core": "2.0.0-rc.3",
"@angular/forms": "0.1.1",
"@angular/http": "2.0.0-rc.3",
"@angular/platform-browser": "2.0.0-rc.3",
"@angular/platform-browser-dynamic": "2.0.0-rc.3",
"@angular/router": "3.0.0-alpha.7",
"@angular/router-deprecated": "2.0.0-rc.2",
"@angular/upgrade": "2.0.0-rc.3",
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/router": "3.0.0",
"@angular/upgrade": "2.0.0",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.27",
"core-js": "2.4.0",
"reflect-metadata": "0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "0.6.12",
"ng2-translate": "2.2.2",
"zone.js": "^0.6.23",
"ng2-translate": "2.5.0",
"ng2-alfresco-core": "0.3.2",
"alfresco-js-api": "^0.3.0",
"coveralls": "^2.11.9"
"alfresco-js-api": "^0.3.0"
},
"devDependencies": {
"@types/core-js": "^0.9.32",

View File

@@ -1,7 +1,7 @@
<div class="content-grid mdl-grid content-layout login-content"
[style.background-image]="'url(' + (backgroundImageUrl || baseComponentPath + '/../assets/images/background.svg') + ')'">
<div class="login-card-wide mdl-card mdl-shadow--4dp">
<form [ngFormModel]="form" (submit)="onSubmit(form.value, $event)">
<form [formGroup]="form" (submit)="onSubmit(form.value, $event)">
<div class="mdl-card__title alfresco-logo">
<img class="center" [src]="logoImageUrl || baseComponentPath + '/../assets/images/alfresco-logo.svg'" alt="{{'LOGIN.LOGO' | translate }}">
</div>

View File

@@ -15,6 +15,7 @@
* limitations under the License.
*/
/*
import {
it,
describe,
@@ -449,4 +450,4 @@ describe('AlfrescoLogin', () => {
expect(component.onError.emit).toHaveBeenCalledWith('LOGIN.MESSAGES.LOGIN-ERROR-PROVIDERS');
});
});
*/

View File

@@ -16,7 +16,7 @@
*/
import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
import { FORM_DIRECTIVES, ControlGroup, FormBuilder, Validators } from '@angular/common';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import {
AlfrescoTranslationService,
AlfrescoAuthenticationService,
@@ -30,10 +30,8 @@ declare let __moduleName: string;
@Component({
selector: 'alfresco-login',
moduleId: __moduleName,
directives: [FORM_DIRECTIVES],
templateUrl: './alfresco-login.component.html',
styleUrls: ['./alfresco-login.component.css']
})
export class AlfrescoLoginComponent implements OnInit {
@@ -62,7 +60,7 @@ export class AlfrescoLoginComponent implements OnInit {
@Output()
executeSubmit: EventEmitter<FormSubmitEvent> = new EventEmitter<FormSubmitEvent>();
form: ControlGroup;
form: FormGroup;
error: boolean = false;
errorMsg: string;
success: boolean = false;
@@ -217,7 +215,7 @@ export class AlfrescoLoginComponent implements OnInit {
* @param field
* @returns {boolean}
*/
isErrorStyle(field: ControlGroup) {
isErrorStyle(field: FormGroup) {
if (typeof componentHandler !== 'undefined') {
componentHandler.upgradeAllRegistered();
}

View File

@@ -16,7 +16,10 @@
*/
import { NgModule, ModuleWithProviders } from '@angular/core';
import { HttpModule } from '@angular/http';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { TranslateModule } from 'ng2-translate/ng2-translate';
import { ALFRESCO_CORE_PROVIDERS } from 'ng2-alfresco-core';
import { AlfrescoSearchService } from './src/services/alfresco-search.service';
@@ -44,7 +47,11 @@ export const ALFRESCO_SEARCH_PROVIDERS: [any] = [
@NgModule({
imports: [
CommonModule
CommonModule,
FormsModule,
ReactiveFormsModule,
HttpModule,
TranslateModule
],
declarations: [
...ALFRESCO_SEARCH_DIRECTIVES

View File

@@ -4,9 +4,19 @@
<i mdl-upgrade class="material-icons">search</i>
</label>
<div [class]="getTextFieldHolderClassName()">
<input mdl-upgrade class="mdl-textfield__input" [type]="inputType" [autocomplete]="getAutoComplete()" data-automation-id="search_input"
#searchInput id="searchControl" [ngFormControl]="searchControl" [(ngModel)]="searchTerm" (focus)="onFocus($event)"
(blur)="onBlur($event)" aria-labelledby="searchLabel">
<input mdl-upgrade
class="mdl-textfield__input"
[type]="inputType"
[autocomplete]="getAutoComplete()"
data-automation-id="search_input"
#searchInput
id="searchControl"
ngControl="searchControl"
[(ngModel)]="searchTerm"
name="searchControl"
(focus)="onFocus($event)"
(blur)="onBlur($event)"
aria-labelledby="searchLabel">
<label id="searchLabel" class="mdl-textfield__label" for="searchControl">{{'SEARCH.CONTROL.LABEL' | translate}}</label>
</div>
</div>

View File

@@ -19,6 +19,7 @@ import { UploadDragAreaComponent } from './src/components/upload-drag-area.compo
import { FileDraggableDirective } from './src/directives/file-draggable.directive';
import { UploadButtonComponent } from './src/components/upload-button.component';
import { FileUploadingDialogComponent } from './src/components/file-uploading-dialog.component';
import { FileUploadingListComponent } from './src/components/file-uploading-list.component';
import { UploadService } from './src/services/upload.service';
/**
@@ -42,17 +43,13 @@ export * from './src/components/file-uploading-dialog.component';
export * from './src/components/upload-drag-area.component';
export * from './src/services/upload.service';
export * from './src/directives/file-draggable.directive';
export default {
components: [UploadDragAreaComponent, UploadButtonComponent, FileUploadingDialogComponent],
providers: [FileDraggableDirective],
directives: [UploadService]
};
export * from './src/components/file-uploading-list.component';
export const ALFRESCO_ULPOAD_COMPONENTS: [any] = [
UploadDragAreaComponent,
UploadButtonComponent,
FileUploadingDialogComponent
FileUploadingDialogComponent,
FileUploadingListComponent
];
export const ALFRESCO_ULPOAD_DIRECTIVES: [any] = [

View File

@@ -15,9 +15,6 @@
* limitations under the License.
*/
import { ViewerComponent } from './src/componets/viewer.component';
import { RenderingQueueServices } from './src/services/rendering-queue.services';
/**
* ng2-alfresco-viewer, provide components to view files.
*
@@ -27,16 +24,26 @@ import { RenderingQueueServices } from './src/services/rendering-queue.services'
* </alfresco-viewer>
*/
import { ViewerComponent } from './src/componets/viewer.component';
import { RenderingQueueServices } from './src/services/rendering-queue.services';
import { ImgViewerComponent } from './src/componets/imgViewer.component';
import { MediaPlayerComponent } from './src/componets/mediaPlayer.component';
import { NotSupportedFormat } from './src/componets/notSupportedFormat.component';
import { PdfViewerComponent } from './src/componets/pdfViewer.component';
export * from './src/componets/viewer.component';
export * from './src/services/rendering-queue.services';
export default {
components: [ViewerComponent],
directives: [RenderingQueueServices]
};
export * from './src/componets/imgViewer.component';
export * from './src/componets/mediaPlayer.component';
export * from './src/componets/notSupportedFormat.component';
export * from './src/componets/pdfViewer.component';
export const VIEWERCOMPONENT: [any] = [
ViewerComponent
ViewerComponent,
ImgViewerComponent,
MediaPlayerComponent,
NotSupportedFormat,
PdfViewerComponent
];
export const ALFRESCO_VIEWER_SERVICES: [any] = [

View File

@@ -32,6 +32,9 @@ export class MediaPlayerComponent {
@Input()
mimeType: string;
@Input()
nameFile: string;
ngOnChanges(changes) {
if (!this.urlFile) {
throw new Error('Attribute urlFile is required');