Skip to content

Commit c174c31

Browse files
committed
receiving the system information from the system hosting the management application rather than the client information
1 parent 59c2636 commit c174c31

File tree

8 files changed

+80
-24
lines changed

8 files changed

+80
-24
lines changed

app/controllers/SystemInfo.scala renamed to app/controllers/SystemInfoController.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,23 @@
3838

3939
object HostName {
4040
def apply(host: Option[String]): String = {
41-
var hostname = InetAddress.getLocalHost().getHostName()
41+
val hostname = InetAddress.getLocalHost().getHostName()
4242
hostname
4343
}
4444
}
4545

4646
object PlatformName {
4747
def apply(platform: Option[String]): String = {
48-
var os = "os.name";
49-
var version = "os.version";
50-
var osVersion = System.getProperty(os) + " " + System.getProperty(version)
48+
val os = "os.name";
49+
val version = "os.version";
50+
val osVersion = System.getProperty(os) + " " + System.getProperty(version)
5151
osVersion
5252
}
5353
}
5454

5555
object ScalaVersion {
5656
def apply(browser: Option[String]): String = {
57-
var scalaVersion = PlayVersion.current
57+
val scalaVersion = PlayVersion.current
5858
scalaVersion
5959
}
6060
}

app/models/SysInfo.sc

Whitespace-only changes.

client/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
"core-js": "^2.5.4",
2828
"font-awesome": "^4.7.0",
2929
"jquery": "^3.3.1",
30-
"ngx-device-detector": "^1.3.3",
3130
"popper.js": "^1.14.4",
3231
"rxjs": "^6.2.2",
3332
"rxjs-compat": "^6.2.2",

client/src/app/api/api/api.service.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ import {Inject, Injectable, Optional} from '@angular/core';
2020
import {HttpClient, HttpHeaders, HttpParams} from '@angular/common/http';
2121
import {Observable} from 'rxjs';
2222
import {Configuration} from '../configuration';
23-
import {BASE_PATH, INSTANCES, NUMBER_OF_INSTANCES} from '../variables';
23+
import {BASE_PATH, INSTANCES, NUMBER_OF_INSTANCES, SYS_INFO} from '../variables';
2424
import {CustomHttpUrlEncodingCodec} from '../encoder';
2525
import {Instance} from '..';
26+
import {SysInfo} from "../model/sysInfo";
2627

2728

2829
@Injectable({
@@ -46,6 +47,21 @@ export class ApiService {
4647
}
4748
}
4849

50+
public getSysInfo(reportProgress: boolean = false): Observable<SysInfo> {
51+
let headers = this.defaultHeaders;
52+
53+
// to determine the Accept header
54+
const httpHeaderAccepts: string[] = [
55+
'application/json'
56+
];
57+
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
58+
if (httpHeaderAcceptSelected !== undefined) {
59+
headers = headers.set('Accept', httpHeaderAcceptSelected);
60+
}
61+
return this.httpClient.get<SysInfo>(`${this.basePath}${SYS_INFO}`,
62+
{headers: headers, observe: 'body', reportProgress: reportProgress});
63+
}
64+
4965
/**
5066
* Find number of running instances
5167
* How many instances per type are running
@@ -68,7 +84,7 @@ export class ApiService {
6884
return this.get(INSTANCES, componentType);
6985
}
7086

71-
private get(endpoint: string, componentType, observe: any = 'body', reportProgress: boolean = false ): any {
87+
private get(endpoint: string, componentType: string, observe: any = 'body', reportProgress: boolean = false ): any {
7288
if (componentType === null || componentType === undefined) {
7389
throw new Error('Required parameter componentType was null or undefined when calling getInstanceNumber.');
7490
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright (C) 2018 The Delphi Team.
3+
* See the LICENCE file distributed with this work for additional
4+
* information regarding copyright ownership.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
export interface SysInfo {
20+
javaVersion: string;
21+
hostName: string;
22+
platformName: string;
23+
scalaVersion: string;
24+
}

client/src/app/api/variables.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
* See the LICENCE file distributed with this work for additional
44
* information regarding copyright ownership.
55
*
6-
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* Licensed under the Apache License, Version 2.0 (the 'License');
77
* you may not use this file except in compliance with the License.
88
* You may obtain a copy of the License at
99
*
1010
* http://www.apache.org/licenses/LICENSE-2.0
1111
*
1212
* Unless required by applicable law or agreed to in writing, software
13-
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* distributed under the License is distributed on an 'AS IS' BASIS,
1414
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
@@ -19,11 +19,12 @@
1919
import { InjectionToken } from '@angular/core';
2020

2121
export const BASE_PATH = new InjectionToken<string>('basePath');
22-
export const INSTANCES = "/api/instances"
23-
export const NUMBER_OF_INSTANCES = "/api/numberOfInstances"
22+
export const INSTANCES = '/api/instances';
23+
export const SYS_INFO = '/api/systemInfo';
24+
export const NUMBER_OF_INSTANCES = '/api/numberOfInstances';
2425
export const COLLECTION_FORMATS = {
2526
'csv': ',',
2627
'tsv': ' ',
2728
'ssv': ' ',
2829
'pipes': '|'
29-
}
30+
};

client/src/app/dashboard/status-card/status-card.component.html

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,29 @@ <h5>System Information</h5>
2121
<div class="floatStyle">
2222
<table class="tableAlign">
2323
<tr>
24-
<td>Browser: </td>
24+
<td>Scala Version: </td>
2525
<td class="valueBox">
26-
{{deviceInfo.browser}}
26+
{{sysInfo.scalaVersion}}
2727
</td>
2828
</tr>
2929
<tr>
30-
<td>Client Platform: </td>
30+
<td>JVM Version: </td>
3131
<td class="valueBox">
32-
{{deviceInfo.os}}
32+
{{sysInfo.javaVersion}}
3333
</td>
3434
</tr>
35+
<tr>
36+
<td>Platform: </td>
37+
<td class="valueBox">
38+
{{sysInfo.platformName}}
39+
</td>
40+
</tr>
41+
<tr>
42+
<td>Host Name: </td>
43+
<td class="valueBox">
44+
{{sysInfo.hostName}}
45+
</td>
46+
</tr>
3547
</table>
3648
</div>
3749
</div>

client/src/app/dashboard/status-card/status-card.component.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
*/
1818

1919
import { Component, OnInit } from '@angular/core';
20-
import { DeviceDetectorService } from 'ngx-device-detector';
20+
import { ApiService } from '../../api';
21+
import {SysInfo} from '../../api/model/sysInfo';
2122

2223
@Component({
2324
selector: 'app-statuscard',
@@ -26,17 +27,20 @@ import { DeviceDetectorService } from 'ngx-device-detector';
2627
})
2728

2829
export class StatusCardComponent implements OnInit {
29-
public deviceInfo = null;
3030

31-
constructor(private deviceService: DeviceDetectorService) {
32-
this.infoFunction();
33-
}
31+
sysInfo: SysInfo;
3432

35-
infoFunction() {
36-
this.deviceInfo = this.deviceService.getDeviceInfo();
33+
constructor( private apiService: ApiService) {
34+
this.sysInfo = { hostName: 'no server connection',
35+
javaVersion: 'no server connection',
36+
platformName: 'no server connection',
37+
scalaVersion: 'no server connection' };
3738
}
3839

3940
ngOnInit() {
41+
this.apiService.getSysInfo().subscribe((sysInfo) => {
42+
this.sysInfo = sysInfo;
43+
});
4044
}
4145

4246
}

0 commit comments

Comments
 (0)