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"
|
:disabled="isProcessing"
|
||||||
>{{ text }}</k-button
|
>{{ text }}</k-button
|
||||||
>
|
>
|
||||||
<div v-if="progressText" class="k-field-help" style="margin-top: 0.5rem; font-size: 0.875rem;">
|
|
||||||
{{ progressText }}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -29,12 +26,8 @@ const text = ref("Rafraîchir");
|
||||||
const icon = ref("refresh");
|
const icon = ref("refresh");
|
||||||
const theme = ref("aqua-icon");
|
const theme = ref("aqua-icon");
|
||||||
const isProcessing = ref(false);
|
const isProcessing = ref(false);
|
||||||
const progressText = ref("");
|
|
||||||
|
|
||||||
const title = computed(() => {
|
const title = computed(() => {
|
||||||
if (progressText.value) {
|
|
||||||
return progressText.value;
|
|
||||||
}
|
|
||||||
return lastCacheUpdate?.length > 0
|
return lastCacheUpdate?.length > 0
|
||||||
? "Dernière mise à jour : " + lastCacheUpdate
|
? "Dernière mise à jour : " + lastCacheUpdate
|
||||||
: "Mettre à jour le cache front";
|
: "Mettre à jour le cache front";
|
||||||
|
|
@ -59,7 +52,7 @@ async function refreshAllProjects() {
|
||||||
let hasMore = true;
|
let hasMore = true;
|
||||||
let total = 0;
|
let total = 0;
|
||||||
|
|
||||||
text.value = "En cours…";
|
text.value = "En cours 0%";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
while (hasMore) {
|
while (hasMore) {
|
||||||
|
|
@ -84,16 +77,15 @@ async function refreshAllProjects() {
|
||||||
hasMore = json.hasMore;
|
hasMore = json.hasMore;
|
||||||
offset = json.nextOffset;
|
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);
|
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
|
// Succès
|
||||||
text.value = "Terminé";
|
text.value = "Terminé";
|
||||||
progressText.value = `${total} projets mis à jour avec succès`;
|
|
||||||
icon.value = "check";
|
icon.value = "check";
|
||||||
theme.value = "green-icon";
|
theme.value = "green-icon";
|
||||||
|
|
||||||
|
|
@ -104,7 +96,6 @@ async function refreshAllProjects() {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
text.value = "Erreur";
|
text.value = "Erreur";
|
||||||
progressText.value = error.message || "Une erreur est survenue";
|
|
||||||
icon.value = "alert";
|
icon.value = "alert";
|
||||||
theme.value = "red-icon";
|
theme.value = "red-icon";
|
||||||
isProcessing.value = false;
|
isProcessing.value = false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue