Skip to content

Commit

Permalink
Merge pull request #779 from hpcc-systems/yadhap/ASR-NOC-adjustments
Browse files Browse the repository at this point in the history
ASR NOC adjustments
  • Loading branch information
FancMa01 authored May 31, 2024
2 parents 1ede0f2 + 0461817 commit 097733d
Show file tree
Hide file tree
Showing 13 changed files with 949 additions and 350 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@ import { Descriptions, Tooltip, Tag } from 'antd';
import { formatDateTime } from '../../../common/CommonUtil';
import './notifications.css';

function NotificationDetails({ selectedNotification, monitorings, domains, productCategories }) {
function NotificationDetails({ selectedNotification, domains, productCategories }) {
// Destructure metaData
const {
metaData: { asrSpecificMetaData },
} = selectedNotification;
const { asrSpecificMetaData } = selectedNotification;

// JSX
return (
<>
<Descriptions column={1} bordered={true} size="small" className="notifications_tiny-description">
<Descriptions.Item label="Origin ">
{monitorings.find((m) => m.id === selectedNotification.notificationOrigin)?.name || <Tag>Unknown</Tag>}
{selectedNotification.notificationOrigin || <Tag>Unknown</Tag>}
</Descriptions.Item>
<Descriptions.Item label="Reason ">{selectedNotification.notificationTitle}</Descriptions.Item>
<Descriptions.Item label=" Details ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function SentNotificationsTable({
<span
style={{
background:
searchTerm.length > 0 && searchableNotificationId.toLocaleLowerCase().includes(searchTerm)
searchTerm.length > 0 && searchableNotificationId?.toLocaleLowerCase().includes(searchTerm)
? 'var(--highlight)'
: 'transparent',
}}>
Expand Down Expand Up @@ -140,7 +140,7 @@ function SentNotificationsTable({
<span
style={{
background:
searchTerm.length > 0 && updatedBy?.name.toLocaleLowerCase().includes(searchTerm)
searchTerm.length > 0 && updatedBy?.name?.toLocaleLowerCase().includes(searchTerm)
? 'var(--highlight)'
: 'transparent',
}}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function NotificationCountByProductsInGraph({ sentNotifications, productCategori
let chartData = [];
sentNotifications.forEach((notification) => {
if (notification.metaData && notification.metaData.asrSpecificMetaData) {
const category = notification.metaData.asrSpecificMetaData.productCategory;
const category = notification.metaData.asrSpecificMetaData.productCode || 'ACU';
const status = notification.status;
chartData.push({ category, status, count: 1 });
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { Descriptions, Modal, Button, Tooltip, Tag } from 'antd';
import cronstrue from 'cronstrue';
import _ from 'lodash';

import { Constants } from '../../common/Constants';
import { getDayLabel, getMonthLabel, getDateLabel, getWeekLabel } from '../../common/scheduleOptions.js';
Expand Down Expand Up @@ -39,6 +40,7 @@ function MonitoringDetailsModal({
clusterId,
approverComment,
} = selectedMonitoring;
const { requireComplete } = metaData;
const { asrSpecificMetaData, notificationMetaData, schedule } = metaData;
return (
<Modal
Expand Down Expand Up @@ -69,7 +71,7 @@ function MonitoringDetailsModal({
{monitoringScope !== 'ClusterWideMonitoring' && (
<Descriptions.Item label="Job name / pattern">{jobName}</Descriptions.Item>
)}
{schedule && <Descriptions.Item label="Frequency">{schedule[0].frequency}</Descriptions.Item>}
{schedule && <Descriptions.Item label="Frequency">{_.capitalize(schedule[0].frequency)}</Descriptions.Item>}
{schedule && schedule.length > 0 && (
<Descriptions.Item label="Job Schedule">
{generateTagsForSchedule(schedule).map((s, i) => (
Expand All @@ -84,6 +86,7 @@ function MonitoringDetailsModal({
{metaData?.expectedCompletionTime && (
<Descriptions.Item label="Expected Completion Time">{metaData.expectedCompletionTime}</Descriptions.Item>
)}
<Descriptions.Item label="Require complete">{requireComplete ? 'Yes' : 'No'}</Descriptions.Item>
{/* ----------------- ASR SPECIFIC ------------------------------------------------------- */}
{asrSpecificMetaData?.jobMonitorType && (
<Descriptions.Item label="Job Monitoring Type">{asrSpecificMetaData.jobMonitorType}</Descriptions.Item>
Expand All @@ -105,11 +108,6 @@ function MonitoringDetailsModal({
{asrSpecificMetaData?.severity && (
<Descriptions.Item label="Severity">{asrSpecificMetaData.severity}</Descriptions.Item>
)}
{asrSpecificMetaData?.requireComplete && (
<Descriptions.Item label="Require complete">
{asrSpecificMetaData.requireComplete ? 'Yes' : 'No'}
</Descriptions.Item>
)}
{/* ---------NOTIFICATION TRIGGERS AND CONTACTS --------------------------------------------- */}
{notificationMetaData &&
notificationMetaData.notificationCondition &&
Expand All @@ -120,7 +118,7 @@ function MonitoringDetailsModal({
))}
</Descriptions.Item>
)}
{notificationMetaData.primaryContacts && notificationMetaData.primaryContacts.length > 0 && (
{notificationMetaData?.primaryContacts && notificationMetaData.primaryContacts.length > 0 && (
<Descriptions.Item label="Primary contact(s)">
{notificationMetaData.primaryContacts.map((email, index) =>
index < notificationMetaData.primaryContacts.length - 1 ? (
Expand All @@ -131,7 +129,7 @@ function MonitoringDetailsModal({
)}
</Descriptions.Item>
)}
{notificationMetaData.secondaryContacts && notificationMetaData.secondaryContacts.length > 0 && (
{notificationMetaData?.secondaryContacts && notificationMetaData.secondaryContacts.length > 0 && (
<Descriptions.Item label="Secondary contact(s)">
{notificationMetaData.secondaryContacts.map((email, index) =>
index < notificationMetaData.secondaryContacts.length - 1 ? (
Expand All @@ -142,7 +140,7 @@ function MonitoringDetailsModal({
)}
</Descriptions.Item>
)}
{notificationMetaData.notifyContacts && notificationMetaData.notifyContacts.length > 0 && (
{notificationMetaData?.notifyContacts && notificationMetaData.notifyContacts.length > 0 && (
<Descriptions.Item label="Notify contact(s)">
{notificationMetaData.notifyContacts.map((email, index) =>
index < notificationMetaData.notifyContacts.length - 1 ? (
Expand All @@ -153,14 +151,14 @@ function MonitoringDetailsModal({
)}
</Descriptions.Item>
)}
{notificationMetaData.teamsHooks && notificationMetaData.teamsHooks.length > 0 && (
{notificationMetaData?.teamsHooks && notificationMetaData.teamsHooks.length > 0 && (
<Descriptions.Item label="Teams channel(s)">
{getHookTags({ AllTeamsHooks: teamsHooks, hookIds: notificationMetaData.teamsHooks })}
</Descriptions.Item>
)}
{/* ---------------------------------------------------------------------------------------- */}
<Descriptions.Item label="Active">
{isActive && approvalStatus === 'Approved' ? (
{isActive ? (
<Tag color="var(--success)" key={'yes'}>
Yes
</Tag>
Expand Down
Loading

0 comments on commit 097733d

Please sign in to comment.