#455 about page with alfresco packages versions

This commit is contained in:
Denys Vuika
2016-07-22 11:52:17 +01:00
parent 4f86f04a29
commit e370d7feee
5 changed files with 83 additions and 17 deletions

View File

@@ -15,10 +15,11 @@
<a class="mdl-navigation__link" data-automation-id="files" href="" [routerLink]="['Files']">DocumentList</a>
<a class="mdl-navigation__link" data-automation-id="datatable" href="" [routerLink]="['DataTable']">DataTable</a>
<a class="mdl-navigation__link" data-automation-id="uploader" href="" [routerLink]="['Uploader']">Uploader</a>
<a class="mdl-navigation__link" data-automation-id="tasks" href="" [routerLink]="['Activiti']">Activiti</a>
<a class="mdl-navigation__link" data-automation-id="activiti" href="" [routerLink]="['Activiti']">Activiti</a>
<a class="mdl-navigation__link" data-automation-id="tasks" href="" [routerLink]="['Tasks']">Tasks</a>
<a class="mdl-navigation__link" data-automation-id="webscript" href="" [routerLink]="['Webscript']">Webscript</a>
<a class="mdl-navigation__link" data-automation-id="login" href="" [routerLink]="['Login']">Login</a>
<a class="mdl-navigation__link" data-automation-id="about" href="" [routerLink]="['About']">About</a>
</nav>
<!-- Right aligned menu below button -->
@@ -48,6 +49,7 @@
<a class="mdl-navigation__link" href="" [routerLink]="['Activiti']" (click)="hideDrawer()">Activiti Components Demo</a>
<a class="mdl-navigation__link" href="" [routerLink]="['Tasks']" (click)="hideDrawer()">Activiti Tasks Demo</a>
<a class="mdl-navigation__link" href="" [routerLink]="['Webscript']" (click)="hideDrawer()">Webscript</a>
<a class="mdl-navigation__link" href="" [routerLink]="['About']" (click)="hideDrawer()">About</a>
</nav>
</div>
<main class="mdl-layout__content">

View File

@@ -34,6 +34,7 @@ import { LoginDemoComponent } from './components/login/login-demo.component';
import { TasksDemoComponent } from './components/tasks/tasks-demo.component';
import { ActivitiDemoComponent } from './components/activiti/activiti-demo.component';
import { WebscriptComponent } from './components/webscript/webscript.component';
import { AboutComponent } from './components/about/about.component';
declare var document: any;
@@ -54,7 +55,8 @@ declare var document: any;
{ path: '/search', name: 'Search', component: SearchComponent },
{ path: '/tasks', name: 'Tasks', component: TasksDemoComponent },
{ path: '/activiti', name: 'Activiti', component: ActivitiDemoComponent },
{path: '/webscript', name: 'Webscript', component: WebscriptComponent}
{ path: '/webscript', name: 'Webscript', component: WebscriptComponent },
{ path: '/about', name: 'About', component: AboutComponent }
])
export class AppComponent {
translate: AlfrescoTranslationService;

View File

@@ -0,0 +1,4 @@
<div style="padding: 10px">
<h3>Packages</h3>
<alfresco-datatable [data]="data"></alfresco-datatable>
</div>

View File

@@ -0,0 +1,55 @@
/*!
* @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 { Http } from '@angular/http';
import {
ALFRESCO_DATATABLE_DIRECTIVES,
ObjectDataTableAdapter /*,
DataSorting,
ObjectDataRow,
ObjectDataColumn*/
} from 'ng2-alfresco-datatable';
declare let __moduleName: string;
@Component({
moduleId: __moduleName,
selector: 'about-page',
templateUrl: './about.component.html',
directives: [ALFRESCO_DATATABLE_DIRECTIVES]
})
export class AboutComponent implements OnInit {
data: ObjectDataTableAdapter;
constructor(private http: Http) {}
ngOnInit() {
// this.data = new ObjectDataTableAdapter();
this.http.get('/versions').subscribe(response => {
let data = response.json() || {};
let packages = data.packages || [];
this.data = new ObjectDataTableAdapter(packages, [
{ type: 'text', key: 'name', title: 'Name', sortable: true },
{ type: 'text', key: 'version', title: 'Version', sortable: true }
]);
});
}
}

View File

@@ -20,13 +20,16 @@ exports.register = function (server, options, next) {
method: 'GET',
path: '/versions',
handler: function (request, reply) {
var result = {
packages: packages.map(function (packageName) {
return {
name: packageName,
version: require('./../node_modules/' + packageName + '/package.json').version
}
})
};
var result = {};
packages.map(function (packageName) {
result[packageName] = require('./../node_modules/' + packageName + '/package.json').version
});
reply(result);
return reply(result).type('application/json');
}
});