Skip to content

Commit

Permalink
Merge pull request #988 from hpcc-systems/notification-graph-issue
Browse files Browse the repository at this point in the history
Notification graph issue
  • Loading branch information
FancMa01 authored Jan 9, 2025
2 parents 0920fd9 + 8b126df commit 3c6f0f3
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Package imports
import React, { useState, useEffect } from 'react';
import { useSelector } from 'react-redux';
import { Empty } from 'antd';

// Local Imports
Expand All @@ -10,6 +11,9 @@ import NotificationCountByOriginDonut from './charts/NotificationCountByOriginDo

function NotificationDashboard({ sentNotifications, dashBoardFilter, monitorings, productCategories }) {
const [filteredNotifications, setFilteredNotifications] = useState([]);
const { applicationReducer } = useSelector((state) => state);
const { integrations: allIntegrations = [] } = applicationReducer;
const integrationCodes = allIntegrations.map((integration) => integration.name);

useEffect(() => {
console.log('Loading ...');
Expand Down Expand Up @@ -67,13 +71,15 @@ function NotificationDashboard({ sentNotifications, dashBoardFilter, monitorings
<NotificationCountOnLineGraph sentNotifications={filteredNotifications} dashBoardFilter={dashBoardFilter} />
</div>

<div className="notifications_chart_card">
<div className="notifications_chart_title">Notifications by Product with Status Count</div>
<NotificationCountByProductsInGraph
sentNotifications={filteredNotifications}
productCategories={productCategories}
/>
</div>
{integrationCodes.includes('ASR') && (
<div className="notifications_chart_card">
<div className="notifications_chart_title">Notifications by Product with Status Count</div>
<NotificationCountByProductsInGraph
sentNotifications={filteredNotifications}
productCategories={productCategories}
/>
</div>
)}
</>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ function NotificationTableFilters({ setFilters, sentNotifications, monitorings,
<div className="notifications__filter-label">Status</div>
<Form.Item name="status">
<Select placeholder="Status" disabled={false} allowClear>
{statusOptions.map((s) => (
<Option key={s} value={s}>
{statusOptions.map((s, i) => (
<Option key={i} value={s}>
{s}
</Option>
))}
Expand All @@ -106,8 +106,8 @@ function NotificationTableFilters({ setFilters, sentNotifications, monitorings,
<div className="notifications__filter-label">Domain</div>
<Form.Item name="domain">
<Select placeholder="Domain" disabled={false} allowClear>
{domainOptions.map((d) => (
<Option key={d} value={d}>
{domainOptions.map((d, i) => (
<Option key={i} value={d}>
{d}
</Option>
))}
Expand All @@ -118,8 +118,8 @@ function NotificationTableFilters({ setFilters, sentNotifications, monitorings,
<div className="notifications__filter-label">Product</div>
<Form.Item name="product">
<Select placeholder="Product" disabled={false} allowClear>
{productOptions.map((p) => (
<Option key={p} value={p}>
{productOptions.map((p, i) => (
<Option key={i} value={p}>
{p}
</Option>
))}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Packages
import React, { useState, useEffect } from 'react';
import { useSelector } from 'react-redux';
import { DownOutlined } from '@ant-design/icons';
import {
Modal,
Expand All @@ -22,6 +21,7 @@ import dayjs from 'dayjs';
//Local Imports
import { statuses } from './notificationUtil';
import { updateMultipleNotifications } from './notificationUtil';
import { getUser } from '../../../common/userStorage';

const { Option } = Select;
const { TextArea } = Input;
Expand All @@ -47,7 +47,8 @@ const UpdateNotificationModal = ({
const [warningMessages, setWarningMessages] = useState([]);

//Redux
const { user } = useSelector((state) => state.authenticationReducer);
// Get user from local stroage
const user = getUser();

// Effects
useEffect(() => {
Expand Down Expand Up @@ -185,8 +186,7 @@ const UpdateNotificationModal = ({
setSelectedNotificationsIds([]);
}
} catch (err) {
console.error(err);
message.error('Enter updated information');
message.error('Failed to save updated notification(s)');
} finally {
form.resetFields();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ function NotificationCountByProductsInGraph({ sentNotifications, productCategori
// Prepare the data
let chartData = [];
sentNotifications.forEach((notification) => {
if (notification.metaData && notification.metaData.asrSpecificMetaData) {
const category = notification.metaData.asrSpecificMetaData.productCode || 'ACU';
if (notification.metaData && notification.metaData.notificationDetails?.product) {
const category = notification.metaData.notificationDetails?.product;
const status = notification.status;
chartData.push({ category, status, count: 1 });
}
Expand Down

0 comments on commit 3c6f0f3

Please sign in to comment.