diff --git a/client-reactjs/src/App.js b/client-reactjs/src/App.js index 86c27c402..86530eb2a 100644 --- a/client-reactjs/src/App.js +++ b/client-reactjs/src/App.js @@ -57,7 +57,7 @@ const Regulations = React.lazy(() => import('./components/admin/ControlsAndRegul const GitHubSettings = React.lazy(() => import('./components/admin/GitHubSettings/GitHubSettings')); const ScheduledJobsPage = React.lazy(() => import('./components/admin/ScheduledJobsPage')); const Compliance = React.lazy(() => import('./components/admin/Compliance/Compliance')); -const Integrations = React.lazy(() => import('./components/admin/Integrations')); +const Integrations = React.lazy(() => import('./components/admin/Integrations/Integrations')); const TeamsNotification = React.lazy(() => import('./components/admin/notifications/MsTeams/Teams')); // Shared layout, etc. diff --git a/client-reactjs/src/components/admin/ClusterDetails.jsx b/client-reactjs/src/components/admin/ClusterDetails.jsx index 3891416d5..fb73693b0 100644 --- a/client-reactjs/src/components/admin/ClusterDetails.jsx +++ b/client-reactjs/src/components/admin/ClusterDetails.jsx @@ -60,7 +60,7 @@ function ClusterDetails() { return (
- + {clusterMetaData ? ( <> diff --git a/client-reactjs/src/components/admin/Integrations/IntegrationForms/ASRForm.js b/client-reactjs/src/components/admin/Integrations/IntegrationForms/ASRForm.js new file mode 100644 index 000000000..a068abbbe --- /dev/null +++ b/client-reactjs/src/components/admin/Integrations/IntegrationForms/ASRForm.js @@ -0,0 +1,137 @@ +import React from 'react'; +import { useEffect, useState } from 'react'; +import { Form, Select, Switch, Tabs, message } from 'antd'; +import { isEmail } from 'validator'; +import { getAllTeamsHook } from '../../../application/jobMonitoring/jobMonitoringUtils'; + +const { TabPane } = Tabs; +const { Option } = Select; + +const ASRForm = ({ setNotifications, notifications, setActive, selectedIntegration }) => { + const [notificationForm] = Form.useForm(); + const [teamsHooks, setTeamsHook] = useState([]); + + useEffect(() => { + //Get all teams hook + (async () => { + try { + const allTeamsHook = await getAllTeamsHook(); + setTeamsHook(allTeamsHook); + } catch (error) { + message.error('Error fetching teams hook'); + } + })(); + }, []); + + useEffect(() => { + notificationForm.setFieldsValue({ + notificationEmailsSev3: selectedIntegration?.metaData?.notificationEmailsSev3, + megaphone: selectedIntegration?.config?.megaphoneActive, + notificationEmails: selectedIntegration?.metaData?.notificationEmails, + notificationWebhooks: selectedIntegration?.metaData?.notificationWebhooks, + }); + }, [selectedIntegration]); + + return ( + <> +
+ + +

General

+ { + if (!value || value.length === 0) { + return Promise.reject(new Error('Please add at least one email!')); + } + if (value.length > 20) { + return Promise.reject(new Error('Too many emails')); + } + if (!value.every((v) => isEmail(v))) { + return Promise.reject(new Error('One or more emails are invalid')); + } + return Promise.resolve(); + }, + }, + ]}> + { + setNotifications({ ...notifications, notificationEmails: e }); + }} + /> + + + + +
+
+
+ + ); +}; +export default ASRForm; diff --git a/client-reactjs/src/components/admin/Integrations.js b/client-reactjs/src/components/admin/Integrations/Integrations.js similarity index 62% rename from client-reactjs/src/components/admin/Integrations.js rename to client-reactjs/src/components/admin/Integrations/Integrations.js index 9c73ed006..5dc6d9f09 100644 --- a/client-reactjs/src/components/admin/Integrations.js +++ b/client-reactjs/src/components/admin/Integrations/Integrations.js @@ -1,11 +1,12 @@ import React, { useState, useEffect } from 'react'; -import { Tooltip, Space, Table, Switch, Modal, Form, Input, Button, message } from 'antd'; +import { Tooltip, Space, Table, Switch, Modal, Button, message } from 'antd'; import { EditOutlined } from '@ant-design/icons'; -import BreadCrumbs from '../common/BreadCrumbs.js'; -import { authHeader } from '../common/AuthHeader.js'; +import BreadCrumbs from '../../common/BreadCrumbs.js'; +import { authHeader } from '../../common/AuthHeader.js'; import { useSelector, useDispatch } from 'react-redux'; -import { applicationActions } from '../../redux/actions/Application.js'; -import useWindowSize from '../../hooks/useWindowSize.js'; +import { applicationActions } from '../../../redux/actions/Application.js'; +import useWindowSize from '../../../hooks/useWindowSize.js'; +import ASRForm from './IntegrationForms/ASRForm.js'; const Integrations = () => { const [integrations, setIntegrations] = useState([]); @@ -15,7 +16,7 @@ const Integrations = () => { const [selectedIntegration, setSelectedIntegration] = useState({}); const [notifications, setNotifications] = useState({}); const [active, setActive] = useState(false); - const [notificationForm] = Form.useForm(); + const windowSize = useWindowSize(); // Changes modal size per screen vw @@ -24,6 +25,7 @@ const Integrations = () => { if (width > 1500) { setModalWidth('40vw'); } else if (width > 1000) { + integrations; setModalWidth('60vw'); } else { setModalWidth('100vw'); @@ -48,6 +50,7 @@ const Integrations = () => { const response = await fetch(`/api/integrations/get/${applicationId}`, payload); const data = await response.json(); + if (data) { setIntegrations(data); } @@ -61,6 +64,7 @@ const Integrations = () => { await setModalVisible(true); await setSelectedIntegration(record); await setNotifications(record.metaData); + await setActive(record.config?.megaphoneActive); }; const handleSave = async () => { @@ -82,7 +86,6 @@ const Integrations = () => { setModalVisible(false); dispatch(applicationActions.getIntegrations(applicationId)); - notificationForm.resetFields(); message.success('Successfully updated Integration'); } else { message.success('An Error Occured, Integration not updated'); @@ -158,48 +161,17 @@ const Integrations = () => { destroyOnClose footer={saveBtn} title="Integration Settings"> -
-

General Settings

- - setNotifications({ ...notifications, notificationEmailsSev3: e.target.value })}> - -
-

Megaphone Notification Settings

- - { - setActive(e); - }}> - - - setNotifications({ ...notifications, notificationEmails: e.target.value })}> - - - setNotifications({ ...notifications, notificationWebhooks: e.target.value })}> - -
+ {selectedIntegration?.name === 'ASR' && ( + <> + + + )} ); diff --git a/client-reactjs/src/components/application/Dataflow/DataflowDetails.js b/client-reactjs/src/components/application/Dataflow/DataflowDetails.js index 8af266379..bc416e988 100644 --- a/client-reactjs/src/components/application/Dataflow/DataflowDetails.js +++ b/client-reactjs/src/components/application/Dataflow/DataflowDetails.js @@ -33,6 +33,7 @@ function DataflowDetails() {
) : null} - + } key="1">
} onChange={(activeKey) => this.setState({ selectedTabPaneKey: activeKey })}> diff --git a/client-reactjs/src/components/application/Jobs/ManualJobDetail.jsx b/client-reactjs/src/components/application/Jobs/ManualJobDetail.jsx index 427d01138..a6022c908 100644 --- a/client-reactjs/src/components/application/Jobs/ManualJobDetail.jsx +++ b/client-reactjs/src/components/application/Jobs/ManualJobDetail.jsx @@ -110,7 +110,7 @@ function ManualJobDetail() {
{}: {jobDetails.name}
- + } key="1"> {jobData.map((item, i) => ( diff --git a/client-reactjs/src/components/application/VisualizationDetails.js b/client-reactjs/src/components/application/VisualizationDetails.js index 87a8b20d9..8d856e92f 100644 --- a/client-reactjs/src/components/application/VisualizationDetails.js +++ b/client-reactjs/src/components/application/VisualizationDetails.js @@ -170,7 +170,7 @@ function VisualizationDetails() { return ( - + } key="1"> diff --git a/client-reactjs/src/components/application/actions/actions.jsx b/client-reactjs/src/components/application/actions/actions.jsx index 52081314a..c726b9dae 100644 --- a/client-reactjs/src/components/application/actions/actions.jsx +++ b/client-reactjs/src/components/application/actions/actions.jsx @@ -12,7 +12,7 @@ function Actions() {
- + } key="1"> diff --git a/client-reactjs/src/components/application/clusterMonitoring/index.jsx b/client-reactjs/src/components/application/clusterMonitoring/index.jsx index a7a9a966b..cddffee76 100644 --- a/client-reactjs/src/components/application/clusterMonitoring/index.jsx +++ b/client-reactjs/src/components/application/clusterMonitoring/index.jsx @@ -307,6 +307,7 @@ function ClusterMonitoring() { initialValues={{ msTeamsGroups: [''], emails: [''] }}> { setActiveTab(record); }}> diff --git a/client-reactjs/src/components/application/dashboard/ExportMenu/DashboardModal.jsx b/client-reactjs/src/components/application/dashboard/ExportMenu/DashboardModal.jsx index 452105069..bfd87b14f 100644 --- a/client-reactjs/src/components/application/dashboard/ExportMenu/DashboardModal.jsx +++ b/client-reactjs/src/components/application/dashboard/ExportMenu/DashboardModal.jsx @@ -131,7 +131,7 @@ const DashboardModal = ({ modalVisible, setModalVisible, applicationId, authRedu } footer={false} style={{ marginTop: '200px' }}> - +
diff --git a/client-reactjs/src/components/application/dashboard/clusterUsage/index.js b/client-reactjs/src/components/application/dashboard/clusterUsage/index.js index cb7612da7..6949e67d5 100644 --- a/client-reactjs/src/components/application/dashboard/clusterUsage/index.js +++ b/client-reactjs/src/components/application/dashboard/clusterUsage/index.js @@ -103,6 +103,7 @@ function ClusterUsage() { } activeKey={activeTab} + type="card" onChange={handleTabSwitching}> }> - + {selectedNotificationDetails.map((item) => ( diff --git a/client-reactjs/src/components/application/dashboard/notifications/index.js b/client-reactjs/src/components/application/dashboard/notifications/index.js index 1982b038b..4fd4d73fc 100644 --- a/client-reactjs/src/components/application/dashboard/notifications/index.js +++ b/client-reactjs/src/components/application/dashboard/notifications/index.js @@ -181,6 +181,7 @@ function Index() { return (