Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): WF| 'Save' button gets disabled when “Is past today“ is selected in 'Date/Time' column under 'Add Check Value' event #70

Merged
merged 3 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions projects/workflows-creator/src/lib/builder/builder.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {AbstractBaseGroup} from '../classes/nodes';
import {BuilderService, ElementService, NodeService} from '../classes/services';
import {
ActionTypes,
ConditionTypes,
EventTypes,
LocalizedStringKeys,
NodeTypes,
Expand Down Expand Up @@ -458,8 +459,16 @@ export class BuilderComponent<E> implements OnInit, OnChanges {
case EventTypes.OnValueEvent:
case ActionTypes.ChangeColumnValueAction:
const columnExists = !!node.node.state.get('column');
const valueExists =
typeof node.node.state.get('value') !== 'undefined';
let valueExists = false;
if (typeof node.node.state.get('value') !== 'undefined') {
valueExists = true;
} else if (
node.node.state.get('condition') === ConditionTypes.PastToday

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a suggestion for a small improvement that is not mandatory to follow. It involves removing one minor stuff.

let valueExists = false;

if (typeof node.node.state.get('value') !== 'undefined' || node.node.state.get('condition') === ConditionTypes.PastToday) {
  valueExists = true;
} else {
  valueExists = !!node.node.state.get('value');
}

the conditions are combined into a single 'if' statement, which checks if either the 'value' is defined or the condition is 'PastToday'.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Deepika516 please change this as well

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be disregarded as there may be more conditions in the future and need to add more "if" conditions.

) {
valueExists = true;
} else {
valueExists = !!node.node.state.get('value');
}
const valueTypeIsAnyValue =
node.node.state.get('valueType') === ValueTypes.AnyValue;
isValid = columnExists && (valueExists || valueTypeIsAnyValue);
Expand Down
2 changes: 1 addition & 1 deletion projects/workflows-element/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"access": "public",
"directory": "dist"
},
"hash": "da4ef59fb38662182d6ff14d8cc8b20943d7af05ee85afac4bcf99e5f2915efa"
"hash": "52e16f7339ae099b920d5eba85c8551b9ac2178d0fdb8c34eb6eb6de8aa96685"
}
Loading