mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
add alfresco core in viewer
This commit is contained in:
@@ -38,6 +38,9 @@
|
|||||||
"material-design-lite": "1.1.3",
|
"material-design-lite": "1.1.3",
|
||||||
"pdfjs-dist": "1.5.258",
|
"pdfjs-dist": "1.5.258",
|
||||||
|
|
||||||
|
"ng2-alfresco-core": "^0.2.0",
|
||||||
|
"ng2-translate": "2.2.2",
|
||||||
|
"alfresco-js-api": "^0.2.0",
|
||||||
"ng2-alfresco-viewer" : "file:../"
|
"ng2-alfresco-viewer" : "file:../"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
|
'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
|
||||||
'rxjs': 'node_modules/rxjs',
|
'rxjs': 'node_modules/rxjs',
|
||||||
|
|
||||||
|
'ng2-alfresco-core': 'node_modules/ng2-alfresco-core/dist',
|
||||||
'ng2-alfresco-viewer': 'node_modules/ng2-alfresco-viewer/dist'
|
'ng2-alfresco-viewer': 'node_modules/ng2-alfresco-viewer/dist'
|
||||||
};
|
};
|
||||||
// packages tells the System loader how to load when no filename and/or no extension
|
// packages tells the System loader how to load when no filename and/or no extension
|
||||||
@@ -18,6 +19,7 @@
|
|||||||
'rxjs': { defaultExtension: 'js' },
|
'rxjs': { defaultExtension: 'js' },
|
||||||
'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' },
|
'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' },
|
||||||
|
|
||||||
|
'ng2-alfresco-core': { main: 'index.js', defaultExtension: 'js' },
|
||||||
'ng2-alfresco-viewer': { main: 'index.js', defaultExtension: 'js' }
|
'ng2-alfresco-viewer': { main: 'index.js', defaultExtension: 'js' }
|
||||||
};
|
};
|
||||||
var ngPackageNames = [
|
var ngPackageNames = [
|
||||||
|
@@ -8,12 +8,16 @@ __karma__.loaded = function() {};
|
|||||||
var map = {
|
var map = {
|
||||||
'app': 'base/dist',
|
'app': 'base/dist',
|
||||||
'rxjs': 'base/node_modules/rxjs',
|
'rxjs': 'base/node_modules/rxjs',
|
||||||
'@angular': 'base/node_modules/@angular'
|
'ng2-alfresco-core': '/base/node_modules/ng2-alfresco-core/dist',
|
||||||
|
'@angular': 'base/node_modules/@angular',
|
||||||
|
'ng2-translate' : '/base/node_modules/ng2-translate'
|
||||||
};
|
};
|
||||||
|
|
||||||
var packages = {
|
var packages = {
|
||||||
'app': { main: 'main.js', defaultExtension: 'js' },
|
'app': { main: 'main.js', defaultExtension: 'js' },
|
||||||
'rxjs': { defaultExtension: 'js' }
|
'ng2-alfresco-core': { main: 'index.js', defaultExtension: 'js' },
|
||||||
|
'rxjs': { defaultExtension: 'js' },
|
||||||
|
'ng2-translate': { defaultExtension: 'js' }
|
||||||
};
|
};
|
||||||
|
|
||||||
var packageNames = [
|
var packageNames = [
|
||||||
|
@@ -16,6 +16,10 @@ module.exports = function (config) {
|
|||||||
{pattern: 'node_modules/@angular/**/*.js', included: false, watched: false},
|
{pattern: 'node_modules/@angular/**/*.js', included: false, watched: false},
|
||||||
{pattern: 'node_modules/@angular/**/*.map', included: false, watched: false},
|
{pattern: 'node_modules/@angular/**/*.map', included: false, watched: false},
|
||||||
|
|
||||||
|
{pattern: 'node_modules/ng2-alfresco-core/dist/**/*.js', included: false, served: true, watched: false},
|
||||||
|
{pattern: 'node_modules/ng2-translate/**/*.js', included: false, served: true, watched: false},
|
||||||
|
{pattern: 'node_modules/alfresco-js-api/dist/alfresco-js-api.js', included: true, watched: false},
|
||||||
|
|
||||||
{pattern: 'karma-test-shim.js', included: true, watched: true},
|
{pattern: 'karma-test-shim.js', included: true, watched: true},
|
||||||
|
|
||||||
// paths loaded via module imports
|
// paths loaded via module imports
|
||||||
@@ -61,7 +65,7 @@ module.exports = function (config) {
|
|||||||
|
|
||||||
// Coverage reporter generates the coverage
|
// Coverage reporter generates the coverage
|
||||||
reporters: ['mocha', 'coverage', 'coveralls', 'kjhtml'],
|
reporters: ['mocha', 'coverage', 'coveralls', 'kjhtml'],
|
||||||
|
|
||||||
// Source files that you wanna generate coverage for.
|
// Source files that you wanna generate coverage for.
|
||||||
// Do not include tests or libraries (these files will be instrumented by Istanbul)
|
// Do not include tests or libraries (these files will be instrumented by Istanbul)
|
||||||
preprocessors: {
|
preprocessors: {
|
||||||
@@ -74,7 +78,7 @@ module.exports = function (config) {
|
|||||||
reporters: [
|
reporters: [
|
||||||
{type: 'text'},
|
{type: 'text'},
|
||||||
{type: 'json', file: 'coverage-final.json'},
|
{type: 'json', file: 'coverage-final.json'},
|
||||||
{type: 'html'},
|
{type: 'html'},
|
||||||
{type: 'lcov'}
|
{type: 'lcov'}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@@ -58,6 +58,11 @@
|
|||||||
"@angular/router": "3.0.0-alpha.7",
|
"@angular/router": "3.0.0-alpha.7",
|
||||||
"@angular/router-deprecated": "2.0.0-rc.2",
|
"@angular/router-deprecated": "2.0.0-rc.2",
|
||||||
"@angular/upgrade": "2.0.0-rc.3",
|
"@angular/upgrade": "2.0.0-rc.3",
|
||||||
|
|
||||||
|
"ng2-alfresco-core": "0.2.0",
|
||||||
|
"ng2-translate": "2.2.2",
|
||||||
|
"alfresco-js-api": "^0.2.0",
|
||||||
|
|
||||||
"systemjs": "0.19.27",
|
"systemjs": "0.19.27",
|
||||||
"core-js": "2.4.0",
|
"core-js": "2.4.0",
|
||||||
"reflect-metadata": "0.1.3",
|
"reflect-metadata": "0.1.3",
|
||||||
|
@@ -0,0 +1,36 @@
|
|||||||
|
/*!
|
||||||
|
* @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';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class AlfrescoSettingsServiceMock {
|
||||||
|
|
||||||
|
static DEFAULT_HOST_ADDRESS: string = 'fakehost';
|
||||||
|
|
||||||
|
private providers: string[] = ['ECM', 'BPM'];
|
||||||
|
|
||||||
|
private _host: string = AlfrescoSettingsServiceMock.DEFAULT_HOST_ADDRESS;
|
||||||
|
|
||||||
|
public get ecmHost(): string {
|
||||||
|
return this._host;
|
||||||
|
}
|
||||||
|
|
||||||
|
getProviders(): string [] {
|
||||||
|
return this.providers;
|
||||||
|
}
|
||||||
|
}
|
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { describe, expect, it, inject } from '@angular/core/testing';
|
import { describe, expect, it, inject, beforeEachProviders } from '@angular/core/testing';
|
||||||
import { TestComponentBuilder } from '@angular/compiler/testing';
|
import { TestComponentBuilder } from '@angular/compiler/testing';
|
||||||
|
|
||||||
import { PdfViewerComponent } from './pdfViewer.component';
|
import { PdfViewerComponent } from './pdfViewer.component';
|
||||||
@@ -23,8 +23,20 @@ import { PDFJSmock } from './assets/PDFJS.mock';
|
|||||||
import { PDFViewermock } from './assets/PDFViewer.mock';
|
import { PDFViewermock } from './assets/PDFViewer.mock';
|
||||||
import { EventMock } from './assets/event.mock';
|
import { EventMock } from './assets/event.mock';
|
||||||
|
|
||||||
|
import { HTTP_PROVIDERS } from '@angular/http';
|
||||||
|
import { AlfrescoSettingsServiceMock } from '../src/assets/AlfrescoSettingsService.service.mock';
|
||||||
|
import { AlfrescoAuthenticationService, AlfrescoSettingsService } from 'ng2-alfresco-core';
|
||||||
|
|
||||||
describe('PdfViewer', () => {
|
describe('PdfViewer', () => {
|
||||||
|
|
||||||
|
beforeEachProviders(() => {
|
||||||
|
return [
|
||||||
|
HTTP_PROVIDERS,
|
||||||
|
{provide: AlfrescoSettingsService, useClass: AlfrescoSettingsServiceMock},
|
||||||
|
{provide: AlfrescoAuthenticationService, useClass: AlfrescoAuthenticationService}
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
describe('View', () => {
|
describe('View', () => {
|
||||||
it('Canvas should be present', inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
it('Canvas should be present', inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||||
return tcb
|
return tcb
|
||||||
|
@@ -15,13 +15,25 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {describe, expect, it, inject } from '@angular/core/testing';
|
import { describe, expect, it, inject, beforeEachProviders } from '@angular/core/testing';
|
||||||
import { TestComponentBuilder } from '@angular/compiler/testing';
|
import { TestComponentBuilder } from '@angular/compiler/testing';
|
||||||
import { ViewerComponent } from './viewer.component';
|
import { ViewerComponent } from './viewer.component';
|
||||||
import { EventMock } from './assets/event.mock';
|
import { EventMock } from './assets/event.mock';
|
||||||
|
|
||||||
|
import { HTTP_PROVIDERS } from '@angular/http';
|
||||||
|
import { AlfrescoSettingsServiceMock } from '../src/assets/AlfrescoSettingsService.service.mock';
|
||||||
|
import { AlfrescoAuthenticationService, AlfrescoSettingsService } from 'ng2-alfresco-core';
|
||||||
|
|
||||||
describe('ViewerComponent', () => {
|
describe('ViewerComponent', () => {
|
||||||
|
|
||||||
|
beforeEachProviders(() => {
|
||||||
|
return [
|
||||||
|
HTTP_PROVIDERS,
|
||||||
|
{provide: AlfrescoSettingsService, useClass: AlfrescoSettingsServiceMock},
|
||||||
|
{provide: AlfrescoAuthenticationService, useClass: AlfrescoAuthenticationService}
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
describe('View', () => {
|
describe('View', () => {
|
||||||
it('shadow overlay should be present if is overlay mode', inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
it('shadow overlay should be present if is overlay mode', inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||||
return tcb
|
return tcb
|
||||||
|
@@ -20,6 +20,7 @@ import { PdfViewerComponent } from './pdfViewer.component';
|
|||||||
import { ImgViewerComponent } from './imgViewer.component';
|
import { ImgViewerComponent } from './imgViewer.component';
|
||||||
import { NotSupportedFormat } from './notSupportedFormat.component';
|
import { NotSupportedFormat } from './notSupportedFormat.component';
|
||||||
import { DOCUMENT } from '@angular/platform-browser';
|
import { DOCUMENT } from '@angular/platform-browser';
|
||||||
|
import { AlfrescoAuthenticationService} from 'ng2-alfresco-core';
|
||||||
|
|
||||||
declare let __moduleName: string;
|
declare let __moduleName: string;
|
||||||
|
|
||||||
@@ -38,6 +39,9 @@ export class ViewerComponent {
|
|||||||
@Input()
|
@Input()
|
||||||
fileName: string = null;
|
fileName: string = null;
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
fileNodeId: string = null;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
mimeType: string = null;
|
mimeType: string = null;
|
||||||
|
|
||||||
@@ -56,7 +60,7 @@ export class ViewerComponent {
|
|||||||
|
|
||||||
extension: string;
|
extension: string;
|
||||||
|
|
||||||
constructor(private element: ElementRef, @Inject(DOCUMENT) private document) {
|
constructor(private authService: AlfrescoAuthenticationService, private element: ElementRef, @Inject(DOCUMENT) private document) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes) {
|
ngOnChanges(changes) {
|
||||||
@@ -71,7 +75,11 @@ export class ViewerComponent {
|
|||||||
let filenameFromUrl = this.getFilenameFromUrl(this.urlFile);
|
let filenameFromUrl = this.getFilenameFromUrl(this.urlFile);
|
||||||
this.displayName = this.fileName !== null ? this.fileName : filenameFromUrl;
|
this.displayName = this.fileName !== null ? this.fileName : filenameFromUrl;
|
||||||
this.extension = this.getFileExtension(filenameFromUrl);
|
this.extension = this.getFileExtension(filenameFromUrl);
|
||||||
|
} else if (this.fileNodeId) {
|
||||||
|
console.log('call api');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user