Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(snapshots): remove successful snapshot creation notification handling #427

Merged
merged 3 commits into from
Apr 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/app/Recordings/ActiveRecordingsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ import { ServiceContext } from '@app/Shared/Services/Services';
import { NO_TARGET } from '@app/Shared/Services/Target.service';
import { useSubscriptions} from '@app/utils/useSubscriptions';
import { Button, Checkbox, Label, Text, Toolbar, ToolbarContent, ToolbarItem } from '@patternfly/react-core';
import { Tbody, Tr, Td, ExpandableRowContent } from '@patternfly/react-table';
import { Tbody, Tr, Td, ExpandableRowContent } from '@patternfly/react-table';
import * as React from 'react';
import { useHistory, useRouteMatch } from 'react-router-dom';
import { combineLatest, forkJoin, Observable, of } from 'rxjs';
import { combineLatest, forkJoin, merge, Observable } from 'rxjs';
import { concatMap, filter, first } from 'rxjs/operators';
import { RecordingActions } from './RecordingActions';
import { RecordingsTable } from './RecordingsTable';
Expand Down Expand Up @@ -129,7 +129,10 @@ export const ActiveRecordingsTable: React.FunctionComponent<ActiveRecordingsTabl
addSubscription(
combineLatest([
context.target.target(),
context.notificationChannel.messages(NotificationCategory.ActiveRecordingCreated),
merge(
andrewazores marked this conversation as resolved.
Show resolved Hide resolved
context.notificationChannel.messages(NotificationCategory.ActiveRecordingCreated),
context.notificationChannel.messages(NotificationCategory.SnapshotCreated),
),
])
.subscribe(parts => {
const currentTarget = parts[0];
Expand All @@ -146,7 +149,10 @@ export const ActiveRecordingsTable: React.FunctionComponent<ActiveRecordingsTabl
addSubscription(
combineLatest([
context.target.target(),
context.notificationChannel.messages(NotificationCategory.ActiveRecordingDeleted),
merge(
context.notificationChannel.messages(NotificationCategory.ActiveRecordingDeleted),
context.notificationChannel.messages(NotificationCategory.SnapshotDeleted),
),
])
.subscribe(parts => {
const currentTarget = parts[0];
Expand Down
4 changes: 1 addition & 3 deletions src/app/Shared/Services/Api.service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,7 @@ export class ApiService {
method: 'POST',
}).pipe(
tap(resp => {
if (resp.status == 200) {
this.notifications.success('Recording Created');
} else if (resp.status == 202) {
if (resp.status == 202) {
this.notifications.warning('Snapshot Failed to Create', 'The resultant recording was unreadable for some reason, likely due to a lack of Active, non-Snapshot source recordings to take event data from');
}
}),
Expand Down
18 changes: 17 additions & 1 deletion src/app/Shared/Services/NotificationChannel.service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export enum NotificationCategory {
ActiveRecordingStopped = 'ActiveRecordingStopped',
ActiveRecordingSaved = 'ActiveRecordingSaved',
ActiveRecordingDeleted = 'ActiveRecordingDeleted',
SnapshotCreated = 'SnapshotCreated',
SnapshotDeleted = 'SnapshotDeleted',
ArchivedRecordingCreated = 'ArchivedRecordingCreated',
ArchivedRecordingDeleted = 'ArchivedRecordingDeleted',
TemplateUploaded = 'TemplateUploaded',
Expand Down Expand Up @@ -119,7 +121,7 @@ export const messageKeys = new Map([
NotificationCategory.ActiveRecordingCreated, {
variant: AlertVariant.success,
title: 'Recording Created',
body: evt => `${evt.message.recording.name} created in target: ${evt.message.target}`,
body: evt => `${evt.message.recording.name} created in target: ${evt.message.target}`
} as NotificationMessageMapper
],
[
Expand All @@ -143,6 +145,20 @@ export const messageKeys = new Map([
body: evt => `${evt.message.recording.name} was deleted`
} as NotificationMessageMapper
],
[
NotificationCategory.SnapshotCreated, {
variant: AlertVariant.success,
title: 'Snapshot Created',
body: evt => `${evt.message.recording.name} was created in target: ${evt.message.target}`
} as NotificationMessageMapper
],
[
NotificationCategory.SnapshotDeleted, {
variant: AlertVariant.success,
title: 'Snapshot Deleted',
body: evt => `${evt.message.recording.name} was deleted`
} as NotificationMessageMapper
],
[
NotificationCategory.ArchivedRecordingCreated, {
variant: AlertVariant.success,
Expand Down