fix db select when config command is renamed, fix #24

This commit is contained in:
qishibo 2019-05-14 14:34:08 +08:00
parent 7545029ae8
commit 2a8fc21607
2 changed files with 37 additions and 23 deletions

View File

@ -92,31 +92,41 @@ export default {
this.$nextTick(() => {
this.scrollToBottom();
});
} else {
promise.then((reply) => {
let append = '';
if (reply === null) {
append = `${null}\n`;
} else if (typeof reply === 'object') {
const isArray = !isNaN(reply.length);
for (const i in reply) {
append += `${(isArray ? '' : (`${i}\n`)) + reply[i]}\n`;
}
} else {
append = `${reply}\n`;
}
this.cliContent.content += append;
this.inputSuggestionItems.delete(params);
this.inputSuggestionItems.add(params);
this.$nextTick(() => {
this.scrollToBottom();
});
});
return;
}
promise.then((reply) => {
let append = '';
if (reply === null) {
append = `${null}\n`;
}
else if (typeof reply === 'object') {
const isArray = !isNaN(reply.length);
for (const i in reply) {
append += `${(isArray ? '' : (`${i}\n`)) + reply[i]}\n`;
}
}
else {
append = `${reply}\n`;
}
this.cliContent.content += append;
this.inputSuggestionItems.delete(params);
this.inputSuggestionItems.add(params);
this.$nextTick(() => {
this.scrollToBottom();
});
}).catch((err) => {
this.cliContent.content += `${err.message}\n`;
this.$nextTick(() => {
this.scrollToBottom();
});
});
},
searchUp() {
if (--this.historyIndex < (-this.inputSuggestionItems.size - 1)) {

View File

@ -286,6 +286,10 @@ export default {
else {
this.$set(this.dbs, menuIndex, [...Array(16).keys()]);
}
}).catch((err) => {
// config command may be renamed
console.log(`get config databases failed, ${err.message}`);
this.$set(this.dbs, menuIndex, [...Array(16).keys()]);
});
},
setGlobalConnection(menuIndex, connection) {