mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Move to .spec
Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>
This commit is contained in:
parent
aed5760ba0
commit
22787a1376
@ -52,6 +52,7 @@ export interface KubernetesClusterSpec extends CatalogEntitySpec {
|
|||||||
background?: string;
|
background?: string;
|
||||||
};
|
};
|
||||||
accessibleNamespaces?: string[];
|
accessibleNamespaces?: string[];
|
||||||
|
triggerOnRunAfterOnClickDetailIcon?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface KubernetesClusterMetadata extends CatalogEntityMetadata {
|
export interface KubernetesClusterMetadata extends CatalogEntityMetadata {
|
||||||
|
|||||||
@ -32,6 +32,7 @@ export interface WebLinkStatus extends CatalogEntityStatus {
|
|||||||
|
|
||||||
export type WebLinkSpec = {
|
export type WebLinkSpec = {
|
||||||
url: string;
|
url: string;
|
||||||
|
triggerOnRunAfterOnClickDetailIcon?: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
export class WebLink extends CatalogEntity<CatalogEntityMetadata, WebLinkStatus, WebLinkSpec> {
|
export class WebLink extends CatalogEntity<CatalogEntityMetadata, WebLinkStatus, WebLinkSpec> {
|
||||||
|
|||||||
@ -75,12 +75,11 @@ export function syncWeblinks() {
|
|||||||
uid: weblinkData.id,
|
uid: weblinkData.id,
|
||||||
name: weblinkData.name,
|
name: weblinkData.name,
|
||||||
source: "local",
|
source: "local",
|
||||||
labels: {
|
labels: {}
|
||||||
triggerOnRunAfterOnClickDetailIcon: "true",
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
spec: {
|
spec: {
|
||||||
url: weblinkData.url
|
url: weblinkData.url,
|
||||||
|
triggerOnRunAfterOnClickDetailIcon: true,
|
||||||
},
|
},
|
||||||
status: {
|
status: {
|
||||||
phase: "available",
|
phase: "available",
|
||||||
|
|||||||
@ -261,7 +261,6 @@ export function catalogEntityFromCluster(cluster: Cluster) {
|
|||||||
name: cluster.name,
|
name: cluster.name,
|
||||||
source: "local",
|
source: "local",
|
||||||
labels: {
|
labels: {
|
||||||
triggerOnRunAfterOnClickDetailIcon: "true",
|
|
||||||
...cluster.labels,
|
...cluster.labels,
|
||||||
},
|
},
|
||||||
distro: cluster.distribution,
|
distro: cluster.distribution,
|
||||||
@ -270,7 +269,8 @@ export function catalogEntityFromCluster(cluster: Cluster) {
|
|||||||
spec: {
|
spec: {
|
||||||
kubeconfigPath: cluster.kubeConfigPath,
|
kubeconfigPath: cluster.kubeConfigPath,
|
||||||
kubeconfigContext: cluster.contextName,
|
kubeconfigContext: cluster.contextName,
|
||||||
icon: {}
|
icon: {},
|
||||||
|
triggerOnRunAfterOnClickDetailIcon: true,
|
||||||
},
|
},
|
||||||
status: {
|
status: {
|
||||||
phase: cluster.disconnected ? "disconnected" : "connected",
|
phase: cluster.disconnected ? "disconnected" : "connected",
|
||||||
|
|||||||
@ -121,14 +121,14 @@ describe("<CatalogEntityDetails />", () => {
|
|||||||
metadata: {
|
metadata: {
|
||||||
uid: "",
|
uid: "",
|
||||||
name: "",
|
name: "",
|
||||||
labels: {
|
labels: {},
|
||||||
triggerOnRunAfterOnClickDetailIcon: "true",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
status: {
|
status: {
|
||||||
phase: "",
|
phase: "",
|
||||||
},
|
},
|
||||||
spec: { },
|
spec: {
|
||||||
|
triggerOnRunAfterOnClickDetailIcon: true
|
||||||
|
},
|
||||||
getId: () => "",
|
getId: () => "",
|
||||||
getName: () => "",
|
getName: () => "",
|
||||||
onContextMenuOpen: () => {},
|
onContextMenuOpen: () => {},
|
||||||
|
|||||||
@ -75,7 +75,7 @@ export class CatalogEntityDetails<T extends CatalogEntity> extends Component<Pro
|
|||||||
item.onRun(catalogEntityRunContext);
|
item.onRun(catalogEntityRunContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof item.entity.onClickDetailIcon === "function" && Boolean(item.entity.metadata?.labels?.triggerOnRunAfterOnClickDetailIcon)) {
|
if (typeof item.entity.onClickDetailIcon === "function" && item.entity.spec?.triggerOnRunAfterOnClickDetailIcon) {
|
||||||
item.onRun(catalogEntityRunContext);
|
item.onRun(catalogEntityRunContext);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user