Skip to content
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

fix: when resource does not exist node menu and resource details shou… #12360

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -491,17 +491,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