mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Fix strict errors, down to 416 (#31365)
This commit is contained in:
@@ -107,15 +107,16 @@ const defaults: any = {
|
|||||||
transparent: false,
|
transparent: false,
|
||||||
options: {},
|
options: {},
|
||||||
datasource: null,
|
datasource: null,
|
||||||
|
title: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
export class PanelModel implements DataConfigSource {
|
export class PanelModel implements DataConfigSource {
|
||||||
/* persisted id, used in URL to identify a panel */
|
/* persisted id, used in URL to identify a panel */
|
||||||
id: number;
|
id!: number;
|
||||||
editSourceId: number;
|
editSourceId?: number;
|
||||||
gridPos: GridPos;
|
gridPos!: GridPos;
|
||||||
type: string;
|
type!: string;
|
||||||
title: string;
|
title!: string;
|
||||||
alert?: any;
|
alert?: any;
|
||||||
scopedVars?: ScopedVars;
|
scopedVars?: ScopedVars;
|
||||||
repeat?: string;
|
repeat?: string;
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ import _ from 'lodash';
|
|||||||
import { auto } from 'angular';
|
import { auto } from 'angular';
|
||||||
|
|
||||||
export class QueryCtrl {
|
export class QueryCtrl {
|
||||||
target: any;
|
target!: any;
|
||||||
datasource: any;
|
datasource!: any;
|
||||||
panelCtrl: any;
|
panelCtrl!: any;
|
||||||
panel: any;
|
panel: any;
|
||||||
hasRawMode: boolean;
|
hasRawMode!: boolean;
|
||||||
error?: string | null;
|
error?: string | null;
|
||||||
isLastQuery: boolean;
|
isLastQuery: boolean;
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export const ChangePasswordPage: FC<Props> = ({ navModel }) => (
|
|||||||
teams: Team[],
|
teams: Team[],
|
||||||
orgs: UserOrg[],
|
orgs: UserOrg[],
|
||||||
sessions: UserSession[],
|
sessions: UserSession[],
|
||||||
user: UserDTO
|
user?: UserDTO
|
||||||
) => {
|
) => {
|
||||||
return (
|
return (
|
||||||
<Page.Contents>
|
<Page.Contents>
|
||||||
@@ -31,7 +31,7 @@ export const ChangePasswordPage: FC<Props> = ({ navModel }) => (
|
|||||||
{states.loadUser ? (
|
{states.loadUser ? (
|
||||||
<LoadingPlaceholder text="Loading user profile..." />
|
<LoadingPlaceholder text="Loading user profile..." />
|
||||||
) : (
|
) : (
|
||||||
<ChangePasswordForm user={user} onChangePassword={api.changePassword} isSaving={states.changePassword} />
|
<ChangePasswordForm user={user!} onChangePassword={api.changePassword} isSaving={states.changePassword} />
|
||||||
)}
|
)}
|
||||||
</Page.Contents>
|
</Page.Contents>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export const UserProfileEdit: FC<Props> = ({ navModel }) => (
|
|||||||
teams: Team[],
|
teams: Team[],
|
||||||
orgs: UserOrg[],
|
orgs: UserOrg[],
|
||||||
sessions: UserSession[],
|
sessions: UserSession[],
|
||||||
user: UserDTO
|
user?: UserDTO
|
||||||
) => {
|
) => {
|
||||||
return (
|
return (
|
||||||
<Page.Contents>
|
<Page.Contents>
|
||||||
@@ -37,7 +37,7 @@ export const UserProfileEdit: FC<Props> = ({ navModel }) => (
|
|||||||
<UserProfileEditForm
|
<UserProfileEditForm
|
||||||
updateProfile={api.updateUserProfile}
|
updateProfile={api.updateUserProfile}
|
||||||
isSavingUser={states.updateUserProfile}
|
isSavingUser={states.updateUserProfile}
|
||||||
user={user}
|
user={user!}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<SharedPreferences resourceUri="user" />
|
<SharedPreferences resourceUri="user" />
|
||||||
@@ -49,14 +49,14 @@ export const UserProfileEdit: FC<Props> = ({ navModel }) => (
|
|||||||
setUserOrg={api.setUserOrg}
|
setUserOrg={api.setUserOrg}
|
||||||
loadOrgs={api.loadOrgs}
|
loadOrgs={api.loadOrgs}
|
||||||
orgs={orgs}
|
orgs={orgs}
|
||||||
user={user}
|
user={user!}
|
||||||
/>
|
/>
|
||||||
<UserSessions
|
<UserSessions
|
||||||
isLoading={states.loadSessions}
|
isLoading={states.loadSessions}
|
||||||
loadSessions={api.loadSessions}
|
loadSessions={api.loadSessions}
|
||||||
revokeUserSession={api.revokeUserSession}
|
revokeUserSession={api.revokeUserSession}
|
||||||
sessions={sessions}
|
sessions={sessions}
|
||||||
user={user}
|
user={user!}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -30,13 +30,13 @@ jest.mock('app/features/dashboard/services/DashboardSrv', () => ({
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
class ScenarioCtx {
|
class ScenarioCtx {
|
||||||
ds: DataSourceApi;
|
ds!: DataSourceApi;
|
||||||
request: DataQueryRequest;
|
request!: DataQueryRequest;
|
||||||
subscriber: Subscriber<DataQueryResponse>;
|
subscriber!: Subscriber<DataQueryResponse>;
|
||||||
isUnsubbed = false;
|
isUnsubbed = false;
|
||||||
setupFn: () => void = () => {};
|
setupFn: () => void = () => {};
|
||||||
results: PanelData[];
|
results!: PanelData[];
|
||||||
subscription: Subscription;
|
subscription!: Subscription;
|
||||||
wasStarted = false;
|
wasStarted = false;
|
||||||
error: Error | null = null;
|
error: Error | null = null;
|
||||||
toStartTime = dateTime();
|
toStartTime = dateTime();
|
||||||
|
|||||||
@@ -49,11 +49,11 @@ export interface MetricAggregationWithInlineScript extends BaseMetricAggregation
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Count extends BaseMetricAggregation {
|
export interface Count extends BaseMetricAggregation {
|
||||||
type: 'count';
|
type: 'count';
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Average
|
export interface Average
|
||||||
extends MetricAggregationWithField,
|
extends MetricAggregationWithField,
|
||||||
MetricAggregationWithMissingSupport,
|
MetricAggregationWithMissingSupport,
|
||||||
MetricAggregationWithInlineScript {
|
MetricAggregationWithInlineScript {
|
||||||
@@ -64,7 +64,7 @@ interface Average
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Sum extends MetricAggregationWithField, MetricAggregationWithInlineScript {
|
export interface Sum extends MetricAggregationWithField, MetricAggregationWithInlineScript {
|
||||||
type: 'sum';
|
type: 'sum';
|
||||||
settings?: {
|
settings?: {
|
||||||
script?: string;
|
script?: string;
|
||||||
@@ -72,7 +72,7 @@ interface Sum extends MetricAggregationWithField, MetricAggregationWithInlineScr
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Max extends MetricAggregationWithField, MetricAggregationWithInlineScript {
|
export interface Max extends MetricAggregationWithField, MetricAggregationWithInlineScript {
|
||||||
type: 'max';
|
type: 'max';
|
||||||
settings?: {
|
settings?: {
|
||||||
script?: string;
|
script?: string;
|
||||||
@@ -80,7 +80,7 @@ interface Max extends MetricAggregationWithField, MetricAggregationWithInlineScr
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Min extends MetricAggregationWithField, MetricAggregationWithInlineScript {
|
export interface Min extends MetricAggregationWithField, MetricAggregationWithInlineScript {
|
||||||
type: 'min';
|
type: 'min';
|
||||||
settings?: {
|
settings?: {
|
||||||
script?: string;
|
script?: string;
|
||||||
@@ -131,21 +131,21 @@ export interface UniqueCount extends MetricAggregationWithField {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RawDocument extends BaseMetricAggregation {
|
export interface RawDocument extends BaseMetricAggregation {
|
||||||
type: 'raw_document';
|
type: 'raw_document';
|
||||||
settings?: {
|
settings?: {
|
||||||
size?: string;
|
size?: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RawData extends BaseMetricAggregation {
|
export interface RawData extends BaseMetricAggregation {
|
||||||
type: 'raw_data';
|
type: 'raw_data';
|
||||||
settings?: {
|
settings?: {
|
||||||
size?: string;
|
size?: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Logs extends BaseMetricAggregation {
|
export interface Logs extends BaseMetricAggregation {
|
||||||
type: 'logs';
|
type: 'logs';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ export interface BasePipelineMetricAggregation extends MetricAggregationWithFiel
|
|||||||
pipelineAgg?: string;
|
pipelineAgg?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PipelineMetricAggregationWithMultipleBucketPaths extends BaseMetricAggregation {
|
export interface PipelineMetricAggregationWithMultipleBucketPaths extends BaseMetricAggregation {
|
||||||
type: PipelineMetricAggregationType;
|
type: PipelineMetricAggregationType;
|
||||||
pipelineVariables?: PipelineVariable[];
|
pipelineVariables?: PipelineVariable[];
|
||||||
}
|
}
|
||||||
@@ -166,26 +166,27 @@ export interface MovingAverageModelOption {
|
|||||||
value: MovingAverageModel;
|
value: MovingAverageModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface BaseMovingAverageModelSettings {
|
export interface BaseMovingAverageModelSettings {
|
||||||
model: MovingAverageModel;
|
model: MovingAverageModel;
|
||||||
window: number;
|
window: number;
|
||||||
predict: number;
|
predict: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MovingAverageSimpleModelSettings extends BaseMovingAverageModelSettings {
|
export interface MovingAverageSimpleModelSettings extends BaseMovingAverageModelSettings {
|
||||||
model: 'simple';
|
model: 'simple';
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MovingAverageLinearModelSettings extends BaseMovingAverageModelSettings {
|
export interface MovingAverageLinearModelSettings extends BaseMovingAverageModelSettings {
|
||||||
model: 'linear';
|
model: 'linear';
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MovingAverageEWMAModelSettings extends BaseMovingAverageModelSettings {
|
export interface MovingAverageEWMAModelSettings extends BaseMovingAverageModelSettings {
|
||||||
model: 'ewma';
|
model: 'ewma';
|
||||||
alpha: number;
|
alpha: number;
|
||||||
minimize: boolean;
|
minimize: boolean;
|
||||||
}
|
}
|
||||||
interface MovingAverageHoltModelSettings extends BaseMovingAverageModelSettings {
|
|
||||||
|
export interface MovingAverageHoltModelSettings extends BaseMovingAverageModelSettings {
|
||||||
model: 'holt';
|
model: 'holt';
|
||||||
settings: {
|
settings: {
|
||||||
alpha?: number;
|
alpha?: number;
|
||||||
@@ -193,7 +194,8 @@ interface MovingAverageHoltModelSettings extends BaseMovingAverageModelSettings
|
|||||||
};
|
};
|
||||||
minimize: boolean;
|
minimize: boolean;
|
||||||
}
|
}
|
||||||
interface MovingAverageHoltWintersModelSettings extends BaseMovingAverageModelSettings {
|
|
||||||
|
export interface MovingAverageHoltWintersModelSettings extends BaseMovingAverageModelSettings {
|
||||||
model: 'holt_winters';
|
model: 'holt_winters';
|
||||||
settings: {
|
settings: {
|
||||||
alpha?: number;
|
alpha?: number;
|
||||||
@@ -232,7 +234,7 @@ export const isHoltWintersMovingAverage = (
|
|||||||
metric: MovingAverage | MovingAverage<'holt_winters'>
|
metric: MovingAverage | MovingAverage<'holt_winters'>
|
||||||
): metric is MovingAverage<'holt_winters'> => metric.settings?.model === 'holt_winters';
|
): metric is MovingAverage<'holt_winters'> => metric.settings?.model === 'holt_winters';
|
||||||
|
|
||||||
interface MovingFunction extends BasePipelineMetricAggregation {
|
export interface MovingFunction extends BasePipelineMetricAggregation {
|
||||||
type: 'moving_fn';
|
type: 'moving_fn';
|
||||||
settings?: {
|
settings?: {
|
||||||
window?: string;
|
window?: string;
|
||||||
@@ -255,7 +257,7 @@ export interface SerialDiff extends BasePipelineMetricAggregation {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
interface CumulativeSum extends BasePipelineMetricAggregation {
|
export interface CumulativeSum extends BasePipelineMetricAggregation {
|
||||||
type: 'cumulative_sum';
|
type: 'cumulative_sum';
|
||||||
settings?: {
|
settings?: {
|
||||||
format?: string;
|
format?: string;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export class MysqlQueryCtrl extends QueryCtrl {
|
|||||||
|
|
||||||
formats: any[];
|
formats: any[];
|
||||||
lastQueryError?: string;
|
lastQueryError?: string;
|
||||||
showHelp: boolean;
|
showHelp!: boolean;
|
||||||
|
|
||||||
queryModel: MysqlQuery;
|
queryModel: MysqlQuery;
|
||||||
metaBuilder: MysqlMetaQuery;
|
metaBuilder: MysqlMetaQuery;
|
||||||
@@ -34,10 +34,10 @@ export class MysqlQueryCtrl extends QueryCtrl {
|
|||||||
whereAdd: any;
|
whereAdd: any;
|
||||||
timeColumnSegment: any;
|
timeColumnSegment: any;
|
||||||
metricColumnSegment: any;
|
metricColumnSegment: any;
|
||||||
selectMenu: any[];
|
selectMenu: any[] = [];
|
||||||
selectParts: SqlPart[][];
|
selectParts: SqlPart[][] = [];
|
||||||
groupParts: SqlPart[];
|
groupParts: SqlPart[] = [];
|
||||||
whereParts: SqlPart[];
|
whereParts: SqlPart[] = [];
|
||||||
groupAdd: any;
|
groupAdd: any;
|
||||||
|
|
||||||
/** @ngInject */
|
/** @ngInject */
|
||||||
@@ -136,7 +136,6 @@ export class MysqlQueryCtrl extends QueryCtrl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildSelectMenu() {
|
buildSelectMenu() {
|
||||||
this.selectMenu = [];
|
|
||||||
const aggregates = {
|
const aggregates = {
|
||||||
text: 'Aggregate Functions',
|
text: 'Aggregate Functions',
|
||||||
value: 'aggregate',
|
value: 'aggregate',
|
||||||
|
|||||||
@@ -33,20 +33,20 @@ export default function rendering(scope: any, elem: any, attrs: any, ctrl: any)
|
|||||||
return new HeatmapRenderer(scope, elem, attrs, ctrl);
|
return new HeatmapRenderer(scope, elem, attrs, ctrl);
|
||||||
}
|
}
|
||||||
export class HeatmapRenderer {
|
export class HeatmapRenderer {
|
||||||
width: number;
|
width = 200;
|
||||||
height: number;
|
height = 200;
|
||||||
yScale: any;
|
yScale: any;
|
||||||
xScale: any;
|
xScale: any;
|
||||||
chartWidth: number;
|
chartWidth = 0;
|
||||||
chartHeight: number;
|
chartHeight = 0;
|
||||||
chartTop: number;
|
chartTop = 0;
|
||||||
chartBottom: number;
|
chartBottom = 0;
|
||||||
yAxisWidth: number;
|
yAxisWidth = 0;
|
||||||
xAxisHeight: number;
|
xAxisHeight = 0;
|
||||||
cardPadding: number;
|
cardPadding = 0;
|
||||||
cardRound: number;
|
cardRound = 0;
|
||||||
cardWidth: number;
|
cardWidth = 0;
|
||||||
cardHeight: number;
|
cardHeight = 0;
|
||||||
colorScale: any;
|
colorScale: any;
|
||||||
opacityScale: any;
|
opacityScale: any;
|
||||||
mouseUpHandler: any;
|
mouseUpHandler: any;
|
||||||
@@ -61,6 +61,7 @@ export class HeatmapRenderer {
|
|||||||
padding: any;
|
padding: any;
|
||||||
margin: any;
|
margin: any;
|
||||||
dataRangeWidingFactor: number;
|
dataRangeWidingFactor: number;
|
||||||
|
|
||||||
constructor(private scope: any, private elem: any, attrs: any, private ctrl: any) {
|
constructor(private scope: any, private elem: any, attrs: any, private ctrl: any) {
|
||||||
// $heatmap is JQuery object, but heatmap is D3
|
// $heatmap is JQuery object, but heatmap is D3
|
||||||
this.$heatmap = this.elem.find('.heatmap-panel');
|
this.$heatmap = this.elem.find('.heatmap-panel');
|
||||||
@@ -75,9 +76,7 @@ export class HeatmapRenderer {
|
|||||||
this.padding = { left: 0, right: 0, top: 0, bottom: 0 };
|
this.padding = { left: 0, right: 0, top: 0, bottom: 0 };
|
||||||
this.margin = { left: 25, right: 15, top: 10, bottom: 20 };
|
this.margin = { left: 25, right: 15, top: 10, bottom: 20 };
|
||||||
this.dataRangeWidingFactor = DATA_RANGE_WIDING_FACTOR;
|
this.dataRangeWidingFactor = DATA_RANGE_WIDING_FACTOR;
|
||||||
|
|
||||||
this.ctrl.events.on(PanelEvents.render, this.onRender.bind(this));
|
this.ctrl.events.on(PanelEvents.render, this.onRender.bind(this));
|
||||||
|
|
||||||
this.ctrl.tickValueFormatter = this.tickValueFormatter.bind(this);
|
this.ctrl.tickValueFormatter = this.tickValueFormatter.bind(this);
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ export interface StatPanelOptions extends SingleStatBaseOptions {
|
|||||||
textMode: BigValueTextMode;
|
textMode: BigValueTextMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function addStandardDataReduceOptions(
|
export function addStandardDataReduceOptions<T extends SingleStatBaseOptions>(
|
||||||
builder: PanelOptionsEditorBuilder<SingleStatBaseOptions>,
|
builder: PanelOptionsEditorBuilder<T>,
|
||||||
includeOrientation = true,
|
includeOrientation = true,
|
||||||
includeFieldMatcher = true,
|
includeFieldMatcher = true,
|
||||||
includeTextSizes = true
|
includeTextSizes = true
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ export function addAxisConfig(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function addLegendOptions(builder: PanelOptionsEditorBuilder<OptionsWithLegend>) {
|
export function addLegendOptions<T extends OptionsWithLegend>(builder: PanelOptionsEditorBuilder<T>) {
|
||||||
builder
|
builder
|
||||||
.addRadio({
|
.addRadio({
|
||||||
path: 'legend.displayMode',
|
path: 'legend.displayMode',
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -e
|
|||||||
|
|
||||||
echo -e "Collecting code stats (typescript errors & more)"
|
echo -e "Collecting code stats (typescript errors & more)"
|
||||||
|
|
||||||
ERROR_COUNT_LIMIT=452
|
ERROR_COUNT_LIMIT=416
|
||||||
ERROR_COUNT="$(./node_modules/.bin/tsc --project tsconfig.json --noEmit --strict true | grep -oP 'Found \K(\d+)')"
|
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
|
if [ "$ERROR_COUNT" -gt $ERROR_COUNT_LIMIT ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user