-
Notifications
You must be signed in to change notification settings - Fork 16
View in Argo CD action disabled (#10082)
#254
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ import { RouteComponentProps } from 'react-router'; | |
| import classNames from 'classnames'; | ||
|
|
||
| import { useResourceActionsProvider } from '@gitops/hooks/useResourceActionsProvider'; | ||
| import { useArgoServer } from '@gitops/hooks/useArgoServer'; | ||
| import HealthStatus from '@gitops/Statuses/HealthStatus'; | ||
| import SyncStatus from '@gitops/Statuses/SyncStatus'; | ||
| import ActionDropDown from '@gitops/utils/components/ActionDropDown/ActionDropDown'; | ||
|
|
@@ -15,7 +16,6 @@ import { | |
| ResourceLink, | ||
| RowFilter, | ||
| RowFilterItem, | ||
| useK8sModel, | ||
| useListPageFilter, | ||
| } from '@openshift-console/dynamic-plugin-sdk'; | ||
| import { | ||
|
|
@@ -33,7 +33,7 @@ import { DataViewTh, DataViewTr } from '@patternfly/react-data-view/dist/esm/Dat | |
| import { CubesIcon } from '@patternfly/react-icons'; | ||
| import { Tbody, Td, Tr } from '@patternfly/react-table'; | ||
|
|
||
| import { ArgoServer, getArgoServer } from '../../utils/gitops'; | ||
| import { getApplicationArgoUrl } from '../../utils/gitops'; | ||
| import ArgoCDLink from '../shared/ArgoCDLink/ArgoCDLink'; | ||
| import { GitOpsDataViewTable, useGitOpsDataViewSort } from '../shared/DataView'; | ||
|
|
||
|
|
@@ -47,21 +47,8 @@ type ApplicationResourcesTabProps = RouteComponentProps<{ | |
| }; | ||
|
|
||
| const ApplicationResourcesTab: React.FC<ApplicationResourcesTabProps> = ({ obj }) => { | ||
| const [model] = useK8sModel({ group: 'route.openshift.io', version: 'v1', kind: 'Route' }); | ||
|
|
||
| const [argoServer, setArgoServer] = React.useState<ArgoServer>({ host: '', protocol: '' }); | ||
|
|
||
| React.useEffect(() => { | ||
| (async () => { | ||
| getArgoServer(model, obj) | ||
| .then((server) => { | ||
| setArgoServer(server); | ||
| }) | ||
| .catch((err) => { | ||
| console.error('Error:', err); | ||
| }); | ||
| })(); | ||
| }, [model, obj]); | ||
| const argoServer = useArgoServer(obj); | ||
| const argoUrl = getApplicationArgoUrl(argoServer, obj); | ||
|
Comment on lines
+50
to
+51
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. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check whether useResourceActionsProvider conditionally handles an empty argoBaseURL
# similar to useApplicationActionsProvider's href-truthy check.
fd -e ts -e tsx useResourceActionsProvider
rg -n -A 20 'useResourceActionsProvider' --type=tsx --type=tsRepository: redhat-developer/gitops-console-plugin Length of output: 252 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== outline: ApplicationResourcesTab =="
ast-grep outline src/gitops/components/application/ApplicationResourcesTab.tsx --view expanded || true
echo
echo "== outline: useResourceActionsProvider =="
ast-grep outline src/gitops/hooks/useResourceActionsProvider.tsx --view expanded || true
echo
echo "== outline: useApplicationActionsProvider =="
fd -a useApplicationActionsProvider src/gitops/hooks src/gitops/components || true
if [ -f src/gitops/hooks/useApplicationActionsProvider.tsx ]; then
ast-grep outline src/gitops/hooks/useApplicationActionsProvider.tsx --view expanded || true
fi
echo
echo "== relevant matches =="
rg -n -A 30 -B 10 'useResourceActionsProvider|useApplicationActionsProvider|argoBaseURL|argoUrl|View in Argo CD' src/gitops/components/application/ApplicationResourcesTab.tsx src/gitops/hooks/useResourceActionsProvider.tsx src/gitops/hooks/useApplicationActionsProvider.tsx || trueRepository: redhat-developer/gitops-console-plugin Length of output: 38061 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== useResourceActionsProvider =="
cat -n src/gitops/hooks/useResourceActionsProvider.tsx | sed -n '1,260p'
echo
echo "== useApplicationActionsProvider =="
fd -a useApplicationActionsProvider src/gitops/hooks src/gitops/components || true
if [ -f src/gitops/hooks/useApplicationActionsProvider.tsx ]; then
cat -n src/gitops/hooks/useApplicationActionsProvider.tsx | sed -n '1,260p'
fi
echo
echo "== ApplicationResourcesTab around the caller =="
cat -n src/gitops/components/application/ApplicationResourcesTab.tsx | sed -n '280,340p'Repository: redhat-developer/gitops-console-plugin Length of output: 13126 🏁 Script executed: #!/bin/bash
set -euo pipefail
sed -n '1,260p' src/gitops/hooks/useResourceActionsProvider.tsx | cat -n
printf '\n---\n'
sed -n '1,260p' src/gitops/hooks/useApplicationActionsProvider.tsx | cat -n
printf '\n---\n'
sed -n '280,340p' src/gitops/components/application/ApplicationResourcesTab.tsx | cat -nRepository: redhat-developer/gitops-console-plugin Length of output: 12947 Guard the resource-level Argo CD action on 🤖 Prompt for AI Agents |
||
|
|
||
| let resources: ApplicationResourceStatus[]; | ||
| if (obj?.status?.resources) { | ||
|
|
@@ -91,17 +78,7 @@ const ApplicationResourcesTab: React.FC<ApplicationResourcesTabProps> = ({ obj } | |
| const memoizedFilteredResources = React.useMemo(() => [...filteredData], [filteredData]); | ||
| const isEmptyResources = memoizedFilteredResources.length === 0; | ||
|
|
||
| const rows = useResourceRowsDV( | ||
| memoizedFilteredResources, | ||
| obj, | ||
| argoServer.protocol + | ||
| '://' + | ||
| argoServer.host + | ||
| '/applications/' + | ||
| obj?.metadata?.namespace + | ||
| '/' + | ||
| obj?.metadata?.name, | ||
| ); | ||
| const rows = useResourceRowsDV(memoizedFilteredResources, obj, argoUrl); | ||
|
|
||
| const empty = ( | ||
| <Tbody> | ||
|
|
@@ -135,17 +112,7 @@ const ApplicationResourcesTab: React.FC<ApplicationResourcesTabProps> = ({ obj } | |
| <PageBody> | ||
| <Flex style={{ marginTop: '15px' }} flex={{ default: 'flexDefault' }}> | ||
| <FlexItem> | ||
| <ArgoCDLink | ||
| href={ | ||
| argoServer.protocol + | ||
| '://' + | ||
| argoServer.host + | ||
| '/applications/' + | ||
| obj?.metadata?.namespace + | ||
| '/' + | ||
| obj?.metadata?.name | ||
| } | ||
| /> | ||
| <ArgoCDLink href={argoUrl} /> | ||
| </FlexItem> | ||
| </Flex> | ||
| <> | ||
|
|
||
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.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: redhat-developer/gitops-console-plugin
Length of output: 267
🏁 Script executed:
Repository: redhat-developer/gitops-console-plugin
Length of output: 30790
🏁 Script executed:
Repository: redhat-developer/gitops-console-plugin
Length of output: 8354
Hide Argo CD links until the URL is ready
ApplicationDetailsTab.tsxandApplicationResourcesTab.tsxpass''toArgoCDLinkwhileuseArgoServeris still resolving.ApplicationSourcesTab.tsxturns that same state into a query-only relative link (?resource=...).Gate these links on the final
argoUrlbefore rendering.🤖 Prompt for AI Agents