/* * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import {BaseElement, element} from "../../base-ui/BaseElement.js"; import {LitMainMenuGroup} from "../../base-ui/menu/LitMainMenuGroup.js"; import {LitMainMenu, MenuItem} from "../../base-ui/menu/LitMainMenu.js"; import {LitMainMenuItem} from "../../base-ui/menu/LitMainMenuItem"; @element('sp-help') export class SpHelp extends BaseElement { private appContent: HTMLElement | undefined | null get dark() { return this.hasAttribute("dark"); } set dark(dark: boolean) { if (dark) { this.setAttribute("dark", '' + dark); } this.appContent!.innerHTML = "" } initElements(): void { let that = this let parentElement = this.parentNode as HTMLElement; parentElement.style.overflow = 'hidden' this.appContent = this.shadowRoot?.querySelector('#app-content') as HTMLElement let mainMenu = this.shadowRoot?.querySelector('#main-menu') as LitMainMenu let header = mainMenu.shadowRoot?.querySelector('.header') as HTMLDivElement let version = mainMenu.shadowRoot?.querySelector('.version') as HTMLDivElement header.style.display = 'none' version.style.display = 'none' mainMenu.menus = [ { collapsed: false, title: 'QuickStart', describe: '', children: [ { title: "快速抓取trace说明", icon: "", clickHandler: function (item: MenuItem) { that.appContent!.innerHTML = "" } }, { title: "网页加载trace说明", icon: "", clickHandler: function (item: MenuItem) { that.appContent!.innerHTML = "" } }, { title: "Native Memory抓取和展示说明", icon: "", clickHandler: function (item: MenuItem) { that.appContent!.innerHTML = "" } }, { title: "Ability Monitor抓取和展示说明", icon: "", clickHandler: function (item: MenuItem) { that.appContent!.innerHTML = "" } }, { title: "Perf的抓取和展示说明", icon: "", clickHandler: function (item: MenuItem) { that.appContent!.innerHTML = "" } }, { title: "Sql分析和Metrics说明", icon: "", clickHandler: function (item: MenuItem) { that.appContent!.innerHTML = "" } }, { title: "在线抓取trace说明", icon: "", clickHandler: function (item: MenuItem) { that.appContent!.innerHTML = "" } }, { title: "FileSystem抓取和展示说明", icon: "", clickHandler: function (item: MenuItem) { that.appContent!.innerHTML = "" } }, { title: "页内存抓取和展示说明", icon: "", clickHandler: function (item: MenuItem) { that.appContent!.innerHTML = "" } } ] }, { collapsed: false, title: 'TraceStreamer', describe: '', children: [ { title: "TraceStreamer数据库说明", icon: "", clickHandler: function (item: MenuItem) { that.appContent!.innerHTML = "" } }, { title: "编译Trace_streamer", icon: "", clickHandler: function (item: MenuItem) { that.appContent!.innerHTML = "" } }, { title: "TraceStreamer 解析数据状态表", icon: "", clickHandler: function (item: MenuItem) { that.appContent!.innerHTML = "" } }, { title: "TraceStreamer支持解析事件列表", icon: "", clickHandler: function (item: MenuItem) { that.appContent!.innerHTML = "" } }, { title: "trace_streamer工具说明", icon: "", clickHandler: function (item: MenuItem) { that.appContent!.innerHTML = "" } }, { title: "binder事件上下文如何关联", icon: "", clickHandler: function (item: MenuItem) { that.appContent!.innerHTML = "" } }, { title: "wakeup唤醒说明", icon: "", clickHandler: function (item: MenuItem) { that.appContent!.innerHTML = "" } } ] }, { collapsed: false, title: 'SmartPerf', describe: '', children: [ { title: "SmartPerf 编译指导", icon: "", clickHandler: function (item: MenuItem) { that.appContent!.innerHTML = "" } }, ] }, ] mainMenu.style.width = '290px' let body = mainMenu.shadowRoot?.querySelector('.menu-body') as HTMLDivElement let groups = body.querySelectorAll('lit-main-menu-group') groups.forEach(value => { let items = value.querySelectorAll('lit-main-menu-item') items.forEach(item => { item.style.width = '290px' }) if(value.title == 'TraceStreamer'){ let items = value.querySelectorAll('lit-main-menu-item'); items.forEach(i =>{ if(i.title != 'TraceStreamer数据库说明'){ i.style.display = 'none'; } }) } if(value.title == 'SmartPerf'){ value.style.display = 'none'; } }) } initHtml(): string { return `
`; } }