Skip to content

Commit

Permalink
ui: upgrade typescript from v4 to v5
Browse files Browse the repository at this point in the history
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
  • Loading branch information
maryliag committed Aug 3, 2023
1 parent b9f3f15 commit f7a8aa2
Show file tree
Hide file tree
Showing 10 changed files with 208 additions and 278 deletions.
459 changes: 194 additions & 265 deletions pkg/ui/pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/ui/workspaces/cluster-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
"source-map-loader": "^0.2.4",
"style-loader": "^1.1.3",
"ts-jest": "^27.1.3",
"typescript": "4.2.4",
"typescript": "5.1.6",
"uplot": "^1.6.19",
"url-loader": "^4.1.0",
"webpack": "^4.41.5",
Expand Down
2 changes: 1 addition & 1 deletion pkg/ui/workspaces/cluster-ui/src/jobs/util/duration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { JOB_STATUS_SUCCEEDED, isRunning } from "./jobOptions";
type Job = cockroach.server.serverpb.IJobResponse;

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

Expand Down
2 changes: 1 addition & 1 deletion pkg/ui/workspaces/cluster-ui/src/sessions/sessionsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ export class SessionsPage extends React.Component<
TimestampToMoment(s.session.start),
"seconds",
);
return sessionTime >= timeValue || timeValue === "empty";
return timeValue === "empty" || sessionTime >= Number(timeValue);
})
.filter((s: SessionInfo) => {
if (filters.username && filters.username != "All") {
Expand Down
3 changes: 2 additions & 1 deletion pkg/ui/workspaces/cluster-ui/src/sqlActivity/util.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ export function filterStatementsData(
.filter(statement => (filters.fullScan ? statement.fullScan : true))
.filter(
statement =>
statement.stats.service_lat.mean >= timeValue || timeValue === "empty",
timeValue === "empty" ||
statement.stats.service_lat.mean >= Number(timeValue),
)
.filter(
statement =>
Expand Down
4 changes: 2 additions & 2 deletions pkg/ui/workspaces/cluster-ui/src/transactionsPage/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ export const filterTransactions = (
})
.filter(
(t: Transaction) =>
t.stats_data.stats.service_lat.mean >= timeValue ||
timeValue === "empty",
timeValue === "empty" ||
t.stats_data.stats.service_lat.mean >= Number(timeValue),
)
.filter((t: Transaction) => {
// The transaction must contain at least one value of the regions list
Expand Down
2 changes: 1 addition & 1 deletion pkg/ui/workspaces/db-console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
"topojson": "^3.0.2",
"ts-jest": "27.1.3",
"ts-loader": "^6.2.1",
"typescript": "4.2.4",
"typescript": "5.1.6",
"uglify-js": "^2.8.15",
"uplot": "^1.6.8",
"url-loader": "4.1.1",
Expand Down
8 changes: 4 additions & 4 deletions pkg/ui/workspaces/db-console/src/redux/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -588,11 +588,11 @@ export const partitionedStatuses = createSelector(
nodesSummarySelector,
summary => {
return _.groupBy(summary.nodeStatuses, ns => {
switch (summary.livenessByNodeID[ns.desc.node_id]) {
case MembershipStatus.ACTIVE:
case MembershipStatus.DECOMMISSIONING:
switch (summary.livenessStatusByNodeID[ns.desc.node_id]) {
case LivenessStatus.NODE_STATUS_LIVE:
case LivenessStatus.NODE_STATUS_DECOMMISSIONING:
return "live";
case MembershipStatus.DECOMMISSIONED:
case LivenessStatus.NODE_STATUS_DECOMMISSIONED:
return "decommissioned";
default:
// TODO (koorosh): "live" has to be renamed to some partition which
Expand Down
2 changes: 1 addition & 1 deletion pkg/ui/workspaces/e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"eslint-plugin-react": "7.24.0",
"eslint-plugin-react-hooks": "4.2.0",
"prettier": "2.6.2",
"typescript": "^4.6.3"
"typescript": "5.1.6"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "4.29.1"
Expand Down
2 changes: 1 addition & 1 deletion pkg/ui/workspaces/eslint-plugin-crdb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"eslint": "^8.16.0",
"jest": "^28.1.0",
"ts-jest": "^28.0.3",
"typescript": "^4.7.2"
"typescript": "5.1.6"
},
"peerDependencies": {
"@typescript-eslint/parser": "^5.0.0",
Expand Down

0 comments on commit f7a8aa2

Please sign in to comment.