mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-487] added discovery information to about component (#2102)
* [ADF-487] - added discovery service to core * [ADF-487]- added activiti about call * [ADF-487] added discovery info into about component * [ADF-487] removed wrong console log * [ADF-487] fixed problem on index
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
.about-container {
|
.about-container {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.adf-table-version {
|
||||||
|
width: 60%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
@@ -10,6 +10,93 @@
|
|||||||
Alfresco Content Services URL: <strong>{{ ecmHost }}</strong>
|
Alfresco Content Services URL: <strong>{{ ecmHost }}</strong>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h3>Product Versions</h3>
|
||||||
|
<div *ngIf="bpmVersion">
|
||||||
|
<h3>BPM</h3>
|
||||||
|
<label> Edition </label>
|
||||||
|
<p> {{ bpmVersion.edition }}</p>
|
||||||
|
<table border="2" class="adf-table-version">
|
||||||
|
<tr>
|
||||||
|
<th>Major Version</th>
|
||||||
|
<th>Revision Version</th>
|
||||||
|
<th>Minor Version</th>
|
||||||
|
<th>Type</th>
|
||||||
|
</tr>
|
||||||
|
<tr style="align-items: center">
|
||||||
|
<td>{{ bpmVersion.majorVersion }}</td>
|
||||||
|
<td>{{ bpmVersion.revisionVersion }}</td>
|
||||||
|
<td>{{ bpmVersion.minorVersion }}</td>
|
||||||
|
<td>{{ bpmVersion.type }}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="ecmVersion">
|
||||||
|
<h3>ECM</h3>
|
||||||
|
<label> Edition </label>
|
||||||
|
<p> {{ ecmVersion.edition }}</p>
|
||||||
|
<label> Version </label>
|
||||||
|
<p> {{ ecmVersion.version.display }}</p>
|
||||||
|
<h4>License</h4>
|
||||||
|
<table border="2" class="adf-table-version">
|
||||||
|
<tr>
|
||||||
|
<th> Issued At </th>
|
||||||
|
<th> Expires At </th>
|
||||||
|
<th> Remaining Days </th>
|
||||||
|
<th> Holder </th>
|
||||||
|
<th> Mode </th>
|
||||||
|
<th> Is Cluster Enabled </th>
|
||||||
|
<th> Is Cryptodoc Enable </th>
|
||||||
|
</tr>
|
||||||
|
<tr style="align-items: center">
|
||||||
|
<td>{{ ecmVersion.license.issuedAt }}</td>
|
||||||
|
<td>{{ ecmVersion.license.expiresAt }}</td>
|
||||||
|
<td>{{ ecmVersion.license.remainingDays }}</td>
|
||||||
|
<td>{{ ecmVersion.license.holder }}</td>
|
||||||
|
<td>{{ ecmVersion.license.mode }}</td>
|
||||||
|
<td>{{ ecmVersion.license.isClusterEnabled }}</td>
|
||||||
|
<td>{{ ecmVersion.license.isCryptodocEnabled }}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<h4> Status</h4>
|
||||||
|
<table border="2" class="adf-table-version">
|
||||||
|
<tr>
|
||||||
|
<th> ReadOnly </th>
|
||||||
|
<th> Is Audit Enable </th>
|
||||||
|
<th> Is quick shared enable </th>
|
||||||
|
<th> Thumbnail Generation </th>
|
||||||
|
</tr>
|
||||||
|
<tr style="align-items: center">
|
||||||
|
<td>{{ ecmVersion.status.isReadOnly }}</td>
|
||||||
|
<td>{{ ecmVersion.status.isAuditEnabled }}</td>
|
||||||
|
<td>{{ ecmVersion.status.isQuickShareEnabled }}</td>
|
||||||
|
<td>{{ ecmVersion.status.isThumbnailGenerationEnabled }}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<h4>Modules</h4>
|
||||||
|
<table border="2" class="adf-table-version">
|
||||||
|
<tr>
|
||||||
|
<th> ID </th>
|
||||||
|
<th> Title </th>
|
||||||
|
<th> Description </th>
|
||||||
|
<th> Version </th>
|
||||||
|
<th> Install Date </th>
|
||||||
|
<th> Install State </th>
|
||||||
|
<th> Version Minor </th>
|
||||||
|
<th> Version Max </th>
|
||||||
|
</tr>
|
||||||
|
<tr *ngFor="let module of ecmVersion.modules" style="align-items: center">
|
||||||
|
<td>{{ module.id }}</td>
|
||||||
|
<td>{{ module.title }}</td>
|
||||||
|
<td>{{ module.description }}</td>
|
||||||
|
<td>{{ module.version }}</td>
|
||||||
|
<td>{{ module.installDate }}</td>
|
||||||
|
<td>{{ module.installState }}</td>
|
||||||
|
<td>{{ module.versionMin }}</td>
|
||||||
|
<td>{{ module.versionMax }}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div *ngIf="githubUrlCommitAlpha">
|
<div *ngIf="githubUrlCommitAlpha">
|
||||||
<h3>Source code</h3>
|
<h3>Source code</h3>
|
||||||
<small>You are running the project based on the following commit:</small>
|
<small>You are running the project based on the following commit:</small>
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { Http } from '@angular/http';
|
import { Http } from '@angular/http';
|
||||||
import { AppConfigService, LogService } from 'ng2-alfresco-core';
|
import { AlfrescoAuthenticationService, AppConfigService, BpmProductVersionModel, DiscoveryApiService, EcmProductVersionModel, LogService } from 'ng2-alfresco-core';
|
||||||
import { ObjectDataTableAdapter } from 'ng2-alfresco-datatable';
|
import { ObjectDataTableAdapter } from 'ng2-alfresco-datatable';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -42,10 +42,21 @@ export class AboutComponent implements OnInit {
|
|||||||
|
|
||||||
constructor(private http: Http,
|
constructor(private http: Http,
|
||||||
private appConfig: AppConfigService,
|
private appConfig: AppConfigService,
|
||||||
private logService: LogService) {
|
private authService: AlfrescoAuthenticationService,
|
||||||
|
private logService: LogService,
|
||||||
|
private discovery: DiscoveryApiService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
||||||
|
this.discovery.getEcmProductInfo().subscribe((ecmVers) => {
|
||||||
|
this.ecmVersion = ecmVers;
|
||||||
|
});
|
||||||
|
|
||||||
|
this.discovery.getBpmProductInfo().subscribe((bpmVers) => {
|
||||||
|
this.bpmVersion = bpmVers;
|
||||||
|
});
|
||||||
|
|
||||||
this.http.get('/versions.json').subscribe(response => {
|
this.http.get('/versions.json').subscribe(response => {
|
||||||
let regexp = new RegExp('^(ng2-activiti|ng2-alfresco|alfresco-)');
|
let regexp = new RegExp('^(ng2-activiti|ng2-alfresco|alfresco-)');
|
||||||
|
|
||||||
|
@@ -58,6 +58,7 @@ import { PeopleApiService } from './src/services/people-api.service';
|
|||||||
import { SearchApiService } from './src/services/search-api.service';
|
import { SearchApiService } from './src/services/search-api.service';
|
||||||
import { SharedLinksApiService } from './src/services/shared-links-api.service';
|
import { SharedLinksApiService } from './src/services/shared-links-api.service';
|
||||||
import { SitesApiService } from './src/services/sites-api.service';
|
import { SitesApiService } from './src/services/sites-api.service';
|
||||||
|
import { DiscoveryApiService } from './src/services/discovery-api.service';
|
||||||
|
|
||||||
export { ContentService } from './src/services/content.service';
|
export { ContentService } from './src/services/content.service';
|
||||||
export { StorageService } from './src/services/storage.service';
|
export { StorageService } from './src/services/storage.service';
|
||||||
@@ -91,6 +92,7 @@ export { PeopleApiService } from './src/services/people-api.service';
|
|||||||
export { SearchApiService } from './src/services/search-api.service';
|
export { SearchApiService } from './src/services/search-api.service';
|
||||||
export { SharedLinksApiService } from './src/services/shared-links-api.service';
|
export { SharedLinksApiService } from './src/services/shared-links-api.service';
|
||||||
export { SitesApiService } from './src/services/sites-api.service';
|
export { SitesApiService } from './src/services/sites-api.service';
|
||||||
|
export { DiscoveryApiService } from './src/services/discovery-api.service';
|
||||||
|
|
||||||
import { DataColumnListComponent } from './src/components/data-column/data-column-list.component';
|
import { DataColumnListComponent } from './src/components/data-column/data-column-list.component';
|
||||||
import { DataColumnComponent } from './src/components/data-column/data-column.component';
|
import { DataColumnComponent } from './src/components/data-column/data-column.component';
|
||||||
@@ -121,6 +123,7 @@ export * from './src/models/card-view-dateitem.model';
|
|||||||
export * from './src/models/file.model';
|
export * from './src/models/file.model';
|
||||||
export * from './src/models/permissions.enum';
|
export * from './src/models/permissions.enum';
|
||||||
export * from './src/models/site.model';
|
export * from './src/models/site.model';
|
||||||
|
export * from './src/models/product-version.model';
|
||||||
|
|
||||||
export * from './src/models/index';
|
export * from './src/models/index';
|
||||||
|
|
||||||
|
@@ -0,0 +1,141 @@
|
|||||||
|
/*!
|
||||||
|
* @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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export class BpmProductVersionModel {
|
||||||
|
edition: string;
|
||||||
|
majorVersion: string;
|
||||||
|
revisionVersion: string;
|
||||||
|
minorVersion: string;
|
||||||
|
type: string;
|
||||||
|
|
||||||
|
constructor(obj?: any) {
|
||||||
|
if (obj) {
|
||||||
|
this.edition = obj.edition || null;
|
||||||
|
this.majorVersion = obj.majorVersion || null;
|
||||||
|
this.revisionVersion = obj.revisionVersion || null;
|
||||||
|
this.minorVersion = obj.minorVersion || null;
|
||||||
|
this.type = obj.type || null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class EcmProductVersionModel {
|
||||||
|
edition: string;
|
||||||
|
version: VersionModel;
|
||||||
|
license: LicenseModel;
|
||||||
|
status: VersionStatusModel;
|
||||||
|
modules: VersionModuleModel[] = [];
|
||||||
|
|
||||||
|
constructor(obj?: any) {
|
||||||
|
if (obj && obj.entry && obj.entry.repository) {
|
||||||
|
this.edition = obj.entry.repository.edition || null;
|
||||||
|
this.version = new VersionModel(obj.entry.repository.version);
|
||||||
|
this.license = new LicenseModel(obj.entry.repository.license);
|
||||||
|
this.status = new VersionStatusModel(obj.entry.repository.status);
|
||||||
|
if (obj.entry.repository.modules) {
|
||||||
|
obj.entry.repository.modules.forEach((module) => {
|
||||||
|
this.modules.push(new VersionModuleModel(module));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export class VersionModel {
|
||||||
|
major: string;
|
||||||
|
minor: string;
|
||||||
|
patch: string;
|
||||||
|
hotfix: string;
|
||||||
|
schema: number;
|
||||||
|
label: string;
|
||||||
|
display: string;
|
||||||
|
|
||||||
|
constructor(obj?: any) {
|
||||||
|
if (obj) {
|
||||||
|
this.major = obj.major || null;
|
||||||
|
this.minor = obj.minor || null;
|
||||||
|
this.patch = obj.patch || null;
|
||||||
|
this.hotfix = obj.hotfix || null;
|
||||||
|
this.schema = obj.schema || null;
|
||||||
|
this.label = obj.label || null;
|
||||||
|
this.display = obj.display || null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class LicenseModel {
|
||||||
|
issuedAt: string;
|
||||||
|
expiresAt: string;
|
||||||
|
remainingDays: number;
|
||||||
|
holder: string;
|
||||||
|
mode: string;
|
||||||
|
isClusterEnabled: boolean;
|
||||||
|
isCryptodocEnabled: boolean;
|
||||||
|
|
||||||
|
constructor(obj?: any) {
|
||||||
|
if (obj) {
|
||||||
|
this.issuedAt = obj.issuedAt || null;
|
||||||
|
this.expiresAt = obj.expiresAt || null;
|
||||||
|
this.remainingDays = obj.remainingDays || null;
|
||||||
|
this.holder = obj.holder || null;
|
||||||
|
this.mode = obj.mode || null;
|
||||||
|
this.isClusterEnabled = obj.isClusterEnabled ? true : false;
|
||||||
|
this.isCryptodocEnabled = obj.isCryptodocEnabled ? true : false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class VersionStatusModel {
|
||||||
|
isReadOnly: boolean;
|
||||||
|
isAuditEnabled: boolean;
|
||||||
|
isQuickShareEnabled: boolean;
|
||||||
|
isThumbnailGenerationEnabled: boolean;
|
||||||
|
|
||||||
|
constructor(obj?: any) {
|
||||||
|
if (obj) {
|
||||||
|
this.isReadOnly = obj.isReadOnly ? true : false;
|
||||||
|
this.isAuditEnabled = obj.isAuditEnabled ? true : false;
|
||||||
|
this.isQuickShareEnabled = obj.isQuickShareEnabled ? true : false;
|
||||||
|
this.isThumbnailGenerationEnabled = obj.isThumbnailGenerationEnabled ? true : false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class VersionModuleModel {
|
||||||
|
id: string;
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
version: string;
|
||||||
|
installDate: string;
|
||||||
|
installState: string;
|
||||||
|
versionMin: string;
|
||||||
|
versionMax: string;
|
||||||
|
|
||||||
|
constructor(obj?: any) {
|
||||||
|
if (obj) {
|
||||||
|
this.id = obj.id || null;
|
||||||
|
this.title = obj.title || null;
|
||||||
|
this.description = obj.description || null;
|
||||||
|
this.version = obj.version || null;
|
||||||
|
this.installDate = obj.installDate || null;
|
||||||
|
this.installState = obj.installState || null;
|
||||||
|
this.versionMin = obj.versionMin || null;
|
||||||
|
this.versionMax = obj.versionMax || null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,190 @@
|
|||||||
|
/*!
|
||||||
|
* @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 { async, TestBed } from '@angular/core/testing';
|
||||||
|
import { BpmProductVersionModel, EcmProductVersionModel } from '../models/product-version.model';
|
||||||
|
import { AlfrescoApiService } from './alfresco-api.service';
|
||||||
|
import { AlfrescoSettingsService } from './alfresco-settings.service';
|
||||||
|
import { AppConfigModule } from './app-config.service';
|
||||||
|
import { AuthenticationService } from './authentication.service';
|
||||||
|
import { DiscoveryApiService } from './discovery-api.service';
|
||||||
|
import { StorageService } from './storage.service';
|
||||||
|
import { UserPreferencesService } from './user-preferences.service';
|
||||||
|
|
||||||
|
declare let jasmine: any;
|
||||||
|
|
||||||
|
let fakeEcmDiscoveryResponse: any = {
|
||||||
|
'entry': {
|
||||||
|
'repository': {
|
||||||
|
'edition': 'FAKE',
|
||||||
|
'version': {
|
||||||
|
'major': '5',
|
||||||
|
'minor': '2',
|
||||||
|
'patch': '0',
|
||||||
|
'hotfix': '0',
|
||||||
|
'schema': 999999,
|
||||||
|
'label': 'r134899-b26',
|
||||||
|
'display': '5.2.0.0 (r134899-b26) schema 10005'
|
||||||
|
},
|
||||||
|
'license': {
|
||||||
|
'issuedAt': '2017-06-22T10:56:45.796+0000',
|
||||||
|
'expiresAt': '2017-07-22T00:00:00.000+0000',
|
||||||
|
'remainingDays': 4,
|
||||||
|
'holder': 'Trial User',
|
||||||
|
'mode': 'ENTERPRISE',
|
||||||
|
'entitlements': {
|
||||||
|
'isClusterEnabled': false,
|
||||||
|
'isCryptodocEnabled': false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'status': {
|
||||||
|
'isReadOnly': false,
|
||||||
|
'isAuditEnabled': true,
|
||||||
|
'isQuickShareEnabled': true,
|
||||||
|
'isThumbnailGenerationEnabled': true
|
||||||
|
},
|
||||||
|
'modules': [
|
||||||
|
{
|
||||||
|
'id': 'alfresco-fake-services',
|
||||||
|
'title': 'Alfresco Share Services AMP',
|
||||||
|
'description': 'Module to be applied to alfresco.war, containing APIs for Alfresco Share',
|
||||||
|
'version': '5.2.0',
|
||||||
|
'installDate': '2017-03-07T08:48:14.161+0000',
|
||||||
|
'installState': 'INSTALLED',
|
||||||
|
'versionMin': '5.1',
|
||||||
|
'versionMax': '999'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'id': 'alfresco-trashcan-fake',
|
||||||
|
'title': 'alfresco-trashcan-cleaner project',
|
||||||
|
'description': 'The Alfresco Trash Can Cleaner (Alfresco Module)',
|
||||||
|
'version': '2.2',
|
||||||
|
'installState': 'UNKNOWN',
|
||||||
|
'versionMin': '0',
|
||||||
|
'versionMax': '999'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let fakeBPMDiscoveryResponse: any = {
|
||||||
|
'revisionVersion': '2',
|
||||||
|
'edition': 'SUPER FAKE EDITION',
|
||||||
|
'type': 'bpmSuite',
|
||||||
|
'majorVersion': '1',
|
||||||
|
'minorVersion': '6'
|
||||||
|
};
|
||||||
|
|
||||||
|
fdescribe('Discovery Api Service', () => {
|
||||||
|
|
||||||
|
let service;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
imports: [
|
||||||
|
AppConfigModule.forRoot('app.config.json', {
|
||||||
|
ecmHost: 'http://localhost:9876/ecm'
|
||||||
|
})
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
DiscoveryApiService,
|
||||||
|
AlfrescoApiService,
|
||||||
|
UserPreferencesService,
|
||||||
|
AuthenticationService,
|
||||||
|
AlfrescoSettingsService,
|
||||||
|
StorageService
|
||||||
|
]
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
service = TestBed.get(DiscoveryApiService);
|
||||||
|
jasmine.Ajax.install();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
jasmine.Ajax.uninstall();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('For ECM', () => {
|
||||||
|
it('Should retrieve the info about the product for ECM', (done) => {
|
||||||
|
service.getEcmProductInfo().subscribe((data: EcmProductVersionModel) => {
|
||||||
|
expect(data).not.toBeNull();
|
||||||
|
expect(data.edition).toBe('FAKE');
|
||||||
|
expect(data.version.schema).toBe(999999);
|
||||||
|
expect(data.license.isClusterEnabled).toBeFalsy();
|
||||||
|
expect(data.status.isQuickShareEnabled).toBeTruthy();
|
||||||
|
expect(data.modules.length).toBe(2);
|
||||||
|
expect(data.modules[0].id).toBe('alfresco-fake-services');
|
||||||
|
expect(data.modules[1].id).toBe('alfresco-trashcan-fake');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||||
|
status: 200,
|
||||||
|
contentType: 'json',
|
||||||
|
responseText: fakeEcmDiscoveryResponse
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('getEcmProductInfo catch errors call', (done) => {
|
||||||
|
service.getEcmProductInfo().subscribe(
|
||||||
|
() => {
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||||
|
status: 403
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('For BPM', () => {
|
||||||
|
it('Should retrieve the info about the product for BPM', (done) => {
|
||||||
|
service.getBpmProductInfo().subscribe((data: BpmProductVersionModel) => {
|
||||||
|
expect(data).not.toBeNull();
|
||||||
|
expect(data.edition).toBe('SUPER FAKE EDITION');
|
||||||
|
expect(data.revisionVersion).toBe('2');
|
||||||
|
expect(data.type).toBe('bpmSuite');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||||
|
status: 200,
|
||||||
|
contentType: 'json',
|
||||||
|
responseText: fakeBPMDiscoveryResponse
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('getBpmProductInfo catch errors call', (done) => {
|
||||||
|
service.getBpmProductInfo().subscribe(
|
||||||
|
() => {
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||||
|
status: 403
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
@@ -0,0 +1,45 @@
|
|||||||
|
/*!
|
||||||
|
* @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';
|
||||||
|
import { Observable } from 'rxjs/Rx';
|
||||||
|
import { BpmProductVersionModel, EcmProductVersionModel } from '../models/product-version.model';
|
||||||
|
import { AlfrescoApiService } from './alfresco-api.service';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class DiscoveryApiService {
|
||||||
|
|
||||||
|
constructor(private apiService: AlfrescoApiService) { }
|
||||||
|
|
||||||
|
public getEcmProductInfo() {
|
||||||
|
return Observable.fromPromise(
|
||||||
|
this.apiService.getInstance().discovery.discoveryApi.getRepositoryInformation())
|
||||||
|
.map(res => new EcmProductVersionModel(res))
|
||||||
|
.catch(this.handleError);
|
||||||
|
}
|
||||||
|
|
||||||
|
public getBpmProductInfo() {
|
||||||
|
return Observable.fromPromise(
|
||||||
|
this.apiService.getInstance().activiti.aboutApi.getAppVersion())
|
||||||
|
.map(res => new BpmProductVersionModel(res))
|
||||||
|
.catch(this.handleError);
|
||||||
|
}
|
||||||
|
|
||||||
|
private handleError(error): Observable<any> {
|
||||||
|
return Observable.throw(error);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user