2026-04-08 07:45:26 +00:00
|
|
|
import * as appstate from '../../appstate.js';
|
2026-04-08 08:24:55 +00:00
|
|
|
import { viewHostCss } from '../shared/css.js';
|
2026-04-08 07:45:26 +00:00
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
DeesElement,
|
|
|
|
|
customElement,
|
|
|
|
|
html,
|
|
|
|
|
state,
|
|
|
|
|
css,
|
|
|
|
|
cssManager,
|
|
|
|
|
type TemplateResult,
|
|
|
|
|
} from '@design.estate/dees-element';
|
|
|
|
|
import { type IStatsTile } from '@design.estate/dees-catalog';
|
|
|
|
|
|
|
|
|
|
declare global {
|
|
|
|
|
interface HTMLElementTagNameMap {
|
2026-04-08 08:24:55 +00:00
|
|
|
'ops-view-email-security': OpsViewEmailSecurity;
|
2026-04-08 07:45:26 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-08 08:24:55 +00:00
|
|
|
@customElement('ops-view-email-security')
|
|
|
|
|
export class OpsViewEmailSecurity extends DeesElement {
|
2026-04-08 07:45:26 +00:00
|
|
|
@state()
|
|
|
|
|
accessor statsState: appstate.IStatsState = appstate.statsStatePart.getState()!;
|
|
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
|
super();
|
|
|
|
|
const sub = appstate.statsStatePart
|
|
|
|
|
.select((s) => s)
|
|
|
|
|
.subscribe((s) => {
|
|
|
|
|
this.statsState = s;
|
|
|
|
|
});
|
|
|
|
|
this.rxSubscriptions.push(sub);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static styles = [
|
|
|
|
|
cssManager.defaultStyles,
|
2026-04-08 08:24:55 +00:00
|
|
|
viewHostCss,
|
2026-04-08 07:45:26 +00:00
|
|
|
css`
|
|
|
|
|
h2 {
|
|
|
|
|
margin: 32px 0 16px 0;
|
|
|
|
|
font-size: 24px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
color: ${cssManager.bdTheme('#333', '#ccc')};
|
|
|
|
|
}
|
|
|
|
|
dees-statsgrid {
|
|
|
|
|
margin-bottom: 32px;
|
|
|
|
|
}
|
|
|
|
|
.securityCard {
|
|
|
|
|
background: ${cssManager.bdTheme('#fff', '#222')};
|
|
|
|
|
border: 1px solid ${cssManager.bdTheme('#e9ecef', '#333')};
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
padding: 24px;
|
|
|
|
|
position: relative;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
.actionButton {
|
|
|
|
|
margin-top: 16px;
|
|
|
|
|
}
|
|
|
|
|
`,
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
public render(): TemplateResult {
|
|
|
|
|
const metrics = this.statsState.securityMetrics;
|
|
|
|
|
|
|
|
|
|
if (!metrics) {
|
|
|
|
|
return html`
|
|
|
|
|
<div class="loadingMessage">
|
|
|
|
|
<p>Loading security metrics...</p>
|
|
|
|
|
</div>
|
|
|
|
|
`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const tiles: IStatsTile[] = [
|
|
|
|
|
{
|
|
|
|
|
id: 'malware',
|
|
|
|
|
title: 'Malware Detection',
|
|
|
|
|
value: metrics.malwareDetected,
|
|
|
|
|
type: 'number',
|
|
|
|
|
icon: 'lucide:BugOff',
|
|
|
|
|
color: metrics.malwareDetected > 0 ? '#ef4444' : '#22c55e',
|
|
|
|
|
description: 'Malware detected',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'phishing',
|
|
|
|
|
title: 'Phishing Detection',
|
|
|
|
|
value: metrics.phishingDetected,
|
|
|
|
|
type: 'number',
|
|
|
|
|
icon: 'lucide:Fish',
|
|
|
|
|
color: metrics.phishingDetected > 0 ? '#ef4444' : '#22c55e',
|
|
|
|
|
description: 'Phishing attempts detected',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'suspicious',
|
|
|
|
|
title: 'Suspicious Activities',
|
|
|
|
|
value: metrics.suspiciousActivities,
|
|
|
|
|
type: 'number',
|
|
|
|
|
icon: 'lucide:TriangleAlert',
|
|
|
|
|
color: metrics.suspiciousActivities > 5 ? '#ef4444' : '#f59e0b',
|
|
|
|
|
description: 'Suspicious activities detected',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'spam',
|
|
|
|
|
title: 'Spam Detection',
|
|
|
|
|
value: metrics.spamDetected,
|
|
|
|
|
type: 'number',
|
|
|
|
|
icon: 'lucide:Ban',
|
|
|
|
|
color: '#f59e0b',
|
|
|
|
|
description: 'Spam emails blocked',
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
return html`
|
|
|
|
|
<dees-heading level="hr">Email Security</dees-heading>
|
|
|
|
|
|
|
|
|
|
<dees-statsgrid
|
|
|
|
|
.tiles=${tiles}
|
|
|
|
|
.minTileWidth=${200}
|
|
|
|
|
></dees-statsgrid>
|
|
|
|
|
|
|
|
|
|
<h2>Email Security Configuration</h2>
|
|
|
|
|
<div class="securityCard">
|
|
|
|
|
<dees-form>
|
|
|
|
|
<dees-input-checkbox
|
|
|
|
|
.key=${'enableSPF'}
|
|
|
|
|
.label=${'Enable SPF checking'}
|
|
|
|
|
.value=${true}
|
|
|
|
|
></dees-input-checkbox>
|
|
|
|
|
<dees-input-checkbox
|
|
|
|
|
.key=${'enableDKIM'}
|
|
|
|
|
.label=${'Enable DKIM validation'}
|
|
|
|
|
.value=${true}
|
|
|
|
|
></dees-input-checkbox>
|
|
|
|
|
<dees-input-checkbox
|
|
|
|
|
.key=${'enableDMARC'}
|
|
|
|
|
.label=${'Enable DMARC policy enforcement'}
|
|
|
|
|
.value=${true}
|
|
|
|
|
></dees-input-checkbox>
|
|
|
|
|
<dees-input-checkbox
|
|
|
|
|
.key=${'enableSpamFilter'}
|
|
|
|
|
.label=${'Enable spam filtering'}
|
|
|
|
|
.value=${true}
|
|
|
|
|
></dees-input-checkbox>
|
|
|
|
|
</dees-form>
|
|
|
|
|
<dees-button
|
|
|
|
|
class="actionButton"
|
|
|
|
|
type="highlighted"
|
|
|
|
|
@click=${() => this.saveEmailSecuritySettings()}
|
|
|
|
|
>
|
|
|
|
|
Save Settings
|
|
|
|
|
</dees-button>
|
|
|
|
|
</div>
|
|
|
|
|
`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async saveEmailSecuritySettings() {
|
|
|
|
|
// Config is read-only from the UI for now
|
|
|
|
|
alert('Email security settings are read-only. Update the dcrouter configuration file to change these settings.');
|
|
|
|
|
}
|
|
|
|
|
}
|