Update how nodes are hidden

This commit is contained in:
toasted-nutbread 2019-11-02 14:39:37 -04:00
parent 3d78d5400d
commit e355b83914
3 changed files with 14 additions and 11 deletions

View File

@ -18,7 +18,7 @@
#anki-spinner, #anki-error,
#dict-spinner, #dict-error, #dict-warning, #dict-purge, #dict-import-progress,
#dict-spinner, #dict-import-progress,
.storage-hidden, #storage-spinner {
display: none;
}

View File

@ -270,6 +270,8 @@ async function onDatabaseUpdated(options) {
const dictionaries = await utilDatabaseGetDictionaryInfo();
dictionaryUI.setDictionaries(dictionaries);
document.querySelector('#dict-warning').hidden = (dictionaries.length > 0);
updateMainDictionarySelect(options, dictionaries);
const {counts, total} = await utilDatabaseGetDictionaryCounts(dictionaries.map(v => v.title), true);
@ -353,8 +355,8 @@ dictionaryErrorToString.overrides = [
];
function dictionaryErrorsShow(errors) {
const dialog = $('#dict-error');
dialog.show().text('');
const dialog = document.querySelector('#dict-error');
dialog.textContent = '';
if (errors !== null && errors.length > 0) {
const uniqueErrors = {};
@ -375,12 +377,12 @@ function dictionaryErrorsShow(errors) {
} else {
div.textContent = `${e}`;
}
dialog.append($(div));
dialog.appendChild(div);
}
dialog.show();
dialog.hidden = false;
} else {
dialog.hide();
dialog.hidden = true;
}
}
@ -410,7 +412,8 @@ async function onDictionaryPurge(e) {
$('#dict-purge-modal').modal('hide');
const dictControls = $('#dict-importer, #dict-groups, #dict-groups-extra, #dict-main-group').hide();
const dictProgress = $('#dict-purge').show();
const dictProgress = document.querySelector('#dict-purge');
dictProgress.hidden = false;
try {
dictionaryErrorsShow(null);
@ -432,7 +435,7 @@ async function onDictionaryPurge(e) {
dictionarySpinnerShow(false);
dictControls.show();
dictProgress.hide();
dictProgress.hidden = true;
if (storageEstimate.mostRecent !== null) {
storageUpdateStats();

View File

@ -426,9 +426,9 @@
<select class="form-control" id="dict-main"></select>
</div>
<div class="text-danger" id="dict-purge">Dictionary data is being purged, please be patient...</div>
<div class="alert alert-warning" id="dict-warning">No dictionaries have been installed</div>
<div class="alert alert-danger" id="dict-error"></div>
<div class="text-danger" id="dict-purge" hidden>Dictionary data is being purged, please be patient...</div>
<div class="alert alert-warning" id="dict-warning" hidden>No dictionaries have been installed</div>
<div class="alert alert-danger" id="dict-error" hidden></div>
<div id="dict-groups"></div>
<div id="dict-groups-extra"></div>