mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Add self closing comp rule to alerting eslint config (#98603)
This commit is contained in:
@@ -249,6 +249,7 @@ module.exports = [
|
|||||||
name: 'grafana/alerting-overrides',
|
name: 'grafana/alerting-overrides',
|
||||||
plugins: {
|
plugins: {
|
||||||
unicorn: unicornPlugin,
|
unicorn: unicornPlugin,
|
||||||
|
react: reactPlugin,
|
||||||
},
|
},
|
||||||
files: ['public/app/features/alerting/**/*.{ts,tsx,js,jsx}'],
|
files: ['public/app/features/alerting/**/*.{ts,tsx,js,jsx}'],
|
||||||
rules: {
|
rules: {
|
||||||
@@ -256,6 +257,7 @@ module.exports = [
|
|||||||
'dot-notation': 'error',
|
'dot-notation': 'error',
|
||||||
'prefer-const': 'error',
|
'prefer-const': 'error',
|
||||||
'react/no-unused-prop-types': 'error',
|
'react/no-unused-prop-types': 'error',
|
||||||
|
'react/self-closing-comp': 'error',
|
||||||
'unicorn/no-unused-properties': 'error',
|
'unicorn/no-unused-properties': 'error',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export const ManagePermissionsDrawer = ({
|
|||||||
const defaultTitle = t('alerting.manage-permissions.title', 'Manage permissions');
|
const defaultTitle = t('alerting.manage-permissions.title', 'Manage permissions');
|
||||||
return (
|
return (
|
||||||
<Drawer onClose={onClose} title={title || defaultTitle} subtitle={resourceName}>
|
<Drawer onClose={onClose} title={title || defaultTitle} subtitle={resourceName}>
|
||||||
<Permissions {...permissionsProps} canSetPermissions></Permissions>
|
<Permissions {...permissionsProps} canSetPermissions />
|
||||||
</Drawer>
|
</Drawer>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -324,7 +324,7 @@ export const TemplateForm = ({ originalTemplate, prefill, alertmanager }: Props)
|
|||||||
{isGrafanaAlertManager && (
|
{isGrafanaAlertManager && (
|
||||||
<>
|
<>
|
||||||
<div {...rowSplitter.secondaryProps}>
|
<div {...rowSplitter.secondaryProps}>
|
||||||
<div {...rowSplitter.splitterProps}></div>
|
<div {...rowSplitter.splitterProps} />
|
||||||
<TemplatePreview
|
<TemplatePreview
|
||||||
payload={payload}
|
payload={payload}
|
||||||
templateName={watch('title')}
|
templateName={watch('title')}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export const TemplatesTable = ({ alertManagerName, templates }: Props) => {
|
|||||||
</colgroup>
|
</colgroup>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th></th>
|
<th />
|
||||||
<th>Template group</th>
|
<th>Template group</th>
|
||||||
<Authorize
|
<Authorize
|
||||||
actions={[
|
actions={[
|
||||||
@@ -189,7 +189,7 @@ function TemplateRow({ notificationTemplate, idx, alertManagerName, onDeleteClic
|
|||||||
</tr>
|
</tr>
|
||||||
{isExpanded && (
|
{isExpanded && (
|
||||||
<tr className={idx % 2 === 0 ? tableStyles.evenRow : undefined}>
|
<tr className={idx % 2 === 0 ? tableStyles.evenRow : undefined}>
|
||||||
<td></td>
|
<td />
|
||||||
<td colSpan={2}>
|
<td colSpan={2}>
|
||||||
<DetailsField label="" horizontal={true}>
|
<DetailsField label="" horizontal={true}>
|
||||||
<TemplateEditor
|
<TemplateEditor
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ export const GenerateAlertDataModal = ({ isOpen, onDismiss, onAccept }: Props) =
|
|||||||
</Stack>
|
</Stack>
|
||||||
</Card>
|
</Card>
|
||||||
</>
|
</>
|
||||||
<div className={styles.onSubmitWrapper}></div>
|
<div className={styles.onSubmitWrapper} />
|
||||||
{alerts.length > 0 && (
|
{alerts.length > 0 && (
|
||||||
<Stack direction="column" gap={1}>
|
<Stack direction="column" gap={1}>
|
||||||
<h5> Review alert data to add to the payload:</h5>
|
<h5> Review alert data to add to the payload:</h5>
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export const KeyValueMapInput = ({ value, onChange, readOnly = false }: Props) =
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Value</th>
|
<th>Value</th>
|
||||||
{!readOnly && <th></th>}
|
{!readOnly && <th />}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|||||||
@@ -40,13 +40,13 @@ export function AlertManagerManualRouting({ alertManager }: AlertManagerManualRo
|
|||||||
return (
|
return (
|
||||||
<Stack direction="column">
|
<Stack direction="column">
|
||||||
<Stack direction="row" alignItems="center">
|
<Stack direction="row" alignItems="center">
|
||||||
<div className={styles.firstAlertManagerLine}></div>
|
<div className={styles.firstAlertManagerLine} />
|
||||||
<div className={styles.alertManagerName}>
|
<div className={styles.alertManagerName}>
|
||||||
Alertmanager:
|
Alertmanager:
|
||||||
<img src={alertManager.imgUrl} alt="Alert manager logo" className={styles.img} />
|
<img src={alertManager.imgUrl} alt="Alert manager logo" className={styles.img} />
|
||||||
{alertManagerName}
|
{alertManagerName}
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.secondAlertManagerLine}></div>
|
<div className={styles.secondAlertManagerLine} />
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack direction="row" gap={1} alignItems="center">
|
<Stack direction="row" gap={1} alignItems="center">
|
||||||
<ContactPointSelector alertManager={alertManagerName} onSelectContactPoint={onSelectContactPoint} />
|
<ContactPointSelector alertManager={alertManagerName} onSelectContactPoint={onSelectContactPoint} />
|
||||||
|
|||||||
@@ -49,13 +49,13 @@ function NotificationPreviewByAlertManager({
|
|||||||
<div className={styles.alertManagerRow}>
|
<div className={styles.alertManagerRow}>
|
||||||
{!onlyOneAM && (
|
{!onlyOneAM && (
|
||||||
<Stack direction="row" alignItems="center">
|
<Stack direction="row" alignItems="center">
|
||||||
<div className={styles.firstAlertManagerLine}></div>
|
<div className={styles.firstAlertManagerLine} />
|
||||||
<div className={styles.alertManagerName}>
|
<div className={styles.alertManagerName}>
|
||||||
<Trans i18nKey="alerting.notification-preview.alertmanager">Alertmanager:</Trans>
|
<Trans i18nKey="alerting.notification-preview.alertmanager">Alertmanager:</Trans>
|
||||||
<img src={alertManagerSource.imgUrl} alt="" className={styles.img} />
|
<img src={alertManagerSource.imgUrl} alt="" className={styles.img} />
|
||||||
{alertManagerSource.name}
|
{alertManagerSource.name}
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.secondAlertManagerLine}></div>
|
<div className={styles.secondAlertManagerLine} />
|
||||||
</Stack>
|
</Stack>
|
||||||
)}
|
)}
|
||||||
<Stack gap={1} direction="column">
|
<Stack gap={1} direction="column">
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ const FilterOptions = () => {
|
|||||||
<Label>
|
<Label>
|
||||||
<Trans i18nKey="alerting.search.property.namespace">Folder / Namespace</Trans>
|
<Trans i18nKey="alerting.search.property.namespace">Folder / Namespace</Trans>
|
||||||
</Label>
|
</Label>
|
||||||
<Select options={[]} onChange={() => {}}></Select>
|
<Select options={[]} onChange={() => {}} />
|
||||||
<Label>
|
<Label>
|
||||||
<Trans i18nKey="alerting.search.property.rule-name">Alerting rule name</Trans>
|
<Trans i18nKey="alerting.search.property.rule-name">Alerting rule name</Trans>
|
||||||
</Label>
|
</Label>
|
||||||
@@ -100,7 +100,7 @@ const FilterOptions = () => {
|
|||||||
<Label>
|
<Label>
|
||||||
<Trans i18nKey="alerting.search.property.data-source">Data source</Trans>
|
<Trans i18nKey="alerting.search.property.data-source">Data source</Trans>
|
||||||
</Label>
|
</Label>
|
||||||
<Select options={[]} onChange={() => {}}></Select>
|
<Select options={[]} onChange={() => {}} />
|
||||||
<Label>
|
<Label>
|
||||||
<Trans i18nKey="alerting.search.property.state">State</Trans>
|
<Trans i18nKey="alerting.search.property.state">State</Trans>
|
||||||
</Label>
|
</Label>
|
||||||
|
|||||||
@@ -28,11 +28,11 @@ const SilencedAlertsTable = ({ silencedAlerts }: Props) => {
|
|||||||
</colgroup>
|
</colgroup>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th></th>
|
<th />
|
||||||
<th>
|
<th>
|
||||||
<Trans i18nKey="silences-table.header.state">State</Trans>
|
<Trans i18nKey="silences-table.header.state">State</Trans>
|
||||||
</th>
|
</th>
|
||||||
<th></th>
|
<th />
|
||||||
<th>
|
<th>
|
||||||
<Trans i18nKey="silences-table.header.alert-name">Alert name</Trans>
|
<Trans i18nKey="silences-table.header.alert-name">Alert name</Trans>
|
||||||
</th>
|
</th>
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export const SilencedAlertsTableRow = ({ alert, className }: Props) => {
|
|||||||
</tr>
|
</tr>
|
||||||
{!isCollapsed && (
|
{!isCollapsed && (
|
||||||
<tr className={className}>
|
<tr className={className}>
|
||||||
<td></td>
|
<td />
|
||||||
<td colSpan={5}>
|
<td colSpan={5}>
|
||||||
<AlertLabels labels={alert.labels} size="sm" />
|
<AlertLabels labels={alert.labels} size="sm" />
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ interface DataSourceLoaderProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function GrafanaDataSourceLoader() {
|
export function GrafanaDataSourceLoader() {
|
||||||
return <DataSourceSection name="Grafana" application="grafana" uid="grafana" isLoading={true}></DataSourceSection>;
|
return <DataSourceSection name="Grafana" application="grafana" uid="grafana" isLoading={true} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DataSourceLoader({ uid, name }: DataSourceLoaderProps) {
|
export function DataSourceLoader({ uid, name }: DataSourceLoaderProps) {
|
||||||
|
|||||||
Reference in New Issue
Block a user