diff --git a/packages/editor-ui/src/__tests__/utils.ts b/packages/editor-ui/src/__tests__/utils.ts index 47f5a0dd00..836b5608fb 100644 --- a/packages/editor-ui/src/__tests__/utils.ts +++ b/packages/editor-ui/src/__tests__/utils.ts @@ -91,6 +91,19 @@ export const SETTINGS_STORE_DEFAULT_STATE: ISettingsState = { variables: { limit: 100, }, + expressions: { + evaluator: 'tournament', + }, + banners: { + dismissed: [], + }, + ai: { + enabled: false, + }, + workflowHistory: { + pruneTime: -1, + licensePruneTime: -1, + }, }, promptsData: { message: '', diff --git a/packages/editor-ui/src/components/MainHeader/WorkflowDetails.vue b/packages/editor-ui/src/components/MainHeader/WorkflowDetails.vue index 8c046dbd1c..f746cd62c7 100644 --- a/packages/editor-ui/src/components/MainHeader/WorkflowDetails.vue +++ b/packages/editor-ui/src/components/MainHeader/WorkflowDetails.vue @@ -101,6 +101,13 @@ data-test-id="workflow-save-button" @click="onSaveButtonClick" /> + + +
diff --git a/packages/editor-ui/src/components/WorkflowHistory/WorkflowHistoryContent.vue b/packages/editor-ui/src/components/WorkflowHistory/WorkflowHistoryContent.vue index c577445789..0f8e594552 100644 --- a/packages/editor-ui/src/components/WorkflowHistory/WorkflowHistoryContent.vue +++ b/packages/editor-ui/src/components/WorkflowHistory/WorkflowHistoryContent.vue @@ -14,6 +14,11 @@ const props = defineProps<{ diff --git a/packages/editor-ui/src/components/WorkflowHistory/WorkflowHistoryList.vue b/packages/editor-ui/src/components/WorkflowHistory/WorkflowHistoryList.vue index ca2793dc39..d49472831c 100644 --- a/packages/editor-ui/src/components/WorkflowHistory/WorkflowHistoryList.vue +++ b/packages/editor-ui/src/components/WorkflowHistory/WorkflowHistoryList.vue @@ -10,21 +10,17 @@ import type { } from '@/types/workflowHistory'; import WorkflowHistoryListItem from '@/components/WorkflowHistory/WorkflowHistoryListItem.vue'; -const props = withDefaults( - defineProps<{ - items: WorkflowHistory[]; - activeItem: WorkflowHistory | null; - actionTypes: WorkflowHistoryActionTypes; - requestNumberOfItems: number; - shouldUpgrade: boolean; - maxRetentionPeriod: number; - }>(), - { - items: () => [], - shouldUpgrade: false, - maxRetentionPeriod: 0, - }, -); +const props = defineProps<{ + items: WorkflowHistory[]; + activeItem: WorkflowHistory | null; + actionTypes: WorkflowHistoryActionTypes; + requestNumberOfItems: number; + lastReceivedItemsLength: number; + evaluatedPruneTime: number; + shouldUpgrade?: boolean; + isListLoading?: boolean; +}>(); + const emit = defineEmits<{ ( event: 'action', @@ -98,7 +94,10 @@ const onItemMounted = ({ listElement.value?.scrollTo({ top: offsetTop, behavior: 'smooth' }); } - if (index === props.items.length - 1 && props.items.length >= props.requestNumberOfItems) { + if ( + index === props.items.length - 1 && + props.lastReceivedItemsLength === props.requestNumberOfItems + ) { observeElement(listElement.value?.children[index] as Element); } }; @@ -117,16 +116,28 @@ const onItemMounted = ({ @preview="onPreview" @mounted="onItemMounted" /> -
  • +
  • {{ i18n.baseText('workflowHistory.empty') }}
    {{ i18n.baseText('workflowHistory.hint') }}
  • -
  • +
  • + + + +
  • +
  • {{ i18n.baseText('workflowHistory.limit', { - interpolate: { maxRetentionPeriod: props.maxRetentionPeriod }, + interpolate: { evaluatedPruneTime: props.evaluatedPruneTime }, }) }} @@ -143,19 +154,12 @@ const onItemMounted = ({ diff --git a/packages/editor-ui/src/views/__tests__/WorkflowHistory.test.ts b/packages/editor-ui/src/views/__tests__/WorkflowHistory.test.ts index 2ec57fb9fb..35e8b57891 100644 --- a/packages/editor-ui/src/views/__tests__/WorkflowHistory.test.ts +++ b/packages/editor-ui/src/views/__tests__/WorkflowHistory.test.ts @@ -10,7 +10,10 @@ import { SETTINGS_STORE_DEFAULT_STATE } from '@/__tests__/utils'; import WorkflowHistoryPage from '@/views/WorkflowHistory.vue'; import { useWorkflowHistoryStore } from '@/stores/workflowHistory.store'; import { STORES, VIEWS } from '@/constants'; -import type { WorkflowHistory } from '@/types/workflowHistory'; +import { + workflowHistoryDataFactory, + workflowVersionDataFactory, +} from '@/stores/__tests__/utils/workflowHistoryTestUtils'; vi.mock('vue-router', () => { const params = {}; @@ -29,21 +32,6 @@ vi.mock('vue-router', () => { }; }); -const workflowHistoryDataFactory: () => WorkflowHistory = () => ({ - versionId: faker.string.nanoid(), - createdAt: faker.date.past().toDateString(), - authors: Array.from({ length: faker.number.int({ min: 2, max: 5 }) }, faker.person.fullName).join( - ', ', - ), -}); - -const workflowVersionDataFactory: () => WorkflowHistory = () => ({ - ...workflowHistoryDataFactory(), - workflow: { - name: faker.lorem.words(3), - }, -}); - const workflowId = faker.string.nanoid(); const historyData = Array.from({ length: 5 }, workflowHistoryDataFactory); const versionData = { @@ -87,6 +75,7 @@ describe('WorkflowHistory', () => { route = useRoute(); router = useRouter(); + vi.spyOn(workflowHistoryStore, 'getWorkflowHistory').mockResolvedValue(historyData); vi.spyOn(workflowHistoryStore, 'workflowHistory', 'get').mockReturnValue(historyData); vi.spyOn(workflowHistoryStore, 'activeWorkflowVersion', 'get').mockReturnValue(versionData); windowOpenSpy = vi.spyOn(window, 'open').mockImplementation(() => null);