-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #705 from hpcc-systems/yadhap/asr-domain-category-…
…relation Yadhap/asr domain category relation
- Loading branch information
Showing
47 changed files
with
3,219 additions
and
701 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
137 changes: 0 additions & 137 deletions
137
client-reactjs/src/components/admin/Integrations/IntegrationForms/ASRForm.js
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
client-reactjs/src/components/admin/Integrations/IntegrationNotFound.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Package Imports | ||
import React from 'react'; | ||
import { Result, Button } from 'antd'; | ||
import { useHistory } from 'react-router-dom'; | ||
|
||
// Local Imports | ||
import './integrations.css'; | ||
|
||
function IntegrationNotFound() { | ||
const history = useHistory(); | ||
|
||
// Handle Go to Integration | ||
const handleGoToIntegration = () => { | ||
history.push('/admin/integrations'); | ||
}; | ||
|
||
return ( | ||
<div className="integrationSettings__unavailable"> | ||
<Result | ||
status="500" | ||
title="Oops !!" | ||
subTitle="Integration settings not available." | ||
extra={ | ||
<Button type="primary" onClick={handleGoToIntegration}> | ||
Go to Integrations | ||
</Button> | ||
} | ||
/> | ||
</div> | ||
); | ||
} | ||
|
||
export default IntegrationNotFound; |
45 changes: 45 additions & 0 deletions
45
client-reactjs/src/components/admin/Integrations/IntegrationSettings.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Package imports | ||
import React from 'react'; | ||
import { useParams } from 'react-router-dom'; | ||
import { useSelector } from 'react-redux'; | ||
|
||
// Local imports | ||
import IntegrationNotFound from './IntegrationNotFound'; | ||
|
||
function IntegrationSettings() { | ||
// Redux | ||
const { | ||
applicationReducer: { | ||
integrations, | ||
application: { applicationId }, | ||
}, | ||
} = useSelector((state) => state); | ||
|
||
// Integration name from URL | ||
let { integrationName } = useParams(); | ||
|
||
// The integration name from url be present in the integrations list in redux store | ||
const valid = integrations.some((i) => i.name === integrationName && i.application_id === applicationId); | ||
|
||
// If the integration name is not valid, show the IntegrationNotFound component | ||
if (!valid) { | ||
return <IntegrationNotFound />; | ||
} else { | ||
// Try importing the integration component with the name - integrationName | ||
// If error occurs, show the IntegrationNotFound component | ||
try { | ||
// pass relation id as props | ||
const relation_id = integrations.find( | ||
(i) => i.name === integrationName && i.application_id === applicationId | ||
).integration_to_app_mapping_id; | ||
|
||
const IntegrationComponent = require(`./${integrationName.toLowerCase()}`).default; | ||
|
||
return <IntegrationComponent integration_to_app_mapping_id={relation_id} />; | ||
} catch (error) { | ||
return <IntegrationNotFound />; | ||
} | ||
} | ||
} | ||
|
||
export default IntegrationSettings; |
Oops, something went wrong.