Skip to content

Commit f7a8aa2

Browse files
committed
ui: upgrade typescript from v4 to v5
Upgrade Typescript from v4 to v5, that have a smaller size, is faster and adds new features. This commit make some updates that were causing errors on the new Typescript version, such as type mismatch error. Epic: none Release note: None
1 parent b9f3f15 commit f7a8aa2

File tree

10 files changed

+208
-278
lines changed

10 files changed

+208
-278
lines changed

pkg/ui/pnpm-lock.yaml

Lines changed: 194 additions & 265 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/ui/workspaces/cluster-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
"source-map-loader": "^0.2.4",
156156
"style-loader": "^1.1.3",
157157
"ts-jest": "^27.1.3",
158-
"typescript": "4.2.4",
158+
"typescript": "5.1.6",
159159
"uplot": "^1.6.19",
160160
"url-loader": "^4.1.0",
161161
"webpack": "^4.41.5",

pkg/ui/workspaces/cluster-ui/src/jobs/util/duration.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { JOB_STATUS_SUCCEEDED, isRunning } from "./jobOptions";
1717
type Job = cockroach.server.serverpb.IJobResponse;
1818

1919
export const formatDuration = (d: moment.Duration): string =>
20-
[Math.floor(d.asHours()).toFixed(0), d.minutes(), d.seconds()]
20+
[Number(Math.floor(d.asHours()).toFixed(0)), d.minutes(), d.seconds()]
2121
.map(c => (c < 10 ? ("0" + c).slice(-2) : c))
2222
.join(":");
2323

pkg/ui/workspaces/cluster-ui/src/sessions/sessionsPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ export class SessionsPage extends React.Component<
321321
TimestampToMoment(s.session.start),
322322
"seconds",
323323
);
324-
return sessionTime >= timeValue || timeValue === "empty";
324+
return timeValue === "empty" || sessionTime >= Number(timeValue);
325325
})
326326
.filter((s: SessionInfo) => {
327327
if (filters.username && filters.username != "All") {

pkg/ui/workspaces/cluster-ui/src/sqlActivity/util.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ export function filterStatementsData(
100100
.filter(statement => (filters.fullScan ? statement.fullScan : true))
101101
.filter(
102102
statement =>
103-
statement.stats.service_lat.mean >= timeValue || timeValue === "empty",
103+
timeValue === "empty" ||
104+
statement.stats.service_lat.mean >= Number(timeValue),
104105
)
105106
.filter(
106107
statement =>

pkg/ui/workspaces/cluster-ui/src/transactionsPage/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ export const filterTransactions = (
199199
})
200200
.filter(
201201
(t: Transaction) =>
202-
t.stats_data.stats.service_lat.mean >= timeValue ||
203-
timeValue === "empty",
202+
timeValue === "empty" ||
203+
t.stats_data.stats.service_lat.mean >= Number(timeValue),
204204
)
205205
.filter((t: Transaction) => {
206206
// The transaction must contain at least one value of the regions list

pkg/ui/workspaces/db-console/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@
173173
"topojson": "^3.0.2",
174174
"ts-jest": "27.1.3",
175175
"ts-loader": "^6.2.1",
176-
"typescript": "4.2.4",
176+
"typescript": "5.1.6",
177177
"uglify-js": "^2.8.15",
178178
"uplot": "^1.6.8",
179179
"url-loader": "4.1.1",

pkg/ui/workspaces/db-console/src/redux/nodes.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -588,11 +588,11 @@ export const partitionedStatuses = createSelector(
588588
nodesSummarySelector,
589589
summary => {
590590
return _.groupBy(summary.nodeStatuses, ns => {
591-
switch (summary.livenessByNodeID[ns.desc.node_id]) {
592-
case MembershipStatus.ACTIVE:
593-
case MembershipStatus.DECOMMISSIONING:
591+
switch (summary.livenessStatusByNodeID[ns.desc.node_id]) {
592+
case LivenessStatus.NODE_STATUS_LIVE:
593+
case LivenessStatus.NODE_STATUS_DECOMMISSIONING:
594594
return "live";
595-
case MembershipStatus.DECOMMISSIONED:
595+
case LivenessStatus.NODE_STATUS_DECOMMISSIONED:
596596
return "decommissioned";
597597
default:
598598
// TODO (koorosh): "live" has to be renamed to some partition which

pkg/ui/workspaces/e2e-tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"eslint-plugin-react": "7.24.0",
2525
"eslint-plugin-react-hooks": "4.2.0",
2626
"prettier": "2.6.2",
27-
"typescript": "^4.6.3"
27+
"typescript": "5.1.6"
2828
},
2929
"dependencies": {
3030
"@typescript-eslint/eslint-plugin": "4.29.1"

pkg/ui/workspaces/eslint-plugin-crdb/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"eslint": "^8.16.0",
2020
"jest": "^28.1.0",
2121
"ts-jest": "^28.0.3",
22-
"typescript": "^4.7.2"
22+
"typescript": "5.1.6"
2323
},
2424
"peerDependencies": {
2525
"@typescript-eslint/parser": "^5.0.0",

0 commit comments

Comments
 (0)