@adminforth/bulk-ai-flow 1.24.4 → 1.25.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.
package/build.log CHANGED
@@ -14,5 +14,5 @@ custom/package.json
14
14
  custom/pnpm-lock.yaml
15
15
  custom/tsconfig.json
16
16
 
17
- sent 112,987 bytes received 191 bytes 226,356.00 bytes/sec
18
- total size is 112,273 speedup is 0.99
17
+ sent 113,881 bytes received 191 bytes 228,144.00 bytes/sec
18
+ total size is 113,167 speedup is 0.99
@@ -12,10 +12,8 @@
12
12
  :class="popupMode === 'generation' ? 'lg:w-auto !lg:max-w-[1600px]'
13
13
  : popupMode === 'settings' ? 'lg:w-[1000px] !lg:max-w-[1000px]'
14
14
  : 'lg:w-[500px] !lg:max-w-[500px]'"
15
- :beforeCloseFunction="closeDialog"
15
+ :beforeCloseFunction="handleBeforeClose"
16
16
  :closable="false"
17
- :askForCloseConfirmation="popupMode === 'generation' ? true : false"
18
- :closeConfirmationText="t('Are you sure you want to close without saving?')"
19
17
  :buttons="popupMode === 'generation' ? generationModeButtons : popupMode === 'settings' ? [
