/* * 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'; import { SpStatisticsHttpUtil } from '../../statistics/util/SpStatisticsHttpUtil.js'; @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}`); } else { this.removeAttribute('dark'); } this.appContent!.innerHTML = '`; }, }, { title: 'web端抓取trace说明', icon: '', clickHandler: function (item: MenuItem) { SpStatisticsHttpUtil.addOrdinaryVisitAction({ event: 'online_record', action: 'help_doc', }); that.appContent!.innerHTML = '`; }, }, { title: 'Native Memory抓取和展示说明', icon: '', clickHandler: function (item: MenuItem) { SpStatisticsHttpUtil.addOrdinaryVisitAction({ event: 'native', action: 'help_doc', }); that.appContent!.innerHTML = '`; }, }, { title: 'HiPerf的抓取和展示说明', icon: '', clickHandler: function (item: MenuItem) { SpStatisticsHttpUtil.addOrdinaryVisitAction({ event: 'perf', action: 'help_doc', }); that.appContent!.innerHTML = '`; }, }, { title: 'FileSystem抓取和展示说明', icon: '', clickHandler: function (item: MenuItem) { SpStatisticsHttpUtil.addOrdinaryVisitAction({ event: 'file_system', action: 'help_doc', }); that.appContent!.innerHTML = '`; }, }, { title: 'Bio抓取和展示说明', icon: '', clickHandler: function (item: MenuItem) { SpStatisticsHttpUtil.addOrdinaryVisitAction({ event: 'bio', action: 'help_doc', }); that.appContent!.innerHTML = '`; }, }, { title: 'HiSystemEvent抓取和展示说明', icon: '', clickHandler: function (item: MenuItem) { SpStatisticsHttpUtil.addOrdinaryVisitAction({ event: 'hisys', action: 'help_doc', }); that.appContent!.innerHTML = '`; }, }, { title: 'Frame timeline抓取和展示说明', icon: '', clickHandler: function (item: MenuItem) { SpStatisticsHttpUtil.addOrdinaryVisitAction({ event: 'frame_record', action: 'help_doc', }); that.appContent!.innerHTML = '`; }, }, { title: 'Js Memory抓取和展示说明', icon: '', clickHandler: function (item: MenuItem) { SpStatisticsHttpUtil.addOrdinaryVisitAction({ event: 'js_memory', action: 'help_doc', }); that.appContent!.innerHTML = '`; }, }, { title: 'Animation的抓取和展示说明', icon: '', clickHandler: function (item: MenuItem) { SpStatisticsHttpUtil.addOrdinaryVisitAction({ event: 'animation', action: 'help_doc', }); that.appContent!.innerHTML = '`; }, }, { title: 'Cpuprofiler抓取和展示说明', icon: '', clickHandler: function (item: MenuItem) { SpStatisticsHttpUtil.addOrdinaryVisitAction({ event: 'arkts', action: 'help_doc', }); that.appContent!.innerHTML = '`; }, }, { title: '系统内存抓取和展示说明', icon: '', clickHandler: function (item: MenuItem) { SpStatisticsHttpUtil.addOrdinaryVisitAction({ event: 'memory_template', action: 'help_doc', }); that.appContent!.innerHTML = '`; }, }, ], }, { collapsed: false, title: 'TraceStreamer', describe: '', children: [ { title: 'TraceStreamer数据库说明', icon: '', clickHandler: function (item: MenuItem) { SpStatisticsHttpUtil.addOrdinaryVisitAction({ event: 'trace_streamer_explain', action: 'help_doc', }); 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: 'wakeup唤醒说明', icon: '', clickHandler: function (item: MenuItem) { that.appContent!.innerHTML = '`; }, }, ], }, ]; mainMenu.style.width = '330px'; 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 = '330px'; }); 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 `
`; } }