Alerting: Update 'Create alert' to 'New alert rule' in the panel and docs (#76950)

* Update 'Create alert' to 'New alert rule' in the panel and docs

* Fix test
This commit is contained in:
Sonia Aguilar
2023-11-02 17:33:53 +01:00
committed by GitHub
parent 878235248e
commit 0abfc3b6be
16 changed files with 32 additions and 32 deletions

View File

@@ -202,7 +202,7 @@ Create alerts from any panel type. This means you can reuse the queries in the p
1. Navigate to a dashboard in the **Dashboards** section. 1. Navigate to a dashboard in the **Dashboards** section.
2. In the top right corner of the panel, click on the three dots (ellipses). 2. In the top right corner of the panel, click on the three dots (ellipses).
3. From the dropdown menu, select **More...** and then choose **Create alert**. 3. From the dropdown menu, select **More...** and then choose **New alert rule**.
This will open the alert rule form, allowing you to configure and create your alert based on the current panel's query. This will open the alert rule form, allowing you to configure and create your alert based on the current panel's query.

View File

@@ -44,7 +44,7 @@ In these steps you'll create an alert and define an expression to evaluate. Thes
### Create a Grafana-managed alert ### Create a Grafana-managed alert
1. Navigate in Grafana to **Alerting**, then to **Alert Rules** and click **+ Create alert rule**. 1. Navigate in Grafana to **Alerting**, then to **Alert Rules** and click **+ New alert rule**.
1. Choose **Grafana Managed Alert** to create an alert that uses expressions. 1. Choose **Grafana Managed Alert** to create an alert that uses expressions.
1. Select your Loki datasource from the drop-down. 1. Select your Loki datasource from the drop-down.
1. Enter the alert query in the query editor, switch to **code** mode in the top right corner of the editor to paste the query below: 1. Enter the alert query in the query editor, switch to **code** mode in the top right corner of the editor to paste the query below:

View File

@@ -328,7 +328,7 @@ We have now created a dummy webhook endpoint and created a new Alerting Contact
Now that Grafana knows how to notify us, it's time to set up an alert rule: Now that Grafana knows how to notify us, it's time to set up an alert rule:
1. In the sidebar, click **Alert rules**. 1. In the sidebar, click **Alert rules**.
1. Click **Create alert rule**. 1. Click **New alert rule**.
1. In section **1**, name the rule `fundamentals-test`. 1. In section **1**, name the rule `fundamentals-test`.
1. For section **2**, select **Grafana Managed Alert** as the rule type. Next, find query box **A**. Choose your Prometheus datasource and enter the same query that we used in our earlier panel: `sum(rate(tns_request_duration_seconds_count[5m])) by(route)`. Click **Run queries**. You should see some data in the graph. 1. For section **2**, select **Grafana Managed Alert** as the rule type. Next, find query box **A**. Choose your Prometheus datasource and enter the same query that we used in our earlier panel: `sum(rate(tns_request_duration_seconds_count[5m])) by(route)`. Click **Run queries**. You should see some data in the graph.
1. Now scroll down to query box **B**. Change the operation from **Reduce** to **Classic condition**. [You can read more about classic and multi-dimensional conditions here](/docs/grafana/latest/alerting/unified-alerting/alerting-rules/create-grafana-managed-rule/#single-and-multi-dimensional-rule). For conditions enter the following: `WHEN last() OF A IS ABOVE 0.2`. Delete query **C**. 1. Now scroll down to query box **B**. Change the operation from **Reduce** to **Classic condition**. [You can read more about classic and multi-dimensional conditions here](/docs/grafana/latest/alerting/unified-alerting/alerting-rules/create-grafana-managed-rule/#single-and-multi-dimensional-rule). For conditions enter the following: `WHEN last() OF A IS ABOVE 0.2`. Delete query **C**.

View File

@@ -21,7 +21,7 @@ export function getNavTitle(navId: string | undefined) {
case 'import': case 'import':
return t('nav.create-import.title', 'Import dashboard'); return t('nav.create-import.title', 'Import dashboard');
case 'alert': case 'alert':
return t('nav.create-alert.title', 'Create alert rule'); return t('nav.create-alert.title', 'New alert rule');
case 'starred': case 'starred':
return t('nav.starred.title', 'Starred'); return t('nav.starred.title', 'Starred');
case 'starred-empty': case 'starred-empty':

View File

@@ -39,7 +39,7 @@ describe('Analytics', () => {
}); });
render(<NewRuleFromPanelButton panel={panel} dashboard={dashboard} />); render(<NewRuleFromPanelButton panel={panel} dashboard={dashboard} />);
const button = screen.getByText('Create alert rule from this panel'); const button = screen.getByText('New alert rule');
button.addEventListener('click', (event) => event.preventDefault(), false); button.addEventListener('click', (event) => event.preventDefault(), false);

View File

@@ -30,7 +30,7 @@ export const NewRuleFromPanelButton = ({ dashboard, panel, className }: Props) =
); );
if (loading) { if (loading) {
return <Button disabled={true}>Create alert rule from this panel</Button>; return <Button disabled={true}>New alert rule</Button>;
} }
if (!formValues) { if (!formValues) {
@@ -54,7 +54,7 @@ export const NewRuleFromPanelButton = ({ dashboard, panel, className }: Props) =
className={className} className={className}
data-testid="create-alert-rule-button" data-testid="create-alert-rule-button"
> >
Create alert rule from this panel New alert rule
</LinkButton> </LinkButton>
); );
}; };

