diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-09-11 17:01:34 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-09-26 23:49:37 +0200 |
commit | 74c8a8ac5e83144fab7291b9ad57c14742fe8bbf (patch) | |
tree | 191311ab4f4df1faf2c1eac16e2f018b1c77be5a /server/sonar-web/src/main/js/api/system.ts | |
parent | d7df6d3c31db2ca875d8dec2c0b873cc04b7738e (diff) | |
download | sonarqube-74c8a8ac5e83144fab7291b9ad57c14742fe8bbf.tar.gz sonarqube-74c8a8ac5e83144fab7291b9ad57c14742fe8bbf.zip |
SONAR-9802 Add nodes to system info in cluster mode
Diffstat (limited to 'server/sonar-web/src/main/js/api/system.ts')
-rw-r--r-- | server/sonar-web/src/main/js/api/system.ts | 47 |
1 files changed, 41 insertions, 6 deletions
diff --git a/server/sonar-web/src/main/js/api/system.ts b/server/sonar-web/src/main/js/api/system.ts index 93eeaaf5b77..1b4fd125a97 100644 --- a/server/sonar-web/src/main/js/api/system.ts +++ b/server/sonar-web/src/main/js/api/system.ts @@ -18,21 +18,56 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { getJSON, post } from '../helpers/request'; +import throwGlobalError from '../app/utils/throwGlobalError'; -export function setLogLevel(level: string): Promise<void> { - return post('/api/system/change_log_level', { level }); +export type SysValue = boolean | string | number | HealthType | SysValueObject | SysValueArray; +export interface SysValueObject { + [key: string]: SysValue; } +export interface SysValueArray extends Array<SysValue> {} -export function getSystemInfo(): Promise<any> { - return getJSON('/api/system/info'); +export interface SysInfoSection { + [sectionName: string]: SysValueObject; +} + +export enum HealthType { + RED = 'RED', + YELLOW = 'YELLOW', + GREEN = 'GREEN' +} + +export interface HealthCause extends SysValueObject { + message: string; +} + +export interface NodeInfo extends SysValueObject { + Name: string; + Health: HealthType; + 'Health Causes': HealthCause[]; +} + +export interface SysInfo extends SysValueObject { + Cluster: boolean; + Health: HealthType; + 'Health Causes': HealthCause[]; + 'Application Nodes': NodeInfo[]; + 'Search Nodes': NodeInfo[]; +} + +export function setLogLevel(level: string): Promise<void | Response> { + return post('/api/system/change_log_level', { level }).catch(throwGlobalError); +} + +export function getSystemInfo(): Promise<SysInfo> { + return getJSON('/api/system/info').catch(throwGlobalError); } export function getSystemStatus(): Promise<any> { return getJSON('/api/system/status'); } -export function restart(): Promise<void> { - return post('/api/system/restart'); +export function restart(): Promise<void | Response> { + return post('/api/system/restart').catch(throwGlobalError); } const POLLING_INTERVAL = 2000; |