11import React , { useEffect , FC , useState } from 'react' ;
22import './global.css' ;
33import './StatusScreen.css' ;
4- import { findCollection , retrieveTenantId } from './utils/setupConfiguration' ;
4+ import { findCollection , getVersionName , retrieveTenantId } from './utils/setupConfiguration' ;
55import { SplunkCollectionItem } from './models/splunk' ;
66import Button from './components/Button' ;
77
@@ -21,28 +21,32 @@ interface StatusItem {
2121}
2222
2323const StatusScreen : FC < { theme : string } > = ( { theme } ) => {
24+ const [ versionName , setVersionName ] = useState < string > ( 'unknown' ) ;
2425 const [ statusItems , setStatusItem ] = useState < StatusItem [ ] > ( [ ] ) ;
2526 const [ isShowingAllItems , setShowingAllItems ] = useState < boolean > ( false ) ;
2627
2728 useEffect ( ( ) => {
28- Promise . all ( [ retrieveTenantId ( ) , findCollection ( ) ] ) . then ( ( [ id , splunkCollectionItems ] ) => {
29- const items : StatusItem [ ] = [ ] ;
30- items . push ( {
31- key : StatusItemKeys . CURRENT_TENANT_ID ,
32- name : getItemName ( StatusItemKeys . CURRENT_TENANT_ID ) ,
33- value : `${ id } ` ,
34- } ) ;
35- splunkCollectionItems . forEach ( ( item ) => {
29+ Promise . all ( [ retrieveTenantId ( ) , findCollection ( ) , getVersionName ( ) ] ) . then (
30+ ( [ id , splunkCollectionItems , version ] ) => {
31+ const items : StatusItem [ ] = [ ] ;
3632 items . push ( {
37- key : item . key . startsWith ( COLLECTION_KEYS_NEXT_PREFIX )
38- ? StatusItemKeys . NEXT_TOKEN
39- : ( item . key as StatusItemKeys ) ,
40- name : getItemName ( item . key ) ,
41- value : formatValue ( item ) ,
33+ key : StatusItemKeys . CURRENT_TENANT_ID ,
34+ name : getItemName ( StatusItemKeys . CURRENT_TENANT_ID ) ,
35+ value : `${ id } ` ,
4236 } ) ;
43- } ) ;
44- setStatusItem ( items ) ;
45- } ) ;
37+ splunkCollectionItems . forEach ( ( item ) => {
38+ items . push ( {
39+ key : item . key . startsWith ( COLLECTION_KEYS_NEXT_PREFIX )
40+ ? StatusItemKeys . NEXT_TOKEN
41+ : ( item . key as StatusItemKeys ) ,
42+ name : getItemName ( item . key ) ,
43+ value : formatValue ( item ) ,
44+ } ) ;
45+ } ) ;
46+ setStatusItem ( items ) ;
47+ setVersionName ( version ) ;
48+ }
49+ ) ;
4650 } , [ ] ) ;
4751
4852 useEffect ( ( ) => {
@@ -101,7 +105,10 @@ const StatusScreen: FC<{ theme: string }> = ({ theme }) => {
101105 < div id = "container" className = { theme === 'dark' ? 'dark' : '' } >
102106 < div id = "experimental" > This is an experimental release</ div >
103107 < div className = "content" >
104- < h2 > Status</ h2 >
108+ < div >
109+ < h2 > Status</ h2 >
110+ < small > { `Version: ${ versionName } ` } </ small >
111+ </ div >
105112 < div id = "status-list" >
106113 { getItems ( ) . map ( ( item ) => {
107114 return (
0 commit comments