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;
|
||||
};
|
||||
accessibleNamespaces?: string[];
|
||||
triggerOnRunAfterOnClickDetailIcon?: boolean
|
||||
}
|
||||
|
||||
export interface KubernetesClusterMetadata extends CatalogEntityMetadata {
|
||||
|
||||
@ -32,6 +32,7 @@ export interface WebLinkStatus extends CatalogEntityStatus {
|
||||
|
||||
export type WebLinkSpec = {
|
||||
url: string;
|
||||
triggerOnRunAfterOnClickDetailIcon?: true,
|
||||
};
|
||||
|
||||
export class WebLink extends CatalogEntity<CatalogEntityMetadata, WebLinkStatus, WebLinkSpec> {
|
||||
|
||||
@ -75,12 +75,11 @@ export function syncWeblinks() {
|
||||
uid: weblinkData.id,
|
||||
name: weblinkData.name,
|
||||
source: "local",
|
||||
labels: {
|
||||
triggerOnRunAfterOnClickDetailIcon: "true",
|
||||
}
|
||||
labels: {}
|
||||
},
|
||||
spec: {
|
||||
url: weblinkData.url
|
||||
url: weblinkData.url,
|
||||
triggerOnRunAfterOnClickDetailIcon: true,
|
||||
},
|
||||
status: {
|
||||
phase: "available",
|
||||
|
||||
@ -261,7 +261,6 @@ export function catalogEntityFromCluster(cluster: Cluster) {
|
||||
name: cluster.name,
|
||||
source: "local",
|
||||
labels: {
|
||||
triggerOnRunAfterOnClickDetailIcon: "true",
|
||||
...cluster.labels,
|
||||
},
|
||||
distro: cluster.distribution,
|
||||
@ -270,7 +269,8 @@ export function catalogEntityFromCluster(cluster: Cluster) {
|
||||
spec: {
|
||||
kubeconfigPath: cluster.kubeConfigPath,
|
||||
kubeconfigContext: cluster.contextName,
|
||||
icon: {}
|
||||
icon: {},
|
||||
triggerOnRunAfterOnClickDetailIcon: true,
|
||||
},
|
||||
status: {
|
||||
phase: cluster.disconnected ? "disconnected" : "connected",
|
||||
|
||||
@ -121,14 +121,14 @@ describe("<CatalogEntityDetails />", () => {
|
||||
metadata: {
|
||||
uid: "",
|
||||
name: "",
|
||||
labels: {
|
||||
triggerOnRunAfterOnClickDetailIcon: "true",
|
||||
},
|
||||
labels: {},
|
||||
},
|
||||
status: {
|
||||
phase: "",
|
||||
},
|
||||
spec: { },
|
||||
spec: {
|
||||
triggerOnRunAfterOnClickDetailIcon: true
|
||||
},
|
||||
getId: () => "",
|
||||
getName: () => "",
|
||||
onContextMenuOpen: () => {},
|
||||
|
||||
@ -75,7 +75,7 @@ export class CatalogEntityDetails<T extends CatalogEntity> extends Component<Pro
|
||||
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);
|
||||
}
|
||||
}}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user