mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-03 09:45:22 +03:00
Adjust UI colors and behavior
This commit is contained in:
parent
78c1d3b784
commit
d721bf7abe
@ -9,7 +9,6 @@ import * as monaco from 'monaco-editor';
|
|||||||
|
|
||||||
export default function Config() {
|
export default function Config() {
|
||||||
const { data: config } = useSWR('config/raw');
|
const { data: config } = useSWR('config/raw');
|
||||||
const [newCode, setNewCode] = useState();
|
|
||||||
const [success, setSuccess] = useState();
|
const [success, setSuccess] = useState();
|
||||||
const [error, setError] = useState();
|
const [error, setError] = useState();
|
||||||
|
|
||||||
@ -19,7 +18,7 @@ export default function Config() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
axios
|
axios
|
||||||
.post('config/save', newCode, {
|
.post('config/save', window.editor.getValue(), {
|
||||||
headers: { 'Content-Type': 'text/plain' },
|
headers: { 'Content-Type': 'text/plain' },
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
@ -37,7 +36,7 @@ export default function Config() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleCopyConfig = async () => {
|
const handleCopyConfig = async () => {
|
||||||
await window.navigator.clipboard.writeText(newCode);
|
await window.navigator.clipboard.writeText(window.editor.getValue());
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -45,9 +44,11 @@ export default function Config() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
monaco.editor.create(document.getElementById('container'), {
|
window.editor = monaco.editor.create(document.getElementById('container'), {
|
||||||
language: 'yaml',
|
language: 'yaml',
|
||||||
value: config,
|
value: config,
|
||||||
|
scrollBeyondLastLine: false,
|
||||||
|
theme: 'vs-dark',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -63,11 +64,9 @@ export default function Config() {
|
|||||||
<Button className="mx-2" onClick={(e) => handleCopyConfig(e)}>
|
<Button className="mx-2" onClick={(e) => handleCopyConfig(e)}>
|
||||||
Copy Config
|
Copy Config
|
||||||
</Button>
|
</Button>
|
||||||
{newCode && (
|
|
||||||
<Button className="mx-2" onClick={(e) => onHandleSaveConfig(e)}>
|
<Button className="mx-2" onClick={(e) => onHandleSaveConfig(e)}>
|
||||||
Save & Restart
|
Save & Restart
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user