diff --git a/packages/grafana-data/src/utils/datasource.ts b/packages/grafana-data/src/utils/datasource.ts index 6fad3a54b09..3697a132005 100644 --- a/packages/grafana-data/src/utils/datasource.ts +++ b/packages/grafana-data/src/utils/datasource.ts @@ -47,8 +47,8 @@ export const onUpdateDatasourceResetOption = (props: DataSourcePluginOptionsEdit updateDatasourcePluginResetOption(props, key); }; -export function updateDatasourcePluginOption( - props: DataSourcePluginOptionsEditorProps, +export function updateDatasourcePluginOption( + props: DataSourcePluginOptionsEditorProps, key: keyof DataSourceSettings, val: any ) { @@ -82,21 +82,27 @@ export const updateDatasourcePluginSecureJsonDataOption = { const config = props.options; + if (!config.secureJsonData) { + return; + } props.onOptionsChange({ ...config, secureJsonData: { - ...config.secureJsonData!, + ...config.secureJsonData, [key]: val, }, }); }; export const updateDatasourcePluginResetOption = ( - props: DataSourcePluginOptionsEditorProps, + props: DataSourcePluginOptionsEditorProps, key: string ) => { const config = props.options; + if (!config.secureJsonData) { + return; + } props.onOptionsChange({ ...config, diff --git a/scripts/ci-check-strict.sh b/scripts/ci-check-strict.sh index 2a70a11f7c3..0d35063a448 100755 --- a/scripts/ci-check-strict.sh +++ b/scripts/ci-check-strict.sh @@ -3,7 +3,7 @@ set -e echo -e "Collecting code stats (typescript errors & more)" -ERROR_COUNT_LIMIT=12 +ERROR_COUNT_LIMIT=6 ERROR_COUNT="$(./node_modules/.bin/tsc --project tsconfig.json --noEmit --strict true | grep -oP 'Found \K(\d+)')" if [ "$ERROR_COUNT" -gt $ERROR_COUNT_LIMIT ]; then