1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/packages/cluster-settings/src/index.ts
Alex Andreev a0d13e8003
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>
2023-03-23 11:40:56 +03:00

30 lines
868 B
TypeScript

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",
});