From: Grégoire Aubert Date: Mon, 2 Oct 2017 09:14:49 +0000 (+0200) Subject: SONAR-9808 Add ncloc to system info page X-Git-Tag: 6.6-RC1~60 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e3b180065bd5985f7b2addc341a4def75936899e;p=sonarqube.git SONAR-9808 Add ncloc to system info page --- diff --git a/server/sonar-web/src/main/js/apps/system/utils.ts b/server/sonar-web/src/main/js/apps/system/utils.ts index 5514ae4e705..33b18d63120 100644 --- a/server/sonar-web/src/main/js/apps/system/utils.ts +++ b/server/sonar-web/src/main/js/apps/system/utils.ts @@ -33,6 +33,7 @@ import { SysInfoSection, SysValueObject } from '../../api/system'; +import { formatMeasure } from '../../helpers/measures'; export interface Query { expandedCards: string[]; @@ -110,9 +111,18 @@ export function getNodeName(nodeInfo: NodeInfo): string { return nodeInfo['Name']; } +function getSystemData(sysInfoData: SysInfo): SysValueObject { + const statData: SysValueObject = {}; + const statistics = sysInfoData['Statistics'] as SysValueObject; + if (statistics) { + statData['Lines of Code'] = formatMeasure(statistics['ncloc'] as number, 'INT'); + } + return { ...sysInfoData['System'], ...statData }; +} + export function getClusterMainCardSection(sysInfoData: ClusterSysInfo): SysValueObject { return { - ...sysInfoData['System'], + ...getSystemData(sysInfoData), ...omit(sysInfoData, [ 'Application Nodes', PLUGINS_FIELD, @@ -126,7 +136,7 @@ export function getClusterMainCardSection(sysInfoData: ClusterSysInfo): SysValue export function getStandaloneMainSections(sysInfoData: SysInfo): SysValueObject { return { - ...sysInfoData['System'], + ...getSystemData(sysInfoData), ...omitBy( sysInfoData, (value, key) =>