1
0
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:
Hung-Han (Henry) Chen 2021-09-29 16:45:39 +03:00
parent aed5760ba0
commit 22787a1376
No known key found for this signature in database
GPG Key ID: 54B44603D251B788
6 changed files with 12 additions and 11 deletions

View File

@ -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 {

View File

@ -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> {

View File

@ -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",

View File

@ -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",

View File

@ -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: () => {},

View File

@ -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);
} }
}} }}