-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Table component injection tokens (#7754)
Signed-off-by: Alex Andreev <[email protected]>
- Loading branch information
1 parent
4b63bc2
commit 1ffdb6c
Showing
20 changed files
with
167 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
packages/core/src/features/table/table-component.injectable.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* Copyright (c) OpenLens Authors. All rights reserved. | ||
* Licensed under MIT License. See LICENSE in root directory for more information. | ||
*/ | ||
import { tableComponentInjectionToken } from "@k8slens/table-tokens"; | ||
import { getInjectable } from "@ogre-tools/injectable"; | ||
import { Table } from "../../renderer/components/table/table"; | ||
|
||
const tableComponentInjectable = getInjectable({ | ||
id: "table-component", | ||
instantiate: () => ({ Component: Table }), | ||
injectionToken: tableComponentInjectionToken, | ||
}); | ||
|
||
export default tableComponentInjectable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Copyright (c) OpenLens Authors. All rights reserved. | ||
* Licensed under MIT License. See LICENSE in root directory for more information. | ||
*/ | ||
import { getFeature } from "@k8slens/feature-core"; | ||
import tableComponentInjectable from "./table-component.injectable"; | ||
|
||
export const tableFeature = getFeature({ | ||
id: "core-table-feature", | ||
|
||
register: (di) => { | ||
di.register(tableComponentInjectable); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Description | ||
|
||
The package exports tokens needed for external table configuration. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { getInjectionToken } from "@ogre-tools/injectable"; | ||
import type { KubeObject } from "@k8slens/kube-object/src/kube-object"; | ||
import type { | ||
BaseKubeObjectListLayoutColumn, | ||
GeneralKubeObjectListLayoutColumn, | ||
SpecificKubeListLayoutColumn, | ||
} from "@k8slens/list-layout"; | ||
|
||
type Column = ( | ||
| BaseKubeObjectListLayoutColumn<KubeObject> | ||
| SpecificKubeListLayoutColumn<KubeObject> | ||
| GeneralKubeObjectListLayoutColumn | ||
); | ||
|
||
export interface TableComponentProps { | ||
tableId?: string; | ||
columns?: Column[]; | ||
save?: (state: object) => void; | ||
load?: (tableId: string) => object; | ||
} | ||
|
||
export interface TableComponent { | ||
Component: React.ComponentType<TableComponentProps>; | ||
} | ||
|
||
export const tableComponentInjectionToken = getInjectionToken<TableComponent>({ | ||
id: "table-component-injection-token", | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "@k8slens/table-tokens", | ||
"version": "6.5.0-alpha.7", | ||
"description": "Injection token exporter for table components", | ||
"license": "MIT", | ||
"type": "commonjs", | ||
"private": false, | ||
"publishConfig": { | ||
"access": "public", | ||
"registry": "https://registry.npmjs.org/" | ||
}, | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"clean": "rimraf dist/", | ||
"build": "lens-webpack-build" | ||
}, | ||
"devDependencies": { | ||
"@k8slens/webpack": "^6.5.0-alpha.8", | ||
"rimraf": "^4.4.1" | ||
}, | ||
"peerDependencies": { | ||
"@ogre-tools/injectable": "^16.1.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": "@k8slens/typescript/config/base.json", | ||
"include": ["**/*.ts"] | ||
} |
Oops, something went wrong.