Работа над проектом
This commit is contained in:
@@ -1,5 +1,28 @@
|
||||
<template>
|
||||
<div>
|
||||
<q-dialog v-model="busyDialogVisible" no-route-dismiss no-esc-dismiss no-backdrop-dismiss>
|
||||
<div class="q-pa-lg bg-white column" style="width: 400px">
|
||||
<div style="font-weight: bold; font-size: 120%;">
|
||||
{{ mainMessage }}
|
||||
</div>
|
||||
|
||||
<div v-show="jobMessage" class="q-mt-sm" style="width: 350px; white-space: nowrap; overflow: hidden">
|
||||
{{ jobMessage }}
|
||||
</div>
|
||||
<div v-show="jobMessage">
|
||||
<q-linear-progress stripe rounded size="30px" :value="progress" color="green">
|
||||
<div class="absolute-full flex flex-center">
|
||||
<div class="text-black bg-white" style="font-size: 10px; padding: 1px 4px 1px 4px; border-radius: 4px">
|
||||
{{ (progress*100).toFixed(2) }}%
|
||||
</div>
|
||||
</div>
|
||||
</q-linear-progress>
|
||||
</div>
|
||||
<!--div class="q-ml-sm">
|
||||
{{ jsonMessage }}
|
||||
</div-->
|
||||
</div>
|
||||
</q-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -7,9 +30,27 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
import vueComponent from '../vueComponent.js';
|
||||
|
||||
import wsc from './webSocketConnection';
|
||||
//import _ from 'lodash';
|
||||
|
||||
import wsc from './webSocketConnection';
|
||||
import * as utils from '../../share/utils';
|
||||
|
||||
const rotor = '|/-\\';
|
||||
const stepBound = [
|
||||
0,
|
||||
0,//1
|
||||
18,//2
|
||||
20,//3
|
||||
70,//4
|
||||
82,//5
|
||||
84,//6
|
||||
88,//7
|
||||
90,//8
|
||||
98,//9
|
||||
99,//10
|
||||
100,//11
|
||||
];
|
||||
|
||||
const componentOptions = {
|
||||
components: {
|
||||
},
|
||||
@@ -18,6 +59,11 @@ const componentOptions = {
|
||||
};
|
||||
class Api {
|
||||
_options = componentOptions;
|
||||
busyDialogVisible = false;
|
||||
mainMessage = '';
|
||||
jobMessage = '';
|
||||
//jsonMessage = '';
|
||||
progress = 0;
|
||||
|
||||
created() {
|
||||
this.commit = this.$store.commit;
|
||||
@@ -40,8 +86,54 @@ class Api {
|
||||
return this.$store.state.config;
|
||||
}
|
||||
|
||||
async showBusyDialog() {
|
||||
this.mainMessage = '';
|
||||
this.jobMessage = '';
|
||||
this.busyDialogVisible = true;
|
||||
try {
|
||||
let ri = 0;
|
||||
while (1) {// eslint-disable-line
|
||||
const server = await wsc.message(await wsc.send({action: 'get-worker-state', workerId: 'server_state'}));
|
||||
|
||||
if (server.state != 'normal') {
|
||||
this.mainMessage = `${server.serverMessage} ${rotor[ri]}`;
|
||||
if (server.job == 'load inpx') {
|
||||
this.jobMessage = `${server.jobMessage} (${server.recsLoaded}): ${server.fileName}`;
|
||||
} else {
|
||||
this.jobMessage = server.jobMessage;
|
||||
}
|
||||
|
||||
//this.jsonMessage = server;
|
||||
|
||||
const jStep = server.jobStep;
|
||||
|
||||
if (jStep && stepBound[jStep] !== undefined) {
|
||||
const sp = server.progress || 0;
|
||||
const delta = stepBound[jStep + 1] - stepBound[jStep];
|
||||
this.progress = (stepBound[jStep] + sp*delta)/100;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
await utils.sleep(300);
|
||||
ri = (ri < rotor.length - 1 ? ri + 1 : 0);
|
||||
}
|
||||
} finally {
|
||||
this.busyDialogVisible = false;
|
||||
}
|
||||
}
|
||||
|
||||
async request(params) {
|
||||
return await wsc.message(await wsc.send(params));
|
||||
while (1) {// eslint-disable-line
|
||||
const response = await wsc.message(await wsc.send(params));
|
||||
|
||||
if (response && response.error == 'server_busy') {
|
||||
await this.showBusyDialog();
|
||||
} else {
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async search(query) {
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<DivBtn class="q-ml-md text-white bg-secondary" :size="32" :icon-size="24" icon="la la-cog" round @click="settingsDialogVisible = true" />
|
||||
<DivBtn class="q-ml-md text-white bg-secondary" :size="30" :icon-size="24" :imt="1" icon="la la-cog" round @click="settingsDialogVisible = true" />
|
||||
</div>
|
||||
<div class="row q-mx-md q-mb-sm items-center">
|
||||
<q-input
|
||||
@@ -63,7 +63,7 @@
|
||||
/>
|
||||
<div class="q-mx-xs" />
|
||||
|
||||
<DivBtn class="text-white bg-grey-13" :size="32" :icon-size="24" icon="la la-question" round @click="showSearchHelp" />
|
||||
<DivBtn class="text-white bg-grey-13" :size="30" :icon-size="24" icon="la la-question" round @click="showSearchHelp" />
|
||||
|
||||
<div class="q-mx-xs" />
|
||||
<div class="row items-center q-mt-xs">
|
||||
|
||||
@@ -2,7 +2,7 @@ import localForage from 'localforage';
|
||||
//import _ from 'lodash';
|
||||
import * as utils from '../../share/utils';
|
||||
|
||||
const maxDataSize = 100*1024*1024;
|
||||
const maxDataSize = 100*1024*1024;//100 Mb
|
||||
|
||||
const abStore = localForage.createInstance({
|
||||
name: 'authorBooksStorage'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div ref="btn" class="button clickable row justify-center items-center" @click="clickEffect">
|
||||
<div class="row justify-center items-center no-wrap" :class="{'button-pressed': pressed}">
|
||||
<q-icon :name="icon" :size="`${iconSize}px`" />
|
||||
<i :class="icon" :style="`font-size: ${iconSize}px; margin-top: ${imt}px`" />
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>
|
||||
@@ -29,6 +29,7 @@ class DivBtn {
|
||||
icon: { type: String, default: '' },
|
||||
iconSize: { type: Number, default: 14 },
|
||||
round: { type: Boolean },
|
||||
imt: { type: Number, default: 0 },// icon margin top
|
||||
};
|
||||
|
||||
pressed = false;
|
||||
|
||||
@@ -10,6 +10,7 @@ const config = {};
|
||||
//import {QDrawer} from 'quasar/src/components/drawer';
|
||||
|
||||
//import {QCircularProgress} from 'quasar/src/components/circular-progress';
|
||||
import {QLinearProgress} from 'quasar/src/components/linear-progress';
|
||||
import {QInput} from 'quasar/src/components/input';
|
||||
import {QBtn} from 'quasar/src/components/btn';
|
||||
//import {QBtnGroup} from 'quasar/src/components/btn-group';
|
||||
@@ -41,6 +42,7 @@ const components = {
|
||||
//QDrawer,
|
||||
|
||||
//QCircularProgress,
|
||||
QLinearProgress,
|
||||
QInput,
|
||||
QBtn,
|
||||
//QBtnGroup,
|
||||
|
||||
Reference in New Issue
Block a user