Skip to content

Commit b8aa974

Browse files
authored
Removes support for notification channels (#81)
Signed-off-by: Drew Baugher <[email protected]>
1 parent b284bd1 commit b8aa974

32 files changed

+265
-910
lines changed

models/interfaces.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,10 @@ export interface Policy {
100100
}
101101

102102
export interface ErrorNotification {
103-
destination?: Destination;
104-
channel?: Channel;
103+
destination: Destination;
105104
message_template: MessageTemplate;
106105
}
107106

108-
export interface Channel {
109-
id: string;
110-
}
111-
112107
export interface Destination {
113108
chime?: {
114109
url: string;
@@ -228,13 +223,10 @@ export interface InnerCron {
228223

229224
export interface NotificationAction extends Action {
230225
notification: {
231-
destination?: Destination;
232-
channel?: {
233-
id: string;
234-
};
226+
destination: Destination;
235227
message_template: MessageTemplate;
236228
};
237-
notificationJsonString?: string;
229+
notificationJsonString: string;
238230
}
239231

240232
export interface SnapshotAction extends Action {

public/index_management_app.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,7 @@ import { CoreStart, AppMountParameters } from "opensearch-dashboards/public";
2828
import React from "react";
2929
import ReactDOM from "react-dom";
3030
import { HashRouter as Router, Route } from "react-router-dom";
31-
import {
32-
IndexService,
33-
ManagedIndexService,
34-
PolicyService,
35-
RollupService,
36-
TransformService,
37-
NotificationService,
38-
ServicesContext,
39-
} from "./services";
31+
import { IndexService, ManagedIndexService, PolicyService, RollupService, TransformService, ServicesContext } from "./services";
4032
import { DarkModeContext } from "./components/DarkMode";
4133
import Main from "./pages/Main";
4234
import { CoreServicesContext } from "./components/core_services";
@@ -50,8 +42,7 @@ export function renderApp(coreStart: CoreStart, params: AppMountParameters) {
5042
const policyService = new PolicyService(http);
5143
const rollupService = new RollupService(http);
5244
const transformService = new TransformService(http);
53-
const notificationService = new NotificationService(http);
54-
const services = { indexService, managedIndexService, policyService, rollupService, transformService, notificationService };
45+
const services = { indexService, managedIndexService, policyService, rollupService, transformService };
5546

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

public/models/interfaces.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@
2424
* permissions and limitations under the License.
2525
*/
2626

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

2929
export interface BrowserServices {
3030
indexService: IndexService;
3131
managedIndexService: ManagedIndexService;
3232
policyService: PolicyService;
3333
rollupService: RollupService;
3434
transformService: TransformService;
35-
notificationService: NotificationService;
3635
}

public/pages/Main/Main.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,7 @@ export default class Main extends Component<MainProps, object> {
158158
path={ROUTES.CREATE_POLICY}
159159
render={(props: RouteComponentProps) =>
160160
queryString.parse(this.props.location.search).type == "visual" ? (
161-
<VisualCreatePolicy
162-
{...props}
163-
isEdit={false}
164-
policyService={services.policyService}
165-
notificationService={services.notificationService}
166-
/>
161+
<VisualCreatePolicy {...props} isEdit={false} policyService={services.policyService} />
167162
) : (
168163
<CreatePolicy {...props} isEdit={false} policyService={services.policyService} />
169164
)
@@ -173,12 +168,7 @@ export default class Main extends Component<MainProps, object> {
173168
path={ROUTES.EDIT_POLICY}
174169
render={(props: RouteComponentProps) =>
175170
queryString.parse(this.props.location.search).type == "visual" ? (
176-
<VisualCreatePolicy
177-
{...props}
178-
isEdit={true}
179-
policyService={services.policyService}
180-
notificationService={services.notificationService}
181-
/>
171+
<VisualCreatePolicy {...props} isEdit={true} policyService={services.policyService} />
182172
) : (
183173
<CreatePolicy {...props} isEdit={true} policyService={services.policyService} />
184174
)

public/pages/VisualCreatePolicy/components/ChannelNotification/ChannelNotification.test.tsx

Lines changed: 0 additions & 83 deletions
This file was deleted.

public/pages/VisualCreatePolicy/components/ChannelNotification/ChannelNotification.tsx

Lines changed: 0 additions & 96 deletions
This file was deleted.

public/pages/VisualCreatePolicy/components/ChannelNotification/__snapshots__/ChannelNotification.test.tsx.snap

Lines changed: 0 additions & 17 deletions
This file was deleted.

public/pages/VisualCreatePolicy/components/ChannelNotification/index.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

public/pages/VisualCreatePolicy/components/LegacyNotification/LegacyNotification.test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ describe("<LegacyNotification /> spec", () => {
2121
<LegacyNotification
2222
notificationJsonString={JSON.stringify(DEFAULT_LEGACY_ERROR_NOTIFICATION)}
2323
onChangeNotificationJsonString={() => {}}
24-
onSwitchToChannels={() => {}}
2524
/>
2625
);
2726
expect(container.firstChild).toMatchSnapshot();

public/pages/VisualCreatePolicy/components/LegacyNotification/LegacyNotification.tsx

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,39 +10,31 @@
1010
*/
1111

1212
import React from "react";
13-
import { EuiFormRow, EuiCodeEditor, EuiCallOut, EuiButton, EuiSpacer } from "@elastic/eui";
13+
import { EuiFormRow, EuiCodeEditor } from "@elastic/eui";
1414
import "brace/theme/github";
1515
import "brace/mode/json";
1616
import { DarkModeConsumer } from "../../../../components/DarkMode";
17+
import { DEFAULT_LEGACY_ERROR_NOTIFICATION } from "../../utils/constants";
1718

1819
interface LegacyNotificationProps {
1920
notificationJsonString: string;
2021
onChangeNotificationJsonString: (str: string) => void;
21-
onSwitchToChannels: () => void;
2222
actionNotification?: boolean;
2323
}
2424

2525
const LegacyNotification = ({
2626
notificationJsonString,
2727
onChangeNotificationJsonString,
28-
onSwitchToChannels,
2928
actionNotification = false,
3029
}: LegacyNotificationProps) => {
3130
return (
3231
<>
33-
<EuiCallOut title="Update your notifications to use Channel ID" iconType="iInCircle" size="s">
34-
<p>
35-
Using Channel ID will give you more control to manage notifications across OpenSearch dashboards. If you do decide to switch, you
36-
will lose your current error notification settings.
37-
</p>
38-
<EuiButton onClick={onSwitchToChannels}>Switch to using Channel ID</EuiButton>
39-
</EuiCallOut>
40-
<EuiSpacer size="m" />
4132
<EuiFormRow isInvalid={false} error={null} style={{ maxWidth: "100%" }}>
4233
<DarkModeConsumer>
4334
{(isDarkMode) => (
4435
<EuiCodeEditor
4536
mode="json"
37+
placeholder={JSON.stringify(DEFAULT_LEGACY_ERROR_NOTIFICATION, null, 4)}
4638
theme={isDarkMode ? "sense-dark" : "github"}
4739
width="100%"
4840
value={notificationJsonString}

0 commit comments

Comments
 (0)