Skip to content

Commit 386274b

Browse files
author
Laurie T. Malau
committed
t
1 parent 53ea0e9 commit 386274b

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

components/dashboard/src/teams/TeamUsage.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {
1616
} from "@gitpod/gitpod-protocol/lib/usage";
1717
import { AttributionId } from "@gitpod/gitpod-protocol/lib/attribution";
1818
import { Item, ItemField, ItemsList } from "../components/ItemsList";
19-
import moment from "moment";
2019
import Pagination from "../Pagination/Pagination";
2120
import Header from "../components/Header";
2221
import { ErrorCodes } from "@gitpod/gitpod-protocol/lib/messaging/error";
@@ -139,6 +138,17 @@ function TeamUsage() {
139138
return rows;
140139
};
141140

141+
const displayTime = (time: string) => {
142+
const options: Intl.DateTimeFormatOptions = {
143+
day: "numeric",
144+
month: "long",
145+
year: "numeric",
146+
hour: "numeric",
147+
minute: "numeric",
148+
};
149+
return new Date(time).toLocaleDateString("en-US", options);
150+
};
151+
142152
const lastResultOnCurrentPage = currentPage * resultsPerPage;
143153
const firstResultOnCurrentPage = lastResultOnCurrentPage - resultsPerPage;
144154
const totalNumberOfPages = Math.ceil(billedUsage.length / resultsPerPage);
@@ -250,7 +260,7 @@ function TeamUsage() {
250260
</div>
251261
<div className="my-auto">
252262
<span className="text-gray-400">
253-
{moment(new Date(usage.startTime).toDateString()).utc()}
263+
{displayTime(usage.startTime)}
254264
</span>
255265
</div>
256266
</div>

components/server/ee/src/workspace/gitpod-server-impl.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2174,7 +2174,21 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
21742174
);
21752175
const sessions = response.getSessionsList().map((s) => UsageService.mapBilledSession(s));
21762176

2177-
return sessions;
2177+
return sessions.concat([
2178+
{
2179+
attributionId: "some-attribution-id",
2180+
userId: "prebuild",
2181+
teamId: "prebuild",
2182+
instanceId: "some-instance-id",
2183+
workspaceId: "some-workspace-id",
2184+
workspaceType: "prebuild",
2185+
workspaceClass: "XL",
2186+
startTime: new Date(Date.now() + -3 * 24 * 3600 * 1000).toISOString(), // 3 days ago
2187+
endTime: new Date().toISOString(),
2188+
credits: 320,
2189+
projectId: "project-123",
2190+
},
2191+
]);
21782192
}
21792193

21802194
protected async guardCostCenterAccess(

0 commit comments

Comments
 (0)