diff --git a/public/app/features/alerting/.eslintrc b/public/app/features/alerting/.eslintrc index 5d4da843de0..276a60245e1 100644 --- a/public/app/features/alerting/.eslintrc +++ b/public/app/features/alerting/.eslintrc @@ -1,5 +1,8 @@ { "plugins": ["testing-library"], + "rules": { + "react/no-unused-prop-types": "error", + }, "overrides": [ { "files": ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)"], diff --git a/public/app/features/alerting/unified/GrafanaRuleQueryViewer.tsx b/public/app/features/alerting/unified/GrafanaRuleQueryViewer.tsx index 0601d0b445b..35b90649489 100644 --- a/public/app/features/alerting/unified/GrafanaRuleQueryViewer.tsx +++ b/public/app/features/alerting/unified/GrafanaRuleQueryViewer.tsx @@ -58,7 +58,6 @@ export function GrafanaRuleQueryViewer({ rule, queries, condition, evalDataByQue rule={rule} key={index} refId={refId} - isAlertCondition={condition === refId} model={model} relativeTimeRange={relativeTimeRange} dataSource={dataSource} @@ -72,8 +71,6 @@ export function GrafanaRuleQueryViewer({ rule, queries, condition, evalDataByQue
{expressions.map(({ model, refId, datasourceUid }, index) => { - const dataSource = dsByUid[datasourceUid]; - return ( isExpressionQuery(model) && ( ) @@ -95,7 +91,6 @@ export function GrafanaRuleQueryViewer({ rule, queries, condition, evalDataByQue interface QueryPreviewProps extends Pick { rule: CombinedRule; - isAlertCondition: boolean; dataSource?: DataSourceInstanceSettings; queryData?: PanelData; thresholds?: ThresholdDefinition; @@ -209,7 +204,6 @@ const getQueryPreviewStyles = (theme: GrafanaTheme2) => ({ interface ExpressionPreviewProps extends Pick { isAlertCondition: boolean; model: ExpressionQuery; - dataSource: DataSourceInstanceSettings; evalData?: PanelData; } diff --git a/public/app/features/alerting/unified/components/AlertStateDot.tsx b/public/app/features/alerting/unified/components/AlertStateDot.tsx index e966e80ea95..67e20b5b555 100644 --- a/public/app/features/alerting/unified/components/AlertStateDot.tsx +++ b/public/app/features/alerting/unified/components/AlertStateDot.tsx @@ -8,8 +8,8 @@ interface DotStylesProps { includeState?: boolean; } -const AlertStateDot = (props: DotStylesProps) => { - const styles = useStyles2(getDotStyles, props); +const AlertStateDot = ({ color, includeState }: DotStylesProps) => { + const styles = useStyles2(getDotStyles, { color, includeState }); return ( diff --git a/public/app/features/alerting/unified/components/expressions/Expression.tsx b/public/app/features/alerting/unified/components/expressions/Expression.tsx index 9db3be0c830..c9d7d8e2e17 100644 --- a/public/app/features/alerting/unified/components/expressions/Expression.tsx +++ b/public/app/features/alerting/unified/components/expressions/Expression.tsx @@ -138,7 +138,6 @@ export const Expression: FC = ({ queryType={queryType} onRemoveExpression={() => onRemoveExpression(query.refId)} onUpdateRefId={(newRefId) => onUpdateRefId(query.refId, newRefId)} - onUpdateExpressionType={(type) => onUpdateExpressionType(query.refId, type)} onSetCondition={onSetCondition} query={query} alertCondition={alertCondition} @@ -286,7 +285,6 @@ interface HeaderProps { queryType: ExpressionQueryType; onUpdateRefId: (refId: string) => void; onRemoveExpression: () => void; - onUpdateExpressionType: (type: ExpressionQueryType) => void; onSetCondition: (refId: string) => void; query: ExpressionQuery; alertCondition: boolean; diff --git a/public/app/features/alerting/unified/components/rule-editor/QueryWrapper.tsx b/public/app/features/alerting/unified/components/rule-editor/QueryWrapper.tsx index 7a6dfba30bb..ca9ddb606d9 100644 --- a/public/app/features/alerting/unified/components/rule-editor/QueryWrapper.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/QueryWrapper.tsx @@ -165,14 +165,7 @@ export const QueryWrapper = ({ hideHideQueryButton={true} />
- {showVizualisation && ( - onChangeThreshold(thresholds, index) : undefined} - /> - )} + {showVizualisation && } ); }; diff --git a/public/app/features/alerting/unified/components/rule-editor/VizWrapper.tsx b/public/app/features/alerting/unified/components/rule-editor/VizWrapper.tsx index 5d804c1261d..4b23c632341 100644 --- a/public/app/features/alerting/unified/components/rule-editor/VizWrapper.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/VizWrapper.tsx @@ -15,7 +15,6 @@ interface Props { data: PanelData; thresholds?: ThresholdsConfig; thresholdsType?: GraphThresholdsStyleMode; - onThresholdsChange?: (thresholds: ThresholdsConfig) => void; } /** The VizWrapper is just a simple component that renders either a table or a graph based on the type of data we receive from "PanelData" */ diff --git a/public/app/features/alerting/unified/components/rule-list/AlertRuleListItem.tsx b/public/app/features/alerting/unified/components/rule-list/AlertRuleListItem.tsx index 59d42a6b80f..b1cdbd46253 100644 --- a/public/app/features/alerting/unified/components/rule-list/AlertRuleListItem.tsx +++ b/public/app/features/alerting/unified/components/rule-list/AlertRuleListItem.tsx @@ -29,7 +29,6 @@ interface AlertRuleListItemProps { isProvisioned?: boolean; lastEvaluation?: string; evaluationInterval?: string; - evaluationDuration?: number; labels?: Labels; instancesCount?: number; // used for alert rules that use simplified routing @@ -79,9 +78,7 @@ export const AlertRuleListItem = (props: AlertRuleListItemProps) => { @@ -170,13 +167,11 @@ interface RecordingRuleListItemProps { href: string; error?: string; health?: RuleHealth; - recording?: boolean; state?: PromAlertingRuleState; labels?: Labels; isProvisioned?: boolean; lastEvaluation?: string; evaluationInterval?: string; - evaluationDuration?: number; } // @TODO split in to smaller re-usable bits @@ -213,9 +208,7 @@ export const RecordingRuleListItem = ({ {!isEmpty(labels) && ( @@ -258,8 +251,6 @@ interface EvaluationMetadataProps { lastEvaluation?: string; evaluationInterval?: string; state?: PromAlertingRuleState; - health?: RuleHealth; - error?: string; // if health is "error" this should have error details for us } function EvaluationMetadata({ lastEvaluation, evaluationInterval, state }: EvaluationMetadataProps) { diff --git a/public/app/features/alerting/unified/components/rule-list/EvaluationGroupWithRules.tsx b/public/app/features/alerting/unified/components/rule-list/EvaluationGroupWithRules.tsx index 36da6c9a1de..ec52fe3c4a1 100644 --- a/public/app/features/alerting/unified/components/rule-list/EvaluationGroupWithRules.tsx +++ b/public/app/features/alerting/unified/components/rule-list/EvaluationGroupWithRules.tsx @@ -42,7 +42,6 @@ export const EvaluationGroupWithRules = ({ group, rulesSource }: EvaluationGroup name={rulerRule.alert} labels={rulerRule.labels} lastEvaluation={promRule?.lastEvaluation} - evaluationDuration={promRule?.evaluationTime} evaluationInterval={group.interval} instancesCount={isAlertingPromRule ? size(promRule.alerts) : undefined} href={createViewLink(rulesSource, rule)} @@ -59,7 +58,6 @@ export const EvaluationGroupWithRules = ({ group, rulesSource }: EvaluationGroup health={promRule?.health} error={promRule?.lastError} lastEvaluation={promRule?.lastEvaluation} - evaluationDuration={promRule?.evaluationTime} evaluationInterval={group.interval} labels={rulerRule.labels} href={createViewLink(rulesSource, rule)} @@ -80,7 +78,6 @@ export const EvaluationGroupWithRules = ({ group, rulesSource }: EvaluationGroup labels={rulerRule.labels} isPaused={rulerRule.grafana_alert.is_paused} lastEvaluation={promRule?.lastEvaluation} - evaluationDuration={promRule?.evaluationTime} evaluationInterval={group.interval} instancesCount={isAlertingPromRule ? size(promRule.alerts) : undefined} href={createViewLink(rulesSource, rule)} diff --git a/public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx b/public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx index c37b4cd9355..832973c83f3 100644 --- a/public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx +++ b/public/app/features/alerting/unified/components/rule-viewer/AlertRuleMenu.tsx @@ -23,7 +23,6 @@ interface Props { handleDuplicateRule: (identifier: RuleIdentifier) => void; onPauseChange?: () => void; buttonSize?: ComponentSize; - hideLabels?: boolean; } /** diff --git a/public/app/features/alerting/unified/components/rule-viewer/tabs/Query.tsx b/public/app/features/alerting/unified/components/rule-viewer/tabs/Query.tsx index 390c8acf677..967b3f76a75 100644 --- a/public/app/features/alerting/unified/components/rule-viewer/tabs/Query.tsx +++ b/public/app/features/alerting/unified/components/rule-viewer/tabs/Query.tsx @@ -74,7 +74,6 @@ const QueryResults = ({ rule }: Props) => { dataSource={Object.values(config.datasources).find((ds) => ds.uid === query.datasourceUid)} queryData={data[query.refId]} relativeTimeRange={query.relativeTimeRange} - isAlertCondition={false} /> ); })} diff --git a/public/app/features/alerting/unified/components/rules/RuleListStateView.tsx b/public/app/features/alerting/unified/components/rules/RuleListStateView.tsx index 00460715009..04c16b82a06 100644 --- a/public/app/features/alerting/unified/components/rules/RuleListStateView.tsx +++ b/public/app/features/alerting/unified/components/rules/RuleListStateView.tsx @@ -11,7 +11,6 @@ import { RuleListStateSection } from './RuleListStateSection'; interface Props { namespaces: CombinedRuleNamespace[]; - expandAll?: boolean; } type GroupedRules = Record; diff --git a/public/app/features/alerting/unified/components/rules/state-history/LogRecordViewer.tsx b/public/app/features/alerting/unified/components/rules/state-history/LogRecordViewer.tsx index ea841a95bfb..d51d8c07105 100644 --- a/public/app/features/alerting/unified/components/rules/state-history/LogRecordViewer.tsx +++ b/public/app/features/alerting/unified/components/rules/state-history/LogRecordViewer.tsx @@ -11,12 +11,15 @@ import { AlertStateTag } from '../AlertStateTag'; import { LogRecord, omitLabels } from './common'; -interface LogRecordViewerProps { +type LogRecordViewerProps = { records: LogRecord[]; commonLabels: Array<[string, string]>; +}; + +type AdditionalLogRecordViewerProps = { onRecordsRendered?: (timestampRefs: Map) => void; onLabelClick?: (label: string) => void; -} +}; function groupRecordsByTimestamp(records: LogRecord[]) { // groupBy has been replaced by the reduce to avoid back and forth conversion of timestamp from number to string @@ -35,7 +38,12 @@ function groupRecordsByTimestamp(records: LogRecord[]) { } export const LogRecordViewerByTimestamp = memo( - ({ records, commonLabels, onLabelClick, onRecordsRendered }: LogRecordViewerProps) => { + ({ + records, + commonLabels, + onLabelClick, + onRecordsRendered, + }: LogRecordViewerProps & AdditionalLogRecordViewerProps) => { const styles = useStyles2(getStyles); const groupedLines = groupRecordsByTimestamp(records);