-
Notifications
You must be signed in to change notification settings - Fork 115
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
UI implementation for allowing to have api policy and a common policy with same name and same version #809
base: main
Are you sure you want to change the base?
Conversation
Quality Gate failedFailed conditions |
setDrawerOpen, | ||
PolicyConfigurationEditDrawer | ||
}) => { | ||
const AttachedPolicyCardShared: FC<AttachedPolicyCardSharedProps> = (props) => { |
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.
Shall we revert back to the prop destructuring here?
const AttachedPolicyCardShared: FC<AttachedPolicyCardSharedProps> = (props) => { | |
const AttachedPolicyCardShared: FC<AttachedPolicyCardSharedProps> = ({ | |
... | |
}) => { |
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.
This change was introduced based on the following considerations:
Data flows through this shared component to both the Global Policy UIs and the API/Common Policy UIs. In the context of Global Policy flows, the concept represented by listOriginatedFromCommonPolicies does not apply, and as a result, this prop is not passed. Furthermore, in the API/Common Policy flows, there are scenarios where listOriginatedFromCommonPolicies may not exist.
Due to the lack of a definitive way to distinguish between a Global Policy page and a standard policy page based solely on the value of listOriginatedFromCommonPolicies in the props, destructuring was removed. Instead, a check was introduced to verify whether the corresponding prop exists among the passed props, rather than relying on its value.
const policyColor = Utils.stringToColor(props.policyObj.displayName); | ||
const policyBackgroundColor = props.drawerOpen |
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.
Let's not do these modifications. Check and fix similar places as well.
const policyColor = Utils.stringToColor(props.policyObj.displayName); | |
const policyBackgroundColor = props.drawerOpen | |
const policyColor = Utils.stringToColor(policyObj.displayName); | |
const policyBackgroundColor = drawerOpen |
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.
relates to #809 (comment)
title={`${policyObj.displayName} : ${policyObj.version}`} | ||
placement='top' | ||
|
||
if ('listOriginatedFromCommonPolicies' in props) { |
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.
Can't we specify this as a prop passed down from the parent component instead?
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.
relates to #809 (comment)
|
||
if ('listOriginatedFromCommonPolicies' in props) { | ||
// Props were passed, use `listOriginatedFromCommonPolicies` and `isApiRevision` | ||
let policyType = "Common Policy"; |
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.
Shall we make Common Policy
and API Policy
constants?
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.
fixed
} | ||
} | ||
return ( | ||
(<Root> |
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.
Can't we remove this (
?
(<Root> | |
<Root> |
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.
fixed
// Combine the two using a union type | ||
type AttachedPolicyListSharedProps = AttachedPolicyListWithCommonProps | AttachedPolicyListWithoutCommonProps; | ||
|
||
const AttachedPolicyListShared: FC<AttachedPolicyListSharedProps> = (props) => { |
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.
Shall we destruct the props here?
const AttachedPolicyListShared: FC<AttachedPolicyListSharedProps> = (props) => { | |
const AttachedPolicyListShared: FC<AttachedPolicyListSharedProps> = ({ | |
... | |
}) => { |
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.
relates to #809 (comment)
type AttachedPolicyListSharedProps = AttachedPolicyListWithCommonProps | AttachedPolicyListWithoutCommonProps; | ||
|
||
const AttachedPolicyListShared: FC<AttachedPolicyListSharedProps> = (props) => { | ||
if ('listOriginatedFromCommonPolicies' in props) { |
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.
Check this as well
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.
relates to #809 (comment)
currentPolicyList={props.currentPolicyList} | ||
setCurrentPolicyList={props.setCurrentPolicyList} | ||
currentFlow={props.currentFlow} | ||
target={props.target} | ||
verb={props.verb} | ||
allPolicies={props.allPolicies} | ||
isAPILevelPolicy={props.isAPILevelPolicy} | ||
listOriginatedFromCommonPolicies={props.listOriginatedFromCommonPolicies} | ||
isApiRevision={props.isApiRevision} |
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.
Shall we remove the prop from these instances?
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.
relates to #809 (comment)
<FormattedMessage | ||
id='Apis.Details.Policies.PoliciesExpansion.request.flow.title' | ||
defaultMessage='Request Flow' | ||
const PoliciesExpansionShared: FC<PoliciesExpansionSharedProps> = (props) => { |
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.
Destruct props
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.
relates to #809 (comment)
// Combine the two using a union type | ||
type PolicyDropzoneSharedProps = PolicyDropzoneWithCommonProps | PolicyDropzoneWithoutCommonProps; | ||
|
||
const PolicyDropzoneShared: FC<PolicyDropzoneSharedProps> = (props) => { |
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.
Destruct props
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.
relates to #809 (comment)
Quality Gate failedFailed conditions |
Public fix for https://github.com/wso2-enterprise/wso2-apim-internal/issues/7352