mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
support-page extension fixes
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
parent
a489d9aabe
commit
1fc8ff0abc
@ -1,5 +1,4 @@
|
||||
import { LensMainExtension } from "@k8slens/extensions";
|
||||
import { pageUrl } from "./src/common-vars";
|
||||
|
||||
export default class SupportPageMainExtension extends LensMainExtension {
|
||||
appMenus = [
|
||||
@ -7,7 +6,7 @@ export default class SupportPageMainExtension extends LensMainExtension {
|
||||
parentId: "help",
|
||||
label: "Support",
|
||||
click: () => {
|
||||
this.navigate(pageUrl);
|
||||
this.navigate();
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@ -1,14 +1,12 @@
|
||||
import React from "react";
|
||||
import { Component, Interface, LensRendererExtension } from "@k8slens/extensions";
|
||||
import { Support } from "./src/support";
|
||||
import { pageRoute, pageUrl } from "./src/common-vars";
|
||||
import { SupportPage } from "./src/support";
|
||||
|
||||
export default class SupportPageRendererExtension extends LensRendererExtension {
|
||||
globalPages: Interface.PageRegistration[] = [
|
||||
{
|
||||
routePath: pageRoute,
|
||||
components: {
|
||||
Page: Support,
|
||||
Page: SupportPage,
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -16,7 +14,7 @@ export default class SupportPageRendererExtension extends LensRendererExtension
|
||||
statusBarItems: Interface.StatusBarRegistration[] = [
|
||||
{
|
||||
item: (
|
||||
<div className="flex align-center gaps hover-highlight" onClick={() => this.navigate(pageUrl)}>
|
||||
<div className="flex align-center gaps hover-highlight" onClick={() => this.navigate()}>
|
||||
<Component.Icon material="help" smallest/>
|
||||
</div>
|
||||
)
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
// Common variables for both processes (main & renderer)
|
||||
|
||||
export const pageRoute = "/support"
|
||||
export const pageUrl = pageRoute; // same since no special :placeholder-s for react-router's route
|
||||
@ -1,4 +1,4 @@
|
||||
.PageLayout.Support {
|
||||
.SupportPage {
|
||||
a[target=_blank] {
|
||||
text-decoration: none;
|
||||
border-bottom: 1px solid;
|
||||
|
||||
@ -6,12 +6,12 @@ import { observer } from "mobx-react"
|
||||
import { App, Component } from "@k8slens/extensions";
|
||||
|
||||
@observer
|
||||
export class Support extends React.Component {
|
||||
export class SupportPage extends React.Component {
|
||||
render() {
|
||||
const { PageLayout } = Component;
|
||||
const { slackUrl, issuesTrackerUrl } = App;
|
||||
return (
|
||||
<PageLayout showOnTop className="Support" header={<h2>Support</h2>}>
|
||||
<PageLayout showOnTop className="SupportPage" header={<h2>Support</h2>}>
|
||||
<h2>Community Slack Channel</h2>
|
||||
<p>
|
||||
Ask a question, see what's being discussed, join the conversation <a href={slackUrl} target="_blank">here</a>
|
||||
|
||||
@ -6,9 +6,9 @@ import { WindowManager } from "../main/window-manager";
|
||||
export class LensMainExtension extends LensExtension {
|
||||
@observable.shallow appMenus: MenuRegistration[] = []
|
||||
|
||||
async navigate(location: string, frameId?: number) {
|
||||
async navigate(location?: string, frameId?: number) {
|
||||
const windowManager = WindowManager.getInstance<WindowManager>();
|
||||
const url = this.getPageUrl(location);
|
||||
await windowManager.navigate(url, frameId)
|
||||
const url = this.getPageUrl(location); // get full path to extension's page
|
||||
await windowManager.navigate(url, frameId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import type { AppPreferenceRegistration, ClusterFeatureRegistration, KubeObjectDetailRegistration, KubeObjectMenuRegistration, KubeObjectStatusRegistration, PageMenuRegistration, PageRegistration, StatusBarRegistration, } from "./registries"
|
||||
import { ipcRenderer } from "electron"
|
||||
import { observable } from "mobx";
|
||||
import { LensExtension } from "./lens-extension"
|
||||
|
||||
@ -15,7 +14,8 @@ export class LensRendererExtension extends LensExtension {
|
||||
@observable.shallow kubeObjectDetailItems: KubeObjectDetailRegistration[] = []
|
||||
@observable.shallow kubeObjectMenuItems: KubeObjectMenuRegistration[] = []
|
||||
|
||||
navigate(location: string) {
|
||||
ipcRenderer.emit("renderer:navigate", this.getPageUrl(location))
|
||||
async navigate(location?: string) {
|
||||
const { navigate } = await import("../renderer/navigation");
|
||||
navigate(this.getPageUrl(location));
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user