mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
webscript component viewer
This commit is contained in:
10
ng2-components/ng2-alfresco-webscript/demo/.editorconfig
Normal file
10
ng2-components/ng2-alfresco-webscript/demo/.editorconfig
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
root = true
|
||||
|
||||
[{src,scripts}/**.{ts,json,js}]
|
||||
end_of_line = crlf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
6
ng2-components/ng2-alfresco-webscript/demo/.gitignore
vendored
Normal file
6
ng2-components/ng2-alfresco-webscript/demo/.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
typings/
|
||||
node_modules/
|
||||
.idea
|
||||
dist/
|
||||
!systemjs.config.js
|
||||
!browser-sync-config.js
|
19
ng2-components/ng2-alfresco-webscript/demo/README.md
Normal file
19
ng2-components/ng2-alfresco-webscript/demo/README.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# ng2-alfresco-webscript - Demo
|
||||
|
||||
* To install dependencies
|
||||
|
||||
```sh
|
||||
$ npm install
|
||||
```
|
||||
|
||||
* To provide a live demo
|
||||
|
||||
```sh
|
||||
$ npm run start
|
||||
```
|
||||
|
||||
* To clean npm_modules and typings folder
|
||||
|
||||
```sh
|
||||
$ npm run clean
|
||||
```
|
39
ng2-components/ng2-alfresco-webscript/demo/index.html
Normal file
39
ng2-components/ng2-alfresco-webscript/demo/index.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Alfresco Angular 2 Web Script - Demo</title>
|
||||
<base href="./">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<!-- Google Material Design Lite -->
|
||||
<link rel="stylesheet" href="node_modules/material-design-lite/material.min.css">
|
||||
<script src="node_modules/material-design-lite/material.min.js"></script>
|
||||
<link rel="stylesheet" href="node_modules/material-design-icons/iconfont/material-icons.css">
|
||||
|
||||
<!-- 1. Load libraries -->
|
||||
<!-- Polyfill(s) for older browsers -->
|
||||
<script src="node_modules/core-js/client/shim.min.js"></script>
|
||||
|
||||
<script src="node_modules/zone.js/dist/zone.js"></script>
|
||||
<script src="node_modules/reflect-metadata/Reflect.js"></script>
|
||||
<script src="node_modules/systemjs/dist/system.src.js"></script>
|
||||
|
||||
<!-- Additional Alfresco libraries -->
|
||||
<script src="node_modules/alfresco-js-api/dist/alfresco-js-api.js"></script>
|
||||
|
||||
<script src="systemjs.config.js"></script>
|
||||
<script>
|
||||
System.import('app').catch(
|
||||
function (err) {
|
||||
console.error(err);
|
||||
});
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<alfresco-webscript-demo></alfresco-webscript-demo>
|
||||
|
||||
</body>
|
||||
</html>
|
65
ng2-components/ng2-alfresco-webscript/demo/package.json
Normal file
65
ng2-components/ng2-alfresco-webscript/demo/package.json
Normal file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"name": "ng2-alfresco-webscript-demo",
|
||||
"description": "Alfresco Angular2 Viewer - Demo",
|
||||
"version": "0.2.0",
|
||||
"author": "Alfresco Software, Ltd.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist node_modules typings",
|
||||
"typings": "typings install",
|
||||
"postinstall": "npm run typings && npm run build",
|
||||
"start": "concurrently \"npm run build:w\" \"npm run server\" ",
|
||||
"server": "wsrv -o -s -l",
|
||||
"build": "npm run tslint && rimraf dist && tsc",
|
||||
"build:w": "npm run tslint && rimraf dist && tsc -w",
|
||||
"tslint": "npm run tslint-src && npm run tslint-root",
|
||||
"tslint-src": "tslint -c tslint.json src/{,**/}**.ts",
|
||||
"tslint-root": "tslint -c tslint.json *.ts"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"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",
|
||||
"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",
|
||||
|
||||
"material-design-icons": "2.2.3",
|
||||
"material-design-lite": "1.1.3",
|
||||
|
||||
"alfresco-js-api": "^0.2.0",
|
||||
|
||||
"ng2-translate": "2.2.2",
|
||||
"ng2-alfresco-core": "^0.2.0",
|
||||
"ng2-alfresco-datatable": "^0.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"concurrently": "2.0.0",
|
||||
"rimraf": "2.5.2",
|
||||
"tslint": "3.8.1",
|
||||
"typescript": "1.8.10",
|
||||
"typings": "1.0.4",
|
||||
"wsrv": "0.1.3"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Eugenio Romano",
|
||||
"email": "eugenio.romano@alfresco.com"
|
||||
}
|
||||
],
|
||||
"keywords": [
|
||||
"angular2",
|
||||
"typescript",
|
||||
"alfresco"
|
||||
]
|
||||
}
|
115
ng2-components/ng2-alfresco-webscript/demo/src/main.ts
Normal file
115
ng2-components/ng2-alfresco-webscript/demo/src/main.ts
Normal file
@@ -0,0 +1,115 @@
|
||||
/*!
|
||||
* @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 { Component, OnInit } from '@angular/core';
|
||||
import { bootstrap } from '@angular/platform-browser-dynamic';
|
||||
import { HTTP_PROVIDERS } from '@angular/http';
|
||||
|
||||
import {
|
||||
ALFRESCO_CORE_PROVIDERS,
|
||||
AlfrescoSettingsService,
|
||||
AlfrescoAuthenticationService
|
||||
} from 'ng2-alfresco-core';
|
||||
|
||||
import { WEBSCRIPTCOMPONENT } from 'ng2-alfresco-webscript';
|
||||
|
||||
@Component({
|
||||
selector: 'alfresco-webscript-demo',
|
||||
template: `
|
||||
<label for="token"><b>Insert a valid access token / ticket:</b></label><br>
|
||||
<input id="token" type="text" size="48" (change)="updateToken();documentList.reload()" [(ngModel)]="token"><br>
|
||||
<label for="token"><b>Insert the ip of your Alfresco instance:</b></label><br>
|
||||
<input id="token" type="text" size="48" (change)="updateHost();documentList.reload()" [(ngModel)]="host"><br><br>
|
||||
<div *ngIf="!authenticated" style="color:#FF2323">
|
||||
Authentication failed to ip {{ host }} with user: admin, admin, you can still try to add a valid token to perform
|
||||
operations.
|
||||
</div>
|
||||
<hr>
|
||||
<label for="token"><b>Insert a scriptPath</b></label><br>
|
||||
<input id="token" type="text" size="48" [(ngModel)]="scriptPath"><br>
|
||||
<label for="token"><b>Insert a contextRoot</b></label><br>
|
||||
<input id="token" type="text" size="48" [(ngModel)]="contextRoot"><br>
|
||||
<label for="token"><b>Insert a servicePath</b></label><br>
|
||||
<input id="token" type="text" size="48" [(ngModel)]="servicePath"><br>
|
||||
<div class="container" *ngIf="authenticated">
|
||||
<alfresco-webscript-get [scriptPath]="scriptPath"
|
||||
[scriptArgs]="scriptArgs"
|
||||
[contextRoot]="contextRoot"
|
||||
[servicePath]="servicePath"
|
||||
[contentType]="'HTM'"></alfresco-webscript-get>
|
||||
</div>
|
||||
`,
|
||||
directives: [WEBSCRIPTCOMPONENT]
|
||||
})
|
||||
class WebscriptDemo implements OnInit {
|
||||
|
||||
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 = '';
|
||||
|
||||
token: string;
|
||||
|
||||
constructor(private authService: AlfrescoAuthenticationService,
|
||||
private alfrescoSettingsService: AlfrescoSettingsService) {
|
||||
|
||||
alfrescoSettingsService.host = this.host;
|
||||
if (this.authService.getTicket()) {
|
||||
this.token = this.authService.getTicket();
|
||||
}
|
||||
}
|
||||
|
||||
public updateToken(): void {
|
||||
localStorage.setItem('token', this.token);
|
||||
}
|
||||
|
||||
public updateHost(): void {
|
||||
this.alfrescoSettingsService.host = this.host;
|
||||
this.login();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.login();
|
||||
}
|
||||
|
||||
login() {
|
||||
this.authService.login('admin', 'admin', ['ECM']).subscribe(
|
||||
token => {
|
||||
console.log(token);
|
||||
this.token = token;
|
||||
this.authenticated = true;
|
||||
},
|
||||
error => {
|
||||
console.log(error);
|
||||
this.authenticated = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
bootstrap(WebscriptDemo, [
|
||||
HTTP_PROVIDERS,
|
||||
ALFRESCO_CORE_PROVIDERS
|
||||
]);
|
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* System configuration for Angular 2 samples
|
||||
* Adjust as necessary for your application needs.
|
||||
*/
|
||||
(function(global) {
|
||||
// map tells the System loader where to look for things
|
||||
var map = {
|
||||
'app': 'dist', // 'dist',
|
||||
'@angular': 'node_modules/@angular',
|
||||
'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
|
||||
'rxjs': 'node_modules/rxjs',
|
||||
|
||||
'ng2-translate': 'node_modules/ng2-translate',
|
||||
'ng2-alfresco-core': 'node_modules/ng2-alfresco-core/dist',
|
||||
'ng2-alfresco-datatable': 'node_modules/ng2-alfresco-datatable/dist',
|
||||
'ng2-alfresco-webscript': 'node_modules/ng2-alfresco-webscript/dist'
|
||||
};
|
||||
// packages tells the System loader how to load when no filename and/or no extension
|
||||
var packages = {
|
||||
'app': { main: 'main.js', defaultExtension: 'js' },
|
||||
'rxjs': { defaultExtension: 'js' },
|
||||
'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' },
|
||||
|
||||
'ng2-translate': { defaultExtension: 'js' },
|
||||
'ng2-alfresco-core': { main: 'index.js', defaultExtension: 'js' },
|
||||
'ng2-alfresco-datatable': { main: 'index.js', defaultExtension: 'js' },
|
||||
'ng2-alfresco-webscript': { main: 'index.js', defaultExtension: 'js' }
|
||||
};
|
||||
var ngPackageNames = [
|
||||
'common',
|
||||
'compiler',
|
||||
'core',
|
||||
'http',
|
||||
'platform-browser',
|
||||
'platform-browser-dynamic',
|
||||
'router',
|
||||
'router-deprecated',
|
||||
'upgrade'
|
||||
];
|
||||
// Individual files (~300 requests):
|
||||
function packIndex(pkgName) {
|
||||
packages['@angular/'+pkgName] = { main: 'index.js', defaultExtension: 'js' };
|
||||
}
|
||||
// Bundled (~40 requests):
|
||||
function packUmd(pkgName) {
|
||||
packages['@angular/'+pkgName] = { main: '/bundles/' + pkgName + '.umd.js', defaultExtension: 'js' };
|
||||
}
|
||||
// Most environments should use UMD; some (Karma) need the individual index files
|
||||
var setPackageConfig = System.packageWithIndex ? packIndex : packUmd;
|
||||
// Add package entries for angular packages
|
||||
ngPackageNames.forEach(setPackageConfig);
|
||||
var config = {
|
||||
map: map,
|
||||
packages: packages
|
||||
};
|
||||
System.config(config);
|
||||
})(this);
|
19
ng2-components/ng2-alfresco-webscript/demo/tsconfig.json
Normal file
19
ng2-components/ng2-alfresco-webscript/demo/tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "system",
|
||||
"moduleResolution": "node",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"sourceMap": true,
|
||||
"removeComments": true,
|
||||
"declaration": true,
|
||||
"outDir": "dist"
|
||||
},
|
||||
"exclude": [
|
||||
"dist",
|
||||
"node_modules",
|
||||
"typings/main",
|
||||
"typings/main.d.ts"
|
||||
]
|
||||
}
|
124
ng2-components/ng2-alfresco-webscript/demo/tslint.json
Normal file
124
ng2-components/ng2-alfresco-webscript/demo/tslint.json
Normal file
@@ -0,0 +1,124 @@
|
||||
{
|
||||
"rules": {
|
||||
"align": [
|
||||
true,
|
||||
"parameters",
|
||||
"arguments",
|
||||
"statements"
|
||||
],
|
||||
"ban": false,
|
||||
"class-name": true,
|
||||
"comment-format": [
|
||||
true,
|
||||
"check-space",
|
||||
"check-lowercase"
|
||||
],
|
||||
"curly": true,
|
||||
"eofline": true,
|
||||
"forin": true,
|
||||
"indent": [
|
||||
true,
|
||||
"spaces"
|
||||
],
|
||||
"interface-name": false,
|
||||
"jsdoc-format": true,
|
||||
"label-position": true,
|
||||
"label-undefined": true,
|
||||
"max-line-length": [
|
||||
true,
|
||||
140
|
||||
],
|
||||
"member-ordering": [
|
||||
true,
|
||||
"public-before-private",
|
||||
"static-before-instance",
|
||||
"variables-before-functions"
|
||||
],
|
||||
"no-any": false,
|
||||
"no-arg": true,
|
||||
"no-bitwise": true,
|
||||
"no-conditional-assignment": true,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-console": [
|
||||
true,
|
||||
"debug",
|
||||
"info",
|
||||
"time",
|
||||
"timeEnd",
|
||||
"trace"
|
||||
],
|
||||
"no-construct": true,
|
||||
"no-constructor-vars": false,
|
||||
"no-debugger": true,
|
||||
"no-duplicate-key": true,
|
||||
"no-duplicate-variable": true,
|
||||
"no-empty": true,
|
||||
"no-eval": true,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": true,
|
||||
"no-require-imports": true,
|
||||
"no-shadowed-variable": true,
|
||||
"no-switch-case-fall-through": true,
|
||||
"no-trailing-whitespace": true,
|
||||
"no-unreachable": true,
|
||||
"no-unused-expression": true,
|
||||
"no-unused-variable": true,
|
||||
"no-use-before-declare": true,
|
||||
"no-var-keyword": true,
|
||||
"no-var-requires": true,
|
||||
"object-literal-sort-keys": false,
|
||||
"one-line": [
|
||||
true,
|
||||
"check-open-brace",
|
||||
"check-catch",
|
||||
"check-else",
|
||||
"check-whitespace"
|
||||
],
|
||||
"quotemark": [
|
||||
true,
|
||||
"single",
|
||||
"avoid-escape"
|
||||
],
|
||||
"radix": true,
|
||||
"semicolon": true,
|
||||
"switch-default": true,
|
||||
"trailing-comma": [
|
||||
true,
|
||||
{
|
||||
"multiline": "never",
|
||||
"singleline": "never"
|
||||
}
|
||||
],
|
||||
"triple-equals": [
|
||||
true,
|
||||
"allow-null-check"
|
||||
],
|
||||
"typedef": false,
|
||||
"typedef-whitespace": [
|
||||
true,
|
||||
{
|
||||
"call-signature": "nospace",
|
||||
"index-signature": "nospace",
|
||||
"parameter": "nospace",
|
||||
"property-declaration": "nospace",
|
||||
"variable-declaration": "nospace"
|
||||
}
|
||||
],
|
||||
"use-strict": false,
|
||||
"variable-name": [
|
||||
true,
|
||||
"check-format",
|
||||
"allow-leading-underscore",
|
||||
"ban-keywords"
|
||||
],
|
||||
"whitespace": [
|
||||
true,
|
||||
"check-branch",
|
||||
"check-operator",
|
||||
"check-separator",
|
||||
"check-type",
|
||||
"check-module",
|
||||
"check-decl"
|
||||
]
|
||||
}
|
||||
}
|
7
ng2-components/ng2-alfresco-webscript/demo/typings.json
Normal file
7
ng2-components/ng2-alfresco-webscript/demo/typings.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"globalDependencies": {
|
||||
"core-js": "registry:dt/core-js#0.0.0+20160317120654",
|
||||
"jasmine": "registry:dt/jasmine#2.2.0+20160505161446",
|
||||
"node": "registry:dt/node#4.0.0+20160509154515"
|
||||
}
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"watch": [
|
||||
"node_modules/ng2-alfresco-datatable/dist/**/*.{html,htm,css,js}"
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user