diff --git a/.github/workflows/cypress-workflow.yml b/.github/workflows/cypress-workflow.yml index 5d3638a4e..6e2c1049e 100644 --- a/.github/workflows/cypress-workflow.yml +++ b/.github/workflows/cypress-workflow.yml @@ -7,8 +7,8 @@ on: branches: - "**" env: - OPENSEARCH_DASHBOARDS_VERSION: '2.13.0' - ALERTING_PLUGIN_BRANCH: '2.13' + OPENSEARCH_DASHBOARDS_VERSION: '2.x' + ALERTING_PLUGIN_BRANCH: '2.x' jobs: tests: name: Run Cypress E2E tests diff --git a/public/pages/CreateTrigger/containers/ConfigureActions/ConfigureActions.js b/public/pages/CreateTrigger/containers/ConfigureActions/ConfigureActions.js index c7d9fb583..1cf059a76 100644 --- a/public/pages/CreateTrigger/containers/ConfigureActions/ConfigureActions.js +++ b/public/pages/CreateTrigger/containers/ConfigureActions/ConfigureActions.js @@ -122,11 +122,12 @@ class ConfigureActions extends React.Component { let channels = []; let index = 0; const getChannels = async () => { - const config_types = await this.props.notificationService.getServerFeatures(); + const serverFeatures = await this.props.notificationService.getServerFeatures(); + const configTypes = Object.keys(serverFeatures.availableChannels); const getChannelsQuery = { from_index: index, max_items: MAX_CHANNELS_RESULT_SIZE, - config_type: config_types, + config_type: configTypes, sort_field: 'name', sort_order: 'asc', }; diff --git a/public/pages/CreateTrigger/containers/DefineCompositeLevelTrigger/TriggerNotifications.js b/public/pages/CreateTrigger/containers/DefineCompositeLevelTrigger/TriggerNotifications.js index 901a5717e..39ef4e654 100644 --- a/public/pages/CreateTrigger/containers/DefineCompositeLevelTrigger/TriggerNotifications.js +++ b/public/pages/CreateTrigger/containers/DefineCompositeLevelTrigger/TriggerNotifications.js @@ -51,11 +51,12 @@ const TriggerNotifications = ({ let channels = []; let index = 0; const getChannels = async () => { - const config_types = await notificationService.getServerFeatures(); + const serverFeatures = await notificationService.getServerFeatures(); + const configTypes = Object.keys(serverFeatures.availableChannels); const getChannelsQuery = { from_index: index, max_items: MAX_CHANNELS_RESULT_SIZE, - config_type: config_types, + config_type: configTypes, sort_field: 'name', sort_order: 'asc', }; diff --git a/public/services/NotificationService.ts b/public/services/NotificationService.ts index a23609463..82ec22ad8 100644 --- a/public/services/NotificationService.ts +++ b/public/services/NotificationService.ts @@ -4,7 +4,7 @@ */ import { HttpFetchQuery, HttpSetup } from '../../../../src/core/public'; -import { ChannelItemType } from './models/interfaces'; +import { ChannelItemType, NotificationServerFeatures } from './models/interfaces'; import { configListToChannels, configToChannel } from './utils/helper'; import { getDataSourceQueryObj, getDataSourceId } from '../pages/utils/helpers'; @@ -27,17 +27,20 @@ export default class NotificationService { this.httpClient = httpClient; } - getServerFeatures = async (): Promise => { const dataSourceQuery = getDataSourceQueryObj(); try { const response = await this.httpClient.get( NODE_API.GET_AVAILABLE_FEATURES, dataSourceQuery ); - return response.allowed_config_type_list as Array; + return response as NotificationServerFeatures; } catch (error) { console.error('error fetching available features', error); - return []; + return { + availableChannels: {}, + availableConfigTypes: [], + tooltipSupport: false + }; } }; diff --git a/public/services/models/interfaces.ts b/public/services/models/interfaces.ts index eab786e97..cfba7d3e1 100644 --- a/public/services/models/interfaces.ts +++ b/public/services/models/interfaces.ts @@ -37,3 +37,9 @@ export interface ChannelItemType extends ConfigType { }; }; } + +export interface NotificationServerFeatures { + availableChannels: Partial; + availableConfigTypes: string[]; // available backend config types + tooltipSupport: boolean; // if true, IAM role for SNS is optional and helper text should be available +}