Skip to content

Commit

Permalink
feat(md): remove events white list and get info from the backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Rani authored and mergify[bot] committed Mar 3, 2021
1 parent e5213a8 commit 378890b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 94 deletions.
3 changes: 3 additions & 0 deletions app/scripts/modules/core/src/domain/IManagedEntity.ts
Expand Up @@ -207,6 +207,7 @@ export type ManagedResourceEventType =
| 'ResourceCheckError'
| 'ResourceCheckUnresolvable'
| 'ResourceActuationPaused'
| 'ResourceActuationVetoed'
| 'ResourceActuationResumed';

export interface IManagedResourceDiff {
Expand All @@ -225,6 +226,8 @@ export interface IManagedResourceEvent {
id: string;
application: string;
timestamp: string;
displayName: string;
level: 'SUCCESS' | 'INFO' | 'WARNING' | 'ERROR';
plugin?: string;
tasks?: Array<{ id: string; name: string }>;
delta?: IManagedResourceDiff;
Expand Down
Expand Up @@ -10,10 +10,9 @@ import { relativeTime, timestamp } from 'core/utils';

import { ManagedResourceDiffTable } from './ManagedResourceDiffTable';
import { TableCell, TableRow } from '../../presentation';
import { viewConfigurationByEventType } from './utils';

const ExpandedRowContent: React.FC<{
level: 'info' | 'warning' | 'error';
level: IManagedResourceEvent['level'];
diff?: IManagedResourceDiff;
tasks?: Array<{ id: string; name: string }>;
message?: string;
Expand All @@ -24,8 +23,8 @@ const ExpandedRowContent: React.FC<{
{message && (
<div
className={classNames('sp-padding-xs-yaxis', {
'event-warning-message': level === 'warning',
'event-error-message': level === 'error',
'event-warning-message': level === 'WARNING',
'event-error-message': level === 'ERROR',
})}
>
{message}
Expand Down Expand Up @@ -55,7 +54,7 @@ interface HistoryEventRowProps {

export const HistoryEventRow: React.FC<HistoryEventRowProps> = React.memo(
({ event, dismissModal, resourceSummary }) => {
const { type, timestamp: eventTimestamp, delta, tasks, message, reason, exceptionMessage } = event;
const { timestamp: eventTimestamp, delta, tasks, message, reason, exceptionMessage } = event;
const eventTimestampMillis = DateTime.fromISO(eventTimestamp).toMillis();
const hasDetails = delta || tasks || message || reason || exceptionMessage;
return (
Expand All @@ -64,7 +63,7 @@ export const HistoryEventRow: React.FC<HistoryEventRowProps> = React.memo(
hasDetails
? () => (
<ExpandedRowContent
level={viewConfigurationByEventType[type].level}
level={event.level}
diff={delta}
tasks={tasks}
message={message || reason || exceptionMessage}
Expand All @@ -79,13 +78,7 @@ export const HistoryEventRow: React.FC<HistoryEventRowProps> = React.memo(
<span className="sp-margin-s-left">{resourceSummary.displayName}</span>
</TableCell>
<TableCell>
<i
className={classNames(
'event-type-icon ico ico--withLabel sp-margin-s-right',
viewConfigurationByEventType[type]?.iconClass,
)}
/>{' '}
<span className="text-semibold event-type">{viewConfigurationByEventType[type]?.displayName}</span>
<span className="text-semibold event-type">{event.displayName}</span>
</TableCell>
<TableCell>
<div className="flex-container-h middle wrap">
Expand Down
@@ -1,15 +1,10 @@
.ManagedResourceHistoryModal {
width: 100%;

.event-type,
.event-type-icon {
.event-type {
color: var(--color-charcoal);
}

.event-type-icon {
font-size: 24px;
}

.event-warning-message {
color: var(--color-alert);
}
Expand Down
Expand Up @@ -15,7 +15,6 @@ import {
Table,
usePollingData,
} from '../../presentation';
import { viewConfigurationByEventType } from './utils';

import './ManagedResourceHistoryModal.less';

Expand Down Expand Up @@ -71,11 +70,9 @@ export const ManagedResourceHistoryModal = ({ resourceSummary, dismissModal }: I
delta || tasks || message || reason || exceptionMessage,
)}
>
{(historyEvents || [])
.filter(({ type }) => viewConfigurationByEventType[type])
.map((event) => (
<HistoryEventRow key={event.type + event.timestamp} {...{ event, resourceSummary, dismissModal }} />
))}
{(historyEvents || []).map((event) => (
<HistoryEventRow key={event.type + event.timestamp} {...{ event, resourceSummary, dismissModal }} />
))}
</Table>
</div>
)}
Expand Down
69 changes: 0 additions & 69 deletions app/scripts/modules/core/src/managed/resourceHistory/utils.ts

This file was deleted.

0 comments on commit 378890b

Please sign in to comment.