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

moar random fixes

Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman 2020-08-10 21:58:00 +03:00
parent a57be8eb01
commit 45c65610b9
7 changed files with 24 additions and 14 deletions

View File

@ -15,8 +15,9 @@ import { getKubeConfigLocal, loadConfig, saveConfigToAppFiles, splitConfig, vali
import { clusterStore } from "../../../common/cluster-store";
import { workspaceStore } from "../../../common/workspace-store";
import { v4 as uuid } from "uuid"
import { navigation } from "../../navigation";
import { navigate } from "../../navigation";
import { userStore } from "../../../common/user-store";
import { clusterViewURL } from "../cluster-manager/cluster-view.route";
@observer
export class AddCluster extends React.Component {
@ -102,7 +103,7 @@ export class AddCluster extends React.Component {
httpsProxy: proxyServer || undefined,
},
});
navigation.goBack(); // return to previous opened page for the cluster view
navigate(clusterViewURL({ params: { clusterId } }))
} catch (err) {
this.error = String(err);
} finally {

View File

@ -70,9 +70,9 @@ export class App extends React.Component {
<Redirect exact from="/" to={this.startURL}/>
<Route component={NotFound}/>
</Switch>
<KubeObjectDetails/>
<Notifications/>
<ConfirmDialog/>
<KubeObjectDetails/>
<KubeConfigDialog/>
<AddRoleBindingDialog/>
<PodLogsDialog/>

View File

@ -9,6 +9,10 @@
position: relative;
grid-area: main;
display: flex;
> * {
flex: 1;
}
}
#lens-views {

View File

@ -22,12 +22,8 @@ export class ClusterStatus extends React.Component<Props> {
@observable authOutput: KubeAuthProxyLog[] = [];
@observable isReconnecting = false;
@computed get clusterId() {
return this.props.clusterId;
}
@computed get cluster(): Cluster {
return clusterStore.getById(this.clusterId);
get cluster(): Cluster {
return clusterStore.getById(this.props.clusterId);
}
@computed get hasErrors(): boolean {
@ -45,15 +41,17 @@ export class ClusterStatus extends React.Component<Props> {
error: res.error,
});
})
await this.refreshCluster();
if (!this.cluster.initialized) {
await this.refreshCluster();
}
}
componentWillUnmount() {
ipcRenderer.removeAllListeners(`kube-auth:${this.clusterId}`);
ipcRenderer.removeAllListeners(`kube-auth:${this.cluster.id}`);
}
refreshCluster = async () => {
await clusterIpc.activate.invokeFromRenderer(this.clusterId);
await clusterIpc.activate.invokeFromRenderer(this.cluster.id);
}
reconnect = async () => {

View File

@ -13,7 +13,7 @@ export class ClusterView extends React.Component {
return (
<div className="ClusterView flex column">
{showStatus && (
<ClusterStatus clusterId={cluster.id} className="box center"/>
<ClusterStatus key={cluster.id} clusterId={cluster.id} className="box center"/>
)}
</div>
)

View File

@ -69,7 +69,10 @@ export class ClustersMenu extends React.Component<Props> {
accent: true,
label: _i18n._(t`Remove`),
},
ok: () => clusterStore.removeById(cluster.id),
ok: () => {
clusterStore.removeById(cluster.id);
navigate(landingURL());
},
message: <p>Are you sure want to remove cluster <b title={cluster.id}>{cluster.contextName}</b>?</p>,
})
}

View File

@ -9,6 +9,8 @@ import { _i18n } from "./i18n";
import { ClusterManager } from "./components/cluster-manager";
import { ErrorBoundary } from "./components/error-boundary";
import { WhatsNew, whatsNewRoute } from "./components/+whats-new";
import { Notifications } from "./components/notifications";
import { ConfirmDialog } from "./components/confirm-dialog";
@observer
export class LensApp extends React.Component {
@ -23,6 +25,8 @@ export class LensApp extends React.Component {
<Route component={ClusterManager}/>
</Switch>
</ErrorBoundary>
<Notifications/>
<ConfirmDialog/>
</Router>
</I18nProvider>
)