|
68 | 68 | > |
69 | 69 | <div class="bulk-vision-table flex flex-col items-center gap-3 md:gap-4 overflow-y-auto"> |
70 | 70 | <template v-if="recordsList.length && popupMode === 'generation'" > |
| 71 | + |
| 72 | + |
| 73 | + <div class="w-full"> |
| 74 | + <div |
| 75 | + class="w-full h-[30px] rounded-md bg-gray-200 dark:bg-gray-700 overflow-hidden relative" |
| 76 | + role="progressbar" |
| 77 | + :aria-valuenow="displayedProcessedCount" |
| 78 | + :aria-valuemin="0" |
| 79 | + :aria-valuemax="totalRecords" |
| 80 | + > |
| 81 | + <div |
| 82 | + class="h-full bg-gradient-to-r from-purple-500 via-purple-600 to-purple-700 transition-all duration-200" |
| 83 | + :style="{ width: `${displayedProgressPercent}%` }" |
| 84 | + ></div> |
| 85 | + <div class="absolute inset-0 flex items-center justify-center text-sm font-medium text-white drop-shadow"> |
| 86 | + <template v-if="isProcessingAny"> |
| 87 | + {{ displayedProcessedCount }} / {{ totalRecords }} |
| 88 | + </template> |
| 89 | + <template v-else> |
| 90 | + {{ t('Processed') }} |
| 91 | + </template> |
| 92 | + </div> |
| 93 | + </div> |
| 94 | + </div> |
| 95 | + |
| 96 | + |
71 | 97 | <VisionTable |
72 | 98 | class="md:max-h-[75vh] max-w-[1560px] w-full h-full" |
73 | 99 | :records="recordsList" |
@@ -217,6 +243,33 @@ const isDataSaved = ref(false); |
217 | 243 | const overwriteExistingValues = ref<boolean>(false); |
218 | 244 |
|
219 | 245 | const checkedCount = computed(() => recordIds.value.length - uncheckedRecordIds.size); |
| 246 | +const totalRecords = computed(() => recordIds.value.length); |
| 247 | +const processedCount = computed(() => { |
| 248 | + recordsVersion.value; |
| 249 | + return Array.from(recordsById.values()).filter(record => record.status === 'completed' || record.status === 'failed').length; |
| 250 | +}); |
| 251 | +const progressStep = computed(() => { |
| 252 | + if (!totalRecords.value || totalRecords.value < 100) { |
| 253 | + return 1; |
| 254 | + } |
| 255 | + return Math.max(1, Math.floor(totalRecords.value / 100)); |
| 256 | +}); |
| 257 | +const displayedProcessedCount = computed(() => { |
| 258 | + const step = progressStep.value; |
| 259 | + if (step <= 1) { |
| 260 | + return processedCount.value; |
| 261 | + } |
| 262 | + if (processedCount.value >= totalRecords.value) { |
| 263 | + return totalRecords.value; |
| 264 | + } |
| 265 | + return Math.floor(processedCount.value / step) * step; |
| 266 | +}); |
| 267 | +const displayedProgressPercent = computed(() => { |
| 268 | + if (!totalRecords.value) { |
| 269 | + return 0; |
| 270 | + } |
| 271 | + return Math.min(100, Math.round((displayedProcessedCount.value / totalRecords.value) * 100)); |
| 272 | +}); |
220 | 273 | const isProcessingAny = computed(() => { |
221 | 274 | recordsVersion.value; |
222 | 275 | return Array.from(recordsById.values()).some(record => record.status === 'processing'); |
|
0 commit comments