mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
add check for invalid cluster ID, rename storage to seen_workspaces
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
317a2e8f21
commit
13a06c8df9
@ -12,7 +12,7 @@ import { createStorage } from "../../utils";
|
|||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class LandingPage extends React.Component {
|
export class LandingPage extends React.Component {
|
||||||
private static storage = createStorage<WorkspaceId[]>("landing_page", []);
|
private static storage = createStorage<WorkspaceId[]>("seen_workspaces", []);
|
||||||
|
|
||||||
@computed get workspace() {
|
@computed get workspace() {
|
||||||
return workspaceStore.currentWorkspace;
|
return workspaceStore.currentWorkspace;
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import { invalidKubeconfigHandler } from "./invalid-kubeconfig-handler";
|
|||||||
import { clusterStore } from "../../common/cluster-store";
|
import { clusterStore } from "../../common/cluster-store";
|
||||||
import { navigate } from "../navigation";
|
import { navigate } from "../navigation";
|
||||||
import { clusterSettingsURL } from "../components/+cluster-settings";
|
import { clusterSettingsURL } from "../components/+cluster-settings";
|
||||||
|
import logger from "../../main/logger";
|
||||||
|
|
||||||
function sendToBackchannel(backchannel: string, notificationId: string, data: BackchannelArg): void {
|
function sendToBackchannel(backchannel: string, notificationId: string, data: BackchannelArg): void {
|
||||||
notificationsStore.remove(notificationId);
|
notificationsStore.remove(notificationId);
|
||||||
@ -59,6 +60,12 @@ const listNamespacesForbiddenHandlerDisplayedAt = new Map<string, number>();
|
|||||||
const intervalBetweenNotifications = 1000 * 60; // 60s
|
const intervalBetweenNotifications = 1000 * 60; // 60s
|
||||||
|
|
||||||
function ListNamespacesForbiddenHandler(event: IpcRendererEvent, ...[clusterId]: ListNamespaceForbiddenArgs): void {
|
function ListNamespacesForbiddenHandler(event: IpcRendererEvent, ...[clusterId]: ListNamespaceForbiddenArgs): void {
|
||||||
|
const cluster = clusterStore.getById(clusterId);
|
||||||
|
|
||||||
|
if (!cluster) {
|
||||||
|
return void logger.warn("[ListNamespacesForbiddenHandler]: received event but was given an unknown cluster ID", { clusterId });
|
||||||
|
}
|
||||||
|
|
||||||
const lastDisplayedAt = listNamespacesForbiddenHandlerDisplayedAt.get(clusterId);
|
const lastDisplayedAt = listNamespacesForbiddenHandlerDisplayedAt.get(clusterId);
|
||||||
const wasDisplayed = Boolean(lastDisplayedAt);
|
const wasDisplayed = Boolean(lastDisplayedAt);
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
@ -76,7 +83,7 @@ function ListNamespacesForbiddenHandler(event: IpcRendererEvent, ...[clusterId]:
|
|||||||
(
|
(
|
||||||
<div className="flex column gaps">
|
<div className="flex column gaps">
|
||||||
<b>Add Accessible Namespaces</b>
|
<b>Add Accessible Namespaces</b>
|
||||||
<p>Cluster <b>{clusterStore.getById(clusterId).name}</b> does not have permissions to list namespaces. Please add the namespaces you have access to.</p>
|
<p>Cluster <b>{cluster.name}</b> does not have permissions to list namespaces. Please add the namespaces you have access to.</p>
|
||||||
<div className="flex gaps row align-left box grow">
|
<div className="flex gaps row align-left box grow">
|
||||||
<Button active outlined label="Go to Accessible Namespaces Settings" onClick={()=> {
|
<Button active outlined label="Go to Accessible Namespaces Settings" onClick={()=> {
|
||||||
navigate(clusterSettingsURL({ params: { clusterId }, fragment: "accessible-namespaces" }));
|
navigate(clusterSettingsURL({ params: { clusterId }, fragment: "accessible-namespaces" }));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user