@adminforth/bulk-ai-flow 1.10.2 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,15 +19,22 @@
19
19
  <!-- IMAGE CELL TEMPLATE -->
20
20
  <template #cell:images="{item}">
21
21
  <div class="flex flex-shrink-0 gap-2">
22
- <div v-for="image in item.images" :key="image">
22
+ <div v-if="item.images.length" v-for="image in item.images" :key="image">
23
23
  <div class="mt-2 flex items-center justify-center gap-2">
24
- <img
24
+ <img
25
+ v-if="isValidUrl(image)"
25
26
  :src="image"
26
27
  class="w-20 h-20 object-cover rounded cursor-pointer border hover:border-blue-500 transition"
27
28
  @click="zoomImage(image)"
28
29
  />
30
+ <div v-else class="w-20 h-20">
31
+ <p>Invalid source image</p>
32
+ </div>
29
33
  </div>
30
34
  </div>
35
+ <div class="flex items-center justify-center text-center w-20 h-20" v-else>
36
+ <p>No images found</p>
37
+ </div>
31
38
  <transition name="fade">
32
39
  <div
33
40
  v-if="zoomedImage"
@@ -84,12 +91,34 @@
84
91
 
85
92
  <div v-if="isAiResponseReceivedImage[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])]">
86
93
  <div v-if="isInColumnImage(n)">
87
- <div class="mt-2 flex items-center justify-center gap-2">
88
- <img
89
- :src="selected[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n]"
90
- class="w-20 h-20 object-cover rounded cursor-pointer border hover:border-blue-500 transition"
91
- @click="() => {openGenerationCarousel[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n] = true}"
94
+ <div class="mt-2 flex items-center justify-start gap-2">
95
+ <img v-if="isValidUrl(selected[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n])"
96
+ :src="selected[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n]"
97
+ class="w-20 h-20 object-cover rounded cursor-pointer border hover:border-blue-500 transition"
98
+ @click="() => {openGenerationCarousel[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n] = true}"
92
99
  />
100
+ <div v-else class="flex items-center justify-center text-center w-20 h-20">
101
+ <Tooltip v-if="imageGenerationErrorMessage[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])] === 'No source images found'">
102
+ <p
103
+ >
104
+ Can't generate image.
105
+ </p>
106
+ <template #tooltip>
107
+ {{ imageGenerationErrorMessage[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])] }}
108
+ </template>
109
+ </Tooltip>
110
+ <Tooltip v-else>
111
+ <div>
112
+ <IconRefreshOutline
113
+ @click="() => {regenerateImages(item[primaryKey])}"
114
+ class="w-20 h-20 hover:text-blue-500 cursor-pointer transition hover:scale-105"
115
+ />
116
+ </div>
117
+ <template #tooltip>
118
+ {{ imageGenerationErrorMessage[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])] + '. Click to retry.' }}
119
+ </template>
120
+ </Tooltip>
121
+ </div>
93
122
  </div>
94
123
  <div>
95
124
  <GenerationCarousel
@@ -100,6 +129,7 @@
100
129
  :fieldName="n"
101
130
  :carouselImageIndex="carouselImageIndex[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n]"
102
131
  :regenerateImagesRefreshRate="regenerateImagesRefreshRate"
132
+ :sourceImage="item.images && item.images.length ? item.images : null"
103
133
  @error="handleError"
104
134
  @close="openGenerationCarousel[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n] = false"
105
135
  @selectImage="updateSelectedImage"
@@ -122,8 +152,9 @@
122
152
 
123
153
  <script lang="ts" setup>
124
154
  import { ref } from 'vue'
125
- import { Select, Input, Textarea, Table, Checkbox, Skeleton, Toggle } from '@/afcl'
155
+ import { Select, Input, Textarea, Table, Checkbox, Skeleton, Toggle, Tooltip } from '@/afcl'
126
156
  import GenerationCarousel from './ImageGenerationCarousel.vue'
157
+ import { IconRefreshOutline } from '@iconify-prerendered/vue-flowbite';
127
158
 
128
159
  const props = defineProps<{
129
160
  meta: any,
@@ -141,8 +172,12 @@ const props = defineProps<{
141
172
  carouselSaveImages: any[]
142
173
  carouselImageIndex: any[]
143
174
  regenerateImagesRefreshRate: number
175
+ isAiGenerationError: boolean[],
176
+ aiGenerationErrorMessage: string[],
177
+ isAiImageGenerationError: boolean[],
178
+ imageGenerationErrorMessage: string[]
144
179
  }>();
145
- const emit = defineEmits(['error']);
180
+ const emit = defineEmits(['error', 'regenerateImages']);
146
181
 
147
182
 
148
183
  const zoomedImage = ref(null)
@@ -188,10 +223,27 @@ function handleError({ isError, errorMessage }) {
188
223
  });
189
224
  }
190
225
 
226
+ function regenerateImages(recordInfo: any) {
227
+ emit('regenerateImages', {
228
+ recordInfo
229
+ });
230
+ }
231
+
191
232
  function updateActiveIndex(newIndex: number, id: any, fieldName: string) {
192
233
  props.carouselImageIndex[props.tableColumnsIndexes.findIndex(el => el[props.primaryKey] === id)][fieldName] = newIndex;
193
234
  }
194
235
 
236
+ function isValidUrl(str: string): boolean {
237
+ try {
238
+ new URL(str);
239
+ return true;
240
+ } catch {
241
+ return false;
242
+ }
243
+ }
244
+
245
+
246
+
195
247
  </script>
196
248
 
197
249
  <style scoped>