-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoo-hud-loggers.html
117 lines (97 loc) · 3.11 KB
/
oo-hud-loggers.html
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<link rel="import" href="../polymer/polymer-element.html">
<link rel="import" href="../iron-icons/iron-icons.html">
<link rel="import" href="../iron-flex-layout/iron-flex-layout-classes.html">
<link rel="import" href="../iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="../neon-animation/web-animations.html">
<link rel="import" href="../paper-checkbox/paper-checkbox.html">
<link rel="import" href="../paper-dropdown-menu/paper-dropdown-menu.html">
<link rel="import" href="../paper-item/paper-item.html">
<link rel="import" href="../paper-listbox/paper-listbox.html">
<link rel="import" href="../paper-styles/paper-styles-classes.html">
<link rel="import" href="../paper-styles/paper-styles.html">
<link rel="import" href="../oo-logger/oo-logger-mixin.html">
<dom-module id="oo-hud-loggers">
<template>
<style include="iron-flex iron-positioning">
:host {
display: block;
}
#content {
background: white;
}
.list {
width: 50%;
padding: 0 10px;
}
paper-checkbox {
padding: 8px 0;
}
paper-dropdown-menu {
padding: 0 15px;
--paper-dropdown-menu-input: {
padding: 6px 0;
}
--paper-input-container: {
padding: 0;
}
}
</style>
<div id="content" class="horizontal layout">
<div class="flex">loggers</div>
<div class="list">
<template is="dom-repeat" items="[[loggerNames]]" as="loggerName">
<div class="horizontal layout start">
<paper-checkbox checked>[[loggerName]]</paper-checkbox>
<paper-dropdown-menu
no-label-float
no-animations
horizontal-align="left"
vertical-align="middle"
class="flex">
<paper-listbox slot="dropdown-content" selected="2">
<paper-item>ERROR</paper-item>
<paper-item>WARN</paper-item>
<paper-item>INFO</paper-item>
<paper-item>DEBUG</paper-item>
<paper-item>TRACE</paper-item>
</paper-listbox>
</paper-dropdown-menu>
</div>
</template>
</div>
</div>
</template>
<script>
class OoHudLoggers extends Polymer.Element {
static get is() {
return "oo-hud-loggers"
}
static get properties() {
return {
loggerNames: {
type: String,
value: () => []
}
}
}
ready() {
super.ready()
this._log("ready")
this.addEventListener("hud-item-enter", () => {
this._log("hud enter")
this._timeout(100, () => {
const loggers = oo.LoggerFactory.getLoggerContexts()
this.loggerNames = Object.keys(loggers)
})
})
}
_timeout(delayMillis, action) {
return Polymer.Async.timeOut.after(delayMillis).run(action)
}
_log(...messages) {
console.log(`[${this.localName}]`, ...messages)
}
}
window.customElements.define(OoHudLoggers.is, OoHudLoggers)
</script>
</dom-module>