mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Fix typescript strict null fixes now at 298 (#26125)
* Chore: Fix typescript strict null errors * Added new limit * Fixed ts issue * fixed tests * trying to fix type inference * Fixing more ts errors * Revert tsconfig option * Fix * Fixed code * More fixes * fix tests * Updated snapshot * Chore: More ts strict null fixes * More fixes in some really messed up azure config components * More fixes, current count: 441 * 419 * More fixes * Fixed invalid initial state in explore * Fixing tests * Fixed tests * Explore fix * More fixes * Progress * Sub 300 * Fixed incorrect type * removed unused import
This commit is contained in:
@@ -8,7 +8,7 @@ import { CloudWatchDatasource } from '../datasource';
|
||||
|
||||
interface Props {
|
||||
query: CloudWatchLogsQuery;
|
||||
panelData: PanelData;
|
||||
panelData?: PanelData;
|
||||
datasource: CloudWatchDatasource;
|
||||
}
|
||||
|
||||
@@ -18,8 +18,12 @@ interface State {
|
||||
|
||||
export default class CloudWatchLink extends Component<Props, State> {
|
||||
state: State = { href: '' };
|
||||
|
||||
async componentDidUpdate(prevProps: Props) {
|
||||
if (prevProps.panelData !== this.props.panelData && this.props.panelData.request) {
|
||||
const { panelData: panelDataNew } = this.props;
|
||||
const { panelData: panelDataOld } = prevProps;
|
||||
|
||||
if (panelDataOld !== panelDataNew && panelDataNew?.request) {
|
||||
const href = this.getExternalLink();
|
||||
this.setState({ href });
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ export const Dimensions: FunctionComponent<Props> = ({ dimensions, loadValues, l
|
||||
}, [data]);
|
||||
|
||||
const excludeUsedKeys = (options: SelectableStrings) => {
|
||||
return options.filter(({ value }) => !Object.keys(data).includes(value));
|
||||
return options.filter(({ value }) => !Object.keys(data).includes(value!));
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -47,7 +47,7 @@ export const Dimensions: FunctionComponent<Props> = ({ dimensions, loadValues, l
|
||||
if (newKey === removeText) {
|
||||
setData({ ...newDimensions });
|
||||
} else {
|
||||
setData({ ...newDimensions, [newKey]: '' });
|
||||
setData({ ...newDimensions, [newKey!]: '' });
|
||||
}
|
||||
}}
|
||||
/>
|
||||
@@ -57,7 +57,7 @@ export const Dimensions: FunctionComponent<Props> = ({ dimensions, loadValues, l
|
||||
value={value}
|
||||
placeholder="select dimension value"
|
||||
loadOptions={() => loadValues(key)}
|
||||
onChange={({ value: newValue }) => setData({ ...data, [key]: newValue })}
|
||||
onChange={({ value: newValue }) => setData({ ...data, [key]: newValue! })}
|
||||
/>
|
||||
{Object.values(data).length > 1 && index + 1 !== Object.values(data).length && (
|
||||
<label className="gf-form-label query-keyword">AND</label>
|
||||
@@ -73,7 +73,7 @@ export const Dimensions: FunctionComponent<Props> = ({ dimensions, loadValues, l
|
||||
</a>
|
||||
}
|
||||
loadOptions={() => loadKeys().then(excludeUsedKeys)}
|
||||
onChange={({ value: newKey }) => setData({ ...data, [newKey]: '' })}
|
||||
onChange={({ value: newKey }) => setData({ ...data, [newKey!]: '' })}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
|
||||
@@ -40,7 +40,7 @@ export interface CloudWatchLogsQueryFieldProps extends ExploreQueryFieldProps<Cl
|
||||
onLabelsRefresh?: () => void;
|
||||
ExtraFieldElement?: ReactNode;
|
||||
syntaxLoaded: boolean;
|
||||
syntax: Grammar;
|
||||
syntax: Grammar | null;
|
||||
exploreId: ExploreId;
|
||||
allowCustomValue?: boolean;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ export function MetricsQueryFieldsEditor({
|
||||
placeholder="Select region"
|
||||
options={regions}
|
||||
allowCustomValue
|
||||
onChange={({ value: region }) => onQueryChange({ ...query, region })}
|
||||
onChange={({ value: region }) => onQueryChange({ ...query, region: region! })}
|
||||
/>
|
||||
</QueryInlineField>
|
||||
|
||||
@@ -106,7 +106,7 @@ export function MetricsQueryFieldsEditor({
|
||||
placeholder="Select namespace"
|
||||
allowCustomValue
|
||||
options={namespaces}
|
||||
onChange={({ value: namespace }) => onQueryChange({ ...query, namespace })}
|
||||
onChange={({ value: namespace }) => onQueryChange({ ...query, namespace: namespace! })}
|
||||
/>
|
||||
</QueryInlineField>
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ export const Stats: FunctionComponent<Props> = ({ stats, values, onChange, varia
|
||||
onChange(
|
||||
value === removeText
|
||||
? values.filter((_, i) => i !== index)
|
||||
: values.map((v, i) => (i === index ? value : v))
|
||||
: values.map((v, i) => (i === index ? value! : v))
|
||||
)
|
||||
}
|
||||
/>
|
||||
@@ -38,8 +38,8 @@ export const Stats: FunctionComponent<Props> = ({ stats, values, onChange, varia
|
||||
</a>
|
||||
}
|
||||
allowCustomValue
|
||||
onChange={({ value }) => onChange([...values, value])}
|
||||
options={[...stats.filter(({ value }) => !values.includes(value)), variableOptionGroup]}
|
||||
onChange={({ value }) => onChange([...values, value!])}
|
||||
options={[...stats.filter(({ value }) => !values.includes(value!)), variableOptionGroup]}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user