Adding package exporting injection tokens for cluster settings (#7395)

* Add clusterIconSettingsComponentInjectionToken

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Adding tests for new token

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Create cluster-settings package

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Fix cluster-settings package build process

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Use tolens from @k8slens/cluster-settings

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Linter fixes

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Remove typescript 5.x.x from cluster-settings package

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Adding prepare:test command to package.json

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Test small cleanup

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Fix getByText check

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Clean up

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Linter fix

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

---------

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev authored and GitHub committed 2023-03-23 11:40:56 +03:00
1 parent 4a3f08d798
commit a0d13e8003
12 files changed
+237 -23

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
import { getInjectionToken } from "@ogre-tools/injectable";
type ClusterPreferences = {
clusterName?: string;
icon?: string | null;
}
export interface ClusterIconMenuItem {
id: string;
title: string;
disabled?: (preferences: ClusterPreferences) => boolean;
onClick: (preferences: ClusterPreferences) => void;
}
export interface ClusterIconSettingComponentProps {
preferences: ClusterPreferences;
}
export interface ClusterIconSettingsComponent {
id: string;
Component: React.ComponentType<ClusterIconSettingComponentProps>;
}
export const clusterIconSettingsMenuInjectionToken = getInjectionToken<ClusterIconMenuItem>({
id: "cluster-icon-settings-menu-injection-token",
});
export const clusterIconSettingsComponentInjectionToken = getInjectionToken<ClusterIconSettingsComponent>({
id: "cluster-icon-settings-component-injection-token",
});