2021-09-23 14:30:02 +02:00
|
|
|
import {
|
|
|
|
|
DeesElement,
|
|
|
|
|
property,
|
|
|
|
|
html,
|
|
|
|
|
customElement,
|
2024-06-26 20:28:09 +02:00
|
|
|
type TemplateResult,
|
2023-01-05 13:37:28 +01:00
|
|
|
cssManager,
|
|
|
|
|
css,
|
2025-06-29 19:55:58 +00:00
|
|
|
unsafeCSS,
|
2024-06-26 20:28:09 +02:00
|
|
|
} from '@design.estate/dees-element';
|
|
|
|
|
import * as domtools from '@design.estate/dees-domtools';
|
2025-06-29 19:55:58 +00:00
|
|
|
import type { IServiceStatus } from '../interfaces/index.js';
|
2025-12-23 09:26:37 +00:00
|
|
|
import * as sharedStyles from '../styles/shared.styles.js';
|
2021-09-23 14:30:02 +02:00
|
|
|
|
2022-03-24 16:07:15 +01:00
|
|
|
import './internal/uplinternal-miniheading.js';
|
2025-06-29 19:55:58 +00:00
|
|
|
import { demoFunc } from './upl-statuspage-assetsselector.demo.js';
|
2021-09-23 14:30:02 +02:00
|
|
|
|
|
|
|
|
declare global {
|
|
|
|
|
interface HTMLElementTagNameMap {
|
|
|
|
|
'upl-statuspage-assetsselector': UplStatuspageAssetsselector;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@customElement('upl-statuspage-assetsselector')
|
|
|
|
|
export class UplStatuspageAssetsselector extends DeesElement {
|
2025-06-29 19:55:58 +00:00
|
|
|
public static demo = demoFunc;
|
|
|
|
|
|
|
|
|
|
@property({ type: Array })
|
2025-12-23 09:26:37 +00:00
|
|
|
accessor services: IServiceStatus[] = [];
|
2025-06-29 19:55:58 +00:00
|
|
|
|
|
|
|
|
@property({ type: String })
|
2025-12-23 09:26:37 +00:00
|
|
|
accessor filterText: string = '';
|
2025-06-29 19:55:58 +00:00
|
|
|
|
|
|
|
|
@property({ type: String })
|
2025-12-23 09:26:37 +00:00
|
|
|
accessor filterCategory: string = 'all';
|
2025-06-29 19:55:58 +00:00
|
|
|
|
|
|
|
|
@property({ type: Boolean })
|
2025-12-23 09:26:37 +00:00
|
|
|
accessor showOnlySelected: boolean = false;
|
2025-06-29 19:55:58 +00:00
|
|
|
|
|
|
|
|
@property({ type: Boolean })
|
2025-12-23 09:26:37 +00:00
|
|
|
accessor loading: boolean = false;
|
|
|
|
|
|
2025-06-29 23:58:51 +00:00
|
|
|
@property({ type: Boolean })
|
2025-12-23 09:26:37 +00:00
|
|
|
accessor expanded: boolean = false;
|
2021-09-23 14:30:02 +02:00
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
|
super();
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-05 13:37:28 +01:00
|
|
|
public static styles = [
|
|
|
|
|
cssManager.defaultStyles,
|
2025-12-23 09:26:37 +00:00
|
|
|
sharedStyles.commonStyles,
|
2023-01-05 13:37:28 +01:00
|
|
|
css`
|
|
|
|
|
:host {
|
2021-09-23 14:30:02 +02:00
|
|
|
display: block;
|
2025-06-29 19:55:58 +00:00
|
|
|
background: transparent;
|
2025-12-23 09:26:37 +00:00
|
|
|
font-family: ${unsafeCSS(sharedStyles.fonts.base)};
|
|
|
|
|
color: ${sharedStyles.colors.text.primary};
|
2025-06-29 19:55:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.container {
|
|
|
|
|
max-width: 1200px;
|
|
|
|
|
margin: 0 auto;
|
2025-12-23 09:26:37 +00:00
|
|
|
padding: 0 ${unsafeCSS(sharedStyles.spacing.lg)} ${unsafeCSS(sharedStyles.spacing.lg)} ${unsafeCSS(sharedStyles.spacing.lg)};
|
2025-06-29 19:55:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.controls {
|
|
|
|
|
display: flex;
|
2025-12-23 09:26:37 +00:00
|
|
|
gap: ${unsafeCSS(sharedStyles.spacing.sm)};
|
|
|
|
|
margin-bottom: ${unsafeCSS(sharedStyles.spacing.md)};
|
2025-06-29 19:55:58 +00:00
|
|
|
flex-wrap: wrap;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.search-input {
|
|
|
|
|
flex: 1;
|
2025-06-29 23:58:51 +00:00
|
|
|
min-width: 200px;
|
2025-12-23 09:26:37 +00:00
|
|
|
padding: ${unsafeCSS(sharedStyles.spacing.xs)} ${unsafeCSS(sharedStyles.spacing.sm)};
|
2025-06-29 23:58:51 +00:00
|
|
|
border: 1px solid ${cssManager.bdTheme('#e5e7eb', '#27272a')};
|
2025-12-23 09:26:37 +00:00
|
|
|
border-radius: ${unsafeCSS(sharedStyles.borderRadius.base)};
|
2025-06-29 23:58:51 +00:00
|
|
|
background: ${cssManager.bdTheme('#ffffff', '#0a0a0a')};
|
|
|
|
|
color: ${cssManager.bdTheme('#0a0a0a', '#fafafa')};
|
|
|
|
|
font-size: 13px;
|
2025-12-23 09:26:37 +00:00
|
|
|
font-family: ${unsafeCSS(sharedStyles.fonts.base)};
|
2025-06-29 19:55:58 +00:00
|
|
|
transition: all 0.2s ease;
|
2025-06-29 23:58:51 +00:00
|
|
|
height: 32px;
|
2025-06-29 19:55:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.search-input:focus {
|
|
|
|
|
outline: none;
|
2025-06-29 23:58:51 +00:00
|
|
|
border-color: ${cssManager.bdTheme('#0a0a0a', '#fafafa')};
|
2025-06-29 19:55:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.search-input::placeholder {
|
2025-06-29 23:58:51 +00:00
|
|
|
color: ${cssManager.bdTheme('#9ca3af', '#71717a')};
|
2025-06-29 19:55:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.filter-button {
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
2025-12-23 09:26:37 +00:00
|
|
|
padding: ${unsafeCSS(sharedStyles.spacing.xs)} ${unsafeCSS(sharedStyles.spacing.sm)};
|
2025-06-29 23:58:51 +00:00
|
|
|
border: 1px solid ${cssManager.bdTheme('#e5e7eb', '#27272a')};
|
2025-12-23 09:26:37 +00:00
|
|
|
border-radius: ${unsafeCSS(sharedStyles.borderRadius.base)};
|
2025-06-29 19:55:58 +00:00
|
|
|
background: transparent;
|
2025-06-29 23:58:51 +00:00
|
|
|
color: ${cssManager.bdTheme('#6b7280', '#a1a1aa')};
|
2025-06-29 19:55:58 +00:00
|
|
|
cursor: pointer;
|
2025-06-29 23:58:51 +00:00
|
|
|
font-size: 13px;
|
|
|
|
|
font-weight: 400;
|
2025-12-23 09:26:37 +00:00
|
|
|
font-family: ${unsafeCSS(sharedStyles.fonts.base)};
|
2025-06-29 19:55:58 +00:00
|
|
|
transition: all 0.2s ease;
|
2025-06-29 23:58:51 +00:00
|
|
|
height: 32px;
|
2025-06-29 19:55:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.filter-button:hover {
|
2025-06-29 23:58:51 +00:00
|
|
|
border-color: ${cssManager.bdTheme('#0a0a0a', '#fafafa')};
|
|
|
|
|
color: ${cssManager.bdTheme('#0a0a0a', '#fafafa')};
|
2025-06-29 19:55:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.filter-button.active {
|
2025-06-29 23:58:51 +00:00
|
|
|
background: ${cssManager.bdTheme('#0a0a0a', '#fafafa')};
|
|
|
|
|
color: ${cssManager.bdTheme('#fafafa', '#0a0a0a')};
|
|
|
|
|
border-color: ${cssManager.bdTheme('#0a0a0a', '#fafafa')};
|
2025-06-29 19:55:58 +00:00
|
|
|
}
|
|
|
|
|
|
2025-06-29 23:58:51 +00:00
|
|
|
.selected-services {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-wrap: wrap;
|
2025-12-23 09:26:37 +00:00
|
|
|
gap: ${unsafeCSS(sharedStyles.spacing.sm)};
|
2025-06-29 23:58:51 +00:00
|
|
|
align-items: center;
|
2025-06-29 19:55:58 +00:00
|
|
|
}
|
2025-12-23 09:26:37 +00:00
|
|
|
|
2025-06-29 23:58:51 +00:00
|
|
|
.service-pill {
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
align-items: center;
|
2025-12-23 09:26:37 +00:00
|
|
|
gap: ${unsafeCSS(sharedStyles.spacing.xs)};
|
|
|
|
|
padding: ${unsafeCSS(sharedStyles.spacing.xs)} ${unsafeCSS(sharedStyles.spacing.md)};
|
2025-06-29 23:58:51 +00:00
|
|
|
background: ${cssManager.bdTheme('#ffffff', '#0a0a0a')};
|
|
|
|
|
border: 1px solid ${cssManager.bdTheme('#e5e7eb', '#27272a')};
|
2025-12-23 09:26:37 +00:00
|
|
|
border-radius: ${unsafeCSS(sharedStyles.borderRadius.full)};
|
2025-06-29 23:58:51 +00:00
|
|
|
font-size: 13px;
|
|
|
|
|
transition: all 0.2s ease;
|
|
|
|
|
}
|
2025-12-23 09:26:37 +00:00
|
|
|
|
2025-06-29 23:58:51 +00:00
|
|
|
.service-pill:hover {
|
|
|
|
|
border-color: ${cssManager.bdTheme('#0a0a0a', '#fafafa')};
|
|
|
|
|
}
|
2025-12-23 09:26:37 +00:00
|
|
|
|
2025-06-29 23:58:51 +00:00
|
|
|
.service-pill .status-dot {
|
|
|
|
|
width: 6px;
|
|
|
|
|
height: 6px;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
}
|
2025-12-23 09:26:37 +00:00
|
|
|
|
2025-06-29 23:58:51 +00:00
|
|
|
.manage-button {
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
align-items: center;
|
2025-12-23 09:26:37 +00:00
|
|
|
gap: ${unsafeCSS(sharedStyles.spacing.xs)};
|
|
|
|
|
padding: ${unsafeCSS(sharedStyles.spacing.xs)} ${unsafeCSS(sharedStyles.spacing.md)};
|
2025-06-29 23:58:51 +00:00
|
|
|
background: transparent;
|
|
|
|
|
border: 1px solid ${cssManager.bdTheme('#e5e7eb', '#27272a')};
|
2025-12-23 09:26:37 +00:00
|
|
|
border-radius: ${unsafeCSS(sharedStyles.borderRadius.base)};
|
2025-06-29 23:58:51 +00:00
|
|
|
font-size: 13px;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
transition: all 0.2s ease;
|
|
|
|
|
color: ${cssManager.bdTheme('#6b7280', '#a1a1aa')};
|
2025-12-23 09:26:37 +00:00
|
|
|
font-family: ${unsafeCSS(sharedStyles.fonts.base)};
|
2025-06-29 23:58:51 +00:00
|
|
|
}
|
2025-12-23 09:26:37 +00:00
|
|
|
|
2025-06-29 23:58:51 +00:00
|
|
|
.manage-button:hover {
|
|
|
|
|
border-color: ${cssManager.bdTheme('#0a0a0a', '#fafafa')};
|
|
|
|
|
color: ${cssManager.bdTheme('#0a0a0a', '#fafafa')};
|
|
|
|
|
}
|
2025-12-23 09:26:37 +00:00
|
|
|
|
2025-06-29 23:58:51 +00:00
|
|
|
.expandable-section {
|
2025-12-23 09:26:37 +00:00
|
|
|
margin-top: ${unsafeCSS(sharedStyles.spacing.lg)};
|
2025-06-29 23:58:51 +00:00
|
|
|
overflow: hidden;
|
|
|
|
|
transition: all 0.3s ease;
|
|
|
|
|
}
|
2025-12-23 09:26:37 +00:00
|
|
|
|
2025-06-29 23:58:51 +00:00
|
|
|
.expandable-content {
|
2025-12-23 09:26:37 +00:00
|
|
|
padding: ${unsafeCSS(sharedStyles.spacing.lg)};
|
2025-06-29 23:58:51 +00:00
|
|
|
background: ${cssManager.bdTheme('#fafafa', '#0a0a0a')};
|
|
|
|
|
border: 1px solid ${cssManager.bdTheme('#e5e7eb', '#27272a')};
|
2025-12-23 09:26:37 +00:00
|
|
|
border-radius: ${unsafeCSS(sharedStyles.borderRadius.base)};
|
2025-06-29 23:58:51 +00:00
|
|
|
}
|
2025-12-23 09:26:37 +00:00
|
|
|
|
2025-06-29 19:55:58 +00:00
|
|
|
.assets-grid {
|
|
|
|
|
display: grid;
|
2025-06-29 23:58:51 +00:00
|
|
|
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
2025-12-23 09:26:37 +00:00
|
|
|
gap: ${unsafeCSS(sharedStyles.spacing.sm)};
|
|
|
|
|
margin-top: ${unsafeCSS(sharedStyles.spacing.md)};
|
2025-06-29 19:55:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.asset-card {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2025-12-23 09:26:37 +00:00
|
|
|
padding: ${unsafeCSS(sharedStyles.spacing.sm)} ${unsafeCSS(sharedStyles.spacing.md)};
|
2025-06-29 23:58:51 +00:00
|
|
|
background: ${cssManager.bdTheme('#ffffff', '#0a0a0a')};
|
2025-12-23 09:26:37 +00:00
|
|
|
border-radius: ${unsafeCSS(sharedStyles.borderRadius.base)};
|
2025-06-29 19:55:58 +00:00
|
|
|
cursor: pointer;
|
|
|
|
|
transition: all 0.2s ease;
|
2025-06-29 23:58:51 +00:00
|
|
|
border: 1px solid ${cssManager.bdTheme('#e5e7eb', '#27272a')};
|
2025-12-23 09:26:37 +00:00
|
|
|
gap: ${unsafeCSS(sharedStyles.spacing.sm)};
|
2025-06-29 19:55:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.asset-card:hover {
|
2025-06-29 23:58:51 +00:00
|
|
|
border-color: ${cssManager.bdTheme('#d1d5db', '#3f3f46')};
|
2025-06-29 19:55:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.asset-card.selected {
|
2025-06-29 23:58:51 +00:00
|
|
|
border-color: ${cssManager.bdTheme('#0a0a0a', '#fafafa')};
|
|
|
|
|
background: ${cssManager.bdTheme('#f9fafb', '#0f0f0f')};
|
2025-06-29 19:55:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.asset-checkbox {
|
|
|
|
|
width: 16px;
|
|
|
|
|
height: 16px;
|
|
|
|
|
cursor: pointer;
|
2025-12-23 09:26:37 +00:00
|
|
|
accent-color: ${sharedStyles.colors.text.primary};
|
2025-06-29 19:55:58 +00:00
|
|
|
flex-shrink: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.asset-info {
|
|
|
|
|
flex: 1;
|
|
|
|
|
min-width: 0;
|
2021-09-23 14:30:02 +02:00
|
|
|
}
|
|
|
|
|
|
2025-06-29 19:55:58 +00:00
|
|
|
.asset-name {
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
font-size: 14px;
|
2025-12-23 09:26:37 +00:00
|
|
|
margin-bottom: ${unsafeCSS(sharedStyles.spacing.xs)};
|
2025-06-29 19:55:58 +00:00
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.asset-description {
|
|
|
|
|
font-size: 13px;
|
2025-12-23 09:26:37 +00:00
|
|
|
color: ${sharedStyles.colors.text.secondary};
|
2025-06-29 19:55:58 +00:00
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.asset-status {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2025-12-23 09:26:37 +00:00
|
|
|
gap: ${unsafeCSS(sharedStyles.spacing.xs)};
|
2025-06-29 19:55:58 +00:00
|
|
|
flex-shrink: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.status-indicator {
|
|
|
|
|
width: 8px;
|
|
|
|
|
height: 8px;
|
2025-12-23 09:26:37 +00:00
|
|
|
border-radius: ${unsafeCSS(sharedStyles.borderRadius.full)};
|
2025-06-29 19:55:58 +00:00
|
|
|
}
|
|
|
|
|
|
2025-06-30 00:17:43 +00:00
|
|
|
.status-indicator.operational, .status-dot.operational { background: #22c55e; }
|
|
|
|
|
.status-indicator.degraded, .status-dot.degraded { background: #fbbf24; }
|
|
|
|
|
.status-indicator.partial_outage, .status-dot.partial_outage { background: #f87171; }
|
|
|
|
|
.status-indicator.major_outage, .status-dot.major_outage { background: #ef4444; }
|
|
|
|
|
.status-indicator.maintenance, .status-dot.maintenance { background: #60a5fa; }
|
2025-06-29 19:55:58 +00:00
|
|
|
|
|
|
|
|
.status-text {
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
text-transform: capitalize;
|
2025-12-23 09:26:37 +00:00
|
|
|
color: ${sharedStyles.colors.text.secondary};
|
2025-06-29 19:55:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.loading-message,
|
|
|
|
|
.no-results {
|
|
|
|
|
grid-column: 1 / -1;
|
2021-09-23 14:30:02 +02:00
|
|
|
text-align: center;
|
2025-12-23 09:26:37 +00:00
|
|
|
padding: ${unsafeCSS(sharedStyles.spacing.xl)};
|
2025-06-29 23:58:51 +00:00
|
|
|
color: ${cssManager.bdTheme('#9ca3af', '#71717a')};
|
|
|
|
|
font-size: 13px;
|
2025-06-29 19:55:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.summary {
|
|
|
|
|
text-align: right;
|
2025-06-29 23:58:51 +00:00
|
|
|
font-size: 12px;
|
2025-12-23 09:26:37 +00:00
|
|
|
margin-top: ${unsafeCSS(sharedStyles.spacing.md)};
|
2025-06-29 23:58:51 +00:00
|
|
|
color: ${cssManager.bdTheme('#9ca3af', '#71717a')};
|
|
|
|
|
}
|
2025-12-23 09:26:37 +00:00
|
|
|
|
2025-06-29 23:58:51 +00:00
|
|
|
.no-services {
|
2025-12-23 09:26:37 +00:00
|
|
|
padding: ${unsafeCSS(sharedStyles.spacing.xl)};
|
2025-06-29 23:58:51 +00:00
|
|
|
text-align: center;
|
|
|
|
|
color: ${cssManager.bdTheme('#9ca3af', '#71717a')};
|
|
|
|
|
font-size: 13px;
|
2025-06-29 19:55:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media (max-width: 640px) {
|
|
|
|
|
.container {
|
2025-12-23 09:26:37 +00:00
|
|
|
padding: 0 ${unsafeCSS(sharedStyles.spacing.md)} ${unsafeCSS(sharedStyles.spacing.md)} ${unsafeCSS(sharedStyles.spacing.md)};
|
2025-06-29 19:55:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.controls {
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: stretch;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.search-input {
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-29 23:58:51 +00:00
|
|
|
.selected-services {
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: stretch;
|
|
|
|
|
}
|
2025-12-23 09:26:37 +00:00
|
|
|
|
2025-06-29 23:58:51 +00:00
|
|
|
.service-pill {
|
|
|
|
|
width: auto;
|
|
|
|
|
}
|
2025-12-23 09:26:37 +00:00
|
|
|
|
2025-06-29 23:58:51 +00:00
|
|
|
.expandable-content {
|
2025-12-23 09:26:37 +00:00
|
|
|
padding: ${unsafeCSS(sharedStyles.spacing.md)};
|
2025-06-29 23:58:51 +00:00
|
|
|
}
|
2025-12-23 09:26:37 +00:00
|
|
|
|
2025-06-29 19:55:58 +00:00
|
|
|
.assets-grid {
|
|
|
|
|
grid-template-columns: 1fr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.asset-card {
|
2025-12-23 09:26:37 +00:00
|
|
|
padding: ${unsafeCSS(sharedStyles.spacing.sm)};
|
2025-06-29 19:55:58 +00:00
|
|
|
}
|
2021-09-23 14:30:02 +02:00
|
|
|
}
|
2023-01-05 13:37:28 +01:00
|
|
|
`,
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
public render(): TemplateResult {
|
2025-06-29 23:58:51 +00:00
|
|
|
const selectedServices = this.services.filter(s => s.selected);
|
|
|
|
|
const selectedCount = selectedServices.length;
|
2025-06-29 19:55:58 +00:00
|
|
|
const categories = this.getUniqueCategories();
|
|
|
|
|
|
2023-01-05 13:37:28 +01:00
|
|
|
return html`
|
2025-06-29 19:55:58 +00:00
|
|
|
<div class="container">
|
|
|
|
|
<uplinternal-miniheading>Monitored Assets</uplinternal-miniheading>
|
|
|
|
|
|
2025-06-29 23:58:51 +00:00
|
|
|
<div class="selected-services">
|
|
|
|
|
${selectedCount === 0 ? html`
|
|
|
|
|
<span style="color: ${cssManager.bdTheme('#9ca3af', '#71717a')}; font-size: 13px;">
|
|
|
|
|
No services selected
|
|
|
|
|
</span>
|
|
|
|
|
` : selectedCount > 5 && !this.expanded ? html`
|
|
|
|
|
${selectedServices.slice(0, 4).map(service => html`
|
|
|
|
|
<div class="service-pill">
|
|
|
|
|
<span class="status-dot ${service.currentStatus}"></span>
|
|
|
|
|
<span>${service.displayName}</span>
|
|
|
|
|
</div>
|
|
|
|
|
`)}
|
|
|
|
|
<span style="color: ${cssManager.bdTheme('#6b7280', '#a1a1aa')}; font-size: 12px;">
|
|
|
|
|
+${selectedCount - 4} more
|
|
|
|
|
</span>
|
|
|
|
|
` : selectedServices.map(service => html`
|
|
|
|
|
<div class="service-pill">
|
|
|
|
|
<span class="status-dot ${service.currentStatus}"></span>
|
|
|
|
|
<span>${service.displayName}</span>
|
|
|
|
|
</div>
|
2025-06-29 19:55:58 +00:00
|
|
|
`)}
|
|
|
|
|
|
2025-06-29 23:58:51 +00:00
|
|
|
<button
|
|
|
|
|
class="manage-button"
|
|
|
|
|
@click=${() => { this.expanded = !this.expanded; }}
|
2025-06-29 19:55:58 +00:00
|
|
|
>
|
2025-06-29 23:58:51 +00:00
|
|
|
${this.expanded ? 'Close' : 'Manage Services'}
|
|
|
|
|
<svg
|
|
|
|
|
width="10"
|
|
|
|
|
height="6"
|
|
|
|
|
viewBox="0 0 10 6"
|
|
|
|
|
fill="none"
|
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
style="transform: rotate(${this.expanded ? '180deg' : '0'}); transition: transform 0.2s;"
|
|
|
|
|
>
|
|
|
|
|
<path
|
|
|
|
|
d="M1 1L5 5L9 1"
|
|
|
|
|
stroke="currentColor"
|
|
|
|
|
stroke-width="1.5"
|
|
|
|
|
stroke-linecap="round"
|
|
|
|
|
stroke-linejoin="round"
|
|
|
|
|
/>
|
|
|
|
|
</svg>
|
2025-06-29 19:55:58 +00:00
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-06-29 23:58:51 +00:00
|
|
|
${this.expanded ? html`
|
|
|
|
|
<div class="expandable-section">
|
|
|
|
|
<div class="expandable-content">
|
|
|
|
|
<div class="controls">
|
|
|
|
|
<input
|
|
|
|
|
type="text"
|
|
|
|
|
class="search-input"
|
|
|
|
|
placeholder="Search services..."
|
|
|
|
|
.value=${this.filterText}
|
|
|
|
|
@input=${(e: Event) => {
|
|
|
|
|
this.filterText = (e.target as HTMLInputElement).value;
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
class="filter-button ${this.filterCategory === 'all' ? 'active' : ''}"
|
|
|
|
|
@click=${() => { this.filterCategory = 'all'; }}
|
|
|
|
|
>
|
|
|
|
|
All
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
${categories.map(category => html`
|
|
|
|
|
<button
|
|
|
|
|
class="filter-button ${this.filterCategory === category ? 'active' : ''}"
|
|
|
|
|
@click=${() => { this.filterCategory = category; }}
|
|
|
|
|
>
|
|
|
|
|
${category}
|
|
|
|
|
</button>
|
|
|
|
|
`)}
|
|
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
class="filter-button ${this.showOnlySelected ? 'active' : ''}"
|
|
|
|
|
@click=${() => { this.showOnlySelected = !this.showOnlySelected; }}
|
|
|
|
|
>
|
|
|
|
|
${this.showOnlySelected ? 'Show All' : 'Selected Only'}
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
class="filter-button"
|
|
|
|
|
@click=${() => this.selectAll()}
|
|
|
|
|
>
|
|
|
|
|
Select All
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
class="filter-button"
|
|
|
|
|
@click=${() => this.selectNone()}
|
|
|
|
|
>
|
|
|
|
|
Select None
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2025-06-29 19:55:58 +00:00
|
|
|
|
2025-06-29 23:58:51 +00:00
|
|
|
<div class="assets-grid">
|
|
|
|
|
${this.loading ? html`
|
|
|
|
|
<div class="loading-message">Loading services...</div>
|
|
|
|
|
` : this.renderServiceGrid()}
|
2025-06-29 19:55:58 +00:00
|
|
|
</div>
|
|
|
|
|
|
2025-06-29 23:58:51 +00:00
|
|
|
<div class="summary">
|
|
|
|
|
${selectedCount} of ${this.services.length} services selected
|
2025-06-29 19:55:58 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-06-29 23:58:51 +00:00
|
|
|
</div>
|
|
|
|
|
` : ''}
|
2021-09-23 14:30:02 +02:00
|
|
|
</div>
|
|
|
|
|
`;
|
|
|
|
|
}
|
2025-06-29 19:55:58 +00:00
|
|
|
|
|
|
|
|
private getFilteredServices(): IServiceStatus[] {
|
|
|
|
|
return this.services.filter(service => {
|
|
|
|
|
// Apply text filter
|
|
|
|
|
if (this.filterText && !service.displayName.toLowerCase().includes(this.filterText.toLowerCase()) &&
|
|
|
|
|
(!service.description || !service.description.toLowerCase().includes(this.filterText.toLowerCase()))) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Apply category filter
|
|
|
|
|
if (this.filterCategory !== 'all' && service.category !== this.filterCategory) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Apply selected filter
|
|
|
|
|
if (this.showOnlySelected && !service.selected) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private getUniqueCategories(): string[] {
|
|
|
|
|
const categories = new Set<string>();
|
|
|
|
|
this.services.forEach(service => {
|
|
|
|
|
if (service.category) {
|
|
|
|
|
categories.add(service.category);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return Array.from(categories).sort();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private toggleService(serviceId: string) {
|
|
|
|
|
const service = this.services.find(s => s.id === serviceId);
|
|
|
|
|
if (service) {
|
|
|
|
|
service.selected = !service.selected;
|
|
|
|
|
this.requestUpdate();
|
|
|
|
|
|
|
|
|
|
this.dispatchEvent(new CustomEvent('selectionChanged', {
|
|
|
|
|
detail: {
|
|
|
|
|
serviceId,
|
|
|
|
|
selected: service.selected,
|
|
|
|
|
selectedServices: this.services.filter(s => s.selected).map(s => s.id)
|
|
|
|
|
},
|
|
|
|
|
bubbles: true,
|
|
|
|
|
composed: true
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private selectAll() {
|
|
|
|
|
const filteredServices = this.getFilteredServices();
|
|
|
|
|
filteredServices.forEach(service => {
|
|
|
|
|
service.selected = true;
|
|
|
|
|
});
|
|
|
|
|
this.requestUpdate();
|
|
|
|
|
this.emitSelectionUpdate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private selectNone() {
|
|
|
|
|
const filteredServices = this.getFilteredServices();
|
|
|
|
|
filteredServices.forEach(service => {
|
|
|
|
|
service.selected = false;
|
|
|
|
|
});
|
|
|
|
|
this.requestUpdate();
|
|
|
|
|
this.emitSelectionUpdate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private emitSelectionUpdate() {
|
|
|
|
|
this.dispatchEvent(new CustomEvent('selectionChanged', {
|
|
|
|
|
detail: {
|
|
|
|
|
selectedServices: this.services.filter(s => s.selected).map(s => s.id)
|
|
|
|
|
},
|
|
|
|
|
bubbles: true,
|
|
|
|
|
composed: true
|
|
|
|
|
}));
|
|
|
|
|
}
|
2025-06-29 23:58:51 +00:00
|
|
|
|
|
|
|
|
private renderServiceGrid(): TemplateResult {
|
|
|
|
|
const filteredServices = this.getFilteredServices();
|
|
|
|
|
|
|
|
|
|
if (filteredServices.length === 0) {
|
|
|
|
|
return html`<div class="no-results">No services found matching your criteria</div>`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return html`${filteredServices.map(service => html`
|
|
|
|
|
<div
|
|
|
|
|
class="asset-card ${service.selected ? 'selected' : ''}"
|
|
|
|
|
@click=${() => this.toggleService(service.id)}
|
|
|
|
|
>
|
|
|
|
|
<input
|
|
|
|
|
type="checkbox"
|
|
|
|
|
class="asset-checkbox"
|
|
|
|
|
.checked=${service.selected}
|
|
|
|
|
@click=${(e: Event) => e.stopPropagation()}
|
|
|
|
|
@change=${(e: Event) => {
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
this.toggleService(service.id);
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<div class="asset-info">
|
|
|
|
|
<div class="asset-name">${service.displayName}</div>
|
|
|
|
|
${service.description ? html`
|
|
|
|
|
<div class="asset-description">${service.description}</div>
|
|
|
|
|
` : ''}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="asset-status">
|
|
|
|
|
<div class="status-indicator ${service.currentStatus}"></div>
|
|
|
|
|
<div class="status-text">${service.currentStatus.replace(/_/g, ' ')}</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
`)}`;
|
|
|
|
|
}
|
2021-09-23 14:30:02 +02:00
|
|
|
}
|