Skip to content

Commit

Permalink
Added app dependency section
Browse files Browse the repository at this point in the history
  • Loading branch information
hardikhdholariya committed Sep 4, 2024
1 parent 829eda0 commit 653f813
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion product_setup_page/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import HoneyDBSetup from './HoneyDBSetup';
import MaliciousIPCollectorSetup from './MaliciousIPCollectorSetup';
import SendEmailSetup from './SendEmailSetup';
import DeviceInventorySetup from './DeviceInventorySetup';
import CyencesDependencies from './CyencesDependencies';

const TABS = [
'Cyences General Configuration',
Expand All @@ -16,7 +17,8 @@ const TABS = [
'HoneyDB Configuration',
'MaliciousIP Collector Configuration',
'Cyences Email Action Configuration',
'Device Inventory Configuration'
'Device Inventory Configuration',
'Cyences Dependencies'
]

export default function App() {
Expand Down Expand Up @@ -53,6 +55,9 @@ export default function App() {
<div key={TABS[6]} style={{ display: activeTabId === TABS[6] ? 'block' : 'none' }}>
<DeviceInventorySetup />
</div>
<div key={TABS[7]} style={{ display: activeTabId === TABS[7] ? 'block' : 'none' }}>
<CyencesDependencies />
</div>
</div>
);
}
36 changes: 36 additions & 0 deletions product_setup_page/src/CyencesDependencies.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React, { useEffect, useState } from 'react';
import Heading from '@splunk/react-ui/Heading';
import SearchTable from './components/SearchTable';



const searchQuery = `| rest /services/apps/local splunk_server=local
| search label IN ("DA-ESS-ContentUpdate", "Splunk Common Information Model", "Flow Map Viz")
| eval is_installed="Installed"
| table label, is_installed, disabled
| append
[| makeresults count=1
| eval label="DA-ESS-ContentUpdate", disabled="-", is_installed="Not Installed", link="https://splunkbase.splunk.com/app/3449/"
| table label, is_installed, disabled, link]
| append
[| makeresults count=1
| eval label="Splunk Common Information Model", disabled="-", is_installed="Not Installed", link="https://splunkbase.splunk.com/app/1621/"
| table label, is_installed, disabled, link]
| append
[| makeresults count=1
| eval label="Flow Map Viz", disabled="-", is_installed="Not Installed", link="https://splunkbase.splunk.com/app/4657/"
| table label, is_installed, disabled, link]
| stats first(*) as * by label
| eval disabled = case(disabled=0, "Enabled", disabled=1, "Disabled", 1==1, "-")
| rename label as "App Name", is_installed as "Installation Status", link as "Splunkbase Link", disabled as "Enabled/Disabled"
`

export default function CyencesDependencies() {

return (
<div style={{ marginLeft: '20px' }}>
<Heading>App Dependencies</Heading>
<SearchTable searchQuery={searchQuery} />
</div>
);
}
3 changes: 2 additions & 1 deletion product_setup_page/src/components/SearchTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
import Table from '@splunk/react-ui/Table';
import SearchJob from '@splunk/search-job';
import { app } from '@splunk/splunk-utils/config';
import Link from '@splunk/react-ui/Link';


export default function SearchTable({ searchQuery, earliestTime, latestTime }) {
Expand Down Expand Up @@ -51,7 +52,7 @@ export default function SearchTable({ searchQuery, earliestTime, latestTime }) {
{data.results?.map((row, index) => (
<Table.Row key={index}>
{data.fields?.map(field => (
<Table.Cell key={index + field.name}>{row[field.name]}</Table.Cell>
<Table.Cell key={index + field.name}>{field.name == 'Splunkbase Link'? <Link to={row[field.name]} openInNewContext>{row[field.name]}</Link>: row[field.name] }</Table.Cell>
))}
</Table.Row>
))}
Expand Down

0 comments on commit 653f813

Please sign in to comment.