mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: More typescript strict null fixes, going for sub 200 (#26134)
* 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 * Now at 218 * Progress * Update * Progress * Updated tests * at 159 * fixed tests * Fixed test
This commit is contained in:
@@ -5,7 +5,7 @@ import { GenericDataSourcePlugin } from '../settings/PluginSettings';
|
||||
export function buildNavModel(dataSource: DataSourceSettings, plugin: GenericDataSourcePlugin): NavModelItem {
|
||||
const pluginMeta = plugin.meta;
|
||||
|
||||
const navModel = {
|
||||
const navModel: NavModelItem = {
|
||||
img: pluginMeta.info.logos.large,
|
||||
id: 'datasource-' + dataSource.id,
|
||||
subTitle: `Type: ${pluginMeta.name}`,
|
||||
@@ -25,7 +25,7 @@ export function buildNavModel(dataSource: DataSourceSettings, plugin: GenericDat
|
||||
|
||||
if (plugin.configPages) {
|
||||
for (const page of plugin.configPages) {
|
||||
navModel.children.push({
|
||||
navModel.children!.push({
|
||||
active: false,
|
||||
text: page.title,
|
||||
icon: page.icon,
|
||||
@@ -36,7 +36,7 @@ export function buildNavModel(dataSource: DataSourceSettings, plugin: GenericDat
|
||||
}
|
||||
|
||||
if (pluginMeta.includes && hasDashboards(pluginMeta.includes)) {
|
||||
navModel.children.push({
|
||||
navModel.children!.push({
|
||||
active: false,
|
||||
icon: 'apps',
|
||||
id: `datasource-dashboards-${dataSource.id}`,
|
||||
@@ -46,7 +46,7 @@ export function buildNavModel(dataSource: DataSourceSettings, plugin: GenericDat
|
||||
}
|
||||
|
||||
if (config.licenseInfo.hasLicense) {
|
||||
navModel.children.push({
|
||||
navModel.children!.push({
|
||||
active: false,
|
||||
icon: 'lock',
|
||||
id: `datasource-permissions-${dataSource.id}`,
|
||||
@@ -55,7 +55,7 @@ export function buildNavModel(dataSource: DataSourceSettings, plugin: GenericDat
|
||||
});
|
||||
|
||||
if (config.featureToggles.datasourceInsights) {
|
||||
navModel.children.push({
|
||||
navModel.children!.push({
|
||||
active: false,
|
||||
icon: 'info-circle',
|
||||
id: `datasource-insights-${dataSource.id}`,
|
||||
|
||||
@@ -17,7 +17,7 @@ export const getDataSourcePlugins = (state: DataSourcesState) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const getDataSource = (state: DataSourcesState, dataSourceId: UrlQueryValue): DataSourceSettings | null => {
|
||||
export const getDataSource = (state: DataSourcesState, dataSourceId: UrlQueryValue): DataSourceSettings => {
|
||||
if (state.dataSource.id === parseInt(dataSourceId as string, 10)) {
|
||||
return state.dataSource;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ describe('createResetHandler', () => {
|
||||
createResetHandler(ctrl, field)(event);
|
||||
expect(ctrl).toEqual({
|
||||
current: {
|
||||
[field]: null,
|
||||
[field]: undefined,
|
||||
secureJsonData: {
|
||||
[field]: '',
|
||||
},
|
||||
|
||||
@@ -31,7 +31,7 @@ export const createResetHandler = (ctrl: Ctrl, field: PasswordFieldEnum) => (
|
||||
) => {
|
||||
event.preventDefault();
|
||||
// Reset also normal plain text password to remove it and only save it in secureJsonData.
|
||||
ctrl.current[field] = null;
|
||||
ctrl.current[field] = undefined;
|
||||
ctrl.current.secureJsonFields[field] = false;
|
||||
ctrl.current.secureJsonData = ctrl.current.secureJsonData || {};
|
||||
ctrl.current.secureJsonData[field] = '';
|
||||
|
||||
Reference in New Issue
Block a user