Skip to content

Commit

Permalink
Merge branch '2.x' into backport-949-to-2.x
Browse files Browse the repository at this point in the history
Signed-off-by: Riya <[email protected]>
  • Loading branch information
riysaxen-amzn authored Jun 6, 2024
2 parents ae0a0e7 + 74f64c5 commit 102c6db
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cypress-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};
Expand Down
11 changes: 7 additions & 4 deletions public/services/NotificationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -27,17 +27,20 @@ export default class NotificationService {
this.httpClient = httpClient;
}


getServerFeatures = async (): Promise<NotificationServerFeatures> => {
const dataSourceQuery = getDataSourceQueryObj();
try {
const response = await this.httpClient.get(
NODE_API.GET_AVAILABLE_FEATURES, dataSourceQuery
);
return response.allowed_config_type_list as Array<String>;
return response as NotificationServerFeatures;
} catch (error) {
console.error('error fetching available features', error);
return [];
return {
availableChannels: {},
availableConfigTypes: [],
tooltipSupport: false
};
}
};

Expand Down
6 changes: 6 additions & 0 deletions public/services/models/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,9 @@ export interface ChannelItemType extends ConfigType {
};
};
}

export interface NotificationServerFeatures {
availableChannels: Partial<typeof CHANNEL_TYPE>;
availableConfigTypes: string[]; // available backend config types
tooltipSupport: boolean; // if true, IAM role for SNS is optional and helper text should be available
}

0 comments on commit 102c6db

Please sign in to comment.