Explore: updates ExploreItemState type, reduces strict null errors count to 702 (#25250)

* Chore: changes null values to undefined in explore reducer

* Chore: changes sortLogsResult param type from null to undefined

* Chore: changes null values to undefined in explore reducer

* Chore: updates strict null errors count

* Revert "Chore: changes null values to undefined in explore reducer"

This reverts commit b82d841611.

* Revert "Chore: changes sortLogsResult param type from null to undefined"

This reverts commit 21073b5d30.

* Revert "Chore: changes null values to undefined in explore reducer"

This reverts commit 798559688c.

* Chore: updates ExploreItemState type

* Chore: updates initial ExploreItemState in Explore reducer

* Chore: updates strict null errors count to 699

* Chore: changed ExploreMode and Emitter type in ExploreStateItem

* Revert "Chore: changed ExploreMode and Emitter type in ExploreStateItem"

This reverts commit 7e0e2027fc.
This commit is contained in:
Lukas Siatka 2020-06-17 10:08:19 +02:00 committed by GitHub
parent 03f7fd0527
commit 7b7000c5bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 10 deletions

View File

@ -12,6 +12,7 @@ import {
TimeZone, TimeZone,
toLegacyResponseData, toLegacyResponseData,
ExploreMode, ExploreMode,
LogsDedupStrategy,
} from '@grafana/data'; } from '@grafana/data';
import { RefreshPicker } from '@grafana/ui'; import { RefreshPicker } from '@grafana/ui';
import { LocationUpdate } from '@grafana/runtime'; import { LocationUpdate } from '@grafana/runtime';
@ -69,6 +70,7 @@ import {
} from './actionTypes'; } from './actionTypes';
import { ResultProcessor } from '../utils/ResultProcessor'; import { ResultProcessor } from '../utils/ResultProcessor';
import { updateLocation } from '../../../core/actions'; import { updateLocation } from '../../../core/actions';
import { Emitter } from 'app/core/core';
export const DEFAULT_RANGE = { export const DEFAULT_RANGE = {
from: 'now-6h', from: 'now-6h',
@ -105,7 +107,6 @@ export const makeExploreItemState = (): ExploreItemState => ({
to: null, to: null,
}, },
scanning: false, scanning: false,
scanRange: null,
showingGraph: true, showingGraph: true,
showingTable: true, showingTable: true,
loading: false, loading: false,
@ -114,11 +115,16 @@ export const makeExploreItemState = (): ExploreItemState => ({
update: makeInitialUpdateState(), update: makeInitialUpdateState(),
latency: 0, latency: 0,
supportedModes: [], supportedModes: [],
mode: null, mode: (null as unknown) as ExploreMode,
isLive: false, isLive: false,
isPaused: false, isPaused: false,
urlReplaced: false, urlReplaced: false,
queryResponse: createEmptyQueryResponse(), queryResponse: createEmptyQueryResponse(),
tableResult: null,
graphResult: null,
logsResult: null,
dedupStrategy: LogsDedupStrategy.none,
eventBridge: (null as unknown) as Emitter,
}); });
export const createEmptyQueryResponse = (): PanelData => ({ export const createEmptyQueryResponse = (): PanelData => ({

View File

@ -66,7 +66,7 @@ export interface ExploreItemState {
/** /**
* True if the datasource is loading. `null` if the loading has not started yet. * True if the datasource is loading. `null` if the loading has not started yet.
*/ */
datasourceLoading?: boolean; datasourceLoading: boolean | null;
/** /**
* True if there is no datasource to be selected. * True if there is no datasource to be selected.
*/ */
@ -74,11 +74,11 @@ export interface ExploreItemState {
/** /**
* Emitter to send events to the rest of Grafana. * Emitter to send events to the rest of Grafana.
*/ */
eventBridge?: Emitter; eventBridge: Emitter;
/** /**
* List of timeseries to be shown in the Explore graph result viewer. * List of timeseries to be shown in the Explore graph result viewer.
*/ */
graphResult?: GraphSeriesXY[]; graphResult: GraphSeriesXY[] | null;
/** /**
* History of recent queries. Datasource-specific and initialized via localStorage. * History of recent queries. Datasource-specific and initialized via localStorage.
*/ */
@ -101,7 +101,7 @@ export interface ExploreItemState {
/** /**
* Log query result to be displayed in the logs result viewer. * Log query result to be displayed in the logs result viewer.
*/ */
logsResult?: LogsModel; logsResult: LogsModel | null;
/** /**
* Time range for this Explore. Managed by the time picker and used by all query runs. * Time range for this Explore. Managed by the time picker and used by all query runs.
@ -112,7 +112,7 @@ export interface ExploreItemState {
/** /**
* True if scanning for more results is active. * True if scanning for more results is active.
*/ */
scanning?: boolean; scanning: boolean;
/** /**
* Current scanning range to be shown to the user while scanning is active. * Current scanning range to be shown to the user while scanning is active.
*/ */
@ -130,7 +130,7 @@ export interface ExploreItemState {
/** /**
* Table model that combines all query table results into a single table. * Table model that combines all query table results into a single table.
*/ */
tableResult?: DataFrame; tableResult: DataFrame | null;
/** /**
* React keys for rendering of QueryRows * React keys for rendering of QueryRows
@ -140,7 +140,7 @@ export interface ExploreItemState {
/** /**
* Current logs deduplication strategy * Current logs deduplication strategy
*/ */
dedupStrategy?: LogsDedupStrategy; dedupStrategy: LogsDedupStrategy;
/** /**
* Currently hidden log series * Currently hidden log series

View File

@ -2,7 +2,7 @@
echo -e "Collecting code stats (typescript errors & more)" echo -e "Collecting code stats (typescript errors & more)"
ERROR_COUNT_LIMIT=724 ERROR_COUNT_LIMIT=702
DIRECTIVES_LIMIT=172 DIRECTIVES_LIMIT=172
CONTROLLERS_LIMIT=139 CONTROLLERS_LIMIT=139