From 7728462fb11eb0633b4935b592b6d8e617e1d5bf Mon Sep 17 00:00:00 2001 From: ysfscream <894402575@qq.com> Date: Wed, 20 Nov 2019 22:44:24 +0800 Subject: [PATCH 1/4] feat(clients): add edit client entry --- .yarnclean | 45 ++++++++++++++++++++ main/updateChecker.ts | 2 +- package.json | 2 +- src/assets/scss/element/element-reset.scss | 3 ++ src/assets/scss/theme/dark.scss | 1 + src/assets/scss/theme/light.scss | 1 + src/assets/scss/theme/purple.scss | 1 + src/lang/brokers.ts | 4 ++ src/lang/common.ts | 8 ++++ src/views/brokers/BrokerContent.vue | 48 +++++++++++++++++----- src/views/brokers/clients/ClientCreate.vue | 32 ++++++++++++++- src/views/settings/SettingsLeft.vue | 2 +- 12 files changed, 133 insertions(+), 16 deletions(-) create mode 100644 .yarnclean diff --git a/.yarnclean b/.yarnclean new file mode 100644 index 000000000..b591611ea --- /dev/null +++ b/.yarnclean @@ -0,0 +1,45 @@ +# test directories +__tests__ +test +tests +powered-test + +# asset directories +docs +doc +website +images +assets + +# examples +example +examples + +# code coverage directories +coverage +.nyc_output + +# build scripts +Makefile +Gulpfile.js +Gruntfile.js + +# configs +appveyor.yml +circle.yml +codeship-services.yml +codeship-steps.yml +wercker.yml +.tern-project +.gitattributes +.editorconfig +.*ignore +.eslintrc +.jshintrc +.flowconfig +.documentup.json +.yarn-metadata.json +.travis.yml + +# misc +*.md diff --git a/main/updateChecker.ts b/main/updateChecker.ts index e5d47520c..a99f83bc8 100644 --- a/main/updateChecker.ts +++ b/main/updateChecker.ts @@ -1,7 +1,7 @@ import { dialog, shell } from 'electron' import axios from 'axios' -const version: string = 'v1.1.0' +const version: string = 'v1.1.1' const release: string = 'https://api.github.com/repos/emqx/MQTTX/releases/latest' const downloadUrl: string = 'https://github.com/emqx/MQTTX/releases/latest' diff --git a/package.json b/package.json index d2f177448..d7e8fac34 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "MQTTX", "author": "EMQ X Team", - "version": "1.1.0", + "version": "1.1.1", "license": "Apache", "description": "MQTT desktop client", "repository": "https://github.com/emqx/MQTTX", diff --git a/src/assets/scss/element/element-reset.scss b/src/assets/scss/element/element-reset.scss index 333cdd796..4a068bcaa 100644 --- a/src/assets/scss/element/element-reset.scss +++ b/src/assets/scss/element/element-reset.scss @@ -29,6 +29,9 @@ border: 1px solid var(--color-border-default); background-color: var(--color-bg-normal); } +.el-card.is-hover-shadow:hover { + box-shadow: 0 2px 12px 0 var(--color-shadow-card); +} /* Form */ .el-form { diff --git a/src/assets/scss/theme/dark.scss b/src/assets/scss/theme/dark.scss index 8717bd259..c5c021a55 100644 --- a/src/assets/scss/theme/dark.scss +++ b/src/assets/scss/theme/dark.scss @@ -29,4 +29,5 @@ body.dark { /* Border color */ --color-border-default: #383838; --color-border-bold: #969696; + --color-shadow-card: #00000059; } diff --git a/src/assets/scss/theme/light.scss b/src/assets/scss/theme/light.scss index a914bc4d6..db6642e19 100644 --- a/src/assets/scss/theme/light.scss +++ b/src/assets/scss/theme/light.scss @@ -29,4 +29,5 @@ body.light { /* Border color */ --color-border-default: #E6E8F1; --color-border-bold: #979797; + --color-shadow-card: #0000001a; } diff --git a/src/assets/scss/theme/purple.scss b/src/assets/scss/theme/purple.scss index 9fe8e6ef5..fb63f562b 100644 --- a/src/assets/scss/theme/purple.scss +++ b/src/assets/scss/theme/purple.scss @@ -29,4 +29,5 @@ body.purple { /* Border color */ --color-border-default: #40414E; --color-border-bold: #4F5367; + --color-shadow-card: #00000085; } diff --git a/src/lang/brokers.ts b/src/lang/brokers.ts index b6789d267..38a9891ef 100644 --- a/src/lang/brokers.ts +++ b/src/lang/brokers.ts @@ -44,6 +44,10 @@ export default { zh: '新建客户端', en: 'New Client', }, + editClient: { + zh: '编辑客户端', + en: 'Edit Client', + }, username: { zh: '用户名', en: 'Username', diff --git a/src/lang/common.ts b/src/lang/common.ts index a6d387c41..e9d473793 100644 --- a/src/lang/common.ts +++ b/src/lang/common.ts @@ -59,4 +59,12 @@ export default { zh: '此操作将删除该 {name},是否继续?', en: 'This will delete {name}, Continue?', }, + delete: { + zh: '删除', + en: 'Delete', + }, + edit: { + zh: '编辑', + en: 'Edit', + }, } diff --git a/src/views/brokers/BrokerContent.vue b/src/views/brokers/BrokerContent.vue index 14f130bda..3a97b546c 100644 --- a/src/views/brokers/BrokerContent.vue +++ b/src/views/brokers/BrokerContent.vue @@ -65,10 +65,22 @@ - - - - + + + + + + + + + {{ $t('common.edit') }} + + + + {{ $t('common.delete') }} + + + {{ client.clientName }} @@ -104,6 +116,13 @@ export default class BrokerContent extends Vue { } } + private editClient(row: ClientModel): void { + this.$router.push({ + path: `/clients/${this.record.id}`, + query: { oper: 'edit', clientId: row.id }, + }) + } + private removeClient(row: ClientModel): void { const confirmDelete: string = this.$t('common.confirmDelete', { name: row.clientName }) as string this.$confirm(confirmDelete, this.$t('common.warning') as string, { @@ -147,17 +166,24 @@ export default class BrokerContent extends Vue { .client-card { margin: 10px 5px 10px 0px; cursor: pointer; - .remove-icon { + .oper-dropdown { position: absolute; right: 10px; - top: 5px; - visibility: hidden; - } - &:hover { - .remove-icon { - visibility: visible; + top: 8px; + .oper-icon { + display: inline-block; + transform: rotate(90deg); } } } } +.dropdown-clients-item { + display: block; + text-align: left; + padding: 5px 16px; + min-width: 85px; + i { + margin-right: 8px; + } +} diff --git a/src/views/brokers/clients/ClientCreate.vue b/src/views/brokers/clients/ClientCreate.vue index bac492771..420dac07e 100644 --- a/src/views/brokers/clients/ClientCreate.vue +++ b/src/views/brokers/clients/ClientCreate.vue @@ -8,7 +8,7 @@
-

{{ $t('brokers.newClient') }}

+

{{ oper === 'create' ? $t('brokers.newClient') : $t('brokers.editClient') }}

@@ -157,7 +157,7 @@ diff --git a/src/views/settings/SettingsLeft.vue b/src/views/settings/SettingsLeft.vue index 579395416..a19a1976e 100644 --- a/src/views/settings/SettingsLeft.vue +++ b/src/views/settings/SettingsLeft.vue @@ -1,7 +1,7 @@