From 6121639cb7a55d09af5e79e74a58ececdeba0804 Mon Sep 17 00:00:00 2001 From: Sergei Zaychenko Date: Thu, 19 Sep 2024 00:48:48 +0300 Subject: [PATCH] v0.26.4: support `FlowEventScheduledForActivation` event in flow history (#430) --- CHANGELOG.md | 4 +++- package-lock.json | 6 ++--- package.json | 4 ++-- resources/schema.graphql | 6 +++++ .../fragment-flow-history-data.graphql | 4 ++++ src/app/api/kamu.graphql.interface.ts | 22 +++++++++++++++++++ .../flow-details-history-tab.helpers.mock.ts | 15 +++++++++++++ .../flow-details-history-tab.helpers.spec.ts | 14 ++++++------ .../flow-details-history-tab.helpers.ts | 11 ++++++++++ 9 files changed, 73 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0da79685..eefc196a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## [0.26.4] - 2024-09-13 +### Added +- Support `FlowEventScheduleForActivationEvent` in flow history ### Fixed - Replaced mock initiator for flows tab for account - Restored `Fetch uncacheable` checkbox when configuration exists diff --git a/package-lock.json b/package-lock.json index 4f23c490..614c3ceb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "kamu-platform", - "version": "0.26.3", + "version": "0.26.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "kamu-platform", - "version": "0.26.3", + "version": "0.26.4", "dependencies": { "@angular/animations": "^16.2.12", "@angular/cdk": "^16.2.14", @@ -44345,4 +44345,4 @@ } } } -} +} \ No newline at end of file diff --git a/package.json b/package.json index 4132a51a..1e01d7ab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kamu-platform", - "version": "0.26.3", + "version": "0.26.4", "scripts": { "ng": "ng", "start": "ng serve --watch", @@ -108,4 +108,4 @@ "ts-node": "~8.3.0", "typescript": "5.1.6" } -} +} \ No newline at end of file diff --git a/resources/schema.graphql b/resources/schema.graphql index e167b597..4c6c3b3b 100644 --- a/resources/schema.graphql +++ b/resources/schema.graphql @@ -1080,6 +1080,12 @@ type FlowEventInitiated implements FlowEvent { trigger: FlowTrigger! } +type FlowEventScheduledForActivation implements FlowEvent { + eventId: EventID! + eventTime: DateTime! + scheduledForActivationAt: DateTime! +} + type FlowEventStartConditionUpdated implements FlowEvent { eventId: EventID! eventTime: DateTime! diff --git a/src/app/api/gql/flows-dataset/fragments/fragment-flow-history-data.graphql b/src/app/api/gql/flows-dataset/fragments/fragment-flow-history-data.graphql index 1c74c933..b27c31af 100644 --- a/src/app/api/gql/flows-dataset/fragments/fragment-flow-history-data.graphql +++ b/src/app/api/gql/flows-dataset/fragments/fragment-flow-history-data.graphql @@ -58,6 +58,10 @@ fragment FlowHistoryData on FlowEvent { } } } + ... on FlowEventScheduledForActivation { + __typename + scheduledForActivationAt + } ... on FlowEventTaskChanged { __typename taskId diff --git a/src/app/api/kamu.graphql.interface.ts b/src/app/api/kamu.graphql.interface.ts index 86a43968..d09f0799 100644 --- a/src/app/api/kamu.graphql.interface.ts +++ b/src/app/api/kamu.graphql.interface.ts @@ -1206,6 +1206,13 @@ export type FlowEventInitiated = FlowEvent & { trigger: FlowTrigger; }; +export type FlowEventScheduledForActivation = FlowEvent & { + __typename?: "FlowEventScheduledForActivation"; + eventId: Scalars["EventID"]; + eventTime: Scalars["DateTime"]; + scheduledForActivationAt: Scalars["DateTime"]; +}; + export type FlowEventStartConditionUpdated = FlowEvent & { __typename?: "FlowEventStartConditionUpdated"; eventId: Scalars["EventID"]; @@ -2916,6 +2923,9 @@ export type GetFlowByIdQuery = { | ({ __typename?: "FlowEventInitiated"; } & FlowHistoryData_FlowEventInitiated_Fragment) + | ({ + __typename?: "FlowEventScheduledForActivation"; + } & FlowHistoryData_FlowEventScheduledForActivation_Fragment) | ({ __typename?: "FlowEventStartConditionUpdated"; } & FlowHistoryData_FlowEventStartConditionUpdated_Fragment) @@ -3218,6 +3228,13 @@ type FlowHistoryData_FlowEventInitiated_Fragment = { | { __typename: "FlowTriggerPush" }; }; +type FlowHistoryData_FlowEventScheduledForActivation_Fragment = { + __typename: "FlowEventScheduledForActivation"; + scheduledForActivationAt: string; + eventId: string; + eventTime: string; +}; + type FlowHistoryData_FlowEventStartConditionUpdated_Fragment = { __typename: "FlowEventStartConditionUpdated"; eventId: string; @@ -3266,6 +3283,7 @@ type FlowHistoryData_FlowEventTriggerAdded_Fragment = { export type FlowHistoryDataFragment = | FlowHistoryData_FlowEventAborted_Fragment | FlowHistoryData_FlowEventInitiated_Fragment + | FlowHistoryData_FlowEventScheduledForActivation_Fragment | FlowHistoryData_FlowEventStartConditionUpdated_Fragment | FlowHistoryData_FlowEventTaskChanged_Fragment | FlowHistoryData_FlowEventTriggerAdded_Fragment; @@ -4483,6 +4501,10 @@ export const FlowHistoryDataFragmentDoc = gql` } } } + ... on FlowEventScheduledForActivation { + __typename + scheduledForActivationAt + } ... on FlowEventTaskChanged { __typename taskId diff --git a/src/app/dataset-flow/dataset-flow-details/tabs/flow-details-history-tab/flow-details-history-tab.helpers.mock.ts b/src/app/dataset-flow/dataset-flow-details/tabs/flow-details-history-tab/flow-details-history-tab.helpers.mock.ts index 7edfc503..cdb55db2 100644 --- a/src/app/dataset-flow/dataset-flow-details/tabs/flow-details-history-tab/flow-details-history-tab.helpers.mock.ts +++ b/src/app/dataset-flow/dataset-flow-details/tabs/flow-details-history-tab/flow-details-history-tab.helpers.mock.ts @@ -155,6 +155,12 @@ export const mockFlowHistoryDataFragmentForDescriptions: FlowHistoryDataFragment shiftedFrom: "2024-02-12T18:22:29+00:00", }, }, + { + __typename: "FlowEventScheduledForActivation", + eventId: "8", + eventTime: "2024-03-13T13:54:30.656488373+00:00", + scheduledForActivationAt: "2024-03-13T14:54:30.656488373+00:00", + }, ]; export const eventFlowDescriptionsResultHistoryTab: string[] = [ @@ -169,6 +175,7 @@ export const eventFlowDescriptionsResultHistoryTab: string[] = [ "Waiting for free executor", "Waiting for batching condition", "Waiting for throttling condition", + "Flow scheduled for activation", ]; export const mockFlowHistoryDataFragmentForIconOptions: FlowHistoryDataFragment[] = [ @@ -211,6 +218,12 @@ export const mockFlowHistoryDataFragmentForIconOptions: FlowHistoryDataFragment[ shiftedFrom: "2024-02-12T18:22:29+00:00", }, }, + { + __typename: "FlowEventScheduledForActivation", + eventId: "5", + eventTime: "2024-03-13T13:54:30.656488373+00:00", + scheduledForActivationAt: "2024-03-13T14:54:30.656488373+00:00", + }, ]; export const flowEventIconOptionsResults: { icon: string; class: string }[] = [ @@ -219,6 +232,7 @@ export const flowEventIconOptionsResults: { icon: string; class: string }[] = [ { icon: "radio_button_checked", class: "running-status" }, { icon: "add_circle", class: "text-muted" }, { icon: "downloading", class: "text-muted" }, + { icon: "timer", class: "text-muted" }, { icon: "check_circle", class: "completed-status" }, { icon: "dangerous", class: "failed-status" }, { icon: "cancel", class: "aborted-outcome" }, @@ -298,6 +312,7 @@ export const flowEventSubMessageResults: string[] = [ "Task #1", "", "Wake up time at Feb 12th 2024, 8:22:30 PM, shifted from 8:22:29 PM", + "Activating at Mar 13th 2024, 4:54:30 PM", "Triggered by kamu", "Input dataset: kamu/alberta.case-details", "Accumulated 100/500 records. Watermark modified. Deadline at Aug 6th 2022, 12:17:30 AM", //1 diff --git a/src/app/dataset-flow/dataset-flow-details/tabs/flow-details-history-tab/flow-details-history-tab.helpers.spec.ts b/src/app/dataset-flow/dataset-flow-details/tabs/flow-details-history-tab/flow-details-history-tab.helpers.spec.ts index f019ed69..0ffd608a 100644 --- a/src/app/dataset-flow/dataset-flow-details/tabs/flow-details-history-tab/flow-details-history-tab.helpers.spec.ts +++ b/src/app/dataset-flow/dataset-flow-details/tabs/flow-details-history-tab/flow-details-history-tab.helpers.spec.ts @@ -45,7 +45,7 @@ describe("DatasetFlowDetailsHelpers", () => { mockHistoryFragmentWithFinishedStatus, mockFlowSummaryDataFragments[0], ), - ).toEqual(flowEventIconOptionsResults[5]); + ).toEqual(flowEventIconOptionsResults[6]); }); it(`should check flow event icon and class with typename = FlowEventTaskChanged and flow outcome = Failed `, () => { @@ -54,7 +54,7 @@ describe("DatasetFlowDetailsHelpers", () => { mockHistoryFragmentWithFinishedStatus, mockFlowSummaryDataFragments[4], ), - ).toEqual(flowEventIconOptionsResults[6]); + ).toEqual(flowEventIconOptionsResults[7]); }); it(`should check flow event icon and class with typename = FlowEventTaskChanged and flow outcome = Aborted `, () => { @@ -63,7 +63,7 @@ describe("DatasetFlowDetailsHelpers", () => { mockHistoryFragmentWithFinishedStatus, mockFlowSummaryDataFragments[3], ), - ).toEqual(flowEventIconOptionsResults[7]); + ).toEqual(flowEventIconOptionsResults[8]); }); mockFlowHistoryDataFragmentForSubMessages.forEach((item, index) => { @@ -80,7 +80,7 @@ describe("DatasetFlowDetailsHelpers", () => { mockHistoryFragmentWithFinishedStatus, mockFlowSummaryDataFragments[4], ), - ).toEqual(flowEventSubMessageResults[10]); + ).toEqual(flowEventSubMessageResults[11]); }); it(`should check flow event submessage with typename = FlowEventTaskChanged and flow outcome = Success (ingestResult=null)`, () => { @@ -89,7 +89,7 @@ describe("DatasetFlowDetailsHelpers", () => { mockHistoryFragmentWithFinishedStatus, mockFlowSummaryDataFragments[0], ), - ).toEqual(flowEventSubMessageResults[11]); + ).toEqual(flowEventSubMessageResults[12]); }); it(`should check flow event submessage with typename = FlowEventTaskChanged and flow outcome = Success (ingestResult!==null)`, () => { @@ -98,7 +98,7 @@ describe("DatasetFlowDetailsHelpers", () => { mockHistoryFragmentWithFinishedStatus, mockFlowSummaryDataFragmentIngestResult, ), - ).toEqual(flowEventSubMessageResults[12]); + ).toEqual(flowEventSubMessageResults[13]); }); it(`should check flow event submessage with typename = FlowEventTaskChanged and flow outcome = Success (ExecuteTransform)`, () => { @@ -107,7 +107,7 @@ describe("DatasetFlowDetailsHelpers", () => { mockHistoryFragmentWithFinishedStatus, mockDatasetExecuteTransformFlowSummaryData, ), - ).toEqual(flowEventSubMessageResults[13]); + ).toEqual(flowEventSubMessageResults[14]); }); it(`should check don't show dynamic image`, () => { diff --git a/src/app/dataset-flow/dataset-flow-details/tabs/flow-details-history-tab/flow-details-history-tab.helpers.ts b/src/app/dataset-flow/dataset-flow-details/tabs/flow-details-history-tab/flow-details-history-tab.helpers.ts index c6dd877d..23d9e4bd 100644 --- a/src/app/dataset-flow/dataset-flow-details/tabs/flow-details-history-tab/flow-details-history-tab.helpers.ts +++ b/src/app/dataset-flow/dataset-flow-details/tabs/flow-details-history-tab/flow-details-history-tab.helpers.ts @@ -1,6 +1,7 @@ import moment from "moment"; import { FlowEventInitiated, + FlowEventScheduledForActivation, FlowEventStartConditionUpdated, FlowEventTaskChanged, FlowEventTriggerAdded, @@ -39,6 +40,8 @@ export class DatasetFlowDetailsHelpers { const startConditionEvent = flowEvent as FlowEventStartConditionUpdated; return `Waiting for ${this.describeStartCondition(startConditionEvent)}`; } + case "FlowEventScheduledForActivation": + return "Flow scheduled for activation"; /* istanbul ignore next */ default: throw new Error("Unknown event typename"); @@ -59,6 +62,8 @@ export class DatasetFlowDetailsHelpers { return { icon: "add_circle", class: "text-muted" }; case "FlowEventStartConditionUpdated": return { icon: "downloading", class: "text-muted" }; + case "FlowEventScheduledForActivation": + return { icon: "timer", class: "text-muted" }; case "FlowEventTaskChanged": { const event = flowEvent as FlowEventTaskChanged; switch (event.taskStatus) { @@ -105,6 +110,12 @@ export class DatasetFlowDetailsHelpers { return this.describeTriggerDetails((flowEvent as FlowEventInitiated).trigger); case "FlowEventAborted": return ""; + case "FlowEventScheduledForActivation": { + const event = flowEvent as FlowEventScheduledForActivation; + return `Activating at ${moment(event.scheduledForActivationAt).format( + AppValues.CRON_EXPRESSION_DATE_FORMAT, + )}`; + } case "FlowEventTaskChanged": { const event = flowEvent as FlowEventTaskChanged; switch (event.taskStatus) {