Add loader for linking modal [SCI-12065]

This commit is contained in:
Anton 2025-06-27 13:27:23 +02:00
parent 169f743a8a
commit 4c944da9a0
2 changed files with 22 additions and 6 deletions

View file

@ -11,7 +11,10 @@
{{ i18n.t('protocols.steps.modals.link_results.title') }}
</h4>
</div>
<div v-if="results.length > 0" class="modal-body">
<div v-if="loading" class="modal-body h-40 flex items-center justify-center">
<div class="sci-loader"></div>
</div>
<div v-else-if="results.length > 0" class="modal-body">
<p>
{{ i18n.t('protocols.steps.modals.link_results.description') }}
</p>
@ -32,7 +35,7 @@
{{ i18n.t('protocols.steps.modals.link_results.empty_description') }}
</p>
</div>
<div class="modal-footer">
<div v-if="!loading" class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
{{ i18n.t('general.cancel') }}
</button>
@ -89,7 +92,8 @@ export default {
return {
results: [],
initialResults: [],
selectedResults: []
selectedResults: [],
loading: true
};
},
computed: {
@ -132,6 +136,10 @@ export default {
axios.get(this.resultsListUrl)
.then((response) => {
this.results = response.data;
this.loading = false;
}).catch(() => {
HelperModule.flashAlertMsg(I18n.t('general.error'), 'danger');
this.loading = false;
});
}
}

View file

@ -11,7 +11,10 @@
{{ i18n.t('my_modules.results.modals.link_steps.title') }}
</h4>
</div>
<div v-if="steps.length > 0" class="modal-body">
<div v-if="loading" class="modal-body h-40 flex items-center justify-center">
<div class="sci-loader"></div>
</div>
<div v-else-if="steps.length > 0" class="modal-body">
<p>
{{ i18n.t('my_modules.results.modals.link_steps.description') }}
</p>
@ -33,7 +36,7 @@
{{ i18n.t('my_modules.results.modals.link_steps.empty_description') }}
</p>
</div>
<div class="modal-footer">
<div v-if="!loading" class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
{{ i18n.t('general.cancel') }}
</button>
@ -94,7 +97,8 @@ export default {
return {
steps: [],
selectedSteps: [],
initialSteps: []
initialSteps: [],
loading: true
};
},
computed: {
@ -136,7 +140,11 @@ export default {
loadSteps() {
axios.get(this.stepsListUrl)
.then((response) => {
this.loading = false;
this.steps = response.data;
}).catch(() => {
HelperModule.flashAlertMsg(I18n.t('general.error'), 'danger');
this.loading = false;
});
},
stepRenderer(option) {