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-config')
export class OpsViewConfig extends DeesElement {
@state()
private configState: appstate.IConfigState = {
config: null,
isLoading: false,
error: null,
};
@state()
private editingSection: string | null = null;
@state()
private editedConfig: any = null;
constructor() {
super();
const subscription = appstate.configStatePart
.select((stateArg) => stateArg)
.subscribe((configState) => {
this.configState = configState;
});
this.rxSubscriptions.push(subscription);
}
public static styles = [
cssManager.defaultStyles,
shared.viewHostCss,
css`
.configSection {
background: white;
border: 1px solid #e9ecef;
border-radius: 8px;
margin-bottom: 24px;
overflow: hidden;
}
.sectionHeader {
background: #f8f9fa;
padding: 16px 24px;
border-bottom: 1px solid #e9ecef;
display: flex;
justify-content: space-between;
align-items: center;
}
.sectionTitle {
font-size: 18px;
font-weight: 600;
color: #333;
}
.sectionContent {
padding: 24px;
}
.configField {
margin-bottom: 20px;
}
.fieldLabel {
font-size: 14px;
font-weight: 600;
color: #666;
margin-bottom: 8px;
display: block;
}
.fieldValue {
font-family: 'Consolas', 'Monaco', monospace;
font-size: 14px;
color: #333;
background: #f8f9fa;
padding: 8px 12px;
border-radius: 4px;
border: 1px solid #e9ecef;
}
.configEditor {
width: 100%;
min-height: 200px;
font-family: 'Consolas', 'Monaco', monospace;
font-size: 14px;
padding: 12px;
border: 1px solid #e9ecef;
border-radius: 4px;
background: #f8f9fa;
resize: vertical;
}
.buttonGroup {
display: flex;
gap: 8px;
margin-top: 16px;
}
.warning {
background: #fff3cd;
border: 1px solid #ffeaa7;
border-radius: 4px;
padding: 12px;
margin-bottom: 16px;
color: #856404;
display: flex;
align-items: center;
gap: 8px;
}
.errorMessage {
background: #fee;
border: 1px solid #fcc;
border-radius: 4px;
padding: 16px;
color: #c00;
margin: 16px 0;
}
.loadingMessage {
text-align: center;
padding: 40px;
color: #666;
}
`,
];
public render() {
return html`
Loading configuration...