зеркало из https://github.com/Azure/ipam.git
Fixed refresh interval adjustment
This commit is contained in:
Родитель
4fe2aad1a8
Коммит
c82bd356ff
|
@ -47,14 +47,17 @@ export default function UserSettings(props) {
|
|||
|
||||
const [refreshValue, setRefreshValue] = React.useState();
|
||||
const [sending, setSending] = React.useState(false);
|
||||
const [changed, setChanged] = React.useState(false);
|
||||
const refreshInterval = useSelector(getRefreshInterval);
|
||||
|
||||
const unchanged = refreshInterval == refreshValue;
|
||||
|
||||
React.useEffect(()=>{
|
||||
setRefreshValue(refreshInterval);
|
||||
}, []);
|
||||
|
||||
React.useEffect(()=>{
|
||||
refreshInterval == refreshValue ? setChanged(false) : setChanged(true);
|
||||
}, [refreshValue]);
|
||||
|
||||
function onSubmit() {
|
||||
var body = [
|
||||
{ "op": "replace", "path": "/apiRefresh", "value": refreshValue }
|
||||
|
@ -108,7 +111,7 @@ export default function UserSettings(props) {
|
|||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={handleClose}>Cancel</Button>
|
||||
<Button onClick={onSubmit} disabled={unchanged || sending}>
|
||||
<Button onClick={onSubmit} disabled={!changed || sending}>
|
||||
Apply
|
||||
</Button>
|
||||
</DialogActions>
|
||||
|
|
Загрузка…
Ссылка в новой задаче