-
Couldn't load subscription status.
- Fork 6.5k
Description
Summary
Application Details View UI extensions should be able to configure certain aspects of the application details screen to fit the ideal UX of the extension.
Motivation
Above is an example of a UI extension we are building, along with the ideal state we would like to configure the Application view to while this extension is displayed.
Namely, while this extension is loaded, we would like to be able to:
- Hide the status panels, as they are unnecessary for this view.
- Hide certain action buttons that are irrelevant to this workflow.
- Move the navigation toolbar (top right) to the top-level header of the page, pushing the View's title to the center to compensate.
Initial View here for reference:

Proposal
This can be accomplished by creating an additional argument passed to the registerAppViewExtension function, that will allow extensions to pass a set of overrides to appDetails view preferences
function registerAppViewExtension(
component: ExtensionComponent,
title: string,
icon: string,
prefOverrides: Partial<AppDetailsPreferences>
)When the extension is rendered, we apply the preference changes supplied, cleaning them up as a part of a useEffect:
const ExtensionView = (props: {extension: AppViewExtension; application: models.Application; tree: models.ApplicationTree}) => {
const {extension, application, tree} = props;
// pull out the extension overrides, clean them up when the component is unmounted
useEffect(() => {
const previousPreferences = services.viewPreferences.getPreferences().appDetails
services.viewPreferences.updatePreferences({appDetails: {...prefOverrides}})
return () => services.viewPreferences.updatePreferences({appDetails: {...previousPreferences}})
});
return <extension.component application={application} tree={tree} />;
};Some new preferences would also be created to get the UX we are looking for:
showStatusPanels: defaults to true, determines whether or not status panels should be shown
actionButtons: list of strings to represent which action buttons should be available (we can possibly make this an enum to make configuration easier)
toolsPosition: DEFAULT | INLINE, determines the position of the view tools in the top bar.
The preferences themselves are open to discussion, the important part is how they are loaded into the core application.