Skip to content

Commit

Permalink
placate flyout with abstractTree
Browse files Browse the repository at this point in the history
Signed-off-by: reggie <[email protected]>
  • Loading branch information
reggie-k committed Jan 10, 2024
1 parent d378a8e commit c099054
Showing 1 changed file with 2 additions and 38 deletions.
40 changes: 2 additions & 38 deletions ui/src/app/shared/services/extensions-service.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import * as React from 'react';
import * as minimatch from 'minimatch';

import {Application, ApplicationSet, ApplicationTree, State} from '../models';
import {AbstractApplicationTree, Application, ApplicationSet, ApplicationTree, State} from '../models';

const extensions = {
resourceExtentions: new Array<ResourceTabExtension>(),
// appSetResourceExtentions: new Array<AppSetResourceTabExtension>(),
systemLevelExtensions: new Array<SystemLevelExtension>(),
appViewExtensions: new Array<AppViewExtension>(),
// appSetViewExtensions: new Array<AppSetViewExtension>(),
statusPanelExtensions: new Array<StatusPanelExtension>()
};

Expand All @@ -24,10 +22,6 @@ function registerAppViewExtension(component: ExtensionComponent, title: string,
extensions.appViewExtensions.push({component, title, icon});
}

// function registerAppSetViewExtension(component: AppSetExtensionComponent, title: string, icon: string) {
// extensions.appSetViewExtensions.push({component, title, icon});
// }

function registerStatusPanelExtension(component: StatusPanelExtensionComponent, title: string, id: string, flyout?: ExtensionComponent) {
extensions.statusPanelExtensions.push({component, flyout, title, id});
}
Expand All @@ -54,14 +48,6 @@ export interface ResourceTabExtension {
icon?: string;
}

// export interface AppSetResourceTabExtension {
// title: string;
// group: string;
// kind: string;
// component: AppSetExtensionComponent;
// icon?: string;
// }

export interface SystemLevelExtension {
title: string;
component: SystemExtensionComponent;
Expand All @@ -75,12 +61,6 @@ export interface AppViewExtension {
icon?: string;
}

// export interface AppSetViewExtension {
// component: AppSetViewExtensionComponent;
// title: string;
// icon?: string;
// }

export interface StatusPanelExtension {
component: StatusPanelExtensionComponent;
flyout?: StatusPanelExtensionFlyoutComponent;
Expand All @@ -89,21 +69,15 @@ export interface StatusPanelExtension {
}

export type ExtensionComponent = React.ComponentType<AbstractExtensionComponentProps>;
// export type AppSetExtensionComponent = React.ComponentType<AppSetExtensionComponentProps>;
export type SystemExtensionComponent = React.ComponentType;
export type AppViewExtensionComponent = React.ComponentType<AbstractViewComponentProps>;
// export type AppSetViewExtensionComponent = React.ComponentType<AppSetViewComponentProps>;
export type StatusPanelExtensionComponent = React.ComponentType<StatusPanelComponentProps>;
export type StatusPanelExtensionFlyoutComponent = React.ComponentType<StatusPanelFlyoutProps>;

export interface Extension {
component: ExtensionComponent;
}

// export interface AppSetExtension {
// component: AppSetExtensionComponent;
// }

export interface AbstractExtensionComponentProps {
resource: State;
tree: ApplicationTree;
Expand Down Expand Up @@ -138,7 +112,7 @@ export interface StatusPanelComponentProps {

export interface StatusPanelFlyoutProps {
application: ApplicationSet | Application;
tree: ApplicationTree;
tree: AbstractApplicationTree;
}

export class ExtensionsService {
Expand All @@ -148,12 +122,6 @@ export class ExtensionsService {
return items.sort((a, b) => a.title.localeCompare(b.title));
}

// public getAppSetResourceTabs(group: string, kind: string): AppSetResourceTabExtension[] {
// initLegacyExtensions();
// const items = extensions.appSetResourceExtentions.filter(extension => minimatch(group, extension.group) && minimatch(kind, extension.kind)).slice();
// return items.sort((a, b) => a.title.localeCompare(b.title));
// }

public getSystemExtensions(): SystemLevelExtension[] {
return extensions.systemLevelExtensions.slice();
}
Expand All @@ -162,10 +130,6 @@ export class ExtensionsService {
return extensions.appViewExtensions.slice();
}

// public getAppSetViewExtensions(): AppSetViewExtension[] {
// return extensions.appSetViewExtensions.slice();
// }

public getStatusPanelExtensions(): StatusPanelExtension[] {
return extensions.statusPanelExtensions.slice();
}
Expand Down

0 comments on commit c099054

Please sign in to comment.