View File

@@ -157,7 +157,7 @@ export const navIndex: NavIndex = {
}, },
{ {
id: 'alert', id: 'alert',
text: 'Create alert rule', text: 'New alert rule',
subTitle: 'Create an alert rule', subTitle: 'Create an alert rule',
icon: 'plus', icon: 'plus',
url: '/alerting/new', url: '/alerting/new',
@@ -215,7 +215,7 @@ export const navIndex: NavIndex = {
}, },
alert: { alert: {
id: 'alert', id: 'alert',
text: 'Create alert rule', text: 'New alert rule',
subTitle: 'Create an alert rule', subTitle: 'Create an alert rule',
icon: 'plus', icon: 'plus',
url: '/alerting/new', url: '/alerting/new',

View File

@@ -625,7 +625,7 @@ describe('getPanelMenu()', () => {
}); });
}); });
describe('Alerting menu', () => { describe('Alerting menu', () => {
it('should render Create alert menu item if user has permissions to read and update alerts ', () => { it('should render "New alert rule" menu item if user has permissions to read and update alerts ', () => {
const panel = new PanelModel({}); const panel = new PanelModel({});
const dashboard = createDashboardModelFixture({}); const dashboard = createDashboardModelFixture({});
@@ -637,13 +637,13 @@ describe('getPanelMenu()', () => {
expect(moreSubMenu).toEqual( expect(moreSubMenu).toEqual(
expect.arrayContaining([ expect.arrayContaining([
expect.objectContaining({ expect.objectContaining({
text: 'Create alert', text: 'New alert rule',
}), }),
]) ])
); );
}); });
it('should not render Create alert menu item, if user does not have permissions to update alerts ', () => { it('should not render "New alert rule" menu item, if user does not have permissions to update alerts ', () => {
const panel = new PanelModel({}); const panel = new PanelModel({});
const dashboard = createDashboardModelFixture({}); const dashboard = createDashboardModelFixture({});
@@ -657,12 +657,12 @@ describe('getPanelMenu()', () => {
expect(moreSubMenu).toEqual( expect(moreSubMenu).toEqual(
expect.arrayContaining([ expect.arrayContaining([
expect.not.objectContaining({ expect.not.objectContaining({
text: 'Create alert', text: 'New alert rule',
}), }),
]) ])
); );
}); });
it('should not render Create alert menu item, if user does not have permissions to read update alerts ', () => { it('should not render "New alert rule" menu item, if user does not have permissions to read update alerts ', () => {
const panel = new PanelModel({}); const panel = new PanelModel({});
const dashboard = createDashboardModelFixture({}); const dashboard = createDashboardModelFixture({});
@@ -672,7 +672,7 @@ describe('getPanelMenu()', () => {
const menuItems = getPanelMenu(dashboard, panel); const menuItems = getPanelMenu(dashboard, panel);
const moreSubMenu = menuItems.find((i) => i.text === 'More...')?.subMenu; const moreSubMenu = menuItems.find((i) => i.text === 'More...')?.subMenu;
const createAlertOption = moreSubMenu?.find((i) => i.text === 'Create alert')?.subMenu; const createAlertOption = moreSubMenu?.find((i) => i.text === 'New alert rule')?.subMenu;
expect(createAlertOption).toBeUndefined(); expect(createAlertOption).toBeUndefined();
}); });

View File

@@ -261,7 +261,7 @@ export function getPanelMenu(
if (isCreateAlertMenuOptionAvailable) { if (isCreateAlertMenuOptionAvailable) {
subMenu.push({ subMenu.push({
text: t('panel.header-menu.create-alert', `Create alert`), text: t('panel.header-menu.new-alert-rule', `New alert rule`),
onClick: onCreateAlert, onClick: onCreateAlert,
}); });
} }
@@ -304,7 +304,7 @@ export function getPanelMenu(
subMenu.length = 0; subMenu.length = 0;
if (isCreateAlertMenuOptionAvailable) { if (isCreateAlertMenuOptionAvailable) {
subMenu.push({ subMenu.push({
text: t('panel.header-menu.create-alert', `Create alert`), text: t('panel.header-menu.new-alert-rule', `New alert rule`),
onClick: onCreateAlert, onClick: onCreateAlert,
}); });
} }

View File

@@ -563,7 +563,7 @@ export const navIndex: NavIndex = {
}, },
{ {
id: 'alert', id: 'alert',
text: 'Create alert rule', text: 'New alert rule',
subTitle: 'Create an alert rule', subTitle: 'Create an alert rule',
icon: 'plus', icon: 'plus',
url: '/alerting/new', url: '/alerting/new',
@@ -622,7 +622,7 @@ export const navIndex: NavIndex = {
}, },
{ {
id: 'alert', id: 'alert',
text: 'Create alert rule', text: 'New alert rule',
subTitle: 'Create an alert rule', subTitle: 'Create an alert rule',
icon: 'plus', icon: 'plus',
url: '/alerting/new', url: '/alerting/new',
@@ -682,7 +682,7 @@ export const navIndex: NavIndex = {
}, },
{ {
id: 'alert', id: 'alert',
text: 'Create alert rule', text: 'New alert rule',
subTitle: 'Create an alert rule', subTitle: 'Create an alert rule',
icon: 'plus', icon: 'plus',
url: '/alerting/new', url: '/alerting/new',
@@ -742,7 +742,7 @@ export const navIndex: NavIndex = {
}, },
{ {
id: 'alert', id: 'alert',
text: 'Create alert rule', text: 'New alert rule',
subTitle: 'Create an alert rule', subTitle: 'Create an alert rule',
icon: 'plus', icon: 'plus',
url: '/alerting/new', url: '/alerting/new',
@@ -802,7 +802,7 @@ export const navIndex: NavIndex = {
}, },
{ {
id: 'alert', id: 'alert',
text: 'Create alert rule', text: 'New alert rule',
subTitle: 'Create an alert rule', subTitle: 'Create an alert rule',
icon: 'plus', icon: 'plus',
url: '/alerting/new', url: '/alerting/new',
@@ -862,7 +862,7 @@ export const navIndex: NavIndex = {
}, },
{ {
id: 'alert', id: 'alert',
text: 'Create alert rule', text: 'New alert rule',
subTitle: 'Create an alert rule', subTitle: 'Create an alert rule',
icon: 'plus', icon: 'plus',
url: '/alerting/new', url: '/alerting/new',
@@ -922,7 +922,7 @@ export const navIndex: NavIndex = {
}, },
{ {
id: 'alert', id: 'alert',
text: 'Create alert rule', text: 'New alert rule',
subTitle: 'Create an alert rule', subTitle: 'Create an alert rule',
icon: 'plus', icon: 'plus',
url: '/alerting/new', url: '/alerting/new',
@@ -933,7 +933,7 @@ export const navIndex: NavIndex = {
}, },
alert: { alert: {
id: 'alert', id: 'alert',
text: 'Create alert rule', text: 'New alert rule',
subTitle: 'Create an alert rule', subTitle: 'Create an alert rule',
icon: 'plus', icon: 'plus',
url: '/alerting/new', url: '/alerting/new',
@@ -984,7 +984,7 @@ export const navIndex: NavIndex = {
}, },
{ {
id: 'alert', id: 'alert',
text: 'Create alert rule', text: 'New alert rule',
subTitle: 'Create an alert rule', subTitle: 'Create an alert rule',
icon: 'plus', icon: 'plus',
url: '/alerting/new', url: '/alerting/new',

View File

@@ -882,7 +882,6 @@
"panel": { "panel": {
"header-menu": { "header-menu": {
"copy": "Kopieren", "copy": "Kopieren",
"create-alert": "",
"create-library-panel": "Bibliotheksleiste erstellen", "create-library-panel": "Bibliotheksleiste erstellen",
"duplicate": "Duplikat", "duplicate": "Duplikat",
"edit": "Bearbeiten", "edit": "Bearbeiten",
@@ -893,6 +892,7 @@
"inspect-data": "Daten", "inspect-data": "Daten",
"inspect-json": "Panel-JSON", "inspect-json": "Panel-JSON",
"more": "Mehr …", "more": "Mehr …",
"new-alert-rule": "",
"query": "Abfrage", "query": "Abfrage",
"remove": "Entfernen", "remove": "Entfernen",
"share": "Teilen", "share": "Teilen",

View File

@@ -882,7 +882,6 @@
"panel": { "panel": {
"header-menu": { "header-menu": {
"copy": "Copy", "copy": "Copy",
"create-alert": "Create alert",
"create-library-panel": "Create library panel", "create-library-panel": "Create library panel",
"duplicate": "Duplicate", "duplicate": "Duplicate",
"edit": "Edit", "edit": "Edit",
@@ -893,6 +892,7 @@
"inspect-data": "Data", "inspect-data": "Data",
"inspect-json": "Panel JSON", "inspect-json": "Panel JSON",
"more": "More...", "more": "More...",
"new-alert-rule": "New alert rule",
"query": "Query", "query": "Query",
"remove": "Remove", "remove": "Remove",
"share": "Share", "share": "Share",

View File

@@ -888,7 +888,6 @@
"panel": { "panel": {
"header-menu": { "header-menu": {
"copy": "Copiar", "copy": "Copiar",
"create-alert": "",
"create-library-panel": "Crear panel de librería", "create-library-panel": "Crear panel de librería",
"duplicate": "Duplicar", "duplicate": "Duplicar",
"edit": "Editar", "edit": "Editar",
@@ -899,6 +898,7 @@
"inspect-data": "Datos", "inspect-data": "Datos",
"inspect-json": "JSON de panel", "inspect-json": "JSON de panel",
"more": "Más...", "more": "Más...",
"new-alert-rule": "",
"query": "Consulta", "query": "Consulta",
"remove": "Eliminar", "remove": "Eliminar",
"share": "Compartir", "share": "Compartir",

View File

@@ -888,7 +888,6 @@
"panel": { "panel": {
"header-menu": { "header-menu": {
"copy": "Copier", "copy": "Copier",
"create-alert": "",
"create-library-panel": "Créer un panneau Bibliothèque", "create-library-panel": "Créer un panneau Bibliothèque",
"duplicate": "Dupliquer", "duplicate": "Dupliquer",
"edit": "Modifier", "edit": "Modifier",
@@ -899,6 +898,7 @@
"inspect-data": "Données", "inspect-data": "Données",
"inspect-json": "Panneau JSON", "inspect-json": "Panneau JSON",
"more": "Plus...", "more": "Plus...",
"new-alert-rule": "",
"query": "Requête", "query": "Requête",
"remove": "Supprimer", "remove": "Supprimer",
"share": "Partager", "share": "Partager",

View File

@@ -882,7 +882,6 @@
"panel": { "panel": {
"header-menu": { "header-menu": {
"copy": "Cőpy", "copy": "Cőpy",
"create-alert": "Cřęäŧę äľęřŧ",
"create-library-panel": "Cřęäŧę ľįþřäřy päʼnęľ", "create-library-panel": "Cřęäŧę ľįþřäřy päʼnęľ",
"duplicate": "Đūpľįčäŧę", "duplicate": "Đūpľįčäŧę",
"edit": "Ēđįŧ", "edit": "Ēđįŧ",
@@ -893,6 +892,7 @@
"inspect-data": "Đäŧä", "inspect-data": "Đäŧä",
"inspect-json": "Päʼnęľ ĴŜØŃ", "inspect-json": "Päʼnęľ ĴŜØŃ",
"more": "Mőřę...", "more": "Mőřę...",
"new-alert-rule": "Ńęŵ äľęřŧ řūľę",
"query": "Qūęřy", "query": "Qūęřy",
"remove": "Ŗęmővę", "remove": "Ŗęmővę",
"share": "Ŝĥäřę", "share": "Ŝĥäřę",

View File

@@ -876,7 +876,6 @@
"panel": { "panel": {
"header-menu": { "header-menu": {
"copy": "复制", "copy": "复制",
"create-alert": "",
"create-library-panel": "创建库面板", "create-library-panel": "创建库面板",
"duplicate": "复制", "duplicate": "复制",
"edit": "编辑", "edit": "编辑",
@@ -887,6 +886,7 @@
"inspect-data": "数据", "inspect-data": "数据",
"inspect-json": "面板 JSON", "inspect-json": "面板 JSON",
"more": "更多...", "more": "更多...",
"new-alert-rule": "",
"query": "查询", "query": "查询",
"remove": "删除", "remove": "删除",
"share": "分享", "share": "分享",