Skip to content

Commit

Permalink
eslint format
Browse files Browse the repository at this point in the history
  • Loading branch information
qishibo committed Mar 1, 2019
1 parent 602ebcd commit ee6a01d
Show file tree
Hide file tree
Showing 26 changed files with 1,133 additions and 1,154 deletions.
6 changes: 4 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ import Tabs from '@/components/Tabs';
export default {
name: 'App',
components: {Header, Aside, Command, Tabs}
}
components: {
Header, Aside, Command, Tabs,
},
};
</script>

Expand Down
8 changes: 4 additions & 4 deletions src/Aside.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ export default {
port: '',
auth: '',
name: '',
}
},
};
},
components: {Connections},
components: { Connections },
methods: {
addNewConnection() {
let connection = this.newConnection;
const connection = this.newConnection;
!connection.host && (connection.host = '127.0.0.1');
!connection.port && (connection.port = 6379);
Expand All @@ -79,6 +79,6 @@ export default {
this.dialogFormVisible = false;
this.$refs.connections.initConnections();
},
}
},
};
</script>
82 changes: 38 additions & 44 deletions src/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,31 +76,31 @@ export default {
return {
form: {
name: '',
region: ''
region: '',
},
dialogFormVisible: false,
selectedLang: 'en',
langItems: [
{value: 'en', label: 'English'},
{value: 'cn', label: '简体中文'},
{ value: 'en', label: 'English' },
{ value: 'cn', label: '简体中文' },
],
cliDialogVisible: false,
cliContent: {content: '', params: ''},
cliContent: { content: '', params: '' },
inputSuggestionItems: new Set(),
historyIndex: 0,
};
},
methods: {
inputSuggestion(input, cb) {
let suggestions = [];
for (var key of this.inputSuggestionItems) {
const suggestions = [];
for (const key of this.inputSuggestionItems) {
if (key.indexOf(input) !== -1) {
suggestions.push({value: key});
suggestions.push({ value: key });
}
}
cb(suggestions);
},
showSettings: function () {
showSettings() {
let settings = this.getSettings();
if (!settings) {
Expand All @@ -111,11 +111,11 @@ export default {
this.form = settings;
},
getSettings () {
getSettings() {
return localStorage.getItem('settings');
},
saveSettings() {
let settings = JSON.stringify(this.form);
const settings = JSON.stringify(this.form);
console.log('saving settings...', settings);
localStorage.setItem('settings', settings);
Expand All @@ -127,54 +127,48 @@ export default {
this.$i18n.locale = this.selectedLang;
},
consoleTitle() {
let client = this.$util.get('client');
const client = this.$util.get('client');
if (!client) {
return 'Client Not Yet, Please Add A Connection First';
}
let host = client.options.host;
let port = client.options.port;
let dbIndex = client.selected_db;
const { host } = client.options;
const { port } = client.options;
const dbIndex = client.selected_db;
let consoleName = host + ':' + port + " #db" + (dbIndex ? dbIndex : '0');
const consoleName = `${host}:${port} #db${dbIndex || '0'}`;
return this.$t('message.redis_console') + ' [' + consoleName + ']';
return `${this.$t('message.redis_console')} [${consoleName}]`;
},
consoleExec() {
let params = this.cliContent.params;
let promise = rawCommand.exec(this, params);
const { params } = this.cliContent;
const promise = rawCommand.exec(this, params);
this.cliContent.content += '> ' + params + "\n";
this.cliContent.content += `> ${params}\n`;
this.cliContent.params = '';
this.historyIndex = 0;
if (!promise) {
this.cliContent.content += "Error!\n";
this.cliContent.content += 'Error!\n';
this.$nextTick(() => {
this.scrollToBottom();
});
}
else {
} else {
promise.then((reply) => {
let append = '';
let append = '';
if (reply === null) {
append = null + "\n";
}
else if (typeof reply === 'object') {
let isArray = !isNaN(reply.length);
append = `${null}\n`;
} else if (typeof reply === 'object') {
const isArray = !isNaN(reply.length);
for (var i in reply) {
append += (isArray ? '' : (i + "\n")) + reply[i] + "\n";
for (const i in reply) {
append += `${(isArray ? '' : (`${i}\n`)) + reply[i]}\n`;
}
}
else {
append = reply + "\n";
} else {
append = `${reply}\n`;
}
this.cliContent.content += append;
Expand All @@ -192,7 +186,7 @@ export default {
this.historyIndex = -this.inputSuggestionItems.size - 1;
}
let stopIndex = this.inputSuggestionItems.size + this.historyIndex;
const stopIndex = this.inputSuggestionItems.size + this.historyIndex;
if (stopIndex < 0) {
this.cliContent.params = '';
Expand All @@ -201,7 +195,7 @@ export default {
let counter = 0;
for (var i of this.inputSuggestionItems) {
for (const i of this.inputSuggestionItems) {
if (counter++ == stopIndex) {
this.cliContent.params = i;
}
Expand All @@ -212,7 +206,7 @@ export default {
this.historyIndex = 0;
}
let stopIndex = this.inputSuggestionItems.size + this.historyIndex;
const stopIndex = this.inputSuggestionItems.size + this.historyIndex;
if (stopIndex >= this.inputSuggestionItems.size) {
this.cliContent.params = '';
Expand All @@ -221,14 +215,14 @@ export default {
let counter = 0;
for (var i of this.inputSuggestionItems) {
for (const i of this.inputSuggestionItems) {
if (counter++ == stopIndex) {
this.cliContent.params = i;
}
}
},
scrollToBottom() {
let textarea = document.getElementById('cli-content');
const textarea = document.getElementById('cli-content');
textarea.scrollTop = textarea.scrollHeight;
},
openConsole() {
Expand All @@ -240,14 +234,14 @@ export default {
return true;
}
let connections = storage.getConnections();
let connection = connections[0];
const connections = storage.getConnections();
const connection = connections[0];
if (!connection) {
return;
}
let client = redisClient.createConnection(connection.host, connection.port, connection.auth);
const client = redisClient.createConnection(connection.host, connection.port, connection.auth);
// set global client
this.$util.set('client', client);
Expand All @@ -258,7 +252,7 @@ export default {
this.showSettings();
this.initDefaultConnection();
}
},
};
</script>

Expand Down
10 changes: 5 additions & 5 deletions src/bus.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import Vue from 'vue';
const eventHub = new Vue();

export default {
$on (...event) {
$on(...event) {
eventHub.$on(...event);
},
$off (...event) {
$off(...event) {
eventHub.$off(...event);
},
$once (...event) {
$once(...event) {
eventHub.$once(...event);
},
$emit (...event) {
$emit(...event) {
eventHub.$emit(...event);
}
},
};
48 changes: 24 additions & 24 deletions src/components/Command.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,30 @@
</template>

<script>
export default{
data() {
return {
commands: [
{'time': new Date().toGMTString(), 'command': 'keys * 1 100', 'result': 'success'},
{'time': new Date().toGMTString(), 'command': 'keys * 1 100', 'result': 'success'},
{'time': new Date().toGMTString(), 'command': 'keys * 1 100', 'result': 'success'},
{'time': new Date().toGMTString(), 'command': 'keys * 1 100', 'result': 'success'},
{'time': new Date().toGMTString(), 'command': 'keys * 1 100', 'result': 'success'},
{'time': new Date().toGMTString(), 'command': 'keys * 1 100', 'result': 'success'},
{'time': new Date().toGMTString(), 'command': 'keys * 1 100', 'result': 'success'},
{'time': new Date().toGMTString(), 'command': 'keys * 1 100', 'result': 'success'},
{'time': new Date().toGMTString(), 'command': 'keys * 1 100', 'result': 'success'},
{'time': new Date().toGMTString(), 'command': 'keys * 1 100', 'result': 'success'},
{'time': new Date().toGMTString(), 'command': 'keys * 1 100', 'result': 'success'},
{'time': new Date().toGMTString(), 'command': 'keys * 1 100', 'result': 'success'},
{'time': new Date().toGMTString(), 'command': 'keys * 1 100', 'result': 'success'},
{'time': new Date().toGMTString(), 'command': 'keys * 1 100', 'result': 'success'},
{'time': new Date().toGMTString(), 'command': 'keys * 1 100', 'result': 'success'},
{'time': new Date().toGMTString(), 'command': 'keys * 1 100', 'result': 'success'},
]
};
}
}
export default {
data() {
return {
commands: [
{ time: new Date().toGMTString(), command: 'keys * 1 100', result: 'success' },
{ time: new Date().toGMTString(), command: 'keys * 1 100', result: 'success' },
{ time: new Date().toGMTString(), command: 'keys * 1 100', result: 'success' },
{ time: new Date().toGMTString(), command: 'keys * 1 100', result: 'success' },
{ time: new Date().toGMTString(), command: 'keys * 1 100', result: 'success' },
{ time: new Date().toGMTString(), command: 'keys * 1 100', result: 'success' },
{ time: new Date().toGMTString(), command: 'keys * 1 100', result: 'success' },
{ time: new Date().toGMTString(), command: 'keys * 1 100', result: 'success' },
{ time: new Date().toGMTString(), command: 'keys * 1 100', result: 'success' },
{ time: new Date().toGMTString(), command: 'keys * 1 100', result: 'success' },
{ time: new Date().toGMTString(), command: 'keys * 1 100', result: 'success' },
{ time: new Date().toGMTString(), command: 'keys * 1 100', result: 'success' },
{ time: new Date().toGMTString(), command: 'keys * 1 100', result: 'success' },
{ time: new Date().toGMTString(), command: 'keys * 1 100', result: 'success' },
{ time: new Date().toGMTString(), command: 'keys * 1 100', result: 'success' },
{ time: new Date().toGMTString(), command: 'keys * 1 100', result: 'success' },
],
};
},
};
</script>

<style>
Expand Down
Loading

0 comments on commit ee6a01d

Please sign in to comment.