1<!-- Copyright (C) 2020 The Android Open Source Project 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14--> 15<template> 16 <span> 17 <span class="kind">{{item.kind}}</span> 18 <span v-if="item.kind && item.name">-</span> 19 <span 20 v-if="simplifyNames && item.shortName && 21 item.shortName !== item.name" 22 >{{ item.shortName }} <!-- No line break on purpose --> 23 <md-tooltip 24 md-delay="300" 25 md-direction="top" 26 style="margin-bottom: -10px" 27 > 28 {{item.name}} 29 </md-tooltip> 30 </span> 31 <span v-else>{{ item.name }}</span> 32 <div 33 v-for="c in item.chips" 34 v-bind:key="c.long" 35 :title="c.long" 36 :class="chipClassForChip(c)" 37 >{{c.short}} <!-- No line break on purpose --> 38 <md-tooltip 39 md-delay="300" 40 md-direction="top" 41 style="margin-bottom: -10px" 42 > 43 {{c.long}} 44 </md-tooltip> 45 </div> 46 </span> 47</template> 48 49<script> 50export default { 51 name: 'DefaultTreeElement', 52 props: ['item', 'simplify-names'], 53 methods: { 54 chipClassForChip(c) { 55 return [ 56 'tree-view-internal-chip', 57 'tree-view-chip', 58 'tree-view-chip' + '-' + 59 (c.type?.toString() || c.class?.toString() || 'default'), 60 ]; 61 }, 62 }, 63}; 64</script> 65 66<style scoped> 67.tree-view-internal-chip { 68 display: inline-block; 69} 70 71.tree-view-chip { 72 padding: 0 10px; 73 border-radius: 10px; 74 background-color: #aaa; 75 color: black; 76} 77 78.tree-view-chip.tree-view-chip-warn { 79 background-color: #ffaa6b; 80 color: black; 81} 82 83.tree-view-chip.tree-view-chip-error { 84 background-color: #ff6b6b; 85 color: black; 86} 87 88.tree-view-chip.tree-view-chip-gpu { 89 background-color: #00c853; 90 color: black; 91} 92 93.tree-view-chip.tree-view-chip-hwc { 94 background-color: #448aff; 95 color: black; 96} 97 98span { 99 overflow-wrap: break-word; 100 flex: 1 1 auto; 101 width: 0; 102} 103</style> 104