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:
Roland 2026-03-22 12:56:37 -06:00
parent 83ad253d6f
commit 755b133fa4
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
7 changed files with 91 additions and 5 deletions

View file

@ -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>