Alerting: Add version to Integration front-end model (#111421)

This commit is contained in:
Yuri Tseretyan
2025-09-23 15:54:12 +02:00
committed by GitHub
parent 896a56ada8
commit 42d64929d8
3 changed files with 9 additions and 0 deletions
@@ -1249,6 +1249,7 @@ export type ReceiverIntegration = {
};
type: string;
uid?: string;
version: string;
};
export type ReceiverSpec = {
integrations: ReceiverIntegration[];
@@ -47,10 +47,12 @@ export const GenericIntegrationFactory = Factory.define<Integration>(() => ({
settings: {
foo: 'bar',
},
version: 'v1', // Add version field
}));
export const EmailIntegrationFactory = Factory.define<Integration>(() => ({
type: 'email',
version: 'v1',
settings: {
addresses: faker.internet.email(),
},
@@ -58,6 +60,7 @@ export const EmailIntegrationFactory = Factory.define<Integration>(() => ({
export const SlackIntegrationFactory = Factory.define<Integration>(() => ({
type: 'slack',
version: 'v1',
settings: {
mentionChannel: '#alerts',
},
@@ -70,5 +73,6 @@ export const ContactPointMetadataAnnotationsFactory = Factory.define<ContactPoin
'grafana.com/access/canReadSecrets': 'true',
'grafana.com/inUse/routes': '1',
'grafana.com/inUse/rules': '1',
'grafana.com/canUse': 'true',
...AlertingEntityMetadataAnnotationsFactory.build(),
}));
@@ -17,6 +17,7 @@ type EmailIntegration = OverrideProperties<
GenericIntegration,
{
type: 'email';
version: 'v1';
settings: {
singleEmail?: boolean;
addresses: string;
@@ -32,6 +33,7 @@ type SlackIntegration = OverrideProperties<
GenericIntegration,
{
type: 'slack';
version: 'v1';
settings: {
endpointUrl?: string;
url?: string;
@@ -56,6 +58,7 @@ type OnCallIntegration = OverrideProperties<
GenericIntegration,
{
type: 'OnCall';
version: 'v1';
settings: {
url: string;
httpMethod?: 'POST' | 'PUT';
@@ -98,6 +101,7 @@ export type AlertingEntityMetadataAnnotations = Partial<{
'grafana.com/access/canAdmin': 'true' | 'false';
'grafana.com/access/canDelete': 'true' | 'false';
'grafana.com/access/canWrite': 'true' | 'false';
'grafana.com/canUse': 'true' | 'false';
// used for provisioning to identify what system created the entity
'grafana.com/provenance': string;
}>;