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

added landing-page

Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman 2020-07-15 14:37:18 +03:00
parent d20e61b3e2
commit 717dfff851
10 changed files with 46 additions and 10 deletions

View File

@ -47,7 +47,7 @@ export default {
display: flex;
justify-content: center;
align-items: center;
background: #282b2f url(../assets/img/crane.svg) no-repeat;
background: #282b2f url(../../components/icon/crane.svg) no-repeat;
background-position: 0px 35%;
background-size: 85%;
background-clip: content-box;

View File

@ -4,7 +4,7 @@
<div class="row">
<div class="col-md whats-new-text-wrapper">
<div class="logo">
<img src="../assets/img/lens-logo.svg">
<img src="../../components/icon/lens-logo.svg">
</div>
<!-- Safe to use v-html as we self generate the html locally only -->
<!-- eslint-disable-next-line vue/no-v-html -->
@ -59,7 +59,7 @@ export default {
<style lang="scss" scoped>
.content {
background: #282b2f url(../assets/img/crane.svg) no-repeat;
background: #282b2f url(../../components/icon/crane.svg) no-repeat;
background-position: 0px 35%;
background-size: 85%;
background-clip: content-box;

View File

@ -1 +1,2 @@
export * from "./landing-page.route"
export * from "./landing-page"

View File

@ -0,0 +1,8 @@
import { RouteProps } from "react-router";
import { buildURL } from "../../navigation";
export const landingRoute: RouteProps = {
path: "/landing"
}
export const landingURL = buildURL(landingRoute.path)

View File

@ -1,3 +1,15 @@
.LandingPage {
height: 100%;
background: #282b2f url(../../components/icon/crane.svg) no-repeat;
background-position: 0 35%;
background-size: 85%;
background-clip: content-box;
text-align: center;
h1 {
color: white;
text-align: center;
font-size: 28px;
font-weight: normal;
}
}

View File

@ -1,13 +1,25 @@
import "./landing-page.scss"
import React from "react";
import { observer } from "mobx-react";
import { clusterStore } from "../../../common/cluster-store";
import { Trans } from "@lingui/macro";
@observer
export class LandingPage extends React.Component {
render() {
const noClusters = !clusterStore.clusters.size;
return (
<div className="LandingPage">
LandingPage
<div className="LandingPage flex">
{noClusters && (
<div className="no-clusters flex column gaps box center">
<h1>
<Trans>Welcome!</Trans>
</h1>
<p>
<Trans>Get started by associating one or more clusters to Lens.</Trans>
</p>
</div>
)}
</div>
)
}

View File

@ -31,7 +31,7 @@ import { CustomResources } from "./+custom-resources/custom-resources";
import { crdRoute } from "./+custom-resources";
import { isAllowedResource } from "../api/rbac";
import { AddCluster, addClusterRoute } from "./+add-cluster";
import { LandingPage } from "./+landing-page";
import { LandingPage, landingRoute } from "./+landing-page";
import { clusterStore } from "../../common/cluster-store";
import { ClusterSettings, clusterSettingsRoute } from "./+cluster-settings";
@ -46,13 +46,14 @@ export class App extends React.Component {
}
render() {
const showLanding = clusterStore.clusters.size === 0;
const noClusters = clusterStore.clusters.size === 0;
const homeUrl = isAllowedResource(["events", "nodes", "pods"]) ? clusterURL() : workloadsURL();
return (
<Fragment>
<Switch>
<Switch>
{showLanding && <Route component={LandingPage}/>}
{noClusters && <Route component={LandingPage}/>}
<Route component={LandingPage} {...landingRoute}/>
<Route component={AddCluster} {...addClusterRoute}/>
<Route component={ClusterSettings} {...clusterSettingsRoute}/>
<Route component={Cluster} {...clusterRoute}/>

View File

@ -15,6 +15,7 @@ import { Badge } from "../badge";
import { navigate } from "../../navigation";
import { addClusterURL } from "../+add-cluster";
import { clusterSettingsURL } from "../+cluster-settings";
import { landingURL } from "../+landing-page";
// fixme: allow to rearrange clusters with drag&drop
// fixme: make add-icon's tooltip visible on init
@ -45,12 +46,13 @@ export class ClustersMenu extends React.Component<Props> {
label: _i18n._(t`Settings`),
click: () => navigate(clusterSettingsURL())
}));
// fixme: disconnect cluster
if (cluster.initialized) {
menu.append(new MenuItem({
label: _i18n._(t`Disconnect`),
click: () => {
console.log(`//fixme: disconnect cluster`, cluster);
navigate("/");
navigate(landingURL());
}
}))
}

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB