@adminforth/upload 2.7.0 → 2.7.2

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.
package/build.log CHANGED
@@ -11,5 +11,5 @@ custom/preview.vue
11
11
  custom/tsconfig.json
12
12
  custom/uploader.vue
13
13
 
14
- sent 51,239 bytes received 134 bytes 102,746.00 bytes/sec
15
- total size is 50,757 speedup is 0.99
14
+ sent 51,379 bytes received 134 bytes 103,026.00 bytes/sec
15
+ total size is 50,890 speedup is 0.99
@@ -11,7 +11,7 @@
11
11
  {{ $t('Generate image with AI') }}
12
12
  </h3>
13
13
  <button type="button"
14
- @click="emit('close')"
14
+ @click="() => {stopGeneration = true; emit('close')}"
15
15
  class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white" >
16
16
  <svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
17
17
  <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"/>
@@ -161,7 +161,7 @@
161
161
  disabled:opacity-50 disabled:cursor-not-allowed"
162
162
  >{{ $t('Use image') }}</button>
163
163
  <button type="button" class="py-2.5 px-5 ms-3 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded-lg border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700"
164
- @click="emit('close')"
164
+ @click="() => {stopGeneration = true; emit('close')}"
165
165
  >{{ $t('Cancel') }}</button>
166
166
  </div>
167
167
  </div>
@@ -190,6 +190,7 @@ const props = defineProps(['meta', 'record']);
190
190
  const images = ref([]);
191
191
  const loading = ref(false);
192
192
  const attachmentFiles = ref<string[]>([])
193
+ const stopGeneration = ref(false);
193
194
 
194
195
  function minifyField(field: string): string {
195
196
  if (field.length > 100) {
@@ -390,7 +391,7 @@ async function generateImages() {
390
391
  }
391
392
  }
392
393
  await new Promise((resolve) => setTimeout(resolve, 2000));
393
- } while (jobStatus === 'in_progress' || jobStatus === null)
394
+ } while ((jobStatus === 'in_progress' || jobStatus === null) && !stopGeneration.value);
394
395
 
395
396
  if (error) {
396
397
  adminforth.alert({
@@ -38,7 +38,7 @@
38
38
  </template>
39
39
 
40
40
  <style>
41
- .medium-zoom-image {
41
+ .medium-zoom-image--opened {
42
42
  z-index: 999999;
43
43
  background: rgba(0, 0, 0, 0.8);
44
44
  }
@@ -11,7 +11,7 @@
11
11
  {{ $t('Generate image with AI') }}
12
12
  </h3>
13
13
  <button type="button"
14
- @click="emit('close')"
14
+ @click="() => {stopGeneration = true; emit('close')}"
15
15
  class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white" >
16
16
  <svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
17
17
  <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"/>
@@ -161,7 +161,7 @@
161
161
  disabled:opacity-50 disabled:cursor-not-allowed"
162
162
  >{{ $t('Use image') }}</button>
163
163
  <button type="button" class="py-2.5 px-5 ms-3 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded-lg border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700"
164
- @click="emit('close')"
164
+ @click="() => {stopGeneration = true; emit('close')}"
165
165
  >{{ $t('Cancel') }}</button>
166
166
  </div>
167
167
  </div>
@@ -190,6 +190,7 @@ const props = defineProps(['meta', 'record']);
190
190
  const images = ref([]);
191
191
  const loading = ref(false);
192
192
  const attachmentFiles = ref<string[]>([])
193
+ const stopGeneration = ref(false);
193
194
 
194
195
  function minifyField(field: string): string {
195
196
  if (field.length > 100) {
@@ -390,7 +391,7 @@ async function generateImages() {
390
391
  }
391
392
  }
392
393
  await new Promise((resolve) => setTimeout(resolve, 2000));
393
- } while (jobStatus === 'in_progress' || jobStatus === null)
394
+ } while ((jobStatus === 'in_progress' || jobStatus === null) && !stopGeneration.value);
394
395
 
395
396
  if (error) {
396
397
  adminforth.alert({
@@ -38,7 +38,7 @@
38
38
  </template>
39
39
 
40
40
  <style>
41
- .medium-zoom-image {
41
+ .medium-zoom-image--opened {
42
42
  z-index: 999999;
43
43
  background: rgba(0, 0, 0, 0.8);
44
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/upload",
3
- "version": "2.7.0",
3
+ "version": "2.7.2",
4
4
  "description": "Plugin for uploading files for adminforth",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",