reset file input after upload
This commit is contained in:
parent
d3c342071f
commit
4cb7e8d2ac
@ -254,19 +254,21 @@ function onDictionaryImport(e) {
|
|||||||
dictionaryErrorShow(null);
|
dictionaryErrorShow(null);
|
||||||
dictionarySpinnerShow(true);
|
dictionarySpinnerShow(true);
|
||||||
|
|
||||||
const dictUrl = $('#dict-url');
|
const dictFile = $('#dict-file');
|
||||||
const dictImporter = $('#dict-importer').hide();
|
const dictImporter = $('#dict-importer').hide();
|
||||||
const dictProgress = $('#dict-import-progress').show();
|
const dictProgress = $('#dict-import-progress').show();
|
||||||
const setProgress = percent => dictProgress.find('.progress-bar').css('width', `${percent}%`);
|
const setProgress = percent => dictProgress.find('.progress-bar').css('width', `${percent}%`);
|
||||||
|
const updateProgress = (total, current) => setProgress(current / total * 100.0);
|
||||||
|
|
||||||
setProgress(0.0);
|
setProgress(0.0);
|
||||||
|
|
||||||
optionsLoad().then(options => {
|
optionsLoad().then(options => {
|
||||||
return instDb().importDictionary(e.target.files[0], (total, current) => setProgress(current / total * 100.0)).then(summary => {
|
return instDb().importDictionary(e.target.files[0], updateProgress).then(summary => {
|
||||||
options.dictionaries[summary.title] = {enabled: true, priority: 0};
|
options.dictionaries[summary.title] = {enabled: true, priority: 0};
|
||||||
return optionsSave(options);
|
return optionsSave(options);
|
||||||
}).then(() => dictionaryGroupsPopulate(options));
|
}).then(() => dictionaryGroupsPopulate(options));
|
||||||
}).catch(dictionaryErrorShow).then(() => {
|
}).catch(dictionaryErrorShow).then(() => {
|
||||||
|
dictFile.val('');
|
||||||
dictionarySpinnerShow(false);
|
dictionarySpinnerShow(false);
|
||||||
dictProgress.hide();
|
dictProgress.hide();
|
||||||
dictImporter.show();
|
dictImporter.show();
|
||||||
|
Loading…
Reference in New Issue
Block a user