Deployed e560baa2d to master with MkDocs 1.1.2 and mike 1.0.0

This commit is contained in:
GitHub Action committed 2021-04-19 15:53:35 +00:00
1 parent 9d9348a4ff
commit 8dd3c37633
266 files changed
+7875 -4052

No files matched your search

@@ -665,6 +665,18 @@
</li>
<li class="md-nav__item">
<a href="../protocol-handlers/" class="md-nav__link">
Protocol Handlers
</a>
</li>
</ul>
</nav>
</li>
@@ -917,7 +929,9 @@
<h1 id="main-extension">Main Extension<a class="headerlink" href="#main-extension" title="Permanent link">#</a></h1>
<p>The Main Extension API is the interface to Lens's main process. Lens runs in both main and renderer processes. The Main Extension API allows you to access, configure, and customize Lens data, add custom application menu items, and run custom code in Lens's main process.</p>
<p>The Main Extension API is the interface to Lens's main process.
Lens runs in both main and renderer processes.
The Main Extension API allows you to access, configure, and customize Lens data, add custom application menu items, and run custom code in Lens's main process.</p>
<h2 id="lensmainextension-class"><code>LensMainExtension</code> Class<a class="headerlink" href="#lensmainextension-class" title="Permanent link">#</a></h2>
<h3 id="onactivate-and-ondeactivate-methods"><code>onActivate()</code> and <code>onDeactivate()</code> Methods<a class="headerlink" href="#onactivate-and-ondeactivate-methods" title="Permanent link">#</a></h3>
<p>To create a main extension simply extend the <code>LensMainExtension</code> class:</p>
@@ -933,14 +947,21 @@
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div>
<p>Two methods enable you to run custom code: <code>onActivate()</code> and <code>onDeactivate()</code>. Enabling your extension calls <code>onActivate()</code> and disabling your extension calls <code>onDeactivate()</code>. You can initiate custom code by implementing <code>onActivate()</code>. Implementing <code>onDeactivate()</code> gives you the opportunity to clean up after your extension.</p>
<p>Two methods enable you to run custom code: <code>onActivate()</code> and <code>onDeactivate()</code>.
Enabling your extension calls <code>onActivate()</code> and disabling your extension calls <code>onDeactivate()</code>.
You can initiate custom code by implementing <code>onActivate()</code>.
Implementing <code>onDeactivate()</code> gives you the opportunity to clean up after your extension.</p>
<p>Disable extensions from the Lens Extensions page:</p>
<ol>
<li>Navigate to <strong>File</strong> &gt; <strong>Extensions</strong> in the top menu bar. (On Mac, it is <strong>Lens</strong> &gt; <strong>Extensions</strong>.)</li>
<li>Navigate to <strong>File</strong> &gt; <strong>Extensions</strong> in the top menu bar.
(On Mac, it is <strong>Lens</strong> &gt; <strong>Extensions</strong>.)</li>
<li>Click <strong>Disable</strong> on the extension you want to disable.</li>
</ol>
<p>The example above logs messages when the extension is enabled and disabled. To see standard output from the main process there must be a console connected to it. Achieve this by starting Lens from the command prompt.</p>
<p>The following example is a little more interesting. It accesses some Lens state data, and it periodically logs the name of the cluster that is currently active in Lens.</p>
<p>The example above logs messages when the extension is enabled and disabled.
To see standard output from the main process there must be a console connected to it.
Achieve this by starting Lens from the command prompt.</p>
<p>The following example is a little more interesting.
It accesses some Lens state data, and it periodically logs the name of the cluster that is currently active in Lens.</p>
<div class="highlight"><pre><span></span><code><span class="k">import</span> <span class="p">{</span> <span class="nx">LensMainExtension</span><span class="p">,</span> <span class="nx">Store</span> <span class="p">}</span> <span class="nx">from</span> <span class="s2">&quot;@k8slens/extensions&quot;</span><span class="p">;</span>
<span class="kd">const</span> <span class="nx">clusterStore</span> <span class="o">=</span> <span class="nx">Store</span><span class="p">.</span><span class="nx">clusterStore</span>
@@ -968,7 +989,9 @@
</code></pre></div>
<p>For more details on accessing Lens state data, please see the <a href="../stores">Stores</a> guide.</p>
<h3 id="appmenus"><code>appMenus</code><a class="headerlink" href="#appmenus" title="Permanent link">#</a></h3>
<p>The Main Extension API allows you to customize the UI application menu. Note that this is the only UI feature that the Main Extension API allows you to customize. The following example demonstrates adding an item to the <strong>Help</strong> menu.</p>
<p>The Main Extension API allows you to customize the UI application menu.
Note that this is the only UI feature that the Main Extension API allows you to customize.
The following example demonstrates adding an item to the <strong>Help</strong> menu.</p>
<div class="highlight"><pre><span></span><code><span class="k">import</span> <span class="p">{</span> <span class="nx">LensMainExtension</span> <span class="p">}</span> <span class="nx">from</span> <span class="s2">&quot;@k8slens/extensions&quot;</span><span class="p">;</span>
<span class="k">export</span> <span class="k">default</span> <span class="kd">class</span> <span class="nx">SamplePageMainExtension</span> <span class="k">extends</span> <span class="nx">LensMainExtension</span> <span class="p">{</span>
@@ -983,11 +1006,18 @@
<span class="p">]</span>
<span class="p">}</span>
</code></pre></div>
<p><code>appMenus</code> is an array of objects that satisfy the <code>MenuRegistration</code> interface. <code>MenuRegistration</code> extends React's <code>MenuItemConstructorOptions</code> interface. The properties of the appMenus array objects are defined as follows:</p>
<p><code>appMenus</code> is an array of objects that satisfy the <code>MenuRegistration</code> interface.
<code>MenuRegistration</code> extends React's <code>MenuItemConstructorOptions</code> interface.
The properties of the appMenus array objects are defined as follows:</p>
<ul>
<li><code>parentId</code> is the name of the menu where your new menu item will be listed. Valid values include: <code>"file"</code>, <code>"edit"</code>, <code>"view"</code>, and <code>"help"</code>. <code>"lens"</code> is valid on Mac only.</li>
<li><code>parentId</code> is the name of the menu where your new menu item will be listed.
Valid values include: <code>"file"</code>, <code>"edit"</code>, <code>"view"</code>, and <code>"help"</code>.
<code>"lens"</code> is valid on Mac only.</li>
<li><code>label</code> is the name of your menu item.</li>
<li><code>click()</code> is called when the menu item is selected. In this example, we simply log a message. However, you would typically have this navigate to a specific page or perform another operation. Note that pages are associated with the <a href="../renderer-extension/"><code>LensRendererExtension</code></a> class and can be defined in the process of extending it. </li>
<li><code>click()</code> is called when the menu item is selected.
In this example, we simply log a message.
However, you would typically have this navigate to a specific page or perform another operation.
Note that pages are associated with the <a href="../renderer-extension/"><code>LensRendererExtension</code></a> class and can be defined in the process of extending it.</li>
</ul>