From e83cf6cf4e7b24bf94ed2fe672685c6bef34c848 Mon Sep 17 00:00:00 2001 From: liushuyu Date: Sat, 29 Jun 2019 16:29:44 +0800 Subject: [PATCH] ui: use Buefy components to... ... beautify the UI --- ui/mock-server.js | 56 ++++++++++++++++++--------------- ui/src/main.js | 2 ++ ui/src/views/DownloadConfig.vue | 2 +- ui/src/views/ErrorView.vue | 27 +++++++--------- ui/src/views/SelectPackages.vue | 5 +-- 5 files changed, 49 insertions(+), 43 deletions(-) diff --git a/ui/mock-server.js b/ui/mock-server.js index f9219d4..4d3644e 100644 --- a/ui/mock-server.js +++ b/ui/mock-server.js @@ -17,31 +17,7 @@ function progressSimulation (res) { }, 1500) } -app.get('/api/attrs', (req, res) => { - res.send( - `var base_attributes = {"name":"yuzu","target_url":"https://raw.githubusercontent.com/j-selby/test-installer/master/config.linux.v2.toml"};` - ) -}) - -app.get('/api/dark-mode', (req, res) => { - res.json(false) -}) - -app.get('/api/installation-status', (req, res) => { - res.json({ - database: { packages: [], shortcuts: [] }, - install_path: null, - preexisting_install: false, - is_launcher: false, - launcher_path: null - }) -}) - -app.get('/api/default-path', (req, res) => { - res.json({ path: '/tmp/test/' }) -}) - -app.get('/api/config', (req, res) => { +function returnConfig (res) { res.json({ installing_message: 'Test Banner Bold 
Code block
 Italic Strike', @@ -73,6 +49,36 @@ app.get('/api/config', (req, res) => { ], hide_advanced: false }) +} + +app.get('/api/attrs', (req, res) => { + res.send( + `var base_attributes = {"name":"yuzu","target_url":"https://raw.githubusercontent.com/j-selby/test-installer/master/config.linux.v2.toml"};` + ) +}) + +app.get('/api/dark-mode', (req, res) => { + res.json(false) +}) + +app.get('/api/installation-status', (req, res) => { + res.json({ + database: { packages: [], shortcuts: [] }, + install_path: null, + preexisting_install: false, + is_launcher: false, + launcher_path: null + }) +}) + +app.get('/api/default-path', (req, res) => { + res.json({ path: '/tmp/test/' }) +}) + +app.get('/api/config', (req, res) => { + setTimeout(() => { + returnConfig(res) + }, 3000) }) app.post('/api/start-install', (req, res) => { diff --git a/ui/src/main.js b/ui/src/main.js index 49d91c1..3e404f8 100644 --- a/ui/src/main.js +++ b/ui/src/main.js @@ -2,9 +2,11 @@ import Vue from 'vue' import App from './App.vue' import router from './router' import { ajax, stream_ajax } from './helpers' +import Buefy from 'buefy' import 'buefy/dist/buefy.css' Vue.config.productionTip = false +Vue.use(Buefy) // Borrowed from http://tobyho.com/2012/07/27/taking-over-console-log/ function intercept (method) { diff --git a/ui/src/views/DownloadConfig.vue b/ui/src/views/DownloadConfig.vue index 9ce1b72..38b6567 100644 --- a/ui/src/views/DownloadConfig.vue +++ b/ui/src/views/DownloadConfig.vue @@ -3,7 +3,7 @@

Downloading config...


- + 0% diff --git a/ui/src/views/ErrorView.vue b/ui/src/views/ErrorView.vue index acb17e3..fc83c82 100644 --- a/ui/src/views/ErrorView.vue +++ b/ui/src/views/ErrorView.vue @@ -1,25 +1,22 @@ diff --git a/ui/src/views/SelectPackages.vue b/ui/src/views/SelectPackages.vue index b9d9873..863b5a9 100644 --- a/ui/src/views/SelectPackages.vue +++ b/ui/src/views/SelectPackages.vue @@ -8,8 +8,9 @@