Mercurial > code > home > repos > light9
diff web/metrics/ServiceButtonRow.ts @ 2376:4556eebe5d73
topdir reorgs; let pdm have its src/ dir; separate vite area from light9/
author | drewp@bigasterisk.com |
---|---|
date | Sun, 12 May 2024 19:02:10 -0700 |
parents | light9/web/metrics/ServiceButtonRow.ts@06bf6dae8e64 |
children | 9a4bc2ea264e |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/metrics/ServiceButtonRow.ts Sun May 12 19:02:10 2024 -0700 @@ -0,0 +1,66 @@ +import { LitElement, html, css } from "lit"; +import { customElement, property } from "lit/decorators.js"; +export { StatsLine } from "./StatsLine"; + +@customElement("service-button-row") +export class ServiceButtonRow extends LitElement { + @property() name: string = "?"; + @property({ type:Boolean, attribute: "metrics" }) hasMetrics: boolean = false; + static styles = [ + css` + :host { + padding-bottom: 10px; + border-bottom: 1px solid #333; + } + a { + color: #7d7dec; + } + div { + display: flex; + justify-content: space-between; + padding: 2px 3px; + } + .left { + display: inline-block; + margin-right: 3px; + flex-grow: 1; + min-width: 9em; + } + .window { + } + .serviceGrid > td { + border: 5px solid red; + display: inline-block; + } + .big { + font-size: 120%; + display: inline-block; + padding: 10px 0; + } + + :host > div { + display: inline-block; + vertical-align: top; + } + :host > div:nth-child(2) { + width: 9em; + } + `, + ]; + + render() { + return html` + <div> + <div class="left"><a class="big" href="${this.name}/">${this.name}</a></div> + <div class="window"><button @click="${this.click}">window</button></div> + ${this.hasMetrics ? html`<div><a href="${this.name}/metrics">metrics</a></div>` : ""} + </div> + + ${this.hasMetrics ? html`<div id="stats"><stats-line name="${this.name}"></div>` : ""} + `; + } + + click() { + window.open(this.name + "/", "_blank", "scrollbars=1,resizable=1,titlebar=0,location=0"); + } +}