Skip to content

Commit

Permalink
refactor(nms): Fix some simple TypeScript migration TODOs (magma#13247)
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Schmitt <thomas.schmitt@tngtech.com>
  • Loading branch information
thmsschmitt authored and Tales Mota committed Jul 11, 2022
1 parent d192067 commit a9ebb2d
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 28 deletions.
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,
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"
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

0 comments on commit a9ebb2d

Please sign in to comment.