Skip to content

Commit

Permalink
fix: when resource does not exist node menu and resource details shou… (
Browse files Browse the repository at this point in the history
#12360)

* fix: when resource does not exist node menu and resource details should still render

Signed-off-by: Joshua Helton <[email protected]>

* Retrigger CI pipeline

Signed-off-by: Joshua Helton <[email protected]>

---------

Signed-off-by: Joshua Helton <[email protected]>
  • Loading branch information
jphelton authored and alexmt committed Feb 16, 2023
1 parent 6e02f8b commit 7bbedff
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export const ResourceDetails = (props: ResourceDetailsProps) => {
const execEnabled = settings.execEnabled;
const logsAllowed = await services.accounts.canI('logs', 'get', application.spec.project + '/' + application.metadata.name);
const execAllowed = await services.accounts.canI('exec', 'create', application.spec.project + '/' + application.metadata.name);
const links = await services.applications.getResourceLinks(application.metadata.name, application.metadata.namespace, selectedNode);
const links = await services.applications.getResourceLinks(application.metadata.name, application.metadata.namespace, selectedNode).catch(() => null);
return {controlledState, liveState, events, podState, execEnabled, execAllowed, logsAllowed, links};
}}>
{data => (
Expand Down
25 changes: 14 additions & 11 deletions ui/src/app/applications/components/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -493,17 +493,20 @@ function getActionItems(

const resourceActions = getResourceActionsMenuItems(resource, application.metadata, appContext);

const links = services.applications.getResourceLinks(application.metadata.name, application.metadata.namespace, resource).then(data => {
return (data.items || []).map(
link =>
({
title: link.title,
iconClassName: `fa ${link.iconClass ? link.iconClass : 'fa-external-link'}`,
action: () => window.open(link.url, '_blank'),
tooltip: link.description
} as MenuItem)
);
});
const links = services.applications
.getResourceLinks(application.metadata.name, application.metadata.namespace, resource)
.then(data => {
return (data.items || []).map(
link =>
({
title: link.title,
iconClassName: `fa ${link.iconClass ? link.iconClass : 'fa-external-link'}`,
action: () => window.open(link.url, '_blank'),
tooltip: link.description
} as MenuItem)
);
})
.catch(() => [] as MenuItem[]);

return combineLatest(
from([items]), // this resolves immediately
Expand Down

0 comments on commit 7bbedff

Please sign in to comment.