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

Merge remote-tracking branch 'origin/master' into page_registry_issue_1258

# Conflicts:
#	extensions/support-page/renderer.tsx
This commit is contained in:
Roman 2020-11-12 14:52:24 +02:00
commit 356cbefddc
9 changed files with 61 additions and 31 deletions

View File

@ -6,7 +6,7 @@ In this topic, we'll teach you the fundamental concepts for building extensions.
Simple Lens extension that adds "Hello World" page to a cluster menu. Simple Lens extension that adds "Hello World" page to a cluster menu.
### Linux ### Setup the extension directory
First you will need to clone the [Lens Extension samples](https://github.com/lensapp/lens-extension-samples) repository to your local machine: First you will need to clone the [Lens Extension samples](https://github.com/lensapp/lens-extension-samples) repository to your local machine:
@ -16,12 +16,36 @@ git clone https://github.com/lensapp/lens-extension-samples.git
Next you need to create a symlink from the directory that Lens will monitor for user installed extensions to the sample extension, in this case **helloworld-sample**: Next you need to create a symlink from the directory that Lens will monitor for user installed extensions to the sample extension, in this case **helloworld-sample**:
**Linux & MacOS**
```sh ```sh
mkdir -p ~/.k8slens/extensions mkdir -p ~/.k8slens/extensions
cd ~/.k8slens/extensions cd ~/.k8slens/extensions
ln -s <lens-extension-samples directory>/helloworld-sample helloworld-sample ln -s lens-extension-samples/helloworld-sample helloworld-sample
``` ```
**Windows**
Create the directory that Lens will monitor for user installed extensions:
```sh
mkdir C:\Users\<user>\.k8slens\extensions -force
cd C:\Users\<user>\.k8slens\extensions
```
If you have administrator rights, you can create symlink to the sample extension, in this case **helloworld-sample**:
```sh
cmd /c mklink /D helloworld-sample lens-extension-samples\helloworld-sample
```
Without administrator rights, you need to copy the extensions sample directory into `C:\Users\<user>\.k8slens\extensions`:
```
Copy-Item 'lens-extension-samples\helloworld-sample' 'C:\Users\<user>\.k8slens\extensions\helloworld-sample'
```
### Build the extension
To build the extension you can use `make` or run the `npm` commands manually: To build the extension you can use `make` or run the `npm` commands manually:
```sh ```sh

View File

@ -14,8 +14,8 @@ export default class SupportPageRendererExtension extends LensRendererExtension
statusBarItems: Interface.StatusBarRegistration[] = [ statusBarItems: Interface.StatusBarRegistration[] = [
{ {
item: ( item: (
<div className="flex align-center gaps hover-highlight" onClick={() => this.navigate()}> <div className="SupportPageIcon flex align-center" onClick={() => this.navigate()}>
<Component.Icon material="help" smallest/> <Component.Icon interactive material="help" smallest/>
</div> </div>
) )
} }

View File

@ -10,4 +10,10 @@
margin-left: 2px; margin-left: 2px;
} }
} }
}
.SupportPageIcon {
color: white;
font-size: var(--font-size-small);
padding-right: calc(var(--padding) / 2);
} }

View File

@ -2,27 +2,19 @@
$spacing: $padding / 2; $spacing: $padding / 2;
--flex-gap: #{$spacing}; --flex-gap: #{$spacing};
font-size: $font-size-small; background-color: var(--blue);
background-color: #3d90ce;
padding: 0 2px; padding: 0 2px;
color: white;
height: 22px; height: 22px;
#current-workspace { #current-workspace {
font-size: var(--font-size-small);
color: white;
padding: $padding / 4 $padding / 2; padding: $padding / 4 $padding / 2;
cursor: pointer; cursor: pointer;
}
.hover-highlight {
&:hover { &:hover {
background-color: #ffffff33; background-color: #ffffff33;
cursor: pointer; cursor: pointer;
} }
} }
.extensions {
> * {
padding: $padding / 4 $padding / 2;
}
}
} }

View File

@ -13,7 +13,7 @@ export class BottomBar extends React.Component {
const { currentWorkspace } = workspaceStore; const { currentWorkspace } = workspaceStore;
return ( return (
<div className="BottomBar flex gaps"> <div className="BottomBar flex gaps">
<div id="current-workspace" className="flex gaps align-center hover-highlight"> <div id="current-workspace" className="flex gaps align-center">
<Icon smallest material="layers"/> <Icon smallest material="layers"/>
<span className="workspace-name">{currentWorkspace.name}</span> <span className="workspace-name">{currentWorkspace.name}</span>
</div> </div>

View File

@ -9,20 +9,6 @@
grid-area: main; grid-area: main;
position: relative; position: relative;
display: flex; display: flex;
> * {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
display: flex;
background-color: $mainBackground;
> * {
flex: 1;
}
}
} }
.ClustersMenu { .ClustersMenu {
@ -32,4 +18,18 @@
.BottomBar { .BottomBar {
grid-area: bottom-bar; grid-area: bottom-bar;
} }
#lens-views {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
display: flex;
background-color: $mainBackground;
iframe {
flex: 1;
}
}
} }

View File

@ -1,4 +1,6 @@
.ClusterView { .ClusterView {
flex: 1;
&:empty { &:empty {
display: none; display: none;
} }

View File

@ -34,7 +34,7 @@ export class ClusterView extends React.Component<Props> {
const { cluster } = this; const { cluster } = this;
const showStatus = cluster && (!cluster.available || !hasLoadedView(cluster.id) || !cluster.ready) const showStatus = cluster && (!cluster.available || !hasLoadedView(cluster.id) || !cluster.ready)
return ( return (
<div className="ClusterView"> <div className="ClusterView flex align-center">
{showStatus && ( {showStatus && (
<ClusterStatus key={cluster.id} clusterId={cluster.id} className="box center"/> <ClusterStatus key={cluster.id} clusterId={cluster.id} className="box center"/>
)} )}

View File

@ -5,6 +5,7 @@
--min-width: 570px; --min-width: 570px;
position: relative; position: relative;
width: 100%;
height: 100%; height: 100%;
display: grid !important; display: grid !important;
grid-template-rows: min-content 1fr; grid-template-rows: min-content 1fr;
@ -13,6 +14,11 @@
&.top { &.top {
position: fixed !important; // allow to cover ClustersMenu position: fixed !important; // allow to cover ClustersMenu
z-index: 1; z-index: 1;
left: 0;
top: 0;
right: 0;
bottom: 0;
background-color: $mainBackground;
// adds extra space for traffic-light top buttons (mac only) // adds extra space for traffic-light top buttons (mac only)
.is-mac & > .header { .is-mac & > .header {