Skip to content

Commit

Permalink
[Backport 2.x] Fix broken osd functional test repo (#189) (#190)
Browse files Browse the repository at this point in the history
* Fix broken osd functional test repo (#189)

* moved constants to common folder

Signed-off-by: Riya Saxena <[email protected]>

* fix broken osd functionaltest Repo

Signed-off-by: Riya Saxena <[email protected]>

* fixing the UT's

Signed-off-by: Riya Saxena <[email protected]>

* fixing the UT's

Signed-off-by: Riya Saxena <[email protected]>

---------

Signed-off-by: Riya Saxena <[email protected]>
Signed-off-by: Riya <[email protected]>
(cherry picked from commit e597081)

* fix merge conflict

Signed-off-by: Riya Saxena <[email protected]>

* revert configRoutes changes

Signed-off-by: Riya Saxena <[email protected]>

* revert configRoutes changes

Signed-off-by: Riya Saxena <[email protected]>

---------

Signed-off-by: Riya Saxena <[email protected]>
Signed-off-by: Riya <[email protected]>
Co-authored-by: Hailong Cui <[email protected]>
  • Loading branch information
riysaxen-amzn and Hailong-am authored Apr 26, 2024
1 parent 1994dbb commit dada2bf
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 35 deletions.
23 changes: 23 additions & 0 deletions common/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export const BACKEND_CHANNEL_TYPE = Object.freeze({
SLACK: 'slack',
EMAIL: 'email',
CHIME: 'chime',
MICROSOFT_TEAMS: 'microsoft_teams',
CUSTOM_WEBHOOK: 'webhook',
SNS: 'sns',
});
export const CHANNEL_TYPE = Object.freeze({
[BACKEND_CHANNEL_TYPE.SLACK]: 'Slack',
[BACKEND_CHANNEL_TYPE.EMAIL]: 'Email',
[BACKEND_CHANNEL_TYPE.CHIME]: 'Chime',
[BACKEND_CHANNEL_TYPE.MICROSOFT_TEAMS]: 'Microsoft Teams',
[BACKEND_CHANNEL_TYPE.CUSTOM_WEBHOOK]: 'Custom webhook',
[BACKEND_CHANNEL_TYPE.SNS]: 'Amazon SNS',
}) as {
slack: string;
email: string;
chime: string;
microsoft_teams: string;
webhook: string;
sns: string;
};
4 changes: 3 additions & 1 deletion models/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
import { Direction } from '@elastic/eui';
import { WebhookMethodType } from '../public/pages/Channels/types';
import {
CHANNEL_TYPE,
ENCRYPTION_TYPE,
} from '../public/utils/constants';
import {
CHANNEL_TYPE,
} from '../common/constants';

export interface ChannelStatus {
config_id: string;
Expand Down
4 changes: 3 additions & 1 deletion public/pages/Channels/Channels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ import { CoreServicesContext } from '../../components/coreServices';
import { NotificationService } from '../../services';
import {
BREADCRUMBS,
CHANNEL_TYPE,
ROUTES,
} from '../../utils/constants';
import {
CHANNEL_TYPE,
} from '../../../common/constants';
import { getErrorMessage } from '../../utils/helpers';
import { DEFAULT_PAGE_SIZE_OPTIONS } from '../Notifications/utils/constants';
import { ChannelActions } from './components/ChannelActions';
Expand Down
2 changes: 1 addition & 1 deletion public/pages/Channels/components/ChannelControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import _ from 'lodash';
import React, { useContext, useEffect, useState } from 'react';
import {
CHANNEL_TYPE,
} from '../../../../public/utils/constants';
} from '../../../../common/constants';
import { MainContext } from '../../Main/Main';
import { ChannelFiltersType } from '../types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { EuiLink } from '@elastic/eui';
import React from 'react';
import { ChannelItemType } from '../../../../../models/interfaces';
import { ModalConsumer } from '../../../../components/Modal';
import { BACKEND_CHANNEL_TYPE, CHANNEL_TYPE } from '../../../../utils/constants';
import { BACKEND_CHANNEL_TYPE, CHANNEL_TYPE } from '../../../../../common/constants';
import {
deconstructEmailObject,
deconstructWebhookObject,
Expand Down
3 changes: 1 addition & 2 deletions public/pages/CreateChannel/CreateChannel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ import { ContentPanel } from '../../components/ContentPanel';
import { CoreServicesContext } from '../../components/coreServices';
import { ServicesContext } from '../../services';
import {
BACKEND_CHANNEL_TYPE,
BREADCRUMBS,
CHANNEL_TYPE,
CUSTOM_WEBHOOK_ENDPOINT_TYPE,
ROUTES,
} from '../../utils/constants';
import {BACKEND_CHANNEL_TYPE,CHANNEL_TYPE } from '../../../common/constants'
import { getErrorMessage } from '../../utils/helpers';
import { HeaderItemType, WebhookHttpType, WebhookMethodType } from '../Channels/types';
import { MainContext } from '../Main/Main';
Expand Down
5 changes: 3 additions & 2 deletions public/pages/Main/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import { CoreServicesConsumer } from '../../components/coreServices';
import { ModalProvider, ModalRoot } from '../../components/Modal';
import { BrowserServices } from '../../models/interfaces';
import { ServicesConsumer, ServicesContext } from '../../services/services';
import { CHANNEL_TYPE, ROUTES } from '../../utils/constants';
import { ROUTES } from '../../utils/constants';
import { CHANNEL_TYPE } from '../../../common/constants';
import { Channels } from '../Channels/Channels';
import { ChannelDetails } from '../Channels/components/details/ChannelDetails';
import { CreateChannel } from '../CreateChannel/CreateChannel';
Expand Down Expand Up @@ -78,7 +79,7 @@ export default class Main extends Component<MainProps, MainState> {
'ses_account',
'email_group',
],
tooltipSupport: serverFeatures.tooltipSupport,
tooltipSupport: false,
});
}
}
Expand Down
1 change: 1 addition & 0 deletions public/services/NotificationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
SenderType,
SESSenderItemType,
} from '../../models/interfaces';
import { CHANNEL_TYPE } from '../../common/constants';
import {
configListToChannels,
configListToRecipientGroups,
Expand Down
25 changes: 0 additions & 25 deletions public/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,31 +48,6 @@ export const BREADCRUMBS = Object.freeze({
EDIT_RECIPIENT_GROUP: { text: 'Edit recipient group' },
});

export const BACKEND_CHANNEL_TYPE = Object.freeze({
SLACK: 'slack',
EMAIL: 'email',
CHIME: 'chime',
MICROSOFT_TEAMS: 'microsoft_teams',
CUSTOM_WEBHOOK: 'webhook',
SNS: 'sns',
});

export const CHANNEL_TYPE = Object.freeze({
[BACKEND_CHANNEL_TYPE.SLACK]: 'Slack',
[BACKEND_CHANNEL_TYPE.EMAIL]: 'Email',
[BACKEND_CHANNEL_TYPE.CHIME]: 'Chime',
[BACKEND_CHANNEL_TYPE.MICROSOFT_TEAMS]: 'Microsoft Teams',
[BACKEND_CHANNEL_TYPE.CUSTOM_WEBHOOK]: 'Custom webhook',
[BACKEND_CHANNEL_TYPE.SNS]: 'Amazon SNS',
}) as {
slack: string;
email: string;
chime: string;
microsoft_teams: string;
webhook: string;
sns: string;
};

export const ENCRYPTION_TYPE = Object.freeze({
ssl: 'SSL/TLS',
start_tls: 'STARTTLS',
Expand Down
3 changes: 2 additions & 1 deletion server/routes/configRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {
import { NODE_API } from '../../common';
import { joinRequestParams } from '../utils/helper';
import _ from 'lodash';
import { CHANNEL_TYPE } from '../../public/utils/constants';
import { CHANNEL_TYPE } from '../../common/constants';


export function configRoutes(router: IRouter) {
router.get(
Expand Down
2 changes: 1 addition & 1 deletion test/mocks/serviceMock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { CoreStart } from 'opensearch-dashboards/public';
import { MainState } from '../../public/pages/Main/Main';
import { NotificationService } from '../../public/services';
import { CHANNEL_TYPE } from '../../public/utils/constants';
import { CHANNEL_TYPE } from '../../common/constants';
import httpClientMock from './httpClientMock';

const coreServicesMock = ({
Expand Down

0 comments on commit dada2bf

Please sign in to comment.