Alerting: Update message templates to notification templates nomenclature (#77374)
This commit is contained in:
+11
-11
@@ -48,8 +48,8 @@ import { UnusedContactPointBadge } from '../receivers/ReceiversTable';
|
||||
import { ReceiverMetadataBadge } from '../receivers/grafanaAppReceivers/ReceiverMetadataBadge';
|
||||
import { ReceiverPluginMetadata } from '../receivers/grafanaAppReceivers/useReceiversMetadata';
|
||||
|
||||
import { MessageTemplates } from './MessageTemplates';
|
||||
import { useDeleteContactPointModal } from './Modals';
|
||||
import { NotificationTemplates } from './NotificationTemplates';
|
||||
import {
|
||||
RECEIVER_META_KEY,
|
||||
RECEIVER_PLUGIN_META_KEY,
|
||||
@@ -61,7 +61,7 @@ import { ContactPointWithMetadata, getReceiverDescription, isProvisioned, Receiv
|
||||
|
||||
enum ActiveTab {
|
||||
ContactPoints,
|
||||
MessageTemplates,
|
||||
NotificationTemplates,
|
||||
}
|
||||
|
||||
const DEFAULT_PAGE_SIZE = 10;
|
||||
@@ -83,7 +83,7 @@ const ContactPoints = () => {
|
||||
const [ExportDrawer, showExportDrawer] = useExportContactPoint();
|
||||
|
||||
const showingContactPoints = activeTab === ActiveTab.ContactPoints;
|
||||
const showingMessageTemplates = activeTab === ActiveTab.MessageTemplates;
|
||||
const showNotificationTemplates = activeTab === ActiveTab.NotificationTemplates;
|
||||
|
||||
if (error) {
|
||||
// TODO fix this type casting, when error comes from "getContactPointsStatus" it probably won't be a SerializedError
|
||||
@@ -105,9 +105,9 @@ const ContactPoints = () => {
|
||||
onChangeTab={() => setActiveTab(ActiveTab.ContactPoints)}
|
||||
/>
|
||||
<Tab
|
||||
label="Message Templates"
|
||||
active={showingMessageTemplates}
|
||||
onChangeTab={() => setActiveTab(ActiveTab.MessageTemplates)}
|
||||
label="Notification Templates"
|
||||
active={showNotificationTemplates}
|
||||
onChangeTab={() => setActiveTab(ActiveTab.NotificationTemplates)}
|
||||
/>
|
||||
</TabsBar>
|
||||
<TabContent>
|
||||
@@ -162,19 +162,19 @@ const ContactPoints = () => {
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{/* Message Templates tab */}
|
||||
{showingMessageTemplates && (
|
||||
{/* Notification Templates tab */}
|
||||
{showNotificationTemplates && (
|
||||
<>
|
||||
<Stack direction="row" alignItems="center">
|
||||
<Text variant="body" color="secondary">
|
||||
Create message templates to customize your notifications.
|
||||
Create notification templates to customize your notifications.
|
||||
</Text>
|
||||
<Spacer />
|
||||
<LinkButton icon="plus" variant="primary" href="/alerting/notifications/templates/new">
|
||||
Add message template
|
||||
Add notification template
|
||||
</LinkButton>
|
||||
</Stack>
|
||||
<MessageTemplates />
|
||||
<NotificationTemplates />
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ const NewMessageTemplate = ({ match }: Props) => {
|
||||
|
||||
const name = match?.params.name;
|
||||
if (!name) {
|
||||
return <EntityNotFound entity="Message template" />;
|
||||
return <EntityNotFound entity="Notification template" />;
|
||||
}
|
||||
|
||||
if (isLoading && !data) {
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ const EditMessageTemplate = ({ match }: Props) => {
|
||||
|
||||
const name = match?.params.name;
|
||||
if (!name) {
|
||||
return <EntityNotFound entity="Message template" />;
|
||||
return <EntityNotFound entity="Notification template" />;
|
||||
}
|
||||
|
||||
if (isLoading && !data) {
|
||||
@@ -25,7 +25,7 @@ const EditMessageTemplate = ({ match }: Props) => {
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<Alert severity="error" title="Failed to fetch message template">
|
||||
<Alert severity="error" title="Failed to fetch notification template">
|
||||
{String(error)}
|
||||
</Alert>
|
||||
);
|
||||
|
||||
@@ -16,7 +16,7 @@ const NewMessageTemplate = () => {
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<Alert severity="error" title="Failed to fetch message template">
|
||||
<Alert severity="error" title="Failed to fetch notification template">
|
||||
{String(error)}
|
||||
</Alert>
|
||||
);
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ const NewMessageTemplate = () => {
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<Alert severity="error" title="Failed to fetch message template">
|
||||
<Alert severity="error" title="Failed to fetch notification template">
|
||||
{String(error)}
|
||||
</Alert>
|
||||
);
|
||||
|
||||
+2
-2
@@ -6,12 +6,12 @@ import { useAlertmanagerConfig } from '../../hooks/useAlertmanagerConfig';
|
||||
import { useAlertmanager } from '../../state/AlertmanagerContext';
|
||||
import { TemplatesTable } from '../receivers/TemplatesTable';
|
||||
|
||||
export const MessageTemplates = () => {
|
||||
export const NotificationTemplates = () => {
|
||||
const { selectedAlertmanager } = useAlertmanager();
|
||||
const { data, error } = useAlertmanagerConfig(selectedAlertmanager);
|
||||
|
||||
if (error) {
|
||||
return <Alert title="Failed to fetch message templates">{String(error)}</Alert>;
|
||||
return <Alert title="Failed to fetch notification templates">{String(error)}</Alert>;
|
||||
}
|
||||
|
||||
if (data) {
|
||||
+1
-1
@@ -25,7 +25,7 @@ export const ReceiversAndTemplatesView = ({ config, alertManagerName }: Props) =
|
||||
return (
|
||||
<Stack direction="column" gap={4}>
|
||||
<ReceiversTable config={config} alertManagerName={alertManagerName} />
|
||||
{/* Vanilla flavored Alertmanager does not support editing message templates via the UI */}
|
||||
{/* Vanilla flavored Alertmanager does not support editing notification templates via the UI */}
|
||||
{!isVanillaAM && <TemplatesView config={config} alertManagerName={alertManagerName} />}
|
||||
{/* Grafana manager Alertmanager does not support global config, Mimir and Cortex do */}
|
||||
{!isGrafanaManagedAlertmanager && <GlobalConfigAlert alertManagerName={alertManagerName} />}
|
||||
|
||||
Reference in New Issue
Block a user