mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Review fixes
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
8c8ada45c0
commit
59124e351b
@ -91,23 +91,15 @@ export class App extends React.Component {
|
||||
reaction(() => this.warningsTotal, (count: number) => {
|
||||
broadcastMessage(`cluster-warning-event-count:${getHostedCluster().id}`, count);
|
||||
}),
|
||||
|
||||
reaction(getHostedCluster, () => {
|
||||
this.setStartUrl();
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
||||
@observable startUrl: string = clusterURL();
|
||||
@observable startUrl = isAllowedResource(["events", "nodes", "pods"]) ? clusterURL() : workloadsURL();
|
||||
|
||||
@computed get warningsTotal(): number {
|
||||
return nodesStore.getWarningsCount() + eventStore.getWarningsCount();
|
||||
}
|
||||
|
||||
setStartUrl() {
|
||||
this.startUrl = isAllowedResource(["events", "nodes", "pods"]) ? clusterURL() : workloadsURL();
|
||||
}
|
||||
|
||||
getTabLayoutRoutes(menuItem: ClusterPageMenuRegistration) {
|
||||
const routes: TabLayoutRoute[] = [];
|
||||
|
||||
@ -190,7 +182,7 @@ export class App extends React.Component {
|
||||
<StatefulSetScaleDialog/>
|
||||
<ReplicaSetScaleDialog/>
|
||||
<CronJobTriggerDialog/>
|
||||
<CommandContainer/>
|
||||
<CommandContainer clusterId={getHostedCluster()?.id}/>
|
||||
</ErrorBoundary>
|
||||
</Router>
|
||||
);
|
||||
|
||||
@ -8,7 +8,7 @@ import { EventEmitter } from "../../../common/event-emitter";
|
||||
import { subscribeToBroadcast } from "../../../common/ipc";
|
||||
import { CommandDialog } from "./command-dialog";
|
||||
import { CommandRegistration, commandRegistry } from "../../../extensions/registries/command-registry";
|
||||
import { clusterStore, getHostedCluster } from "../../../common/cluster-store";
|
||||
import { clusterStore } from "../../../common/cluster-store";
|
||||
import { workspaceStore } from "../../../common/workspace-store";
|
||||
|
||||
export type CommandDialogEvent = {
|
||||
@ -28,9 +28,8 @@ export class CommandOverlay {
|
||||
}
|
||||
|
||||
@observer
|
||||
export class CommandContainer extends React.Component {
|
||||
export class CommandContainer extends React.Component<{ clusterId?: string }> {
|
||||
@observable.ref commandComponent: React.ReactElement;
|
||||
@observable cluster = getHostedCluster();
|
||||
|
||||
private escHandler(event: KeyboardEvent) {
|
||||
if (event.key === "Escape") {
|
||||
@ -56,8 +55,8 @@ export class CommandContainer extends React.Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (this.cluster) {
|
||||
subscribeToBroadcast(`command-palette:run-action:${this.cluster.id}`, (event, commandId: string) => {
|
||||
if (this.props.clusterId) {
|
||||
subscribeToBroadcast(`command-palette:run-action:${this.props.clusterId}`, (event, commandId: string) => {
|
||||
const command = this.findCommandById(commandId);
|
||||
|
||||
if (command) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user