-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '2.x' into backport-165
Signed-off-by: Derek Ho <[email protected]>
- Loading branch information
Showing
40 changed files
with
1,415 additions
and
809 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# This should match the owning team set up in https://github.com/orgs/opensearch-project/teams | ||
* @opensearch-project/notifications | ||
* @opensearch-project/notifications | ||
* @xluo-aws @gaobinlong @Hailong-am @SuZhou-Joe @zhichao-aws @yuye-aws @getsaurabh02 @sbcd90 @praveensameneni @amsiglan @AWSHurneyt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
## Overview | ||
|
||
This document contains a list of maintainers in this repo. See [opensearch-project/.github/RESPONSIBILITIES.md](https://github.com/opensearch-project/.github/blob/main/RESPONSIBILITIES.md#maintainer-responsibilities) that explains what the role of maintainer means, what maintainers do in this and other repos, and how they should be doing it. If you're interested in contributing, and becoming a maintainer, see [CONTRIBUTING](CONTRIBUTING.md). | ||
|
||
## Current Maintainers | ||
| Maintainer | GitHub ID | Affiliation | | ||
|-----------------------|----------------------------------------------------------| ----------- | | ||
| Saurabh Singh | [getsaurabh02](https://github.com/getsaurabh02) | Amazon | | ||
| Subhobrata Dey | [sbcd90](https://github.com/sbcd90) | Amazon | | ||
| Praveen Sameneni | [praveensameneni](https://github.com/praveensameneni) | Amazon | | ||
| Amardeepsingh Siglani | [amsiglan](https://github.com/amsiglan) | Amazon | | ||
| Xuesong Luo | [xluo-aws](https://github.com/xluo-aws) | Amazon | | ||
| Hailong Cui | [Hailong-am](https://github.com/Hailong-am) | Amazon | | ||
| Binlong Gao | [gaobinlong](https://github.com/gaobinlong) | Amazon | | ||
| Zhou Su | [SuZhou-Joe](https://github.com/SuZhou-Joe) | Amazon | | ||
| Yuye Zhu | [yuye-aws](https://github.com/yuye-aws) | Amazon | | ||
| Zhichao Geng | [zhichao-aws](https://github.com/zhichao-aws) | Amazon | | ||
| Thomas Hurney | [AWSHurneyt](https://github.com/AWSHurneyt) | Amazon | | ||
|
||
[This document](https://github.com/opensearch-project/.github/blob/main/MAINTAINERS.md) explains what maintainers do in this repo, and how they should be doing it. If you're interested in contributing, see [CONTRIBUTING](CONTRIBUTING.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
export class MDSEnabledClientService { | ||
static getClient(request, context, dataSourceEnabled) { | ||
const { dataSourceId = "" } = (request.query || {}) as { dataSourceId?: string }; | ||
if (dataSourceEnabled && dataSourceId && dataSourceId.trim().length != 0) { | ||
return context.dataSource.opensearch.legacy.getClient(dataSourceId.toString()).callAPI; | ||
} else { | ||
// fall back to default local cluster | ||
return context.notificationsContext.notificationsClient.asScoped( | ||
request, | ||
).callAsCurrentUser; | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,4 +34,4 @@ | |
"tough-cookie": "^4.1.3", | ||
"@cypress/request": "^3.0.0" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
public/components/MDSEnabledComponent/MDSEnabledComponent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React, { useContext, useEffect } from "react"; | ||
import { DataSourceMenuContext, DataSourceMenuProperties } from "../../services/DataSourceMenuContext"; | ||
import { useHistory } from "react-router"; | ||
import queryString from "query-string"; | ||
import { MainContext } from '../../pages/Main/Main'; | ||
|
||
export default class MDSEnabledComponent< | ||
Props extends DataSourceMenuProperties, | ||
State extends DataSourceMenuProperties | ||
> extends React.Component<Props, State> { | ||
constructor(props: Props) { | ||
super(props); | ||
this.state = { | ||
dataSourceId: props.dataSourceId, | ||
multiDataSourceEnabled: props.multiDataSourceEnabled, | ||
} as State; | ||
} | ||
} | ||
|
||
export function isDataSourceChanged(prevProps, currentProps) { | ||
if ( | ||
prevProps.notificationService?.multiDataSourceEnabled && | ||
currentProps.notificationService?.multiDataSourceEnabled | ||
) { | ||
const prevDataSourceId = prevProps.notificationService.dataSourceId; | ||
const currDataSourceId = currentProps.notificationService.dataSourceId; | ||
if (!_.isEqual(prevDataSourceId, currDataSourceId)) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
export function isDataSourceError(error) { | ||
return (error.body && error.body.message && error.body.message.includes("Data Source Error")); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.