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

tweaks workspace overview layout

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen 2021-03-09 07:31:19 +02:00
parent 74d8ff212f
commit e0778fa8b4
6 changed files with 43 additions and 17 deletions

View File

@ -352,7 +352,7 @@ export class AddCluster extends React.Component {
return ( return (
<DropFileInput onDropFiles={this.onDropKubeConfig}> <DropFileInput onDropFiles={this.onDropKubeConfig}>
<PageLayout className="AddClusters" header={<h2>Add Clusters</h2>}> <PageLayout className="AddClusters" header={<h2>Add Clusters</h2>} showOnTop={true}>
<h2>Add Clusters from Kubeconfig</h2> <h2>Add Clusters from Kubeconfig</h2>
{this.renderInfo()} {this.renderInfo()}
{this.renderKubeConfigSource()} {this.renderKubeConfigSource()}

View File

@ -60,6 +60,15 @@
} }
.PageLayout.LandingOverview { .PageLayout.LandingOverview {
--width: 80%; --width: 100%;
--height: 100%;
text-align: center; text-align: center;
}
.content-wrapper {
.content {
margin: unset;
max-width: unset;
}
}
}

View File

@ -23,7 +23,7 @@ export class LandingPage extends React.Component {
Associate clusters and choose the ones you want to access via quick launch menu by clicking the + button. Associate clusters and choose the ones you want to access via quick launch menu by clicking the + button.
</p> </p>
</div> </div>
) );
} }
render() { render() {
@ -46,11 +46,11 @@ export class LandingPage extends React.Component {
</p> </p>
</div> </div>
</div> </div>
) );
} }
return ( return (
<PageLayout className="LandingOverview flex column gaps" header={header} provideBackButtonNavigation={false} contentGaps={false}> <PageLayout className="LandingOverview flex" header={header} provideBackButtonNavigation={true} showOnTop={true}>
<WorkspaceOverview workspace={this.workspace}/> <WorkspaceOverview workspace={this.workspace}/>
</PageLayout> </PageLayout>
); );

View File

@ -1,6 +1,8 @@
.WorkspaceOverview { .WorkspaceOverview {
background-color: var(--mainBackground); max-height: 50%;
.Table {
padding-bottom: 60px;
}
.TableCell { .TableCell {
display: flex; display: flex;
align-items: left; align-items: left;
@ -10,5 +12,17 @@
flex-grow: 0.2; flex-grow: 0.2;
padding: 0; padding: 0;
} }
&.online {
color: var(--colorSuccess);
}
} }
}
.TableCell.status {
flex: 0.1;
}
.TableCell.version {
flex: 0.2;
}
}

View File

@ -8,6 +8,8 @@ import { ClusterItem, WorkspaceClusterStore } from "./workspace-cluster.store";
import { navigate } from "../../navigation"; import { navigate } from "../../navigation";
import { clusterViewURL } from "../cluster-manager/cluster-view.route"; import { clusterViewURL } from "../cluster-manager/cluster-view.route";
import { WorkspaceClusterMenu } from "./workspace-cluster-menu"; import { WorkspaceClusterMenu } from "./workspace-cluster-menu";
import { kebabCase } from "lodash";
import { addClusterURL } from "../+add-cluster";
interface Props { interface Props {
workspace: Workspace; workspace: Workspace;
@ -25,15 +27,15 @@ export class WorkspaceOverview extends Component<Props> {
showCluster = ({ clusterId }: ClusterItem) => { showCluster = ({ clusterId }: ClusterItem) => {
navigate(clusterViewURL({ params: { clusterId } })); navigate(clusterViewURL({ params: { clusterId } }));
}; };
render() { render() {
const { workspace } = this.props; const { workspace } = this.props;
const workspaceClusterStore = new WorkspaceClusterStore(workspace.id); const workspaceClusterStore = new WorkspaceClusterStore(workspace.id);
workspaceClusterStore.loadAll(); workspaceClusterStore.loadAll();
return ( return (
<ItemListLayout <ItemListLayout
renderHeaderTitle={<div>Clusters</div>} renderHeaderTitle={<div>Clusters</div>}
isClusterScoped isClusterScoped
isSearchable={false} isSearchable={false}
@ -42,22 +44,23 @@ export class WorkspaceOverview extends Component<Props> {
store={workspaceClusterStore} store={workspaceClusterStore}
sortingCallbacks={{ sortingCallbacks={{
[sortBy.name]: (item: ClusterItem) => item.name, [sortBy.name]: (item: ClusterItem) => item.name,
[sortBy.contextName]: (item: ClusterItem) => item.cluster.contextName,
[sortBy.version]: (item: ClusterItem) => item.cluster.version, [sortBy.version]: (item: ClusterItem) => item.cluster.version,
}} }}
renderTableHeader={[ renderTableHeader={[
{ title: "Name", className: "name", sortBy: sortBy.name }, { title: "Name", className: "name", sortBy: sortBy.name },
{ title: "Context", className: "context", sortBy: sortBy.contextName },
{ title: "Version", className: "version", sortBy: sortBy.version }, { title: "Version", className: "version", sortBy: sortBy.version },
{ title: "Status", className: "status" }, { title: "Status", className: "status" },
]} ]}
renderTableContents={(item: ClusterItem) => [ renderTableContents={(item: ClusterItem) => [
item.name, item.name,
item.cluster.contextName,
item.cluster.version, item.cluster.version,
item.cluster.online ? "online" : "offline" { title: item.cluster.online ? "online" : "offline", className: kebabCase(item.cluster.online ? "online" : "offline") }
]} ]}
onDetails={this.showCluster} onDetails={this.showCluster}
addRemoveButtons={{
addTooltip: "Add Cluster",
onAdd: () => navigate(addClusterURL()),
}}
renderItemMenu={(clusterItem: ClusterItem) => ( renderItemMenu={(clusterItem: ClusterItem) => (
<WorkspaceClusterMenu clusterItem={clusterItem} workspace={workspace} workspaceClusterStore={workspaceClusterStore}/> <WorkspaceClusterMenu clusterItem={clusterItem} workspace={workspace} workspaceClusterStore={workspaceClusterStore}/>
)} )}

View File

@ -24,7 +24,7 @@ export class ChooseWorkspace extends React.Component {
return { value: workspace.id, label: workspace.name }; return { value: workspace.id, label: workspace.name };
}); });
options.push({ value: ChooseWorkspace.overviewActionId, label: "Workspace: Overview" }); options.push({ value: ChooseWorkspace.overviewActionId, label: "Show current workspace overview ..." });
options.push({ value: ChooseWorkspace.addActionId, label: "Add workspace ..." }); options.push({ value: ChooseWorkspace.addActionId, label: "Add workspace ..." });