dees-catalog/ts_web/elements/dees-dataview-statusobject.ts

166 lines
4.0 KiB
TypeScript
Raw Normal View History

2024-01-18 01:08:19 +00:00
import * as colors from './00colors.js';
import * as plugins from './00plugins.js';
2023-09-07 16:34:38 +00:00
import { demoFunc } from './dees-dataview-statusobject.demo.js';
2023-04-05 12:46:20 +00:00
import {
DeesElement,
html,
customElement,
2023-08-07 18:02:18 +00:00
type TemplateResult,
2023-04-05 12:46:20 +00:00
property,
state,
cssManager,
css,
2023-08-07 18:02:18 +00:00
type CSSResult,
2023-08-07 17:13:29 +00:00
} from '@design.estate/dees-element';
2023-04-05 12:46:20 +00:00
import * as tsclass from '@tsclass/tsclass';
declare global {
interface HTMLElementTagNameMap {
'dees-dataview-statusobject': DeesDataviewStatusobject;
}
}
@customElement('dees-dataview-statusobject')
export class DeesDataviewStatusobject extends DeesElement {
2023-09-07 16:34:38 +00:00
public static demo = demoFunc;
2023-04-05 12:46:20 +00:00
@property({ type: Object }) statusObject: tsclass.code.IStatusObject;
public static styles = [
cssManager.defaultStyles,
css`
.mainbox {
2023-10-05 20:42:33 +00:00
border-radius: 8px;
2023-04-05 16:57:12 +00:00
background: ${cssManager.bdTheme('#fff', '#1b1b1b')};
box-shadow: 0px 1px 3px #00000030;
2023-04-05 12:46:20 +00:00
min-height: 48px;
color: ${cssManager.bdTheme('#000', '#fff')};
2024-01-21 00:12:57 +00:00
border-top: ${cssManager.bdTheme('none', '1px solid #ffffff10')};
2024-01-18 01:08:19 +00:00
cursor: default;
2023-04-05 12:46:20 +00:00
}
.heading {
display: grid;
align-items: center;
grid-template-columns: 40px auto 120px;
}
h1 {
display: block;
margin: 0px;
padding: 0px;
height: 48px;
text-transform: uppercase;
font-size: 12px;
line-height: 48px;
}
.statusdot {
height: 8px;
width: 8px;
border-radius: 6px;
background: grey;
margin: auto;
}
.copyMain {
2023-09-07 16:34:38 +00:00
font-size: 10px;
2023-04-05 12:46:20 +00:00
font-weight: 600;
text-transform: uppercase;
2024-01-21 00:12:57 +00:00
border: 1px solid ${cssManager.bdTheme('#e0e0e0', '#444')};
2023-04-05 12:46:20 +00:00
text-align: center;
padding: 4px;
border-radius: 3px;
margin-right: 16px;
2024-01-21 00:12:57 +00:00
color: ${cssManager.bdTheme('#333', '#ffffff80')};
2024-01-18 01:08:19 +00:00
user-select: none;
}
.copyMain:hover {
background: ${cssManager.bdTheme(colors.bright.blue, colors.dark.blue)};
border: 1px solid ${cssManager.bdTheme(colors.bright.blue, colors.dark.blue)};
color: #fff;
}
.copyMain:active {
background: ${cssManager.bdTheme(colors.bright.blueActive, colors.dark.blueActive)};
border: 1px solid ${cssManager.bdTheme(colors.bright.blueActive, colors.dark.blueActive)};
color: #fff;
2023-04-05 12:46:20 +00:00
}
.statusdot.ok {
background: green;
}
.statusdot.not_ok{
background: red;
}
.statusdot.partly_ok {
background: orange;
}
.detail {
2024-01-18 01:08:19 +00:00
min-height: 60px;
2023-04-05 12:46:20 +00:00
align-items: center;
display: grid;
grid-template-columns: 40px auto;
2024-01-21 00:12:57 +00:00
border-top: 1px dotted ${cssManager.bdTheme('#e0e0e0', '#282828')};
2024-01-18 01:08:19 +00:00
transition: all 0.2s;
}
.detail:hover {
background: #ffffff05;
2023-04-05 12:46:20 +00:00
}
2024-01-21 00:12:57 +00:00
.detail:active {
background: #ffffff10;
}
2023-04-07 21:55:55 +00:00
.detail .detailsText {
2023-04-09 22:26:55 +00:00
padding-top: 8px;
padding-bottom: 8px;
padding-right: 8px;
word-break: break-all;
2023-04-07 21:55:55 +00:00
}
2023-04-05 12:46:20 +00:00
.detail .detailsText .label {
font-size: 12px;
2023-09-07 16:34:38 +00:00
color: #ffffff80
2023-04-05 12:46:20 +00:00
}
.detail .detailsText .value {
2023-09-07 16:34:38 +00:00
font-size: 14px;
font-family: 'Intel One Mono', 'Geist Mono';
2023-04-05 12:46:20 +00:00
}
`,
];
render(): TemplateResult {
return html`
<div class="mainbox">
<div class="heading">
2023-04-05 15:17:02 +00:00
<div class="statusdot ${this.statusObject?.combinedStatus}"></div>
2023-04-05 12:46:20 +00:00
<h1>${this.statusObject?.name || 'no status object assigned'}</h1>
<div class="copyMain">Copy as JSON</div>
</div>
2023-04-05 15:00:44 +00:00
${this.statusObject?.details?.map((detailArg) => {
2023-04-05 12:46:20 +00:00
return html`
<div class="detail">
<div class="statusdot ${detailArg.status}"></div>
<div class="detailsText">
<div class="label">${detailArg.name}</div>
<div class="value">${detailArg.value}</div>
</div>
</div>
`;
})}
</div>
`;
}
async firstUpdated() {}
}