@@ -23,6 +23,7 @@ import { ErrorCodes } from "@gitpod/gitpod-protocol/lib/messaging/error";
23
23
import { FeatureFlagContext } from "../contexts/FeatureFlagContext" ;
24
24
import { ReactComponent as CreditsSvg } from "../images/credits.svg" ;
25
25
import { ReactComponent as Spinner } from "../icons/Spinner.svg" ;
26
+ import Arrow from "../components/Arrow" ;
26
27
27
28
function TeamUsage ( ) {
28
29
const { teams } = useContext ( TeamsContext ) ;
@@ -39,7 +40,7 @@ function TeamUsage() {
39
40
const [ startDateOfBillMonth , setStartDateOfBillMonth ] = useState ( timestampStartOfCurrentMonth ) ;
40
41
const [ endDateOfBillMonth , setEndDateOfBillMonth ] = useState ( Date . now ( ) ) ;
41
42
const [ isLoading , setIsLoading ] = useState < boolean > ( true ) ;
42
- const [ startedTimeOrder ] = useState < SortOrder > ( SortOrder . Descending ) ;
43
+ const [ isStartedTimeDescending , setIsStartedTimeDescending ] = useState < boolean > ( true ) ;
43
44
44
45
useEffect ( ( ) => {
45
46
if ( ! team ) {
@@ -49,7 +50,7 @@ function TeamUsage() {
49
50
const attributionId = AttributionId . render ( { kind : "team" , teamId : team . id } ) ;
50
51
const request : BillableSessionRequest = {
51
52
attributionId,
52
- startedTimeOrder,
53
+ startedTimeOrder : isStartedTimeDescending ? SortOrder . Descending : SortOrder . Ascending ,
53
54
from : startDateOfBillMonth ,
54
55
to : endDateOfBillMonth ,
55
56
} ;
@@ -64,7 +65,7 @@ function TeamUsage() {
64
65
setIsLoading ( false ) ;
65
66
}
66
67
} ) ( ) ;
67
- } , [ team , startDateOfBillMonth , endDateOfBillMonth , startedTimeOrder ] ) ;
68
+ } , [ team , startDateOfBillMonth , endDateOfBillMonth , isStartedTimeDescending ] ) ;
68
69
69
70
if ( ! showUsageBasedPricingUI ) {
70
71
return < Redirect to = "/" /> ;
@@ -200,7 +201,12 @@ function TeamUsage() {
200
201
< CreditsSvg className = "my-auto mr-1" />
201
202
< span > Credits</ span >
202
203
</ ItemField >
203
- < ItemField className = "my-auto" />
204
+ < ItemField className = "my-auto cursor-pointer" >
205
+ < span onClick = { ( ) => setIsStartedTimeDescending ( ! isStartedTimeDescending ) } >
206
+ Started
207
+ < Arrow direction = { isStartedTimeDescending ? "down" : "up" } />
208
+ </ span >
209
+ </ ItemField >
204
210
</ Item >
205
211
{ currentPaginatedResults &&
206
212
currentPaginatedResults . map ( ( usage ) => (
0 commit comments