1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Add URL display to weblink URLs (#4046)

This commit is contained in:
Sebastian Malton 2021-10-18 09:38:10 -04:00 committed by GitHub
parent 86da6260b6
commit f12b0658ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 4 deletions

View File

@ -35,8 +35,11 @@ export type WebLinkSpec = {
}; };
export class WebLink extends CatalogEntity<CatalogEntityMetadata, WebLinkStatus, WebLinkSpec> { export class WebLink extends CatalogEntity<CatalogEntityMetadata, WebLinkStatus, WebLinkSpec> {
public readonly apiVersion = "entity.k8slens.dev/v1alpha1"; public static readonly apiVersion = "entity.k8slens.dev/v1alpha1";
public readonly kind = "WebLink"; public static readonly kind = "WebLink";
public readonly apiVersion = WebLink.apiVersion;
public readonly kind = WebLink.kind;
async onRun() { async onRun() {
window.open(this.spec.url, "_blank"); window.open(this.spec.url, "_blank");

View File

@ -20,7 +20,7 @@
*/ */
import React from "react"; import React from "react";
import { KubernetesCluster } from "../../common/catalog-entities"; import { KubernetesCluster, WebLink } from "../../common/catalog-entities";
import { CatalogEntityDetailRegistry, CatalogEntityDetailsProps } from "../../extensions/registries"; import { CatalogEntityDetailRegistry, CatalogEntityDetailsProps } from "../../extensions/registries";
import { DrawerItem, DrawerTitle } from "../components/drawer"; import { DrawerItem, DrawerTitle } from "../components/drawer";
@ -45,6 +45,20 @@ export function initCatalogEntityDetailRegistry() {
</> </>
), ),
}, },
} },
{
apiVersions: [WebLink.apiVersion],
kind: WebLink.kind,
components: {
Details: ({ entity }: CatalogEntityDetailsProps<WebLink>) => (
<>
<DrawerTitle title="More Information" />
<DrawerItem name="URL">
{entity.spec.url}
</DrawerItem>
</>
),
},
},
]); ]);
} }