update
This commit is contained in:
151
ts_web/elements/sz-reverse-proxy-card.ts
Normal file
151
ts_web/elements/sz-reverse-proxy-card.ts
Normal file
@@ -0,0 +1,151 @@
|
||||
import {
|
||||
DeesElement,
|
||||
customElement,
|
||||
html,
|
||||
css,
|
||||
cssManager,
|
||||
property,
|
||||
type TemplateResult,
|
||||
} from '@design.estate/dees-element';
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
'sz-reverse-proxy-card': SzReverseProxyCard;
|
||||
}
|
||||
}
|
||||
|
||||
@customElement('sz-reverse-proxy-card')
|
||||
export class SzReverseProxyCard extends DeesElement {
|
||||
public static demo = () => html`
|
||||
<div style="padding: 24px; max-width: 400px;">
|
||||
<sz-reverse-proxy-card
|
||||
httpPort="8080"
|
||||
httpsPort="8443"
|
||||
httpActive
|
||||
httpsActive
|
||||
routeCount="3"
|
||||
></sz-reverse-proxy-card>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@property({ type: String })
|
||||
public accessor httpPort: string = '80';
|
||||
|
||||
@property({ type: String })
|
||||
public accessor httpsPort: string = '443';
|
||||
|
||||
@property({ type: Boolean })
|
||||
public accessor httpActive: boolean = false;
|
||||
|
||||
@property({ type: Boolean })
|
||||
public accessor httpsActive: boolean = false;
|
||||
|
||||
@property({ type: String })
|
||||
public accessor routeCount: string = '0';
|
||||
|
||||
public static styles = [
|
||||
cssManager.defaultStyles,
|
||||
css`
|
||||
:host {
|
||||
display: block;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: ${cssManager.bdTheme('#ffffff', '#09090b')};
|
||||
border: 1px solid ${cssManager.bdTheme('#e4e4e7', '#27272a')};
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.header {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: ${cssManager.bdTheme('#18181b', '#fafafa')};
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 13px;
|
||||
color: ${cssManager.bdTheme('#71717a', '#a1a1aa')};
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.items {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.item-label {
|
||||
font-size: 14px;
|
||||
color: ${cssManager.bdTheme('#18181b', '#fafafa')};
|
||||
}
|
||||
|
||||
.item-value {
|
||||
font-size: 14px;
|
||||
color: ${cssManager.bdTheme('#71717a', '#a1a1aa')};
|
||||
}
|
||||
|
||||
.badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 2px 10px;
|
||||
border-radius: 9999px;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.badge.active {
|
||||
background: ${cssManager.bdTheme('#dcfce7', 'rgba(34, 197, 94, 0.2)')};
|
||||
color: ${cssManager.bdTheme('#16a34a', '#22c55e')};
|
||||
}
|
||||
|
||||
.badge.inactive {
|
||||
background: ${cssManager.bdTheme('#fee2e2', 'rgba(239, 68, 68, 0.2)')};
|
||||
color: ${cssManager.bdTheme('#dc2626', '#ef4444')};
|
||||
}
|
||||
`,
|
||||
];
|
||||
|
||||
public render(): TemplateResult {
|
||||
return html`
|
||||
<div class="card">
|
||||
<div class="header">
|
||||
<div class="title">Reverse Proxy</div>
|
||||
<div class="subtitle">HTTP/HTTPS proxy status</div>
|
||||
</div>
|
||||
|
||||
<div class="items">
|
||||
<div class="item">
|
||||
<span class="item-label">HTTP (${this.httpPort})</span>
|
||||
<span class="badge ${this.httpActive ? 'active' : 'inactive'}">
|
||||
${this.httpActive ? 'Active' : 'Inactive'}
|
||||
</span>
|
||||
</div>
|
||||
<div class="item">
|
||||
<span class="item-label">HTTPS (${this.httpsPort})</span>
|
||||
<span class="badge ${this.httpsActive ? 'active' : 'inactive'}">
|
||||
${this.httpsActive ? 'Active' : 'Inactive'}
|
||||
</span>
|
||||
</div>
|
||||
<div class="item">
|
||||
<span class="item-label">Routes</span>
|
||||
<span class="item-value">${this.routeCount}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user