-
Notifications
You must be signed in to change notification settings - Fork 263
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
Refactor rules feature with new rules execution object contract + eslint license header rule update to support 2025 #7300
Open
jeradrutnam
wants to merge
8
commits into
wso2:new-signup
Choose a base branch
from
jeradrutnam:new-signup
base: new-signup
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ab518a9
Change rule feature data.tsx to ts
jeradrutnam aad979f
Update eslint to support 2025 copyright year
jeradrutnam 46e599c
Fix update-versions.js license header
jeradrutnam 66aab0f
Refactor rules feature with the new rule execution object contract
jeradrutnam fa020aa
Fix update-versions.js code format issues
jeradrutnam c7926f8
Refactor rule-condition component to fix unexpected API callings
jeradrutnam e945f02
Update a type validation in rule component meta data
jeradrutnam 3660b64
Add single rule acceptance support to the rule feature
jeradrutnam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -22,7 +22,13 @@ import Stack from "@oxygen-ui/react/Stack"; | |||||
import Typography from "@oxygen-ui/react/Typography"; | ||||||
import useGetRulesMeta from "@wso2is/admin.rules.v1/api/use-get-rules-meta"; | ||||||
import RulesComponent from "@wso2is/admin.rules.v1/components/rules-component"; | ||||||
import { sampleExecutionsList } from "@wso2is/admin.rules.v1/data"; | ||||||
import { | ||||||
sampleExpressionsMeta, | ||||||
sampleRuleExecuteInstances, | ||||||
sampleRuleExecutionMeta | ||||||
} from "@wso2is/admin.rules.v1/data"; | ||||||
import { RuleExecuteCollectionInterface } from "@wso2is/admin.rules.v1/models/rules"; | ||||||
import { getRuleInstanceValue } from "@wso2is/admin.rules.v1/providers/rules-provider"; | ||||||
import { IdentifiableComponentInterface } from "@wso2is/core/models"; | ||||||
import React, { FunctionComponent, ReactElement } from "react"; | ||||||
import "./rules-properties.scss"; | ||||||
|
@@ -33,30 +39,51 @@ import "./rules-properties.scss"; | |||||
export interface RulesPropertiesPropsInterface extends IdentifiableComponentInterface { } | ||||||
|
||||||
/** | ||||||
* Component to generate the properties for the attribute collector widget. | ||||||
* Rules properties component. | ||||||
* | ||||||
* @param props - Props injected to the component. | ||||||
* @returns The RulesProperties component. | ||||||
* @returns Rules properties component. | ||||||
*/ | ||||||
const RulesProperties: FunctionComponent<RulesPropertiesPropsInterface> = ({ | ||||||
["data-componentid"]: componentId = "rules-properties-component" | ||||||
}: RulesPropertiesPropsInterface): ReactElement => { | ||||||
|
||||||
// TODO: Change the glow value | ||||||
// TODO: Change to collect dynamic value from the context | ||||||
const { | ||||||
data: RulesMeta | ||||||
data: RuleExpressionsMetaData | ||||||
} = useGetRulesMeta("preIssueAccessToken"); | ||||||
|
||||||
// TODO: Use this function to get the rule value. | ||||||
/* eslint-disable @typescript-eslint/no-unused-vars */ | ||||||
const handleGetRuleValue = () => { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
const ruleValue: RuleExecuteCollectionInterface = getRuleInstanceValue(); | ||||||
|
||||||
// eslint-disable-next-line no-console | ||||||
console.log(ruleValue); | ||||||
}; | ||||||
/* eslint-enable @typescript-eslint/no-unused-vars */ | ||||||
|
||||||
return ( | ||||||
<Stack gap={ 2 } data-componentid={ componentId }> | ||||||
<Typography variant="body2"> | ||||||
Define a rule to how conditionally proceed to next steps in the flow | ||||||
</Typography> | ||||||
{ RulesMeta && | ||||||
<RulesComponent metaData={ RulesMeta } multipleRules={ true } ruleExecutions={ sampleExecutionsList } /> | ||||||
} | ||||||
{ RuleExpressionsMetaData && ( | ||||||
<RulesComponent | ||||||
initialData={ sampleRuleExecuteInstances } | ||||||
conditionExpressionsMetaData={ sampleExpressionsMeta } | ||||||
isMultipleRules={ true } | ||||||
ruleExecutionMetaData={ sampleRuleExecutionMeta } /> | ||||||
) } | ||||||
<Box sx={ { mt: 3 } }> | ||||||
<Button size="small" variant="contained" color="primary">Save</Button> | ||||||
<Button | ||||||
size="small" | ||||||
variant="contained" | ||||||
color="primary" | ||||||
onClick={ handleGetRuleValue } | ||||||
> | ||||||
Print Data | ||||||
</Button> | ||||||
</Box> | ||||||
</Stack> | ||||||
); | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.