Skip to content

Commit

Permalink
feat: support application level extensions (#9923)
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Matyushentsev <[email protected]>
  • Loading branch information
alexmt committed Jul 28, 2022
1 parent a85d88d commit ac34ff2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
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

0 comments on commit ac34ff2

Please sign in to comment.