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

feat: support application level extensions #9923

Merged
merged 1 commit into from
Jul 12, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/developer-guide/ui-extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ The resource tab extension should be registered using the `extensionsAPI.registe
registerResourceExtension(component: ExtensionComponent, group: string, kind: string, tabTitle: string)
```



* `component: ExtensionComponent` is a React component that receives the following properties:

* resource: State - the kubernetes resource object;
Expand All @@ -57,3 +55,7 @@ Below is an example of a resource tab extension:
})(window)
```

## Application Tab Extensions

Since the Argo CD Application is a Kubernetes resource, application tabs can be the same as any other resource tab.
Make sure to use 'argoproj.io'/'Application' as group/kind and an extension will be used to render the application-level tab.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,13 @@ export const ResourceDetails = (props: ResourceDetailsProps) => {
content: <ApplicationResourceEvents applicationName={application.metadata.name} />
});

return tabs;
const extensionTabs = services.extensions.getResourceTabs('argoproj.io', 'Application').map((ext, i) => ({
title: ext.title,
key: `extension-${i}`,
content: <ext.component resource={application} tree={tree} />
}));

return tabs.concat(extensionTabs);
};

const extensions = selectedNode?.kind && selectedNode?.group ? services.extensions.getResourceTabs(selectedNode?.group, selectedNode?.kind) : [];
Expand Down