prevent double loading on import
This commit is contained in:
parent
89550e8345
commit
22c88e5269
@ -52,23 +52,23 @@
|
||||
</b-button>
|
||||
|
||||
<!-- recent imports, nice for testing/development -->
|
||||
<!-- <div class="row mt-2"> -->
|
||||
<!-- <div class="col col-md-12">-->
|
||||
<!-- <div v-if="!import_multiple">-->
|
||||
<!-- <a href="#" @click="clearRecentImports()">Clear recent-->
|
||||
<!-- imports</a>-->
|
||||
<!-- <ul>-->
|
||||
<!-- <li v-for="x in recent_urls" v-bind:key="x">-->
|
||||
<!-- <a href="#"-->
|
||||
<!-- @click="loadRecipe(x, false, undefined)">{{-->
|
||||
<!-- x-->
|
||||
<!-- }}</a>-->
|
||||
<!-- </li>-->
|
||||
<!-- </ul>-->
|
||||
<!-- <div class="row mt-2"> -->
|
||||
<!-- <div class="col col-md-12">-->
|
||||
<!-- <div v-if="!import_multiple">-->
|
||||
<!-- <a href="#" @click="clearRecentImports()">Clear recent-->
|
||||
<!-- imports</a>-->
|
||||
<!-- <ul>-->
|
||||
<!-- <li v-for="x in recent_urls" v-bind:key="x">-->
|
||||
<!-- <a href="#"-->
|
||||
<!-- @click="loadRecipe(x, false, undefined)">{{-->
|
||||
<!-- x-->
|
||||
<!-- }}</a>-->
|
||||
<!-- </li>-->
|
||||
<!-- </ul>-->
|
||||
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -238,17 +238,20 @@
|
||||
</b-row>
|
||||
</b-card-body>
|
||||
<b-card-footer class="text-center">
|
||||
<div class="d-flex justify-content-center mb-3" v-if="import_loading">
|
||||
<b-spinner variant="primary"></b-spinner>
|
||||
</div>
|
||||
<b-button-group>
|
||||
<b-button @click="importRecipe('view')" v-if="!import_multiple">Import &
|
||||
<b-button @click="importRecipe('view')" v-if="!import_multiple" :disabled="import_loading">Import &
|
||||
View
|
||||
</b-button> <!-- TODO localize -->
|
||||
<b-button @click="importRecipe('edit')" variant="success"
|
||||
v-if="!import_multiple">Import & Edit
|
||||
v-if="!import_multiple" :disabled="import_loading">Import & Edit
|
||||
</b-button>
|
||||
<b-button @click="importRecipe('import')" v-if="!import_multiple">Import &
|
||||
<b-button @click="importRecipe('import')" v-if="!import_multiple" :disabled="import_loading">Import &
|
||||
Restart
|
||||
</b-button>
|
||||
<b-button @click="location.reload()">Restart
|
||||
<b-button @click="location.reload()" :disabled="import_loading">Restart
|
||||
</b-button>
|
||||
</b-button-group>
|
||||
</b-card-footer>
|
||||
@ -462,6 +465,7 @@ export default {
|
||||
source_data: '',
|
||||
recipe_json: undefined,
|
||||
use_plural: false,
|
||||
import_loading: false,
|
||||
// recipe_html: undefined,
|
||||
// recipe_tree: undefined,
|
||||
recipe_images: [],
|
||||
@ -504,6 +508,7 @@ export default {
|
||||
* @param silent do not show any messages for imports
|
||||
*/
|
||||
importRecipe: function (action, data, silent) {
|
||||
this.import_loading = true
|
||||
if (this.recipe_json !== undefined) {
|
||||
this.$set(this.recipe_json, 'keywords', this.recipe_json.keywords.filter(k => k.show))
|
||||
}
|
||||
@ -528,12 +533,14 @@ export default {
|
||||
if (recipe_json.source_url !== '') {
|
||||
this.failed_imports.push(recipe_json.source_url)
|
||||
}
|
||||
this.import_loading = false
|
||||
if (!silent) {
|
||||
StandardToasts.makeStandardToast(this, StandardToasts.FAIL_CREATE)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log('cant import recipe without data')
|
||||
this.import_loading = false
|
||||
if (!silent) {
|
||||
StandardToasts.makeStandardToast(this, StandardToasts.FAIL_CREATE)
|
||||
}
|
||||
@ -563,6 +570,7 @@ export default {
|
||||
this.imported_recipes.push(recipe)
|
||||
break;
|
||||
case 'nothing':
|
||||
this.import_loading = false
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user