mirror of
https://github.com/optim-enterprises-bv/OptimCloud-gw-ui.git
synced 2025-10-30 17:57:46 +00:00
Added command succesfuly submitted to config modal
This commit is contained in:
@@ -20,6 +20,7 @@ import {
|
|||||||
import { checkIfJson } from '../../utils/helper';
|
import { checkIfJson } from '../../utils/helper';
|
||||||
import axiosInstance from '../../utils/axiosInstance';
|
import axiosInstance from '../../utils/axiosInstance';
|
||||||
import eventBus from '../../utils/EventBus';
|
import eventBus from '../../utils/EventBus';
|
||||||
|
import SuccessfulActionModalBody from '../../components/SuccessfulActionModalBody';
|
||||||
|
|
||||||
const ConfigureModal = ({ show, toggleModal }) => {
|
const ConfigureModal = ({ show, toggleModal }) => {
|
||||||
const [hadSuccess, setHadSuccess] = useState(false);
|
const [hadSuccess, setHadSuccess] = useState(false);
|
||||||
@@ -99,55 +100,59 @@ import {
|
|||||||
<CModalHeader closeButton>
|
<CModalHeader closeButton>
|
||||||
<CModalTitle>Configure Device</CModalTitle>
|
<CModalTitle>Configure Device</CModalTitle>
|
||||||
</CModalHeader>
|
</CModalHeader>
|
||||||
<CModalBody>
|
{hadSuccess ?
|
||||||
<h6>Enter new device configuration: </h6>
|
<SuccessfulActionModalBody toggleModal={toggleModal} /> :
|
||||||
<CRow style={{ marginTop: '20px' }}>
|
<div>
|
||||||
<CCol>
|
<CModalBody>
|
||||||
<CForm>
|
<h6>Enter new device configuration: </h6>
|
||||||
<CTextarea
|
<CRow style={{ marginTop: '20px' }}>
|
||||||
name="textarea-input"
|
<CCol>
|
||||||
id="textarea-input"
|
<CForm>
|
||||||
rows="9"
|
<CTextarea
|
||||||
placeholder="Config JSON"
|
name="textarea-input"
|
||||||
value={newConfig}
|
id="textarea-input"
|
||||||
onChange={(event) => setNewConfig(event.target.value)}
|
rows="9"
|
||||||
invalid={errorJson}
|
placeholder="Config JSON"
|
||||||
/>
|
value={newConfig}
|
||||||
<CInvalidFeedback className="help-block">
|
onChange={(event) => setNewConfig(event.target.value)}
|
||||||
You need to enter valid JSON
|
invalid={errorJson}
|
||||||
</CInvalidFeedback>
|
/>
|
||||||
</CForm>
|
<CInvalidFeedback className="help-block">
|
||||||
</CCol>
|
You need to enter valid JSON
|
||||||
</CRow>
|
</CInvalidFeedback>
|
||||||
<div hidden={!hadSuccess && !hadFailure}>
|
</CForm>
|
||||||
<div>
|
</CCol>
|
||||||
<pre className="ignore">{responseBody}</pre>
|
</CRow>
|
||||||
</div>
|
<div hidden={!hadSuccess && !hadFailure}>
|
||||||
</div>
|
<div>
|
||||||
</CModalBody>
|
<pre className="ignore">{responseBody}</pre>
|
||||||
<CModalFooter>
|
</div>
|
||||||
<div hidden={!checkingIfSure}>Are you sure?</div>
|
</div>
|
||||||
<CButton
|
</CModalBody>
|
||||||
disabled={waiting}
|
<CModalFooter>
|
||||||
hidden={checkingIfSure}
|
<div hidden={!checkingIfSure}>Are you sure?</div>
|
||||||
color="primary"
|
<CButton
|
||||||
onClick={() => confirmingIfSure()}
|
disabled={waiting}
|
||||||
>
|
hidden={checkingIfSure}
|
||||||
Submit
|
color="primary"
|
||||||
</CButton>
|
onClick={() => confirmingIfSure()}
|
||||||
<CButton
|
>
|
||||||
hidden={!checkingIfSure}
|
Submit
|
||||||
disabled={waiting}
|
</CButton>
|
||||||
color="primary"
|
<CButton
|
||||||
onClick={() => doAction(false)}
|
hidden={!checkingIfSure}
|
||||||
>
|
disabled={waiting}
|
||||||
{waiting && !doingNow ? 'Loading...' : 'Yes'} {' '}
|
color="primary"
|
||||||
<CSpinner hidden={!waiting || doingNow} component="span" size="sm" />
|
onClick={() => doAction(false)}
|
||||||
</CButton>
|
>
|
||||||
<CButton color="secondary" onClick={toggleModal}>
|
{waiting && !doingNow ? 'Loading...' : 'Yes'} {' '}
|
||||||
Cancel
|
<CSpinner hidden={!waiting || doingNow} component="span" size="sm" />
|
||||||
</CButton>
|
</CButton>
|
||||||
</CModalFooter>
|
<CButton color="secondary" onClick={toggleModal}>
|
||||||
|
Cancel
|
||||||
|
</CButton>
|
||||||
|
</CModalFooter>
|
||||||
|
</div>}
|
||||||
</CModal>
|
</CModal>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user