import response improvements

This commit is contained in:
vabene1111
2021-06-17 14:08:03 +02:00
parent afc31b313f
commit a9a0716c45
13 changed files with 140 additions and 63 deletions

View File

@@ -1,54 +1,42 @@
<template>
<div id="app">
<div class="row">
<div class="col col-md-12">
<h2>{{ $t('Import') }}</h2>
</div>
</div>
<br/>
<br/>
<template v-if="import_info !== undefined">
<template v-if="import_info.running" style="text-align: center;">
<div class="row">
<div class="col col-md-12">
</div>
</div>
<loading-spinner></loading-spinner>
<br/>
<br/>
<template v-if="import_info.running">
<h5 style="text-align: center">{{ $t('Importing') }}...</h5>
<b-progress :max="import_info.total_recipes">
<b-progress-bar :value="import_info.imported_recipes" :label="`${import_info.imported_recipes}/${import_info.total_recipes}`"></b-progress-bar>
</b-progress>
<loading-spinner :size="25"></loading-spinner>
</template>
<template v-else>
<div class="row">
<div class="col col-md-12">
<span>{{ $t('Import_finished') }}! </span>
<a :href="`${resolveDjangoUrl('view_search') }?keyword=${import_info.keyword.id}`"
v-if="import_info.keyword !== null">{{ $t('View_Recipes') }}</a>
</div>
<div class="row">
<div class="col col-md-12" v-if="!import_info.running">
<span>{{ $t('Import_finished') }}! </span>
<a :href="`${resolveDjangoUrl('view_search') }?keyword=${import_info.keyword.id}`"
v-if="import_info.keyword !== null">{{ $t('View_Recipes') }}</a>
</div>
</div>
<br/>
<br/>
<div class="row">
<div class="col col-md-12">
<label for="id_textarea">{{ $t('Information') }}</label>
<textarea id="id_textarea" class="form-control" style="height: 50vh" v-html="import_info.msg"
disabled></textarea>
<div class="row">
<div class="col col-md-12">
<label for="id_textarea">{{ $t('Information') }}</label>
<textarea id="id_textarea" ref="output_text" class="form-control" style="height: 50vh"
v-html="import_info.msg"
disabled></textarea>
</div>
</div>
</template>
</div>
<br/>
<br/>
</template>
</div>
@@ -90,6 +78,8 @@ export default {
setInterval(() => {
if ((this.import_id !== null) && window.navigator.onLine && this.import_info.running) {
this.refreshData()
let el = this.$refs.output_text
el.scrollTop = el.scrollHeight;
}
}, 5000)
@@ -100,6 +90,7 @@ export default {
apiClient.retrieveImportLog(this.import_id).then(result => {
this.import_info = result.data
})
}
}

View File

@@ -1,9 +1,9 @@
<template>
<div class="row">
<div class="col" style="text-align: center">
<img class="spinner-tandoor" alt="loading spinner" src="" style="height: 30vh"/>
</div>
<div class="row">
<div class="col" style="text-align: center">
<img class="spinner-tandoor" alt="loading spinner" src="" v-bind:style="{ height: size + 'vh' }"/>
</div>
</div>
</template>
<script>
@@ -12,6 +12,10 @@ export default {
name: 'LoadingSpinner',
props: {
recipe: Object,
size: {
type: Number,
default: 30
},
},
}
</script>

View File

@@ -193,6 +193,18 @@ export interface ImportLog {
* @memberof ImportLog
*/
keyword?: ImportLogKeyword;
/**
*
* @type {number}
* @memberof ImportLog
*/
total_recipes?: number;
/**
*
* @type {number}
* @memberof ImportLog
*/
imported_recipes?: number;
/**
*
* @type {string}
@@ -1031,6 +1043,12 @@ export interface RecipeSteps {
* @memberof RecipeSteps
*/
show_as_header?: boolean;
/**
*
* @type {StepFile}
* @memberof RecipeSteps
*/
file?: StepFile | null;
}
/**
@@ -1039,7 +1057,8 @@ export interface RecipeSteps {
*/
export enum RecipeStepsTypeEnum {
Text = 'TEXT',
Time = 'TIME'
Time = 'TIME',
File = 'FILE'
}
/**
@@ -1429,6 +1448,12 @@ export interface Step {
* @memberof Step
*/
show_as_header?: boolean;
/**
*
* @type {StepFile}
* @memberof Step
*/
file?: StepFile | null;
}
/**
@@ -1437,9 +1462,35 @@ export interface Step {
*/
export enum StepTypeEnum {
Text = 'TEXT',
Time = 'TIME'
Time = 'TIME',
File = 'FILE'
}
/**
*
* @export
* @interface StepFile
*/
export interface StepFile {
/**
*
* @type {string}
* @memberof StepFile
*/
name: string;
/**
*
* @type {any}
* @memberof StepFile
*/
file?: any;
/**
*
* @type {number}
* @memberof StepFile
*/
id?: number;
}
/**
*
* @export