Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(nms): Fix some simple TypeScript migration TODOs #13247

Merged
merged 1 commit into from
Jul 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 0 additions & 6 deletions nms/app/components/CustomMetrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ export default function CustomHistogram(props: Props) {
data={{datasets: props.dataset}}
options={{
maintainAspectRatio: false,
// TODO[TS-migration is this a valid chart.js option?]
// @ts-ignore
scaleShowValues: true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I searched through the code base of react-chart-js and chart-js and could not find "scaleShowValues".

scales: {
xAxes: [
{
Expand Down Expand Up @@ -188,9 +185,6 @@ export function CustomLineChart(props: Props) {
}}
options={{
maintainAspectRatio: false,
// TODO[TS-migration is this a valid chart.js option?]
// @ts-ignore
scaleShowValues: true,
scales: {
xAxes: [
{
Expand Down
3 changes: 0 additions & 3 deletions nms/app/components/insights/AsyncMetric.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,6 @@ export default function AsyncMetric(props: Props) {
height={props.height}
options={{
maintainAspectRatio: false,
// TODO[TS-migration is this a valid chart.js option?]
// @ts-ignore
scaleShowValues: true,
scales: {
xAxes: [
{
Expand Down
4 changes: 1 addition & 3 deletions nms/app/components/insights/TimeRangeSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ export default function TimeRangeSelector(props: Props) {
<Select
inputProps={{id: 'time_range'}}
value={props.value}
// TODO[ts-migration]: this was migrated from fbcnms-ui and types are broken
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
onChange={event => props.onChange(event.target.value as any)}>
onChange={event => props.onChange(event.target.value as TimeRange)}>
<MenuItem value="3_hours">Last 3 hours</MenuItem>
<MenuItem value="6_hours">Last 6 hours</MenuItem>
<MenuItem value="12_hours">Last 12 hours</MenuItem>
Expand Down
18 changes: 2 additions & 16 deletions nms/app/views/subscriber/SubscriberChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,6 @@ export default function SubscriberChart() {
<Grid item>
<DateTimePicker
autoOk
// TODO[ts-migration]: There is a serious mismatch here.
// type WrapperVariant is a alias for:
// "dialog" | "inline" | "static"
// @ts-ignore
variant="outlined"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test that this has no effect and inputVariant="outlined" is what is needed.

inputVariant="outlined"
maxDate={end}
disableFuture
Expand All @@ -255,11 +250,6 @@ export default function SubscriberChart() {
<Grid item>
<DateTimePicker
autoOk
// TODO[ts-migration]: There is a serious mismatch here.
// type WrapperVariant is a alias for:
// "dialog" | "inline" | "static"
// @ts-ignore
variant="outlined"
inputVariant="outlined"
disableFuture
value={end}
Expand Down Expand Up @@ -306,12 +296,8 @@ export default function SubscriberChart() {
yLabel={yLabelUnit}
tooltipHandler={(tooltipItem, data) => {
const val = tooltipItem.yLabel;
return `${
// TODO[ts-migration] The tooltip handler is also broken in CustomMetrics
// such that this is a follow up of the broken type there.
// @ts-ignore
data.datasets[tooltipItem.datasetIndex].label // eslint-disable-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/restrict-template-expressions
} ${val!} ${yLabelUnit} in last ${toolTipHint}s`;
return `${data.datasets![tooltipItem.datasetIndex!]
.label!} ${val!} ${yLabelUnit} in last ${toolTipHint}s`;
}}
/>
}
Expand Down