Skip to content

Commit

Permalink
v0.26.4: support FlowEventScheduledForActivation event in flow hist…
Browse files Browse the repository at this point in the history
…ory (#430)
  • Loading branch information
zaychenko-sergei authored Sep 18, 2024
1 parent f9b831a commit 6121639
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 13 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kamu-platform",
"version": "0.26.3",
"version": "0.26.4",
"scripts": {
"ng": "ng",
"start": "ng serve --watch",
Expand Down Expand Up @@ -108,4 +108,4 @@
"ts-node": "~8.3.0",
"typescript": "5.1.6"
}
}
}
6 changes: 6 additions & 0 deletions resources/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ fragment FlowHistoryData on FlowEvent {
}
}
}
... on FlowEventScheduledForActivation {
__typename
scheduledForActivationAt
}
... on FlowEventTaskChanged {
__typename
taskId
Expand Down
22 changes: 22 additions & 0 deletions src/app/api/kamu.graphql.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
Expand Down Expand Up @@ -2916,6 +2923,9 @@ export type GetFlowByIdQuery = {
| ({
__typename?: "FlowEventInitiated";
} & FlowHistoryData_FlowEventInitiated_Fragment)
| ({
__typename?: "FlowEventScheduledForActivation";
} & FlowHistoryData_FlowEventScheduledForActivation_Fragment)
| ({
__typename?: "FlowEventStartConditionUpdated";
} & FlowHistoryData_FlowEventStartConditionUpdated_Fragment)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -4483,6 +4501,10 @@ export const FlowHistoryDataFragmentDoc = gql`
}
}
}
... on FlowEventScheduledForActivation {
__typename
scheduledForActivationAt
}
... on FlowEventTaskChanged {
__typename
taskId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [
Expand All @@ -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[] = [
Expand Down Expand Up @@ -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 }[] = [
Expand All @@ -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" },
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 `, () => {
Expand All @@ -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 `, () => {
Expand All @@ -63,7 +63,7 @@ describe("DatasetFlowDetailsHelpers", () => {
mockHistoryFragmentWithFinishedStatus,
mockFlowSummaryDataFragments[3],
),
).toEqual(flowEventIconOptionsResults[7]);
).toEqual(flowEventIconOptionsResults[8]);
});

mockFlowHistoryDataFragmentForSubMessages.forEach((item, index) => {
Expand All @@ -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)`, () => {
Expand All @@ -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)`, () => {
Expand All @@ -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)`, () => {
Expand All @@ -107,7 +107,7 @@ describe("DatasetFlowDetailsHelpers", () => {
mockHistoryFragmentWithFinishedStatus,
mockDatasetExecuteTransformFlowSummaryData,
),
).toEqual(flowEventSubMessageResults[13]);
).toEqual(flowEventSubMessageResults[14]);
});

it(`should check don't show dynamic image`, () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import moment from "moment";
import {
FlowEventInitiated,
FlowEventScheduledForActivation,
FlowEventStartConditionUpdated,
FlowEventTaskChanged,
FlowEventTriggerAdded,
Expand Down Expand Up @@ -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");
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 6121639

Please sign in to comment.