Skip to content

Commit

Permalink
Remove unused functionality from Notifications frontend for initial r…
Browse files Browse the repository at this point in the history
…elease (#377)

* Remove Dashboard from sidenav

Signed-off-by: Mohammad Qureshi <[email protected]>

* Remove sent Notifications dashboard

Signed-off-by: Mohammad Qureshi <[email protected]>

* Remove 'Source' dropdown from Channels table

Signed-off-by: Mohammad Qureshi <[email protected]>

* Remove Availability section in Channel details

Signed-off-by: Mohammad Qureshi <[email protected]>

* Remove channel availability selection when creating a channel

Signed-off-by: Mohammad Qureshi <[email protected]>

* Remove notification source from channel item in Channels table

Signed-off-by: Mohammad Qureshi <[email protected]>

* Remove EventService and consolidate send test message logic into NotificationService

Signed-off-by: Mohammad Qureshi <[email protected]>

* Remove unusued routes for APIs

Signed-off-by: Mohammad Qureshi <[email protected]>

* Update failing jest tests and snapshots

Signed-off-by: Mohammad Qureshi <[email protected]>

* Remove stale snapshot file for ChannelAvailabilityPanel

Signed-off-by: Mohammad Qureshi <[email protected]>
  • Loading branch information
qreshi authored Mar 15, 2022
1 parent 99baa27 commit aa26e98
Show file tree
Hide file tree
Showing 73 changed files with 453 additions and 6,591 deletions.
1 change: 0 additions & 1 deletion dashboards-notifications/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const NODE_API = Object.freeze({
CREATE_CONFIG: `${NODE_API_BASE_PATH}/create_config`,
DELETE_CONFIGS: `${NODE_API_BASE_PATH}/delete_configs`,
UPDATE_CONFIG: `${NODE_API_BASE_PATH}/update_config`,
GET_EVENTS: `${NODE_API_BASE_PATH}/get_events`,
GET_EVENT: `${NODE_API_BASE_PATH}/get_event`,
GET_AVAILABLE_FEATURES: `${NODE_API_BASE_PATH}/features`,
SEND_TEST_MESSAGE: `${NODE_API_BASE_PATH}/test_message`,
Expand Down
17 changes: 0 additions & 17 deletions dashboards-notifications/models/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,8 @@ import {
CHANNEL_TYPE,
ENCRYPTION_TYPE,
NOTIFICATION_SOURCE,
SEVERITY_TYPE,
} from '../public/utils/constants';

export interface NotificationItem {
event_id: string;
created_time_ms: number;
last_updated_time_ms: number;
tenant?: string;
event_source: {
title: string;
reference_id: string;
feature: keyof typeof NOTIFICATION_SOURCE;
severity: keyof typeof SEVERITY_TYPE;
tags?: string[];
};
status_list: ChannelStatus[]; // could be multiple channels in a notification item
success: boolean; // calculated in the frontend based on status_list
}

export interface ChannelStatus {
config_id: string;
config_name: string;
Expand Down
5 changes: 2 additions & 3 deletions dashboards-notifications/public/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ import { HashRouter as Router, Route } from 'react-router-dom';
import { AppMountParameters, CoreStart } from '../../../src/core/public';
import { CoreServicesContext } from './components/coreServices';
import Main from './pages/Main';
import { EventService, NotificationService } from './services';
import { NotificationService } from './services';
import { ServicesContext } from './services/services';

export const renderApp = (coreStart: CoreStart, params: AppMountParameters) => {
const http = coreStart.http;
const notificationService = new NotificationService(http);
const eventService = new EventService(http);
const services = { notificationService, eventService };
const services = { notificationService };

ReactDOM.render(
<Router>
Expand Down
2 changes: 0 additions & 2 deletions dashboards-notifications/public/models/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
*/

import { NotificationService } from '../services';
import EventService from '../services/EventService';

export interface BrowserServices {
notificationService: NotificationService;
eventService: EventService;
}
13 changes: 0 additions & 13 deletions dashboards-notifications/public/pages/Channels/Channels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import { NotificationService } from '../../services';
import {
BREADCRUMBS,
CHANNEL_TYPE,
NOTIFICATION_SOURCE,
ROUTES,
} from '../../utils/constants';
import { getErrorMessage } from '../../utils/helpers';
Expand Down Expand Up @@ -95,16 +94,6 @@ export class Channels extends Component<ChannelsProps, ChannelsState> {
truncateText: false,
render: (type: string) => _.get(CHANNEL_TYPE, type, '-'),
},
{
field: 'feature_list',
name: 'Notification source',
sortable: true,
truncateText: true,
render: (features: string[]) =>
features
.map((feature) => _.get(NOTIFICATION_SOURCE, feature, '-'))
.join(', ') || '-',
},
{
field: 'description',
name: 'Description',
Expand Down Expand Up @@ -148,8 +137,6 @@ export class Channels extends Component<ChannelsProps, ChannelsState> {
};
if (state.filters.state != undefined)
queryObject.is_enabled = state.filters.state;
if (!_.isEmpty(state.filters.source))
queryObject.feature_list = state.filters.source;
return queryObject;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@ describe('<ChannelControls /> spec', () => {
fireEvent.click(utils.getByText('Chime'));
expect(onFiltersChange).toBeCalledWith({ type: ['email', 'chime'] });

fireEvent.click(utils.getByText('Source'));
fireEvent.click(utils.getByText('Alerting'));
fireEvent.click(utils.getByText('Reporting'));
expect(onFiltersChange).toBeCalledWith({ source: ['alerting', 'reports'] });

expect(onFiltersChange).toBeCalledTimes(5);
expect(onFiltersChange).toBeCalledTimes(3);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -121,44 +121,6 @@ exports[`<ChannelControls /> spec renders the component 1`] = `
</button>
</div>
</div>
<div
class="euiPopover euiPopover--anchorDownCenter"
>
<div
class="euiPopover__anchor"
>
<button
class="euiButtonEmpty euiButtonEmpty--text euiFilterButton euiFilterButton--hasIcon euiFilterButton--noGrow"
type="button"
>
<span
class="euiButtonContent euiButtonContent--iconRight euiButtonEmpty__content"
>
<svg
aria-hidden="true"
class="euiIcon euiIcon--medium euiIcon-isLoading euiButtonContent__icon"
focusable="false"
height="16"
role="img"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
/>
<span
class="euiButtonEmpty__text"
>
<span
class="euiFilterButton__textShift"
data-text="Source"
title="Source"
>
Source
</span>
</span>
</span>
</button>
</div>
</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,72 +168,6 @@ exports[`<ChannelDetails/> spec handles a non-existing channel 1`] = `
style="padding: initial;"
/>
</div>
<div
class="euiSpacer euiSpacer--l"
/>
<div
class="euiPanel euiPanel--paddingMedium"
style="max-width: 1300px;"
>
<div
class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--alignItemsCenter euiFlexGroup--justifyContentSpaceBetween euiFlexGroup--directionRow euiFlexGroup--responsive"
style="padding: 0px 0px;"
>
<div
class="euiFlexItem"
>
<h3
class="euiTitle euiTitle--small"
>
Availability
</h3>
</div>
</div>
<hr
class="euiHorizontalRule euiHorizontalRule--full euiHorizontalRule--marginSmall"
/>
<div
style="padding: initial;"
>
<div>
<div
class="euiSpacer euiSpacer--s"
/>
<div
class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--directionRow euiFlexGroup--responsive"
>
<div
class="euiFlexItem"
>
<dl
class="euiDescriptionList euiDescriptionList--row"
style="word-break: break-word; white-space: pre-line;"
>
<dt
class="euiDescriptionList__title"
>
Notification sources
</dt>
<dd
class="euiDescriptionList__description"
>
-
</dd>
</dl>
</div>
<div
class="euiFlexItem"
/>
<div
class="euiFlexItem"
/>
</div>
<div
class="euiSpacer euiSpacer--m"
/>
</div>
</div>
</div>
</div>
`;

Expand Down Expand Up @@ -405,72 +339,6 @@ exports[`<ChannelDetails/> spec renders a specific channel 1`] = `
style="padding: initial;"
/>
</div>
<div
class="euiSpacer euiSpacer--l"
/>
<div
class="euiPanel euiPanel--paddingMedium"
style="max-width: 1300px;"
>
<div
class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--alignItemsCenter euiFlexGroup--justifyContentSpaceBetween euiFlexGroup--directionRow euiFlexGroup--responsive"
style="padding: 0px 0px;"
>
<div
class="euiFlexItem"
>
<h3
class="euiTitle euiTitle--small"
>
Availability
</h3>
</div>
</div>
<hr
class="euiHorizontalRule euiHorizontalRule--full euiHorizontalRule--marginSmall"
/>
<div
style="padding: initial;"
>
<div>
<div
class="euiSpacer euiSpacer--s"
/>
<div
class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--directionRow euiFlexGroup--responsive"
>
<div
class="euiFlexItem"
>
<dl
class="euiDescriptionList euiDescriptionList--row"
style="word-break: break-word; white-space: pre-line;"
>
<dt
class="euiDescriptionList__title"
>
Notification sources
</dt>
<dd
class="euiDescriptionList__description"
>
-
</dd>
</dl>
</div>
<div
class="euiFlexItem"
/>
<div
class="euiFlexItem"
/>
</div>
<div
class="euiSpacer euiSpacer--m"
/>
</div>
</div>
</div>
</div>
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,44 +221,6 @@ exports[`<Channels/> spec renders the empty component 1`] = `
</button>
</div>
</div>
<div
class="euiPopover euiPopover--anchorDownCenter"
>
<div
class="euiPopover__anchor"
>
<button
class="euiButtonEmpty euiButtonEmpty--text euiFilterButton euiFilterButton--hasIcon euiFilterButton--noGrow"
type="button"
>
<span
class="euiButtonContent euiButtonContent--iconRight euiButtonEmpty__content"
>
<svg
aria-hidden="true"
class="euiIcon euiIcon--medium euiIcon-isLoading euiButtonContent__icon"
focusable="false"
height="16"
role="img"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
/>
<span
class="euiButtonEmpty__text"
>
<span
class="euiFilterButton__textShift"
data-text="Source"
title="Source"
>
Source
</span>
</span>
</span>
</button>
</div>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -480,37 +442,7 @@ exports[`<Channels/> spec renders the empty component 1`] = `
aria-live="polite"
aria-sort="none"
class="euiTableHeaderCell"
data-test-subj="tableHeaderCell_feature_list_3"
role="columnheader"
scope="col"
>
<button
class="euiTableHeaderButton"
data-test-subj="tableHeaderSortButton"
type="button"
>
<span
class="euiTableCellContent"
>
<span
class="euiTableCellContent__text"
title="Notification source"
>
Notification source
</span>
<span
class="euiScreenReaderOnly"
>
Click to sort in ascending order
</span>
</span>
</button>
</th>
<th
aria-live="polite"
aria-sort="none"
class="euiTableHeaderCell"
data-test-subj="tableHeaderCell_description_4"
data-test-subj="tableHeaderCell_description_3"
role="columnheader"
scope="col"
>
Expand Down Expand Up @@ -544,7 +476,7 @@ exports[`<Channels/> spec renders the empty component 1`] = `
>
<td
class="euiTableRowCell euiTableRowCell--isMobileFullWidth"
colspan="6"
colspan="5"
>
<div
class="euiTableCellContent euiTableCellContent--alignCenter"
Expand Down
Loading

0 comments on commit aa26e98

Please sign in to comment.