-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added configuration page integration for table and single page …
…form
- Loading branch information
1 parent
1970d9d
commit b7a4d50
Showing
9 changed files
with
355 additions
and
147 deletions.
There are no files selected for viewing
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
61 changes: 61 additions & 0 deletions
61
splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/components/ConfigurationTable.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,61 @@ | ||
import React, { useState } from 'react'; | ||
import Button from '@splunk/react-ui/Button'; | ||
import ToastMessages from '@splunk/react-toast-notifications/ToastMessages'; | ||
|
||
import { InputRowContextProvider } from '../context/InputRowContext'; | ||
import TableWrapper from './table/TableWrapper'; | ||
import ErrorBoundary from './ErrorBoundary'; | ||
import EntityModal from './EntityModal'; | ||
import { MODE_CREATE } from '../constants/modes'; | ||
|
||
const ConfigurationTable = ({ serviceName, serviceTitle, handleSavedata }) => { | ||
const [open, setOpen] = useState(false); | ||
const serviceLabel = `Add ${serviceTitle}`; | ||
|
||
const handleRequestOpen = () => { | ||
setOpen(true); | ||
}; | ||
|
||
const handleRequestClose = () => { | ||
setOpen(false); | ||
}; | ||
const generateModalDialog = () => { | ||
if (open) { | ||
return ( | ||
<EntityModal | ||
isInput={false} | ||
open={open} | ||
handleRequestClose={handleRequestClose} | ||
handleSavedata={handleSavedata} | ||
serviceName={serviceName} | ||
mode={MODE_CREATE} | ||
formLabel={serviceLabel} | ||
/> | ||
); | ||
} | ||
return null; | ||
}; | ||
return ( | ||
<> | ||
<InputRowContextProvider value={null}> | ||
<ErrorBoundary> | ||
<TableWrapper | ||
isInput={false} | ||
serviceName={serviceName} | ||
addButton={ | ||
<Button | ||
label="Add" | ||
appearance="primary" | ||
onClick={() => handleRequestOpen()} | ||
/> | ||
} | ||
/> | ||
</ErrorBoundary> | ||
<ToastMessages /> | ||
</InputRowContextProvider> | ||
{generateModalDialog()} | ||
</> | ||
); | ||
}; | ||
|
||
export default ConfigurationTable; |
Oops, something went wrong.