-
Notifications
You must be signed in to change notification settings - Fork 0
/
atom.xml
59 lines (30 loc) · 28.8 KB
/
atom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Chris Jericho's Blog</title>
<link href="http://example.com/atom.xml" rel="self"/>
<link href="http://example.com/"/>
<updated>2022-05-26T08:55:37.965Z</updated>
<id>http://example.com/</id>
<author>
<name>Chris Jericho</name>
</author>
<generator uri="https://hexo.io/">Hexo</generator>
<entry>
<title>自定义 LIGHTNING WEB 组件中的 APEX 类资源管理器</title>
<link href="http://example.com/2022/05/26/%E8%87%AA%E5%AE%9A%E4%B9%89LWC%E7%BB%84%E4%BB%B6-Apex%E8%B5%84%E6%BA%90%E7%AE%A1%E7%90%86%E5%99%A8/"/>
<id>http://example.com/2022/05/26/%E8%87%AA%E5%AE%9A%E4%B9%89LWC%E7%BB%84%E4%BB%B6-Apex%E8%B5%84%E6%BA%90%E7%AE%A1%E7%90%86%E5%99%A8/</id>
<published>2022-05-26T08:27:21.291Z</published>
<updated>2022-05-26T08:55:37.965Z</updated>
<content type="html"><![CDATA[<h2 id="自定义-LIGHTNING-WEB-组件中的-APEX-类资源管理器"><a href="#自定义-LIGHTNING-WEB-组件中的-APEX-类资源管理器" class="headerlink" title="自定义 LIGHTNING WEB 组件中的 APEX 类资源管理器"></a>自定义 LIGHTNING WEB 组件中的 APEX 类资源管理器</h2><p>您已被要求为 Salesforce 组织中的顶级课程提供配置文件级别的安全性,但您发现很难找到它,因为有成千上万的顶级课程。本博客将为您提供一个原生解决方案,可用于主页、Lightning 应用程序页面或记录页面,以允许通过查找选项快速找到 apex 类。</p><h2 id="解决方案设计-Apex-类资源管理器"><a href="#解决方案设计-Apex-类资源管理器" class="headerlink" title="解决方案设计 - Apex 类资源管理器"></a><strong>解决方案设计 - Apex 类资源管理器</strong></h2><p>我们将拥有一个 Lightning Web 组件和 Apex 类控制器。LWC 在 js 文件中定义了一个搜索输入和客户端处理函数绑定到它。该函数调用一个顶点方法,该方法接收搜索词作为输入参数并返回顶点类的列表。</p><h2 id="元数据列表-–-Apex-类资源管理器"><a href="#元数据列表-–-Apex-类资源管理器" class="headerlink" title="元数据列表 – Apex 类资源管理器"></a><strong>元数据列表 – Apex 类资源管理器</strong></h2><p>apexClassExplorerController(Apex 类)<br>apexClassExplorer (LWC)<br>apexClassExplorerController<br>fetchApexClass 返回顶点类列表并接受字符串输入参数。</p><h2 id="apexClassExplorerController"><a href="#apexClassExplorerController" class="headerlink" title="apexClassExplorerController"></a><strong>apexClassExplorerController</strong></h2><p>fetchApexClass 返回顶点类列表并接受字符串输入参数。</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">public with sharing class apexClassExplorerController {</span><br><span class="line"> @AuraEnabled</span><br><span class="line"> public static List<ApexClass> fetchApexClass(String searchKey){</span><br><span class="line"> String key = '%' + searchKey + '%';</span><br><span class="line"> try {</span><br><span class="line"> return [SELECT Id, NamespacePrefix, Name, ApiVersion, Status, IsValid, BodyCrc,Body, LengthWithoutComments, CreatedDate, CreatedBy.Name, LastModifiedDate, LastModifiedBy.Name, SystemModstamp FROM ApexClass WHERE Name LIKE :key];</span><br><span class="line"> } catch (Exception e) {</span><br><span class="line"> throw new AuraHandledException(e.getMessage());</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line">}</span><br><span class="line"></span><br></pre></td></tr></table></figure><h2 id="apexClassExplorer-html"><a href="#apexClassExplorer-html" class="headerlink" title="apexClassExplorer.html"></a><strong>apexClassExplorer.html</strong></h2><p>HTML 文件具有搜索类型的闪电输入和一个迭代器,该迭代器迭代由闪电网络组件的顶点控制器返回的顶点类列表。HTML 文件还具有用于编辑、查看代码和隐藏所选顶点类的内联顶点代码的按钮。</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br></pre></td><td class="code"><pre><span class="line"><template></span><br><span class="line"> <lightning-card title="Apex Class Search" icon-name="custom:custom57"></span><br><span class="line"> <div class="slds-var-m-around_medium"></span><br><span class="line"> <lightning-input type="search" onchange={handleKeyChange}</span><br><span class="line"> class="slds-show slds-is-relative slds-var-m-bottom_small" label="Search"></span><br><span class="line"> </lightning-input></span><br><span class="line"> <template if:true={apexClasses}></span><br><span class="line"> <template for:each={apexClasses} for:item="apex"></span><br><span class="line"> <lightning-card key={apex.Id}></span><br><span class="line"> <h3 slot="title"></span><br><span class="line"> <lightning-icon icon-name="doctype:xml" alternative-text="XML file" title="XML"></span><br><span class="line"> </lightning-icon></span><br><span class="line"> {apex.Name}</span><br><span class="line"> </h3></span><br><span class="line"> <lightning-button label="Edit" onclick={handleEdit} slot="actions" data-url={apex.Id}></span><br><span class="line"> </lightning-button></span><br><span class="line"> <lightning-button label="View" onclick={handleView} data-id={apex.Id} slot="actions"></span><br><span class="line"> </lightning-button></span><br><span class="line"> <lightning-button if:true={apex.showCode} label="Hide" onclick={handleHide} data-id={apex.Id}</span><br><span class="line"> slot="actions"></span><br><span class="line"> </lightning-button></span><br><span class="line"> <div class="slds-scrollable"></span><br><span class="line"> <div class="slds-text-longform"></span><br><span class="line"> <div class="slds-page-header__row slds-page-header__row_gutters"></span><br><span class="line"> <div class="slds-page-header__col-details"></span><br><span class="line"> <ul class="slds-page-header__detail-row" style="list-style: none;"></span><br><span class="line"> <li class="slds-page-header__detail-block"></span><br><span class="line"> <div class="slds-text-title slds-truncate" title="Api Version">Api</span><br><span class="line"> Version</span><br><span class="line"> </div></span><br><span class="line"> <div class="slds-truncate" title={apex.ApiVersion}>{apex.ApiVersion}</span><br><span class="line"> </div></span><br><span class="line"> </li></span><br><span class="line"> <li class="slds-page-header__detail-block"></span><br><span class="line"> <div class="slds-text-title slds-truncate" title="Status">Status</div></span><br><span class="line"> <div class="slds-truncate" title={apex.Status}>{apex.Status}</div></span><br><span class="line"> </li></span><br><span class="line"> <li class="slds-page-header__detail-block"></span><br><span class="line"> <div class="slds-text-title slds-truncate" title="Namespace Prefix"></span><br><span class="line"> Namespace Prefix</span><br><span class="line"> </div></span><br><span class="line"> <div class="slds-truncate" title={apex.NamespacePrefix}></span><br><span class="line"> {apex.NamespacePrefix}</span><br><span class="line"> </div></span><br><span class="line"> </li></span><br><span class="line"> <li class="slds-page-header__detail-block"></span><br><span class="line"> <div class="slds-text-title slds-truncate" title="IsValid">Created Date</span><br><span class="line"> </div></span><br><span class="line"> <div class="slds-truncate" title={apex.IsValid}>{apex.CreatedDate}</div></span><br><span class="line"> </li></span><br><span class="line"> <li class="slds-page-header__detail-block"></span><br><span class="line"> <div class="slds-text-title slds-truncate" title="IsValid">Created By</span><br><span class="line"> Name</span><br><span class="line"> </div></span><br><span class="line"> <div class="slds-truncate" title={apex.IsValid}>{apex.CreatedBy.Name}</span><br><span class="line"> </div></span><br><span class="line"> </li></span><br><span class="line"> <li class="slds-page-header__detail-block"></span><br><span class="line"> <div class="slds-text-title slds-truncate" title="IsValid">Last Modified</span><br><span class="line"> Date</span><br><span class="line"> </div></span><br><span class="line"> <div class="slds-truncate" title={apex.IsValid}>{apex.LastModifiedDate}</span><br><span class="line"> </div></span><br><span class="line"> </li></span><br><span class="line"> <li class="slds-page-header__detail-block"></span><br><span class="line"> <div class="slds-text-title slds-truncate" title="IsValid">Last Modified</span><br><span class="line"> By Name</span><br><span class="line"> </div></span><br><span class="line"> <div class="slds-truncate" title={apex.IsValid}></span><br><span class="line"> {apex.LastModifiedBy.Name}</span><br><span class="line"> </div></span><br><span class="line"> </li></span><br><span class="line"> </ul></span><br><span class="line"> </div></span><br><span class="line"> </div></span><br><span class="line"> <blockquote if:true={apex.showCode}></span><br><span class="line"> <pre></span><br><span class="line"> <code class="language-html"></span><br><span class="line"> {apex.Body}</span><br><span class="line"> </code></span><br><span class="line"> </pre></span><br><span class="line"> </blockquote></span><br><span class="line"> </div></span><br><span class="line"> </div></span><br><span class="line"> </lightning-card></span><br><span class="line"> </template></span><br><span class="line"> </template></span><br><span class="line"> </div></span><br><span class="line"> </lightning-card></span><br><span class="line"></template></span><br></pre></td></tr></table></figure><h2 id="ApexClassExplorer-js"><a href="#ApexClassExplorer-js" class="headerlink" title="ApexClassExplorer.js"></a><strong>ApexClassExplorer.js</strong></h2><p>Lightning Web 组件的 JavaScript 文件有以下方法:-<br>handleKeyChange - 它绑定到搜索输入并在值更改时触发。它根据搜索输入进行顶点类的顶点调用和返回列表。</p><p>handleView – 每当用户单击迭代记录列表上的查看按钮时,都会触发此方法。它基本上显示所选顶点类的顶点代码。</p><p>handleHide – 每当用户单击迭代记录列表上的隐藏按钮时触发。它基本上隐藏了所选顶点类的顶点代码。</p><p>handleEdit – 编辑按钮将用户带到设置中顶点类的标准记录页面。</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br></pre></td><td class="code"><pre><span class="line">import { LightningElement, track } from 'lwc';</span><br><span class="line">import fetchApexClass from '@salesforce/apex/apexClassExplorerController.fetchApexClass';</span><br><span class="line">/** The delay used when debouncing event handlers before invoking Apex. */</span><br><span class="line">const DELAY = 350;</span><br><span class="line">export default class ApexClassExplorer extends LightningElement {</span><br><span class="line"> @track apexClasses;</span><br><span class="line"> error;</span><br><span class="line"></span><br><span class="line"> handleKeyChange(event) {</span><br><span class="line"> // Debouncing this method: Do not actually invoke the Apex call as long as this function is</span><br><span class="line"> // being called within a delay of DELAY. This is to avoid a very large number of Apex method calls.</span><br><span class="line"> window.clearTimeout(this.delayTimeout);</span><br><span class="line"> const searchKey = event.target.value;</span><br><span class="line"> // eslint-disable-next-line @lwc/lwc/no-async-operation</span><br><span class="line"> this.delayTimeout = setTimeout(() => {</span><br><span class="line"> fetchApexClass({ searchKey: searchKey })</span><br><span class="line"> .then((result) => {</span><br><span class="line"> result.forEach(element => {</span><br><span class="line"> element.showCode = false;</span><br><span class="line"> });</span><br><span class="line"> this.apexClasses = result;</span><br><span class="line"> this.error = undefined;</span><br><span class="line"> })</span><br><span class="line"> .catch((error) => {</span><br><span class="line"> this.error = error;</span><br><span class="line"> this.apexClasses = undefined;</span><br><span class="line"> });</span><br><span class="line"> }, DELAY);</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> handleView(event) {</span><br><span class="line"> const dataid = event.target.dataset.id;</span><br><span class="line"> this.apexClasses = this.apexClasses.map(x => {</span><br><span class="line"> if (x.Id == dataid) {</span><br><span class="line"> x.showCode = true;</span><br><span class="line"> }</span><br><span class="line"> return x;</span><br><span class="line"> });</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> handleHide(event) {</span><br><span class="line"> const dataid = event.target.dataset.id;</span><br><span class="line"> this.apexClasses = this.apexClasses.map(x => {</span><br><span class="line"> if (x.Id == dataid) {</span><br><span class="line"> x.showCode = false;</span><br><span class="line"> }</span><br><span class="line"> return x;</span><br><span class="line"> });</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> handleEdit(event) {</span><br><span class="line"> const url = window.location.origin + '/' + event.target.dataset.url;</span><br><span class="line"> window.open(url);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure><h2 id="ApexClassExplorer-js-meta-xml"><a href="#ApexClassExplorer-js-meta-xml" class="headerlink" title="ApexClassExplorer.js-meta.xml"></a><strong>ApexClassExplorer.js-meta.xml</strong></h2><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><?xml version="1.0" encoding="UTF-8"?></span><br><span class="line"><LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"></span><br><span class="line"> <apiVersion>52.0</apiVersion></span><br><span class="line"> <isExposed>true</isExposed></span><br><span class="line"> <targets></span><br><span class="line"> <target>lightning__AppPage</target></span><br><span class="line"> <target>lightning__RecordPage</target></span><br><span class="line"> <target>lightning__HomePage</target></span><br><span class="line"> </targets></span><br><span class="line"></LightningComponentBundle></span><br></pre></td></tr></table></figure><h2 id="本文章转自https-salesforcediaries-com-2022-01-09-apex-class-explorer-in-custom-lightning-web-component-仅作为博客制作测试使用-更多信息可点此链接查看"><a href="#本文章转自https-salesforcediaries-com-2022-01-09-apex-class-explorer-in-custom-lightning-web-component-仅作为博客制作测试使用-更多信息可点此链接查看" class="headerlink" title="本文章转自https://salesforcediaries.com/2022/01/09/apex-class-explorer-in-custom-lightning-web-component/ (仅作为博客制作测试使用)更多信息可点此链接查看"></a>本文章转自<em><a href="https://salesforcediaries.com/2022/01/09/apex-class-explorer-in-custom-lightning-web-component/">https://salesforcediaries.com/2022/01/09/apex-class-explorer-in-custom-lightning-web-component/</a></em><a href=""></a> (仅作为博客制作测试使用)更多信息可点此链接查看</h2>]]></content>
<summary type="html"><h2 id="自定义-LIGHTNING-WEB-组件中的-APEX-类资源管理器"><a href="#自定义-LIGHTNING-WEB-组件中的-APEX-类资源管理器" class="headerlink" title="自定义 LIGHTNING WEB 组件中的 A</summary>
</entry>
<entry>
<title>Hello World</title>
<link href="http://example.com/2022/05/26/hello-world/"/>
<id>http://example.com/2022/05/26/hello-world/</id>
<published>2022-05-26T07:25:23.066Z</published>
<updated>2022-05-26T07:25:23.071Z</updated>
<content type="html"><![CDATA[<p>Welcome to <a href="https://hexo.io/">Hexo</a>! This is your very first post. Check <a href="https://hexo.io/docs/">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a href="https://hexo.io/docs/troubleshooting.html">troubleshooting</a> or you can ask me on <a href="https://github.com/hexojs/hexo/issues">GitHub</a>.</p><h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="Create-a-new-post"><a href="#Create-a-new-post" class="headerlink" title="Create a new post"></a>Create a new post</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new <span class="string">"My New Post"</span></span><br></pre></td></tr></table></figure><p>More info: <a href="https://hexo.io/docs/writing.html">Writing</a></p><h3 id="Run-server"><a href="#Run-server" class="headerlink" title="Run server"></a>Run server</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo server</span><br></pre></td></tr></table></figure><p>More info: <a href="https://hexo.io/docs/server.html">Server</a></p><h3 id="Generate-static-files"><a href="#Generate-static-files" class="headerlink" title="Generate static files"></a>Generate static files</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo generate</span><br></pre></td></tr></table></figure><p>More info: <a href="https://hexo.io/docs/generating.html">Generating</a></p><h3 id="Deploy-to-remote-sites"><a href="#Deploy-to-remote-sites" class="headerlink" title="Deploy to remote sites"></a>Deploy to remote sites</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo deploy</span><br></pre></td></tr></table></figure><p>More info: <a href="https://hexo.io/docs/one-command-deployment.html">Deployment</a></p>]]></content>
<summary type="html"><p>Welcome to <a href="https://hexo.io/">Hexo</a>! This is your very first post. Check <a href="https://hexo.io/docs/">documentation</a> for</summary>
</entry>
</feed>