mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
use BaseRegistry
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
571694bb8e
commit
0f997094e2
@ -1,4 +1,4 @@
|
|||||||
import { observable } from "mobx"
|
import { BaseRegistry } from "./base-registry";
|
||||||
import { ClusterFeature } from "../cluster-feature";
|
import { ClusterFeature } from "../cluster-feature";
|
||||||
|
|
||||||
export interface ClusterFeatureComponents {
|
export interface ClusterFeatureComponents {
|
||||||
@ -11,17 +11,6 @@ export interface ClusterFeatureRegistration {
|
|||||||
feature: ClusterFeature
|
feature: ClusterFeature
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ClusterFeatureRegistry {
|
export class ClusterFeatureRegistry extends BaseRegistry<ClusterFeatureRegistration> {}
|
||||||
features = observable.array<ClusterFeatureRegistration>([], { deep: false });
|
|
||||||
|
|
||||||
add(feature: ClusterFeatureRegistration) {
|
|
||||||
this.features.push(feature)
|
|
||||||
return () => {
|
|
||||||
this.features.replace(
|
|
||||||
this.features.filter(f => f !== feature)
|
|
||||||
)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const clusterFeatureRegistry = new ClusterFeatureRegistry()
|
export const clusterFeatureRegistry = new ClusterFeatureRegistry()
|
||||||
|
|||||||
@ -14,7 +14,7 @@ export class Features extends React.Component<Props> {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h2>Features</h2>
|
<h2>Features</h2>
|
||||||
{ clusterFeatureRegistry.features.map((f) => {
|
{ clusterFeatureRegistry.getItems().map((f) => {
|
||||||
return (
|
return (
|
||||||
<InstallFeature cluster={cluster} feature={f.feature}>
|
<InstallFeature cluster={cluster} feature={f.feature}>
|
||||||
<>
|
<>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user