Fix : affichage progression dans le texte du bouton
La div en dessous ne s'affichait pas dans le panel Kirby. La progression s'affiche maintenant directement dans le bouton : "En cours 0%" → "En cours 20%" → "En cours 100%" → "Terminé" Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
4669f03f16
commit
378af9ac96
1 changed files with 4 additions and 13 deletions
|
|
@ -10,9 +10,6 @@
|
|||
:disabled="isProcessing"
|
||||
>{{ text }}</k-button
|
||||
>
|
||||
<div v-if="progressText" class="k-field-help" style="margin-top: 0.5rem; font-size: 0.875rem;">
|
||||
{{ progressText }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -29,12 +26,8 @@ const text = ref("Rafraîchir");
|
|||
const icon = ref("refresh");
|
||||
const theme = ref("aqua-icon");
|
||||
const isProcessing = ref(false);
|
||||
const progressText = ref("");
|
||||
|
||||
const title = computed(() => {
|
||||
if (progressText.value) {
|
||||
return progressText.value;
|
||||
}
|
||||
return lastCacheUpdate?.length > 0
|
||||
? "Dernière mise à jour : " + lastCacheUpdate
|
||||
: "Mettre à jour le cache front";
|
||||
|
|
@ -59,7 +52,7 @@ async function refreshAllProjects() {
|
|||
let hasMore = true;
|
||||
let total = 0;
|
||||
|
||||
text.value = "En cours…";
|
||||
text.value = "En cours 0%";
|
||||
|
||||
try {
|
||||
while (hasMore) {
|
||||
|
|
@ -84,16 +77,15 @@ async function refreshAllProjects() {
|
|||
hasMore = json.hasMore;
|
||||
offset = json.nextOffset;
|
||||
|
||||
// Mise à jour de la progression
|
||||
// Mise à jour de la progression dans le texte du bouton
|
||||
const progress = Math.round((json.processed / json.total) * 100);
|
||||
progressText.value = `Traitement : ${json.processed}/${json.total} projets (${progress}%)`;
|
||||
text.value = `En cours ${progress}%`;
|
||||
|
||||
console.log(`Batch terminé : ${json.processed}/${json.total} projets`);
|
||||
console.log(`Batch terminé : ${json.processed}/${json.total} projets (${progress}%)`);
|
||||
}
|
||||
|
||||
// Succès
|
||||
text.value = "Terminé";
|
||||
progressText.value = `${total} projets mis à jour avec succès`;
|
||||
icon.value = "check";
|
||||
theme.value = "green-icon";
|
||||
|
||||
|
|
@ -104,7 +96,6 @@ async function refreshAllProjects() {
|
|||
} catch (error) {
|
||||
console.error(error);
|
||||
text.value = "Erreur";
|
||||
progressText.value = error.message || "Une erreur est survenue";
|
||||
icon.value = "alert";
|
||||
theme.value = "red-icon";
|
||||
isProcessing.value = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue