mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
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:
1 parent
4a3f08d798
commit
a0d13e8003
12 files changed
+237
-23
No files matched your search
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/swcrc",
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript"
|
||||
},
|
||||
"target": "es2022"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
# Description
|
||||
|
||||
The package exports tokens needed for external configuration of Cluster Settings page.
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "@k8slens/cluster-settings",
|
||||
"version": "6.5.0-alpha.1",
|
||||
"description": "Injection token exporter for cluster settings configuration",
|
||||
"license": "MIT",
|
||||
"private": false,
|
||||
"mode": "production",
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
},
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"clean": "rimraf dist/",
|
||||
"generate-types": "tsc --d --declarationDir ./dist --declarationMap --emitDeclarationOnly",
|
||||
"build": "npm run generate-types && swc ./src/index.ts -d ./dist",
|
||||
"prepare:test": "npm run build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ogre-tools/injectable": "^15.1.2",
|
||||
"@swc/cli": "^0.1.61",
|
||||
"@swc/core": "^1.3.37",
|
||||
"@types/node": "^16.18.11",
|
||||
"@types/semver": "^7.3.13",
|
||||
"rimraf": "^4.1.2"
|
||||
}
|
||||
}
|
||||
@@ -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",
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "dist/",
|
||||
"paths": {
|
||||
"*": [
|
||||
"node_modules/*",
|
||||
"types/*"
|
||||
]
|
||||
},
|
||||
},
|
||||
"include": [
|
||||
"src/**/*",
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user