@@ -26,6 +26,10 @@ function TeamUsage() {
26
26
const [ currentPage , setCurrentPage ] = useState ( 1 ) ;
27
27
const [ resultsPerPage ] = useState ( 10 ) ;
28
28
const [ errorMessage , setErrorMessage ] = useState ( "" ) ;
29
+ const today = new Date ( ) ;
30
+ const startOfCurrentMonth = new Date ( today . getFullYear ( ) , today . getMonth ( ) , 1 ) ;
31
+ const timestampOfStart = startOfCurrentMonth . getTime ( ) ;
32
+ const [ startDateOfBillMonth ] = useState ( timestampOfStart ) ;
29
33
30
34
useEffect ( ( ) => {
31
35
if ( ! team ) {
@@ -34,7 +38,11 @@ function TeamUsage() {
34
38
( async ( ) => {
35
39
const attributionId = AttributionId . render ( { kind : "team" , teamId : team . id } ) ;
36
40
try {
37
- const billedUsageResult = await getGitpodService ( ) . server . listBilledUsage ( attributionId ) ;
41
+ const billedUsageResult = await getGitpodService ( ) . server . listBilledUsage (
42
+ attributionId ,
43
+ startDateOfBillMonth , // TODO: set based on selected month
44
+ Date . now ( ) , // TODO: set based on selected month
45
+ ) ;
38
46
setBilledUsage ( billedUsageResult ) ;
39
47
} catch ( error ) {
40
48
if ( error . code === ErrorCodes . PERMISSION_DENIED ) {
@@ -90,7 +98,10 @@ function TeamUsage() {
90
98
< div className = "space-y-8 mb-6" style = { { width : "max-content" } } >
91
99
< div className = "flex flex-col truncate" >
92
100
< div className = "text-base text-gray-500 truncate" > Period</ div >
93
- < div className = "text-lg text-gray-600 font-semibold truncate" > June 2022</ div >
101
+ < div className = "text-lg text-gray-600 font-semibold truncate" >
102
+ { startOfCurrentMonth . toLocaleString ( "default" , { month : "long" } ) } { " " }
103
+ { startOfCurrentMonth . getFullYear ( ) }
104
+ </ div >
94
105
</ div >
95
106
< div className = "flex flex-col truncate" >
96
107
< div className = "text-base text-gray-500" > Total usage</ div >
0 commit comments