mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-30 11:56:18 -05:00
Fixing bug where configs could be overwritten with empty configs on first refresh. Fixing bug where configs were displayed as JSON in admin settings.
This commit is contained in:
parent
83ad253d6f
commit
755b133fa4
7 changed files with 91 additions and 5 deletions
|
|
@ -3,7 +3,7 @@ import {Button, Header, Icon, Loader, Modal, Popup, Table} from "../Theme";
|
|||
import React, {useContext, useEffect, useState} from "react";
|
||||
import {TableBody, TableCell, TableHeader, TableHeaderCell, TableRow} from "semantic-ui-react";
|
||||
import {TableRowPlaceholder} from "../Placeholder";
|
||||
import {getConfig, getConfigBackups, postConfigBackupImport, postConfigBackupPreview} from "../../api";
|
||||
import {getConfigText, getConfigBackups, postConfigBackupImport, postConfigBackupPreview} from "../../api";
|
||||
import {ThemeContext} from "../../contexts/contexts";
|
||||
|
||||
function WarningIcon({ok}) {
|
||||
|
|
@ -300,7 +300,7 @@ function ConfigContentModal({open, onClose, fileName}) {
|
|||
let cancelled = false;
|
||||
setLoading(true);
|
||||
setContent(null);
|
||||
getConfig(fileName).then(result => {
|
||||
getConfigText(fileName).then(result => {
|
||||
if (cancelled) return;
|
||||
setContent(result);
|
||||
setLoading(false);
|
||||
|
|
@ -318,7 +318,7 @@ function ConfigContentModal({open, onClose, fileName}) {
|
|||
{loading
|
||||
? <Loader active inline='centered'/>
|
||||
: content
|
||||
? <pre style={{whiteSpace: 'pre-wrap', wordBreak: 'break-word'}}>{JSON.stringify(content, null, 2)}</pre>
|
||||
? <pre style={{whiteSpace: 'pre-wrap', wordBreak: 'break-word'}}>{content}</pre>
|
||||
: <p>Failed to load config contents.</p>
|
||||
}
|
||||
</Modal.Content>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue