Skip to content

Commit

Permalink
fix(comsumption): Setting Default Recurrence Interval based on Sku (#…
Browse files Browse the repository at this point in the history
…4066)

* checks sku to get recurrence interval

* adding recurrenceInterval as a designer option

* removing comment

* moving recurrence into host options
  • Loading branch information
valentina-vallalta committed Feb 5, 2024
1 parent 89ddb0b commit 160d636
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 12 deletions.
9 changes: 4 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# Logic Apps Designer
## [2.109.0](https://github.com/Azure/LogicAppsUX/compare/v2.108.0...v2.109.0) (2024-02-01)

## [2.109.0](https://github.com/Azure/LogicAppsUX/compare/v2.108.0...v2.109.0) (2024-02-01)

### Features

* **designer:** Adding support for warnings and custom messages to ErrorsPanel ([#4053](https://github.com/Azure/LogicAppsUX/issues/4053)) ([6b07460](https://github.com/Azure/LogicAppsUX/commit/6b0746062fea3e1a4189c032b90ad68954d33c7a))

- **designer:** Adding support for warnings and custom messages to ErrorsPanel ([#4053](https://github.com/Azure/LogicAppsUX/issues/4053)) ([6b07460](https://github.com/Azure/LogicAppsUX/commit/6b0746062fea3e1a4189c032b90ad68954d33c7a))

### Bug Fixes

* **Designer:** Accessibility fix announcing to screen reader search results ([#4082](https://github.com/Azure/LogicAppsUX/issues/4082)) ([06f46fb](https://github.com/Azure/LogicAppsUX/commit/06f46fb92c5249f737b26c10a03d27ac7da137a4))
* **Designer:** Split on is now disabled for stateless workflows ([#4081](https://github.com/Azure/LogicAppsUX/issues/4081)) ([6971bca](https://github.com/Azure/LogicAppsUX/commit/6971bca1de14e19de7033a9433c1eff439deb4eb))
- **Designer:** Accessibility fix announcing to screen reader search results ([#4082](https://github.com/Azure/LogicAppsUX/issues/4082)) ([06f46fb](https://github.com/Azure/LogicAppsUX/commit/06f46fb92c5249f737b26c10a03d27ac7da137a4))
- **Designer:** Split on is now disabled for stateless workflows ([#4081](https://github.com/Azure/LogicAppsUX/issues/4081)) ([6971bca](https://github.com/Azure/LogicAppsUX/commit/6971bca1de14e19de7033a9433c1eff439deb4eb))

## [2.108.0](https://github.com/Azure/LogicAppsUX/compare/v2.107.0...v2.108.0) (2024-01-26)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,10 @@ const DesignerEditor = () => {
isDarkMode,
readOnly: isReadOnly,
isMonitoringView,
hostOptions,
hostOptions: {
...hostOptions,
recurrenceInterval: { interval: 1, frequency: 'Minute' },
},
showConnectionsPanel,
}}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@ const DesignerEditorConsumption = () => {
isMonitoringView,
useLegacyWorkflowParameters: true,
showConnectionsPanel,
hostOptions,
hostOptions: {
...hostOptions,
recurrenceInterval: { interval: 3, frequency: 'Minute' },
},
}}
>
{workflow?.definition ? (
Expand Down
18 changes: 18 additions & 0 deletions libs/designer/src/lib/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,24 @@ export default {
interval: 3,
frequency: 'Minute',
},
RECURRENCE_OPTIONS: {
FREE: {
interval: 1,
frequency: 'Hour',
},
STANDARD: {
interval: 1,
frequency: 'Minute',
},
PREMIUM: {
interval: 15,
frequency: 'Second',
},
CONSUMPTION: {
interval: 3,
frequency: 'Minute',
},
},
RECURRENCE_FREQUENCY_VALUES: ['Month', 'Week', 'Day', 'Hour', 'Minute', 'Second'],
RECURRENCE_TITLE_JOIN_SEPARATOR: ',',
RECURRENCE_SCHEDULE_VALUES: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type {
IConnectionParameterEditorService,
IChatbotService,
} from '@microsoft/designer-client-services-logic-apps';
import type { LogicApps } from '@microsoft/utils-logic-apps';

type PANEL_TAB_NAMES = keyof typeof CONSTANTS.PANEL_TAB_NAMES;

Expand All @@ -32,6 +33,7 @@ export interface DesignerOptionsState {
hostOptions: {
displayRuntimeInfo: boolean; // show info about where the action is run(i.e. InApp/Shared/Custom)
suppressCastingForSerialize?: boolean; // suppress casting for serialize
recurrenceInterval?: LogicApps.Recurrence;
forceEnableSplitOn?: boolean; // force enable split on (by default it is disabled on stateless workflows)
};
nodeSelectAdditionalCallback?: (nodeId: string) => any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export const useMonitoringView = () => {
export const useLegacyWorkflowParameters = () => {
return useSelector((state: RootState) => state.designerOptions.useLegacyWorkflowParameters);
};

export const useHostOptions = () => {
return useSelector((state: RootState) => state.designerOptions.hostOptions);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const initialState: DesignerOptionsState = {
hostOptions: {
displayRuntimeInfo: true,
suppressCastingForSerialize: false,
recurrenceInterval: undefined,
},
};

Expand Down
5 changes: 4 additions & 1 deletion libs/designer/src/lib/core/utils/parameters/recurrence.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import constants from '../../../common/constants';
import { getReactQueryClient } from '../../ReactQueryProvider';
import { loadParameterValuesFromDefault, toParameterInfoMap } from './helper';
import type { ParameterInfo } from '@microsoft/designer-ui';
import { OutputMapKey, SchemaProcessor, toInputParameter } from '@microsoft/parsers-logic-apps';
Expand Down Expand Up @@ -51,7 +52,9 @@ export const getRecurrenceParameters = (recurrence: RecurrenceSetting | undefine
.getSchemaProperties(schema)
.map((item) => toInputParameter(item, true /* suppressCasting */));

const defaultRecurrence = constants.DEFAULT_RECURRENCE;
const queryClient = getReactQueryClient();
const recurrenceInterval = queryClient.getQueryData(['recurrenceInterval']);
const defaultRecurrence = recurrenceInterval ?? constants.DEFAULT_RECURRENCE;

for (const parameter of recurrenceParameters) {
if (!parameter.default) {
Expand Down
7 changes: 6 additions & 1 deletion libs/designer/src/lib/ui/Designer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { openPanel, useNodesInitialized } from '../core';
import { useLayout } from '../core/graphlayout';
import { usePreloadOperationsQuery, usePreloadConnectorsQuery } from '../core/queries/browse';
import { useMonitoringView, useReadOnly } from '../core/state/designerOptions/designerOptionsSelectors';
import { useMonitoringView, useReadOnly, useHostOptions } from '../core/state/designerOptions/designerOptionsSelectors';
import { useClampPan } from '../core/state/designerView/designerViewSelectors';
import { useIsPanelCollapsed } from '../core/state/panel/panelSelectors';
import { clearPanel } from '../core/state/panel/panelSlice';
Expand Down Expand Up @@ -32,6 +32,7 @@ import KeyboardBackendFactory, { isKeyboardDragTrigger } from 'react-dnd-accessi
import { HTML5Backend } from 'react-dnd-html5-backend';
import { DndProvider, createTransition, MouseTransition } from 'react-dnd-multi-backend';
import { useHotkeys } from 'react-hotkeys-hook';
import { useQuery } from 'react-query';
import { useDispatch, useSelector } from 'react-redux';
import { Background, ReactFlow, ReactFlowProvider, useNodes, useReactFlow, useStore, BezierEdge } from 'reactflow';
import type { BackgroundProps, NodeChange } from 'reactflow';
Expand Down Expand Up @@ -216,6 +217,10 @@ export const Designer = (props: DesignerProps) => {
const isInitialized = useNodesInitialized();
const preloadSearch = useMemo(() => (isMonitoringView || isReadOnly) && isInitialized, [isMonitoringView, isReadOnly, isInitialized]);

const recurrenceInterval = useHostOptions().recurrenceInterval;

// Adding recurrence interval to the query to access outside of functional components
useQuery({ queryKey: ['recurrenceInterval'], initialData: recurrenceInterval });
return (
<DndProvider options={DND_OPTIONS}>
{preloadSearch ? <SearchPreloader /> : null}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

0 comments on commit 160d636

Please sign in to comment.