diff --git a/locales/en/plugin__gitops-plugin.json b/locales/en/plugin__gitops-plugin.json index 69a80c10..bd783478 100644 --- a/locales/en/plugin__gitops-plugin.json +++ b/locales/en/plugin__gitops-plugin.json @@ -207,6 +207,11 @@ "Allow/Deny": "Allow/Deny", "ArgoCD AppProject": "ArgoCD AppProject", "There was an error retrieving the AppProject. Check your connection and reload the page.": "There was an error retrieving the AppProject. Check your connection and reload the page.", + "Policy Role": "Role", + "Policy Resource Type": "Resource Type", + "Policy Permission": "Permission", + "Policy Object": "Object", + "Policy Effect": "Effect", "No roles configured": "No roles configured", "This AppProject does not have any roles configured.": "This AppProject does not have any roles configured.", "Groups": "Groups", @@ -257,7 +262,7 @@ "No Argo Rollouts": "No Argo Rollouts", "There are no Argo Rollouts in this project.": "There are no Argo Rollouts in this project.", "There are no Argo Rollouts in all projects.": "There are no Argo Rollouts in all projects.", - "There was an error retrieving applications. Check your connection and reload the page.": "There was an error retrieving applications. Check your connection and reload the page.", + "There was an error retrieving rollouts. Check your connection and reload the page.": "There was an error retrieving rollouts. Check your connection and reload the page.", "Argo Rollouts": "Argo Rollouts", "Create Rollout": "Create Rollout", "Pods": "Pods", @@ -287,6 +292,7 @@ "Try removing the filter or selecting a different label to see more applications.": "Try removing the filter or selecting a different label to see more applications.", "There are no Argo CD Applications in this project.": "There are no Argo CD Applications in this project.", "There are no Argo CD Applications in all projects.": "There are no Argo CD Applications in all projects.", + "There was an error retrieving applications. Check your connection and reload the page.": "There was an error retrieving applications. Check your connection and reload the page.", "No Argo CD ApplicationSets match the label filter": "No Argo CD ApplicationSets match the label filter", "Try removing the filter or selecting a different label to see more ApplicationSets.": "Try removing the filter or selecting a different label to see more ApplicationSets.", "There are no Argo CD ApplicationSets in this project.": "There are no Argo CD ApplicationSets in this project.", diff --git a/locales/ja/plugin__gitops-plugin.json b/locales/ja/plugin__gitops-plugin.json index c5645a69..80a7fad2 100644 --- a/locales/ja/plugin__gitops-plugin.json +++ b/locales/ja/plugin__gitops-plugin.json @@ -207,6 +207,11 @@ "Allow/Deny": "Allow/Deny", "ArgoCD AppProject": "ArgoCD AppProject", "There was an error retrieving the AppProject. Check your connection and reload the page.": "There was an error retrieving the AppProject. Check your connection and reload the page.", + "Policy Role": "Policy Role", + "Policy Resource Type": "Policy Resource Type", + "Policy Permission": "Policy Permission", + "Policy Object": "Policy Object", + "Policy Effect": "Policy Effect", "No roles configured": "No roles configured", "This AppProject does not have any roles configured.": "This AppProject does not have any roles configured.", "Groups": "Groups", @@ -257,7 +262,7 @@ "No Argo Rollouts": "No Argo Rollouts", "There are no Argo Rollouts in this project.": "There are no Argo Rollouts in this project.", "There are no Argo Rollouts in all projects.": "There are no Argo Rollouts in all projects.", - "There was an error retrieving applications. Check your connection and reload the page.": "There was an error retrieving applications. Check your connection and reload the page.", + "There was an error retrieving rollouts. Check your connection and reload the page.": "There was an error retrieving rollouts. Check your connection and reload the page.", "Argo Rollouts": "Argo Rollouts", "Create Rollout": "Create Rollout", "Pods": "Pods", @@ -287,6 +292,7 @@ "Try removing the filter or selecting a different label to see more applications.": "Try removing the filter or selecting a different label to see more applications.", "There are no Argo CD Applications in this project.": "There are no Argo CD Applications in this project.", "There are no Argo CD Applications in all projects.": "There are no Argo CD Applications in all projects.", + "There was an error retrieving applications. Check your connection and reload the page.": "There was an error retrieving applications. Check your connection and reload the page.", "No Argo CD ApplicationSets match the label filter": "No Argo CD ApplicationSets match the label filter", "Try removing the filter or selecting a different label to see more ApplicationSets.": "Try removing the filter or selecting a different label to see more ApplicationSets.", "There are no Argo CD ApplicationSets in this project.": "There are no Argo CD ApplicationSets in this project.", diff --git a/locales/ko/plugin__gitops-plugin.json b/locales/ko/plugin__gitops-plugin.json index 7c392607..7e7e6565 100644 --- a/locales/ko/plugin__gitops-plugin.json +++ b/locales/ko/plugin__gitops-plugin.json @@ -207,6 +207,11 @@ "Allow/Deny": "Allow/Deny", "ArgoCD AppProject": "ArgoCD AppProject", "There was an error retrieving the AppProject. Check your connection and reload the page.": "There was an error retrieving the AppProject. Check your connection and reload the page.", + "Policy Role": "Policy Role", + "Policy Resource Type": "Policy Resource Type", + "Policy Permission": "Policy Permission", + "Policy Object": "Policy Object", + "Policy Effect": "Policy Effect", "No roles configured": "No roles configured", "This AppProject does not have any roles configured.": "This AppProject does not have any roles configured.", "Groups": "Groups", @@ -257,7 +262,7 @@ "No Argo Rollouts": "No Argo Rollouts", "There are no Argo Rollouts in this project.": "There are no Argo Rollouts in this project.", "There are no Argo Rollouts in all projects.": "There are no Argo Rollouts in all projects.", - "There was an error retrieving applications. Check your connection and reload the page.": "There was an error retrieving applications. Check your connection and reload the page.", + "There was an error retrieving rollouts. Check your connection and reload the page.": "There was an error retrieving rollouts. Check your connection and reload the page.", "Argo Rollouts": "Argo Rollouts", "Create Rollout": "Create Rollout", "Pods": "Pods", @@ -287,6 +292,7 @@ "Try removing the filter or selecting a different label to see more applications.": "Try removing the filter or selecting a different label to see more applications.", "There are no Argo CD Applications in this project.": "There are no Argo CD Applications in this project.", "There are no Argo CD Applications in all projects.": "There are no Argo CD Applications in all projects.", + "There was an error retrieving applications. Check your connection and reload the page.": "There was an error retrieving applications. Check your connection and reload the page.", "No Argo CD ApplicationSets match the label filter": "No Argo CD ApplicationSets match the label filter", "Try removing the filter or selecting a different label to see more ApplicationSets.": "Try removing the filter or selecting a different label to see more ApplicationSets.", "There are no Argo CD ApplicationSets in this project.": "There are no Argo CD ApplicationSets in this project.", diff --git a/locales/zh/plugin__gitops-plugin.json b/locales/zh/plugin__gitops-plugin.json index da5f71c8..59e8d782 100644 --- a/locales/zh/plugin__gitops-plugin.json +++ b/locales/zh/plugin__gitops-plugin.json @@ -207,6 +207,11 @@ "Allow/Deny": "Allow/Deny", "ArgoCD AppProject": "ArgoCD AppProject", "There was an error retrieving the AppProject. Check your connection and reload the page.": "There was an error retrieving the AppProject. Check your connection and reload the page.", + "Policy Role": "Policy Role", + "Policy Resource Type": "Policy Resource Type", + "Policy Permission": "Policy Permission", + "Policy Object": "Policy Object", + "Policy Effect": "Policy Effect", "No roles configured": "No roles configured", "This AppProject does not have any roles configured.": "This AppProject does not have any roles configured.", "Groups": "Groups", @@ -257,7 +262,7 @@ "No Argo Rollouts": "No Argo Rollouts", "There are no Argo Rollouts in this project.": "There are no Argo Rollouts in this project.", "There are no Argo Rollouts in all projects.": "There are no Argo Rollouts in all projects.", - "There was an error retrieving applications. Check your connection and reload the page.": "There was an error retrieving applications. Check your connection and reload the page.", + "There was an error retrieving rollouts. Check your connection and reload the page.": "There was an error retrieving rollouts. Check your connection and reload the page.", "Argo Rollouts": "Argo Rollouts", "Create Rollout": "Create Rollout", "Pods": "Pods", @@ -287,6 +292,7 @@ "Try removing the filter or selecting a different label to see more applications.": "Try removing the filter or selecting a different label to see more applications.", "There are no Argo CD Applications in this project.": "There are no Argo CD Applications in this project.", "There are no Argo CD Applications in all projects.": "There are no Argo CD Applications in all projects.", + "There was an error retrieving applications. Check your connection and reload the page.": "There was an error retrieving applications. Check your connection and reload the page.", "No Argo CD ApplicationSets match the label filter": "No Argo CD ApplicationSets match the label filter", "Try removing the filter or selecting a different label to see more ApplicationSets.": "Try removing the filter or selecting a different label to see more ApplicationSets.", "There are no Argo CD ApplicationSets in this project.": "There are no Argo CD ApplicationSets in this project.", diff --git a/src/gitops/components/project/ProjectAllowDenyTab.tsx b/src/gitops/components/project/ProjectAllowDenyTab.tsx index 73ed4944..c977f725 100644 --- a/src/gitops/components/project/ProjectAllowDenyTab.tsx +++ b/src/gitops/components/project/ProjectAllowDenyTab.tsx @@ -7,8 +7,6 @@ import { Card, CardBody, CardHeader, - Flex, - FlexItem, Grid, GridItem, List, @@ -16,16 +14,15 @@ import { PageSection, PageSectionVariants, Panel, - Popover, Title, } from '@patternfly/react-core'; -import { QuestionCircleIcon } from '@patternfly/react-icons'; import { AppProjectKind } from '../../models/AppProjectModel'; import { ArgoServer, getArgoServerForProject } from '../../utils/gitops'; import { useGitOpsTranslation } from '../../utils/hooks/useGitOpsTranslation'; import { getDisplayValue, isDenyRule } from '../../utils/project-utils'; import { ArgoCDLink } from '../shared/ArgoCDLink/ArgoCDLink'; +import { FieldLevelHelp } from '../shared/FieldLevelHelp'; import DestinationsList from './DestinationsList'; import ResourceAllowDenyList from './ResourceAllowDenyList'; @@ -98,40 +95,17 @@ const ProjectAllowDenyTab: React.FC = ({ obj }) => { return ( <> - - - - - - - {t('Allowed Sources')} - - - - {t('Allowed Sources')}} - bodyContent={
{t('Allowed Sources help')}
} - > - -
-
-
-
- {argoCDUrl && ( - - - - )} -
+ + + {argoCDUrl && ( +
+ +
+ )} @@ -154,28 +128,15 @@ const ProjectAllowDenyTab: React.FC = ({ obj }) => {
- - - - - {t('Allowed Destinations')} - - - - {t('Allowed Destinations')}} - bodyContent={
{t('Allowed Destinations help')}
} - > - -
-
-
+ + @@ -189,28 +150,15 @@ const ProjectAllowDenyTab: React.FC = ({ obj }) => { - - - - - {t('Resource Allow/Deny Lists')} - - - - {t('Resource Allow/Deny Lists')}} - bodyContent={
{t('Resource Allow/Deny Lists help')}
} - > - -
-
-
+ + diff --git a/src/gitops/components/project/ProjectRolesTab.tsx b/src/gitops/components/project/ProjectRolesTab.tsx index 71c5f285..751af8ab 100644 --- a/src/gitops/components/project/ProjectRolesTab.tsx +++ b/src/gitops/components/project/ProjectRolesTab.tsx @@ -6,10 +6,9 @@ import { Badge, EmptyState, EmptyStateBody, - Flex, - FlexItem, PageSection, Title, + Tooltip, } from '@patternfly/react-core'; import { DataViewTh, DataViewTr } from '@patternfly/react-data-view/dist/esm/DataViewTable'; import { CubesIcon } from '@patternfly/react-icons'; @@ -22,6 +21,59 @@ import { useGitOpsTranslation } from '../../utils/hooks/useGitOpsTranslation'; import { ArgoCDLink } from '../shared/ArgoCDLink/ArgoCDLink'; import { GitOpsDataViewTable, useGitOpsDataViewSort } from '../shared/DataView'; +/** + * Parses an Argo CD policy string and returns a formatted React element for tooltip + * Policy format: p, , , , , + * Example: "p, proj:myproject:myrole, applications, get, myproject/*, allow" + */ +const formatPolicyDescription = (policy: string, t: (key: string) => string): React.ReactNode => { + const parts = policy.split(',').map((p) => p.trim()); + + // If it doesn't follow the standard format, return as-is + if (parts.length < 6 || parts[0] !== 'p') { + return
{policy}
; + } + + const [, subject, resource, action, object, effect] = parts; + + return ( +
+
+ {t('Policy Role')}: {subject} +
+
+ {t('Policy Resource Type')}: {resource} +
+
+ {t('Policy Permission')}: {action} +
+
+ {t('Policy Object')}: {object} +
+
+ {t('Policy Effect')}:{' '} + {effect === 'allow' ? ( + <> + {' '} + {t('Allow')} + + ) : ( + <> + {' '} + {t('Deny')} + + )} +
+
+ ); +}; + type ProjectRolesTabProps = RouteComponentProps<{ ns: string; name: string }> & { obj?: AppProjectKind; }; @@ -81,21 +133,10 @@ const ProjectRolesTab: React.FC = ({ obj }) => { return ( - - - - {t('Roles')} - - - {argoCDUrl && ( - - - - )} - + + {t('Roles')} + + {argoCDUrl && } string): DataViewTr[] cell: role.policies && role.policies.length > 0 ? (
- {role.policies.map((policy, idx) => ( - - {policy} - - ))} + {role.policies.map((policy, idx) => { + const formattedDescription = formatPolicyDescription(policy, t); + return ( + + + {policy} + + + ); + })}
) : ( '-' diff --git a/src/gitops/components/project/ProjectSyncWindowsTab.tsx b/src/gitops/components/project/ProjectSyncWindowsTab.tsx index 23daa1bc..8ec0f61e 100644 --- a/src/gitops/components/project/ProjectSyncWindowsTab.tsx +++ b/src/gitops/components/project/ProjectSyncWindowsTab.tsx @@ -2,15 +2,7 @@ import * as React from 'react'; import { RouteComponentProps } from 'react-router'; import { useK8sModel } from '@openshift-console/dynamic-plugin-sdk'; -import { - Badge, - EmptyState, - EmptyStateBody, - Flex, - FlexItem, - PageSection, - Title, -} from '@patternfly/react-core'; +import { Badge, EmptyState, EmptyStateBody, PageSection, Title } from '@patternfly/react-core'; import { DataViewTh, DataViewTr } from '@patternfly/react-data-view/dist/esm/DataViewTable'; import { CubesIcon } from '@patternfly/react-icons'; import { ThProps } from '@patternfly/react-table'; @@ -95,21 +87,10 @@ const ProjectSyncWindowsTab: React.FC = ({ obj }) => return ( - - - - {t('Sync Windows')} - - - {argoCDUrl && ( - - - - )} - + + {t('Sync Windows')} + + {argoCDUrl && } = ({ list }) = const resourceList = list || []; return ( - + <> {resourceList.length > 0 ? ( - - - - - - - - - {resourceList.map((resource, index) => ( - - - +
+
{t('Kind')}{t('Group')}
{resource.kind || '-'}{resource.group || '-'}
+ + + + - ))} - -
{t('Kind')}{t('Group')}
+ + + {resourceList.map((resource, index) => ( + + + {resource.kind || '-'} + + + {resource.group || '-'} + + + ))} + + + ) : ( {t('This list does not have any resources configured.')} )} -
+ ); }; diff --git a/src/gitops/components/shared/FieldLevelHelp/FieldLevelHelp.scss b/src/gitops/components/shared/FieldLevelHelp/FieldLevelHelp.scss new file mode 100644 index 00000000..9b8019e7 --- /dev/null +++ b/src/gitops/components/shared/FieldLevelHelp/FieldLevelHelp.scss @@ -0,0 +1,24 @@ +.co-field-level-help { + background-color: transparent !important; + border: none !important; + padding: 0 !important; + min-width: auto !important; + color: var(--pf-v5-global--Color--100) !important; + + &:hover, + &:focus, + &:active { + background-color: transparent !important; + border: none !important; + color: var(--pf-v5-global--Color--100) !important; + } + + .pf-v6-c-button__icon { + margin: 0 !important; + } + + .co-field-level-help_icon { + color: #73bcf7 !important; + fill: #73bcf7 !important; + } +} diff --git a/src/gitops/components/shared/FieldLevelHelp/FieldLevelHelp.tsx b/src/gitops/components/shared/FieldLevelHelp/FieldLevelHelp.tsx new file mode 100644 index 00000000..15d61da8 --- /dev/null +++ b/src/gitops/components/shared/FieldLevelHelp/FieldLevelHelp.tsx @@ -0,0 +1,60 @@ +import * as React from 'react'; + +import { Popover, Title } from '@patternfly/react-core'; +import { OutlinedQuestionCircleIcon } from '@patternfly/react-icons'; + +import './FieldLevelHelp.scss'; + +type FieldLevelHelpProps = { + title: string; + helpText: string; + headingLevel?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'; + className?: string; +}; + +export const FieldLevelHelp: React.FC = ({ + title, + helpText, + headingLevel = 'h2', + className = 'co-section-heading', +}) => { + return ( +
+ + {title} + + {title}
} bodyContent={
{helpText}
}> + + + + ); +}; + +export default FieldLevelHelp; diff --git a/src/gitops/components/shared/FieldLevelHelp/index.ts b/src/gitops/components/shared/FieldLevelHelp/index.ts new file mode 100644 index 00000000..71970373 --- /dev/null +++ b/src/gitops/components/shared/FieldLevelHelp/index.ts @@ -0,0 +1 @@ +export { default, FieldLevelHelp } from './FieldLevelHelp';