Deployed 411b9a9a88 to master with MkDocs 1.2.3 and mike 1.1.2

This commit is contained in:
GitHub Action committed 2022-01-19 15:31:44 +00:00
1 parent cafbc64c83
commit aa19d970b7
18 files changed
+2191 -43

No files matched your search

+26 -10
View File
@@ -546,15 +546,15 @@
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#catalogcategoryregistry" class="md-nav__link">
CatalogCategoryRegistry
<a href="#categories" class="md-nav__link">
Categories
</a>
</li>
<li class="md-nav__item">
<a href="#catalogentityregistry" class="md-nav__link">
CatalogEntityRegistry
<a href="#entities" class="md-nav__link">
Entities
</a>
</li>
@@ -761,15 +761,15 @@
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#catalogcategoryregistry" class="md-nav__link">
CatalogCategoryRegistry
<a href="#categories" class="md-nav__link">
Categories
</a>
</li>
<li class="md-nav__item">
<a href="#catalogentityregistry" class="md-nav__link">
CatalogEntityRegistry
<a href="#entities" class="md-nav__link">
Entities
</a>
</li>
@@ -789,8 +789,24 @@
<h1 id="catalog-wip">Catalog (WIP)<a class="headerlink" href="#catalog-wip" title="Permanent link">#</a></h1>
<h2 id="catalogcategoryregistry">CatalogCategoryRegistry<a class="headerlink" href="#catalogcategoryregistry" title="Permanent link">#</a></h2>
<h2 id="catalogentityregistry">CatalogEntityRegistry<a class="headerlink" href="#catalogentityregistry" title="Permanent link">#</a></h2>
<p>This guide is a brief overview about how the catalog works within Lens.
The catalog should be thought of as the single source of truth about data within Lens.</p>
<p>The data flow is unidirectional, it only flows from the main side to the renderer side.
All data is public within the catalog.</p>
<h2 id="categories">Categories<a class="headerlink" href="#categories" title="Permanent link">#</a></h2>
<p>A category is the declaration to the catalog of a specific kind of entity.
It declares the currently supported versions of that kind of entity but providing the constructors for the entity classes.</p>
<p>To declare a new category class you must create a new class that extends <a href="../../api/classes/Common.Catalog.CatalogCategory/">Common.Catalog.CatalogCategory</a> and implement all of the abstract fields.</p>
<p>The categories provided by Lens itself have the following names:</p>
<ul>
<li><code>KubernetesClusters</code></li>
<li><code>WebLinks</code></li>
<li><code>General</code></li>
</ul>
<p>To register a category, call the <code>Main.Catalog.catalogCategories.add()</code> and <code>Renderer.Catalog.catalogCategories.add()</code> with instances of your class.</p>
<h2 id="entities">Entities<a class="headerlink" href="#entities" title="Permanent link">#</a></h2>
<p>An entity is the data within the catalog.
All entities are typed and the class instances will be recreated on the renderer side by the catalog and the category registrations.</p>
+4
View File
@@ -853,6 +853,10 @@ For introductory information about the Lens Extension API, please see <a href=".
<td><a href="ipc/">Sending Data between main and renderer</a></td>
<td></td>
</tr>
<tr>
<td><a href="catalog/">Catalog Entities and Categories</a></td>
<td></td>
</tr>
</tbody>
</table>
<h2 id="samples">Samples<a class="headerlink" href="#samples" title="Permanent link">#</a></h2>
@@ -854,11 +854,11 @@ It also provides convenient methods for navigating to built-in Lens pages and ex
<span class="k">export</span> <span class="k">default</span> <span class="kd">class</span> <span class="nx">ExampleExtensionMain</span> <span class="k">extends</span> <span class="nx">Main</span><span class="p">.</span><span class="nx">LensExtension</span> <span class="p">{</span>
<span class="nx">onActivate</span><span class="p">()</span> <span class="p">{</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">&#39;custom main process extension code started&#39;</span><span class="p">);</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;custom main process extension code started&quot;</span><span class="p">);</span>
<span class="p">}</span>
<span class="nx">onDeactivate</span><span class="p">()</span> <span class="p">{</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">&#39;custom main process extension de-activated&#39;</span><span class="p">);</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;custom main process extension de-activated&quot;</span><span class="p">);</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div>
@@ -869,13 +869,13 @@ Implementing <code>onDeactivate()</code> gives you the opportunity to clean up a
<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>
(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>For more details on accessing Lens state data, please see the <a href="../stores">Stores</a> guide.</p>
<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.
The following example demonstrates adding an item to the <strong>Help</strong> menu.</p>
@@ -888,9 +888,9 @@ The following example demonstrates adding an item to the <strong>Help</strong> m
<span class="nx">label</span><span class="o">:</span> <span class="s2">&quot;Sample&quot;</span><span class="p">,</span>
<span class="nx">click</span><span class="p">()</span> <span class="p">{</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Sample clicked&quot;</span><span class="p">);</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">},</span>
<span class="p">},</span>
<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.
@@ -898,13 +898,13 @@ The following example demonstrates adding an item to the <strong>Help</strong> m
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>
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>Renderer.LensExtension</code></a> class and can be defined in the process of extending it.</li>
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>Renderer.LensExtension</code></a> class and can be defined in the process of extending it.</li>
</ul>
<p>The following example demonstrates how an application menu can be used to navigate to such a page:</p>
<div class="highlight"><pre><span></span><code><span class="k">import</span> <span class="p">{</span> <span class="nx">Main</span> <span class="p">}</span> <span class="kr">from</span> <span class="s2">&quot;@k8slens/extensions&quot;</span><span class="p">;</span>
@@ -914,9 +914,9 @@ Note that pages are associated with the <a href="../renderer-extension/"><code>R
<span class="p">{</span>
<span class="nx">parentId</span><span class="o">:</span> <span class="s2">&quot;help&quot;</span><span class="p">,</span>
<span class="nx">label</span><span class="o">:</span> <span class="s2">&quot;Sample&quot;</span><span class="p">,</span>
<span class="nx">click</span><span class="o">:</span> <span class="p">()</span> <span class="p">=&gt;</span> <span class="k">this</span><span class="p">.</span><span class="nx">navigate</span><span class="p">(</span><span class="s2">&quot;myGlobalPage&quot;</span><span class="p">)</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="nx">click</span><span class="o">:</span> <span class="p">()</span> <span class="p">=&gt;</span> <span class="k">this</span><span class="p">.</span><span class="nx">navigate</span><span class="p">(</span><span class="s2">&quot;myGlobalPage&quot;</span><span class="p">),</span>
<span class="p">},</span>
<span class="p">];</span>
<span class="p">}</span>
</code></pre></div>
<p>When the menu item is clicked the <code>navigate()</code> method looks for and displays a global page with id <code>"myGlobalPage"</code>.
@@ -927,20 +927,24 @@ This page would be defined in your extension's <code>Renderer.LensExtension</cod
<span class="nx">label?</span>: <span class="kt">string</span><span class="p">;</span>
<span class="nx">click</span><span class="o">?:</span> <span class="p">(</span><span class="nx">menuItem</span>: <span class="kt">TrayMenuRegistration</span><span class="p">)</span> <span class="p">=&gt;</span> <span class="ow">void</span><span class="p">;</span>
<span class="nx">id?</span>: <span class="kt">string</span><span class="p">;</span>
<span class="kr">type</span><span class="o">?:</span> <span class="s2">&quot;normal&quot;</span> <span class="o">|</span> <span class="s2">&quot;separator&quot;</span> <span class="o">|</span> <span class="s2">&quot;submenu&quot;</span>
<span class="kr">type</span><span class="o">?:</span> <span class="s2">&quot;normal&quot;</span> <span class="o">|</span> <span class="s2">&quot;separator&quot;</span> <span class="o">|</span> <span class="s2">&quot;submenu&quot;</span><span class="p">;</span>
<span class="nx">toolTip?</span>: <span class="kt">string</span><span class="p">;</span>
<span class="nx">enabled?</span>: <span class="kt">boolean</span><span class="p">;</span>
<span class="nx">submenu?</span>: <span class="kt">TrayMenuRegistration</span><span class="p">[]</span>
<span class="nx">submenu?</span>: <span class="kt">TrayMenuRegistration</span><span class="p">[];</span>
<span class="p">}</span>
</code></pre></div>
<p>The following example demonstrates how tray menus can be added from extension:</p>
<div class="highlight"><pre><span></span><code><span class="k">import</span> <span class="p">{</span> <span class="nx">Main</span> <span class="p">}</span> <span class="kr">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">SampleTrayMenuMainExtension</span> <span class="k">extends</span> <span class="nx">Main</span><span class="p">.</span><span class="nx">LensExtension</span> <span class="p">{</span>
<span class="nx">trayMenus</span> <span class="o">=</span> <span class="p">[{</span>
<span class="nx">label</span><span class="o">:</span> <span class="s2">&quot;menu from the extension&quot;</span><span class="p">,</span>
<span class="nx">click</span><span class="o">:</span> <span class="p">()</span> <span class="p">=&gt;</span> <span class="p">{</span> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;tray menu clicked!&quot;</span><span class="p">)</span> <span class="p">}</span>
<span class="p">}]</span>
<span class="nx">trayMenus</span> <span class="o">=</span> <span class="p">[</span>
<span class="p">{</span>
<span class="nx">label</span><span class="o">:</span> <span class="s2">&quot;menu from the extension&quot;</span><span class="p">,</span>
<span class="nx">click</span><span class="o">:</span> <span class="p">()</span> <span class="p">=&gt;</span> <span class="p">{</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;tray menu clicked!&quot;</span><span class="p">);</span>
<span class="p">},</span>
<span class="p">},</span>
<span class="p">];</span>
<span class="p">}</span>
</code></pre></div>
<h3 id="addcatalogsource-and-removecatalogsource-methods"><code>addCatalogSource()</code> and <code>removeCatalogSource()</code> Methods<a class="headerlink" href="#addcatalogsource-and-removecatalogsource-methods" title="Permanent link">#</a></h3>