Skip to content

Commit

Permalink
Removes support for notification channels (#81)
Browse files Browse the repository at this point in the history
Signed-off-by: Drew Baugher <[email protected]>
  • Loading branch information
dbbaughe authored Sep 1, 2021
1 parent b284bd1 commit b8aa974
Show file tree
Hide file tree
Showing 32 changed files with 265 additions and 910 deletions.
14 changes: 3 additions & 11 deletions models/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,10 @@ export interface Policy {
}

export interface ErrorNotification {
destination?: Destination;
channel?: Channel;
destination: Destination;
message_template: MessageTemplate;
}

export interface Channel {
id: string;
}

export interface Destination {
chime?: {
url: string;
Expand Down Expand Up @@ -228,13 +223,10 @@ export interface InnerCron {

export interface NotificationAction extends Action {
notification: {
destination?: Destination;
channel?: {
id: string;
};
destination: Destination;
message_template: MessageTemplate;
};
notificationJsonString?: string;
notificationJsonString: string;
}

export interface SnapshotAction extends Action {
Expand Down
13 changes: 2 additions & 11 deletions public/index_management_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,7 @@ import { CoreStart, AppMountParameters } from "opensearch-dashboards/public";
import React from "react";
import ReactDOM from "react-dom";
import { HashRouter as Router, Route } from "react-router-dom";
import {
IndexService,
ManagedIndexService,
PolicyService,
RollupService,
TransformService,
NotificationService,
ServicesContext,
} from "./services";
import { IndexService, ManagedIndexService, PolicyService, RollupService, TransformService, ServicesContext } from "./services";
import { DarkModeContext } from "./components/DarkMode";
import Main from "./pages/Main";
import { CoreServicesContext } from "./components/core_services";
Expand All @@ -50,8 +42,7 @@ export function renderApp(coreStart: CoreStart, params: AppMountParameters) {
const policyService = new PolicyService(http);
const rollupService = new RollupService(http);
const transformService = new TransformService(http);
const notificationService = new NotificationService(http);
const services = { indexService, managedIndexService, policyService, rollupService, transformService, notificationService };
const services = { indexService, managedIndexService, policyService, rollupService, transformService };

const isDarkMode = coreStart.uiSettings.get("theme:darkMode") || false;

Expand Down
3 changes: 1 addition & 2 deletions public/models/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@
* permissions and limitations under the License.
*/

import { IndexService, ManagedIndexService, PolicyService, RollupService, TransformService, NotificationService } from "../services";
import { IndexService, ManagedIndexService, PolicyService, RollupService, TransformService } from "../services";

export interface BrowserServices {
indexService: IndexService;
managedIndexService: ManagedIndexService;
policyService: PolicyService;
rollupService: RollupService;
transformService: TransformService;
notificationService: NotificationService;
}
14 changes: 2 additions & 12 deletions public/pages/Main/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,7 @@ export default class Main extends Component<MainProps, object> {
path={ROUTES.CREATE_POLICY}
render={(props: RouteComponentProps) =>
queryString.parse(this.props.location.search).type == "visual" ? (
<VisualCreatePolicy
{...props}
isEdit={false}
policyService={services.policyService}
notificationService={services.notificationService}
/>
<VisualCreatePolicy {...props} isEdit={false} policyService={services.policyService} />
) : (
<CreatePolicy {...props} isEdit={false} policyService={services.policyService} />
)
Expand All @@ -173,12 +168,7 @@ export default class Main extends Component<MainProps, object> {
path={ROUTES.EDIT_POLICY}
render={(props: RouteComponentProps) =>
queryString.parse(this.props.location.search).type == "visual" ? (
<VisualCreatePolicy
{...props}
isEdit={true}
policyService={services.policyService}
notificationService={services.notificationService}
/>
<VisualCreatePolicy {...props} isEdit={true} policyService={services.policyService} />
) : (
<CreatePolicy {...props} isEdit={true} policyService={services.policyService} />
)
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ describe("<LegacyNotification /> spec", () => {
<LegacyNotification
notificationJsonString={JSON.stringify(DEFAULT_LEGACY_ERROR_NOTIFICATION)}
onChangeNotificationJsonString={() => {}}
onSwitchToChannels={() => {}}
/>
);
expect(container.firstChild).toMatchSnapshot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,31 @@
*/

import React from "react";
import { EuiFormRow, EuiCodeEditor, EuiCallOut, EuiButton, EuiSpacer } from "@elastic/eui";
import { EuiFormRow, EuiCodeEditor } from "@elastic/eui";
import "brace/theme/github";
import "brace/mode/json";
import { DarkModeConsumer } from "../../../../components/DarkMode";
import { DEFAULT_LEGACY_ERROR_NOTIFICATION } from "../../utils/constants";

interface LegacyNotificationProps {
notificationJsonString: string;
onChangeNotificationJsonString: (str: string) => void;
onSwitchToChannels: () => void;
actionNotification?: boolean;
}

const LegacyNotification = ({
notificationJsonString,
onChangeNotificationJsonString,
onSwitchToChannels,
actionNotification = false,
}: LegacyNotificationProps) => {
return (
<>
<EuiCallOut title="Update your notifications to use Channel ID" iconType="iInCircle" size="s">
<p>
Using Channel ID will give you more control to manage notifications across OpenSearch dashboards. If you do decide to switch, you
will lose your current error notification settings.
</p>
<EuiButton onClick={onSwitchToChannels}>Switch to using Channel ID</EuiButton>
</EuiCallOut>
<EuiSpacer size="m" />
<EuiFormRow isInvalid={false} error={null} style={{ maxWidth: "100%" }}>
<DarkModeConsumer>
{(isDarkMode) => (
<EuiCodeEditor
mode="json"
placeholder={JSON.stringify(DEFAULT_LEGACY_ERROR_NOTIFICATION, null, 4)}
theme={isDarkMode ? "sense-dark" : "github"}
width="100%"
value={notificationJsonString}
Expand Down
Loading

0 comments on commit b8aa974

Please sign in to comment.