import * as plugins from '../plugins.js';
import * as shared from './shared/index.js';
import * as appstate from '../appstate.js';
import {
DeesElement,
customElement,
html,
state,
css,
cssManager,
} from '@design.estate/dees-element';
@customElement('ops-view-logs')
export class OpsViewLogs extends DeesElement {
@state()
private logState: appstate.ILogState = {
recentLogs: [],
isStreaming: false,
filters: {},
};
constructor() {
super();
const subscription = appstate.logStatePart
.select((stateArg) => stateArg)
.subscribe((logState) => {
this.logState = logState;
});
this.rxSubscriptions.push(subscription);
}
public static styles = [
cssManager.defaultStyles,
shared.viewHostCss,
css`
.controls {
display: flex;
gap: 16px;
margin-bottom: 24px;
flex-wrap: wrap;
}
.filterGroup {
display: flex;
align-items: center;
gap: 8px;
}
.logContainer {
background: #1e1e1e;
border-radius: 8px;
padding: 16px;
max-height: 600px;
overflow-y: auto;
font-family: 'Consolas', 'Monaco', monospace;
font-size: 13px;
}
.logEntry {
margin-bottom: 8px;
line-height: 1.5;
}
.logTimestamp {
color: #7a7a7a;
margin-right: 8px;
}
.logLevel {
font-weight: bold;
margin-right: 8px;
padding: 2px 6px;
border-radius: 3px;
font-size: 11px;
}
.logLevel.debug {
color: #6a9955;
background: rgba(106, 153, 85, 0.1);
}
.logLevel.info {
color: #569cd6;
background: rgba(86, 156, 214, 0.1);
}
.logLevel.warn {
color: #ce9178;
background: rgba(206, 145, 120, 0.1);
}
.logLevel.error {
color: #f44747;
background: rgba(244, 71, 71, 0.1);
}
.logCategory {
color: #c586c0;
margin-right: 8px;
}
.logMessage {
color: #d4d4d4;
}
.noLogs {
color: #7a7a7a;
text-align: center;
padding: 40px;
}
`,
];
public render() {
return html`