diff --git a/demo-shell-ng2/app/components/about/about.component.html b/demo-shell-ng2/app/components/about/about.component.html index 556f7a350a..cc57e82a5c 100644 --- a/demo-shell-ng2/app/components/about/about.component.html +++ b/demo-shell-ng2/app/components/about/about.component.html @@ -1,4 +1,10 @@
diff --git a/demo-shell-ng2/app/components/about/about.component.ts b/demo-shell-ng2/app/components/about/about.component.ts index f7706caff0..137fb03c28 100644 --- a/demo-shell-ng2/app/components/about/about.component.ts +++ b/demo-shell-ng2/app/components/about/about.component.ts @@ -29,6 +29,8 @@ export class AboutComponent implements OnInit { data: ObjectDataTableAdapter; + githubUrlCommitAlpha: string = 'https://github.com/Alfresco/alfresco-ng2-components/commits/'; + constructor(private http: Http, private logService: LogService) { } @@ -42,18 +44,38 @@ export class AboutComponent implements OnInit { return regexp.test(val); }); - let alfrescoPackagesTableRappresentation = []; + let alfrescoPackagesTableRepresentation = []; alfrescoPackages.forEach((val) => { this.logService.log(response.json().dependencies[val]); - alfrescoPackagesTableRappresentation.push({name: val, version: response.json().dependencies[val].version}); + alfrescoPackagesTableRepresentation.push({ + name: val, + version: response.json().dependencies[val].version + }); }); - this.logService.log(alfrescoPackagesTableRappresentation); + this.gitHubLinkCreation(alfrescoPackagesTableRepresentation); - this.data = new ObjectDataTableAdapter(alfrescoPackagesTableRappresentation, [ + this.logService.log(alfrescoPackagesTableRepresentation); + + this.data = new ObjectDataTableAdapter(alfrescoPackagesTableRepresentation, [ {type: 'text', key: 'name', title: 'Name', sortable: true}, {type: 'text', key: 'version', title: 'Version', sortable: true} ]); }); } + + private gitHubLinkCreation(alfrescoPackagesTableRepresentation): void { + let corePackage = alfrescoPackagesTableRepresentation.find((packageUp) => { + return packageUp.name === 'ng2-alfresco-core'; + }); + + if (corePackage) { + let commitIsh = corePackage.version.split('-'); + if (commitIsh.length > 1) { + this.githubUrlCommitAlpha = this.githubUrlCommitAlpha + commitIsh; + } else { + this.githubUrlCommitAlpha = this.githubUrlCommitAlpha + corePackage.version; + } + } + } }