20
18
  {
21
19
  label: t('Save settings'),
@@ -185,6 +183,7 @@ import { useFiltersStore } from '@/stores/filters';
185
183
 
186
184
  const coreStore = useCoreStore();
187
185
  const filtersStore = useFiltersStore();
186
+ const showCloseConfirmModal = ref(false);
188
187
 
189
188
  const { t } = useI18n();
190
189
  const props = defineProps<{
@@ -319,7 +318,7 @@ const generationModeButtons = computed(() => {
319
318
  options: {
320
319
  class: 'bg-white hover:!bg-gray-100 !text-gray-900 hover:!text-gray-800 dark:!bg-gray-800 dark:!text-gray-100 dark:hover:!bg-gray-700 !border-gray-200 dark:!border-gray-600'
321
320
  },
322
- onclick: (dialog) => confirmDialog.value.tryToHideModal()
321
+ onclick: async (dialog) => { await handleBeforeClose(dialog); }
323
322
  },
324
323
  ]
325
324
 
@@ -336,6 +335,28 @@ const generationModeButtons = computed(() => {
336
335
  return arrayToReturn;
337
336
  });
338
337
 
338
+ const handleBeforeClose = async (dialog?: any) => {
339
+ if (popupMode.value === 'generation') {
340
+ const confirmed = await adminforth.confirm({
341
+ title: t('Close without saving?'),
342
+ message: t('Are you sure you want to close without saving?'),
343
+ yes: t('Yes'),
344
+ no: t('Cancel'),
345
+ });
346
+
347
+ if (confirmed) {
348
+ closeDialog();
349
+
350
+ if (confirmDialog.value && typeof confirmDialog.value.hide === 'function') {
351
+ confirmDialog.value.hide();
352
+ } else if (dialog && typeof dialog.hide === 'function') {
353
+ dialog.hide();
354
+ }
355
+ return true;
356
+ }
357
+ return false;
358
+ }
359
+ }
339
360
 
340
361
  const isSavingCurrent = ref(false);
341
362
  function checkIfDialogOpen() {
@@ -446,8 +467,16 @@ function getActionLabel(actionType: GenerationAction) {
446
467
  return actionType.replace('_', ' ');
447
468
  }
448
469
 
470
+ function getGenerationFailureGroupKey(actionType: GenerationAction, error: string) {
471
+ const normalizedError = error
472
+ .replace(/Please retry in [\d.]+s\.?/g, 'Please retry later.')
473
+ .replace(/\b\d+\.\d+s\b/g, '<duration>')
474
+ .replace(/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi, '<uuid>');
475
+ return `${actionType}:${normalizedError}`;
476
+ }
477
+
449
478
  function registerGenerationFailure(record: RecordState, actionType: GenerationAction, error: string) {
450
- const key = `${actionType}:${error}`;
479
+ const key = getGenerationFailureGroupKey(actionType, error);
451
480
  let group = generationFailureGroups.get(key);
452
481
  if (!group) {
453
482
  group = {
@@ -12,10 +12,8 @@
12
12
  :class="popupMode === 'generation' ? 'lg:w-auto !lg:max-w-[1600px]'
13
13
  : popupMode === 'settings' ? 'lg:w-[1000px] !lg:max-w-[1000px]'
14
14
  : 'lg:w-[500px] !lg:max-w-[500px]'"
15
- :beforeCloseFunction="closeDialog"
15
+ :beforeCloseFunction="handleBeforeClose"
16
16
  :closable="false"
17
- :askForCloseConfirmation="popupMode === 'generation' ? true : false"
18
- :closeConfirmationText="t('Are you sure you want to close without saving?')"
19
17
  :buttons="popupMode === 'generation' ? generationModeButtons : popupMode === 'settings' ? [
20
18
  {
21
19
  label: t('Save settings'),
@@ -185,6 +183,7 @@ import { useFiltersStore } from '@/stores/filters';
185
183
 
186
184
  const coreStore = useCoreStore();
187
185
  const filtersStore = useFiltersStore();
186
+ const showCloseConfirmModal = ref(false);
188
187
 
189
188
  const { t } = useI18n();
190
189
  const props = defineProps<{
@@ -319,7 +318,7 @@ const generationModeButtons = computed(() => {
319
318
  options: {
320
319
  class: 'bg-white hover:!bg-gray-100 !text-gray-900 hover:!text-gray-800 dark:!bg-gray-800 dark:!text-gray-100 dark:hover:!bg-gray-700 !border-gray-200 dark:!border-gray-600'
321
320
  },
322
- onclick: (dialog) => confirmDialog.value.tryToHideModal()
321
+ onclick: async (dialog) => { await handleBeforeClose(dialog); }
323
322
  },
324
323
  ]
325
324
 
@@ -336,6 +335,28 @@ const generationModeButtons = computed(() => {
336
335
  return arrayToReturn;
337
336
  });
338
337
 
338
+ const handleBeforeClose = async (dialog?: any) => {
339
+ if (popupMode.value === 'generation') {
340
+ const confirmed = await adminforth.confirm({
341
+ title: t('Close without saving?'),
342
+ message: t('Are you sure you want to close without saving?'),
343
+ yes: t('Yes'),
344
+ no: t('Cancel'),
345
+ });
346
+
347
+ if (confirmed) {
348
+ closeDialog();
349
+
350
+ if (confirmDialog.value && typeof confirmDialog.value.hide === 'function') {
351
+ confirmDialog.value.hide();
352
+ } else if (dialog && typeof dialog.hide === 'function') {
353
+ dialog.hide();
354
+ }
355
+ return true;
356
+ }
357
+ return false;
358
+ }
359
+ }
339
360
 
340
361
  const isSavingCurrent = ref(false);
341
362
  function checkIfDialogOpen() {
@@ -446,8 +467,16 @@ function getActionLabel(actionType: GenerationAction) {
446
467
  return actionType.replace('_', ' ');
447
468
  }
448
469
 
470
+ function getGenerationFailureGroupKey(actionType: GenerationAction, error: string) {
471
+ const normalizedError = error
472
+ .replace(/Please retry in [\d.]+s\.?/g, 'Please retry later.')
473
+ .replace(/\b\d+\.\d+s\b/g, '<duration>')
474
+ .replace(/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi, '<uuid>');
475
+ return `${actionType}:${normalizedError}`;
476
+ }
477
+
449
478
  function registerGenerationFailure(record: RecordState, actionType: GenerationAction, error: string) {
450
- const key = `${actionType}:${error}`;
479
+ const key = getGenerationFailureGroupKey(actionType, error);
451
480
  let group = generationFailureGroups.get(key);
452
481
  if (!group) {
453
482
  group = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/bulk-ai-flow",
3
- "version": "1.24.4",
3
+ "version": "1.25.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },