From d95592acc9c987b1d29b6beb00f90f485faa49a3 Mon Sep 17 00:00:00 2001 From: Jiiks Date: Fri, 8 Mar 2019 13:57:02 +0200 Subject: [PATCH] Styling and debug view --- client/src/modules/updater.js | 9 +++ .../styles/partials/bdsettings/devview.scss | 9 +++ .../src/styles/partials/bdsettings/index.scss | 1 + .../styles/partials/bdsettings/updater.scss | 18 ++++++ .../src/ui/components/bd/SuperSecretView.vue | 60 ++++++++++++++++++- client/src/ui/components/bd/UpdaterStatus.vue | 4 +- 6 files changed, 97 insertions(+), 4 deletions(-) create mode 100644 client/src/styles/partials/bdsettings/devview.scss diff --git a/client/src/modules/updater.js b/client/src/modules/updater.js index a4260cf5..a48c32c8 100644 --- a/client/src/modules/updater.js +++ b/client/src/modules/updater.js @@ -35,6 +35,7 @@ export default new class extends Module { this.reloadNotif = this.reloadNotif.bind(this); this.startUpdate = this.startUpdate.bind(this); this.setUpdateStatus = this.setUpdateStatus.bind(this); + this.testUi = this.testUi.bind(this); } restartNotif() { @@ -91,6 +92,7 @@ export default new class extends Module { }); ipc.on('updater-updatesAvailable', (_, updates) => { + console.log(updates); if (this.state.updating) return; // If for some reason we get more updates when we're already updating updates.bd = updates.bd.map(update => { update.text = `${update.id.charAt(0).toUpperCase()}${update.id.slice(1)}`; @@ -178,4 +180,11 @@ export default new class extends Module { this.send('updater-startUpdate', updates); } + testUi(updates) { + this.setState({ + updates, + updatesAvailable: true + }); + } + } diff --git a/client/src/styles/partials/bdsettings/devview.scss b/client/src/styles/partials/bdsettings/devview.scss new file mode 100644 index 00000000..5e32088d --- /dev/null +++ b/client/src/styles/partials/bdsettings/devview.scss @@ -0,0 +1,9 @@ +.bd-contentColumn .bd-devview { + display: grid; + grid-template-columns: 33% 33% 33%; + + .bd-button { + font-size: 10px; + height: 20px; + } +} diff --git a/client/src/styles/partials/bdsettings/index.scss b/client/src/styles/partials/bdsettings/index.scss index 4bcde300..0fbda29f 100644 --- a/client/src/styles/partials/bdsettings/index.scss +++ b/client/src/styles/partials/bdsettings/index.scss @@ -10,3 +10,4 @@ @import './kvp'; @import './collection'; @import './e2ee'; +@import './devview'; diff --git a/client/src/styles/partials/bdsettings/updater.scss b/client/src/styles/partials/bdsettings/updater.scss index 3e239974..8428036a 100644 --- a/client/src/styles/partials/bdsettings/updater.scss +++ b/client/src/styles/partials/bdsettings/updater.scss @@ -3,4 +3,22 @@ margin: 0 0 10px; color: #fff; } + + .bd-settingSwitch { + .bd-spinner7 { + height: 24px; + } + + .bd-updaterStatus { + text-align: right; + + &.bd-err { + color: $colerr; + } + + &.bd-ok { + color: $colok; + } + } + } } diff --git a/client/src/ui/components/bd/SuperSecretView.vue b/client/src/ui/components/bd/SuperSecretView.vue index e3521fca..a5d2cc30 100644 --- a/client/src/ui/components/bd/SuperSecretView.vue +++ b/client/src/ui/components/bd/SuperSecretView.vue @@ -22,7 +22,7 @@ import SettingsWrapper from './SettingsWrapper.vue'; import { FormButton } from '../common'; - import { Globals, Events } from 'modules'; + import { Globals, Events, Updater } from 'modules'; import { ClientIPC } from 'common'; export default { @@ -42,7 +42,63 @@ console.log(Globals); }, testUpdateUi() { - Events.emit('update-check-start'); + Updater.testUi({ + 'bd': [ + { + 'id': 'update', + 'version': '3.0.0', + 'currentVersion': '2.0.0', + 'text': 'Update test', + 'hint': 'Current: 2.0.0 | Latest: 3.0.0', + 'status': { + 'update': true, + 'updating': false, + 'updated': false, + 'error': null + } + }, + { + 'id': 'updating', + 'version': '3.0.0', + 'currentVersion': '2.0.0', + 'text': 'Updating test', + 'hint': 'Current: 2.0.0 | Latest: 3.0.0', + 'status': { + 'update': true, + 'updating': true, + 'updated': false, + 'error': null + } + }, + { + 'id': 'updated', + 'version': '3.0.0', + 'currentVersion': '2.0.0', + 'text': 'Updated test', + 'hint': 'Current: 2.0.0 | Latest: 3.0.0', + 'status': { + 'update': true, + 'updating': true, + 'updated': true, + 'error': null + } + }, + { + 'id': 'error', + 'version': '3.0.0', + 'currentVersion': '2.0.0', + 'text': 'Error test', + 'hint': 'Current: 2.0.0 | Latest: 3.0.0', + 'status': { + 'update': true, + 'updating': true, + 'updated': false, + 'error': 'Failed to update.' + } + } + ], + 'haveUpdates': true + }); } } } diff --git a/client/src/ui/components/bd/UpdaterStatus.vue b/client/src/ui/components/bd/UpdaterStatus.vue index c266a89f..76ef0b24 100644 --- a/client/src/ui/components/bd/UpdaterStatus.vue +++ b/client/src/ui/components/bd/UpdaterStatus.vue @@ -12,8 +12,8 @@

{{item.text}}

-

Update Failed!

-

Done

+

Update Failed!

+

Done

Unknown