refactor(frontend): modernise la mise en page du tableau de bord
- ligne d'état « Actualisé à HH:mm:ss · N sites suivis » avec un point animé, figé sous prefers-reduced-motion - indicateurs en cartes : libellé en capitales, grand nombre en chiffres tabulaires, filet supérieur, ombre au survol ; la barre de charge moyenne passe au jaune à 70 % et au rouge à 90 %, avec un texte d'aide - grille à deux colonnes : graphique de charge et prévisions à gauche, flux d'alertes en colonne collante à droite, une colonne sous 900 px - prévisions présentées en tableau (site, prévision, échéance, lien détail) - liens de navigation de l'en-tête restylés en pastilles, par SCSS seulement : le bloc HTML de navigation est inchangé octet pour octet - styles de tableau sortis dans _tables.scss (.ev-table, .ev-table-card), la liste des sites les adopte au lieu de sa copie locale
This commit is contained in:
@@ -32,69 +32,115 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@if (stats(); as s) {
|
@if (stats(); as s) {
|
||||||
<section class="overview">
|
<p class="dashboard__status">
|
||||||
<ev-card class="card card--gauge">
|
<span class="dashboard__pulse" aria-hidden="true"></span>
|
||||||
<span class="card__label">Consommation vs capacité</span>
|
Actualisé à {{ s.timestamp | date: 'HH:mm:ss' }} · {{ s.total_sites }} sites suivis
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<section class="overview" aria-label="Indicateurs du parc">
|
||||||
|
<ev-card class="kpi kpi--gauge">
|
||||||
|
<span class="kpi__label">Consommation vs capacité</span>
|
||||||
<app-consumption-gauge
|
<app-consumption-gauge
|
||||||
[consumption]="s.total_consumption_kw"
|
[consumption]="s.total_consumption_kw"
|
||||||
[capacity]="s.total_capacity_kw"
|
[capacity]="s.total_capacity_kw"
|
||||||
/>
|
/>
|
||||||
<span class="card__value"
|
<span class="kpi__value">
|
||||||
>{{ s.total_consumption_kw | number: '1.0-1' }} /
|
{{ s.total_consumption_kw | number: '1.0-1' }}
|
||||||
{{ s.total_capacity_kw | number }} kW</span
|
<small>/ {{ s.total_capacity_kw | number }} kW</small>
|
||||||
|
</span>
|
||||||
|
</ev-card>
|
||||||
|
|
||||||
|
<ev-card class="kpi">
|
||||||
|
<span class="kpi__label">Charge moyenne du parc</span>
|
||||||
|
<span class="kpi__value"
|
||||||
|
>{{ s.average_load_percent | number: '1.0-0' }} <small>%</small></span
|
||||||
>
|
>
|
||||||
</ev-card>
|
<div
|
||||||
|
class="progress-bar"
|
||||||
<ev-card class="card">
|
role="progressbar"
|
||||||
<span class="card__label">Charge moyenne du parc</span>
|
aria-valuemin="0"
|
||||||
<span class="card__value">{{ s.average_load_percent }} %</span>
|
aria-valuemax="100"
|
||||||
<div class="progress-bar">
|
[attr.aria-valuenow]="s.average_load_percent"
|
||||||
<div class="progress-bar__fill" [style.width.%]="s.average_load_percent"></div>
|
>
|
||||||
|
<div
|
||||||
|
class="progress-bar__fill"
|
||||||
|
[class]="'progress-bar__fill--' + loadTone(s.average_load_percent)"
|
||||||
|
[style.width.%]="s.average_load_percent"
|
||||||
|
></div>
|
||||||
</div>
|
</div>
|
||||||
|
<span class="kpi__hint">{{ loadHint(s.average_load_percent) }}</span>
|
||||||
</ev-card>
|
</ev-card>
|
||||||
|
|
||||||
<ev-card class="card">
|
<ev-card class="kpi">
|
||||||
<span class="card__label">Sites suivis</span>
|
<span class="kpi__label">Sites suivis</span>
|
||||||
<span class="card__value">{{ s.total_sites }}</span>
|
<span class="kpi__value">{{ s.total_sites }}</span>
|
||||||
|
<a routerLink="/sites" class="ev-link kpi__link">Voir la liste des sites</a>
|
||||||
</ev-card>
|
</ev-card>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="chart-section">
|
|
||||||
<h2>Charge et alerte visuelle par site</h2>
|
|
||||||
<app-site-load-chart [sites]="s.sites" />
|
|
||||||
</section>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
<section class="alerts-section">
|
<div class="dashboard__grid">
|
||||||
<app-alert-feed />
|
<div class="dashboard__main">
|
||||||
</section>
|
@if (stats(); as s) {
|
||||||
|
<section class="chart-section">
|
||||||
|
<h2>Charge par site</h2>
|
||||||
|
<ev-card class="chart-card">
|
||||||
|
<app-site-load-chart [sites]="s.sites" />
|
||||||
|
</ev-card>
|
||||||
|
</section>
|
||||||
|
}
|
||||||
|
|
||||||
@if (predictions().length > 0) {
|
<section class="predictions-section">
|
||||||
<section class="predictions-section">
|
<h2>Prévisions de consommation</h2>
|
||||||
<h2>Prévisions de consommation</h2>
|
@if (predictions().length > 0) {
|
||||||
<ul class="predictions-list">
|
<ev-card class="ev-table-card">
|
||||||
@for (site of predictions(); track site.site_id) {
|
<table class="ev-table">
|
||||||
<li class="prediction-item">
|
<thead>
|
||||||
<span class="prediction-item__site">{{ site.site_name }}</span>
|
<tr>
|
||||||
@if (site.prediction; as prediction) {
|
<th>Site</th>
|
||||||
@if (prediction.status === 'available') {
|
<th>Prévision</th>
|
||||||
<span class="prediction-item__value">
|
<th>Échéance</th>
|
||||||
{{ prediction.predicted_value | number: '1.0-1' }} kWh
|
<th></th>
|
||||||
<span class="prediction-item__target">{{
|
</tr>
|
||||||
prediction.target_at | date: "dd/MM 'à' HH:mm"
|
</thead>
|
||||||
}}</span>
|
<tbody>
|
||||||
</span>
|
@for (site of predictions(); track site.site_id) {
|
||||||
} @else {
|
<tr>
|
||||||
<ev-badge [tone]="badgeToneForPredictionStatus(prediction.status)">{{
|
<td>{{ site.site_name }}</td>
|
||||||
prediction.status === 'insufficient_data' ? 'Historique insuffisant' : 'Erreur'
|
@if (site.prediction; as prediction) {
|
||||||
}}</ev-badge>
|
@if (prediction.status === 'available') {
|
||||||
}
|
<td class="ev-table__number">
|
||||||
} @else {
|
{{ prediction.predicted_value | number: '1.0-1' }} kWh
|
||||||
<ev-badge tone="neutral">Pas encore de prévision</ev-badge>
|
</td>
|
||||||
}
|
<td>{{ prediction.target_at | date: "dd/MM 'à' HH:mm" }}</td>
|
||||||
</li>
|
} @else {
|
||||||
|
<td>
|
||||||
|
<ev-badge [tone]="badgeToneForPredictionStatus(prediction.status)">{{
|
||||||
|
prediction.status === 'insufficient_data'
|
||||||
|
? 'Historique insuffisant'
|
||||||
|
: 'Erreur'
|
||||||
|
}}</ev-badge>
|
||||||
|
</td>
|
||||||
|
<td class="ev-table__muted">-</td>
|
||||||
|
}
|
||||||
|
} @else {
|
||||||
|
<td><ev-badge tone="neutral">Pas encore de prévision</ev-badge></td>
|
||||||
|
<td class="ev-table__muted">-</td>
|
||||||
|
}
|
||||||
|
<td><a [routerLink]="['/sites', site.site_id]" class="ev-link">Détail</a></td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</ev-card>
|
||||||
|
} @else if (!predictionsError()) {
|
||||||
|
<p class="dashboard__empty">Aucune prévision disponible pour le moment.</p>
|
||||||
}
|
}
|
||||||
</ul>
|
</section>
|
||||||
</section>
|
</div>
|
||||||
}
|
|
||||||
|
<aside class="dashboard__side" aria-label="Alertes actives">
|
||||||
|
<app-alert-feed />
|
||||||
|
</aside>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,9 +8,11 @@
|
|||||||
|
|
||||||
.dashboard__header {
|
.dashboard__header {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
margin-bottom: 2rem;
|
gap: var(--space-3);
|
||||||
|
margin-bottom: var(--space-3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.dashboard__brand {
|
.dashboard__brand {
|
||||||
@@ -20,8 +22,9 @@
|
|||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 1.75rem;
|
font-size: var(--font-size-xl);
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
|
letter-spacing: -0.01em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,19 +34,69 @@
|
|||||||
|
|
||||||
.dashboard__subtitle {
|
.dashboard__subtitle {
|
||||||
margin: 0.25rem 0 0;
|
margin: 0.25rem 0 0;
|
||||||
|
font-size: var(--font-size-sm);
|
||||||
color: var(--color-text-muted);
|
color: var(--color-text-muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
.dashboard__actions {
|
.dashboard__actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 1rem;
|
gap: var(--space-2);
|
||||||
|
|
||||||
|
.ev-link {
|
||||||
|
padding: 0.45rem 0.9rem;
|
||||||
|
border-radius: var(--radius-pill);
|
||||||
|
background: var(--color-primary-light);
|
||||||
|
color: var(--color-primary-hover);
|
||||||
|
font-size: var(--font-size-sm);
|
||||||
|
transition: background 0.15s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: var(--color-primary);
|
||||||
|
color: var(--color-text-inverse);
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dashboard__status {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: var(--space-2);
|
||||||
|
margin: 0 0 var(--space-4);
|
||||||
|
font-size: var(--font-size-sm);
|
||||||
|
color: var(--color-text-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dashboard__pulse {
|
||||||
|
width: 0.6rem;
|
||||||
|
height: 0.6rem;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--color-success);
|
||||||
|
animation: pulse 2s ease-out infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pulse {
|
||||||
|
0% {
|
||||||
|
box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.45);
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
box-shadow: 0 0 0 8px rgba(22, 163, 74, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.dashboard__pulse {
|
||||||
|
animation: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
font-size: 1.1rem;
|
margin: 0 0 var(--space-3);
|
||||||
|
font-size: var(--font-size-lg);
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
margin: 0 0 1rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.banner-error {
|
.banner-error {
|
||||||
@@ -54,97 +107,124 @@ h2 {
|
|||||||
.overview {
|
.overview {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
|
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
|
||||||
gap: 1rem;
|
gap: var(--space-3);
|
||||||
margin-bottom: 2.5rem;
|
margin-bottom: var(--space-5);
|
||||||
}
|
}
|
||||||
|
|
||||||
.card {
|
.kpi {
|
||||||
padding: 1.25rem;
|
position: relative;
|
||||||
gap: 0.35rem;
|
overflow: hidden;
|
||||||
|
padding: var(--space-4);
|
||||||
|
gap: var(--space-1);
|
||||||
|
transition:
|
||||||
|
box-shadow 0.15s ease,
|
||||||
|
transform 0.15s ease;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
inset: 0 0 auto 0;
|
||||||
|
height: 3px;
|
||||||
|
background: var(--color-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
box-shadow: var(--shadow-card-hover);
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.card--gauge {
|
.kpi--gauge {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card--link {
|
.kpi__label {
|
||||||
cursor: pointer;
|
font-size: var(--font-size-xs);
|
||||||
transition: border-color 0.15s ease;
|
font-weight: 600;
|
||||||
|
color: var(--color-text-muted);
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.06em;
|
||||||
|
}
|
||||||
|
|
||||||
&:hover {
|
.kpi__value {
|
||||||
border-color: var(--color-primary);
|
font-size: var(--font-size-2xl);
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.1;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
|
||||||
|
small {
|
||||||
|
font-size: var(--font-size-sm);
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--color-text-muted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.card__label {
|
.kpi__hint {
|
||||||
font-size: 0.8rem;
|
font-size: var(--font-size-xs);
|
||||||
color: var(--color-text-muted);
|
color: var(--color-text-muted);
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.02em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.card__value {
|
.kpi__link {
|
||||||
font-size: 1.6rem;
|
margin-top: auto;
|
||||||
font-weight: 700;
|
font-size: var(--font-size-sm);
|
||||||
}
|
}
|
||||||
|
|
||||||
.progress-bar {
|
.progress-bar {
|
||||||
height: 6px;
|
height: 8px;
|
||||||
|
margin: var(--space-1) 0;
|
||||||
background: var(--color-border-light);
|
background: var(--color-border-light);
|
||||||
border-radius: var(--radius-pill);
|
border-radius: var(--radius-pill);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin-top: 0.25rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.progress-bar__fill {
|
.progress-bar__fill {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: var(--color-primary);
|
|
||||||
border-radius: var(--radius-pill);
|
border-radius: var(--radius-pill);
|
||||||
|
background: var(--color-success);
|
||||||
transition: width 0.3s ease;
|
transition: width 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.progress-bar__fill--warning {
|
||||||
|
background: var(--color-warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress-bar__fill--danger {
|
||||||
|
background: var(--color-danger);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dashboard__grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
|
||||||
|
gap: var(--space-4);
|
||||||
|
align-items: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dashboard__side {
|
||||||
|
position: sticky;
|
||||||
|
top: var(--space-3);
|
||||||
|
}
|
||||||
|
|
||||||
.chart-section {
|
.chart-section {
|
||||||
margin-bottom: 2.5rem;
|
margin-bottom: var(--space-5);
|
||||||
}
|
}
|
||||||
|
|
||||||
.alerts-section {
|
.chart-card {
|
||||||
margin-bottom: 2.5rem;
|
padding: var(--space-3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.predictions-list {
|
.dashboard__empty {
|
||||||
list-style: none;
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
font-size: var(--font-size-sm);
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.prediction-item {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: 0.75rem;
|
|
||||||
padding: 0.7rem 1rem;
|
|
||||||
border-radius: var(--radius-md);
|
|
||||||
background: var(--color-surface);
|
|
||||||
border: 1px solid var(--color-border-light);
|
|
||||||
}
|
|
||||||
|
|
||||||
.prediction-item__site {
|
|
||||||
font-size: 0.9rem;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.prediction-item__value {
|
|
||||||
font-size: 0.9rem;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.prediction-item__target {
|
|
||||||
margin-left: 0.35rem;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
font-weight: 400;
|
|
||||||
color: var(--color-text-muted);
|
color: var(--color-text-muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 900px) {
|
||||||
|
.dashboard__grid {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dashboard__side {
|
||||||
|
position: static;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -161,6 +161,71 @@ describe('Dashboard', () => {
|
|||||||
expect(navigateSpy).toHaveBeenCalledWith(['/login']);
|
expect(navigateSpy).toHaveBeenCalledWith(['/login']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('affiche l’heure du dernier relevé et les indicateurs du parc', () => {
|
||||||
|
vi.useFakeTimers();
|
||||||
|
const { fixture } = setup({
|
||||||
|
stats: of({
|
||||||
|
timestamp: '2026-09-18T09:00:00Z',
|
||||||
|
total_sites: 7,
|
||||||
|
total_consumption_kw: 1234.5,
|
||||||
|
total_capacity_kw: 5000,
|
||||||
|
average_load_percent: 24.7,
|
||||||
|
sites: [],
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
fixture.detectChanges();
|
||||||
|
vi.advanceTimersByTime(1);
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
const texte = fixture.nativeElement.textContent as string;
|
||||||
|
expect(texte).toContain('Actualisé à');
|
||||||
|
expect(texte).toContain('7 sites suivis');
|
||||||
|
expect(texte).toContain('Marge confortable');
|
||||||
|
expect(fixture.nativeElement.querySelector('.progress-bar__fill--success')).not.toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('présente les prévisions en tableau avec un lien vers chaque site', () => {
|
||||||
|
const { fixture } = setup({
|
||||||
|
predictions: predictionsMock([
|
||||||
|
{
|
||||||
|
site_id: 'SITE001',
|
||||||
|
site_name: 'Usine Nantes',
|
||||||
|
prediction: {
|
||||||
|
target_at: '2026-09-18T10:00:00Z',
|
||||||
|
target_metric: 'consumption_kwh',
|
||||||
|
period_minutes: 60,
|
||||||
|
predicted_value: 118.4,
|
||||||
|
status: 'available',
|
||||||
|
failure_reason: null,
|
||||||
|
model_reference: 'lightgbm-v1',
|
||||||
|
created_at: '2026-09-18T09:00:00Z',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ site_id: 'SITE002', site_name: 'Bureau Lille', prediction: null },
|
||||||
|
]),
|
||||||
|
});
|
||||||
|
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
const table = fixture.nativeElement.querySelector('table.ev-table');
|
||||||
|
expect(table).not.toBeNull();
|
||||||
|
expect(table.textContent).toContain('118.4 kWh');
|
||||||
|
expect(table.textContent).toContain('Pas encore de prévision');
|
||||||
|
expect(fixture.nativeElement.querySelector('a[href="/sites/SITE001"]')).not.toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('colore la charge moyenne selon les seuils 70 % et 90 %', () => {
|
||||||
|
const { fixture } = setup();
|
||||||
|
const dashboard = fixture.componentInstance;
|
||||||
|
|
||||||
|
expect(dashboard.loadTone(69.9)).toBe('success');
|
||||||
|
expect(dashboard.loadTone(70)).toBe('warning');
|
||||||
|
expect(dashboard.loadTone(89.9)).toBe('warning');
|
||||||
|
expect(dashboard.loadTone(90)).toBe('danger');
|
||||||
|
expect(dashboard.loadHint(95)).toBe('Proche de la capacité du parc');
|
||||||
|
});
|
||||||
|
|
||||||
it('distingue le ton des statuts de prévision', () => {
|
it('distingue le ton des statuts de prévision', () => {
|
||||||
const { fixture } = setup();
|
const { fixture } = setup();
|
||||||
const dashboard = fixture.componentInstance;
|
const dashboard = fixture.componentInstance;
|
||||||
|
|||||||
@@ -30,6 +30,11 @@ const TON_PAR_STATUT_PREDICTION: Record<PredictionStatus, BadgeTone> = {
|
|||||||
error: 'danger',
|
error: 'danger',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const SEUIL_CHARGE_SOUTENUE = 70;
|
||||||
|
const SEUIL_CHARGE_CRITIQUE = 90;
|
||||||
|
|
||||||
|
export type LoadTone = 'success' | 'warning' | 'danger';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dashboard',
|
selector: 'app-dashboard',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@@ -97,6 +102,24 @@ export class Dashboard implements OnInit {
|
|||||||
return TON_PAR_STATUT_PREDICTION[status];
|
return TON_PAR_STATUT_PREDICTION[status];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadTone(percent: number): LoadTone {
|
||||||
|
if (percent >= SEUIL_CHARGE_CRITIQUE) {
|
||||||
|
return 'danger';
|
||||||
|
}
|
||||||
|
return percent >= SEUIL_CHARGE_SOUTENUE ? 'warning' : 'success';
|
||||||
|
}
|
||||||
|
|
||||||
|
loadHint(percent: number): string {
|
||||||
|
switch (this.loadTone(percent)) {
|
||||||
|
case 'danger':
|
||||||
|
return 'Proche de la capacité du parc';
|
||||||
|
case 'warning':
|
||||||
|
return 'Charge soutenue';
|
||||||
|
default:
|
||||||
|
return 'Marge confortable';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onLogout(): void {
|
onLogout(): void {
|
||||||
this.auth.logout().subscribe({
|
this.auth.logout().subscribe({
|
||||||
next: () => this.router.navigate(['/login']),
|
next: () => this.router.navigate(['/login']),
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
<ev-alert severity="danger" class="banner-error">{{ message }}</ev-alert>
|
<ev-alert severity="danger" class="banner-error">{{ message }}</ev-alert>
|
||||||
}
|
}
|
||||||
|
|
||||||
<ev-card class="table-card">
|
<ev-card class="ev-table-card">
|
||||||
<table class="sites-table">
|
<table class="ev-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Nom</th>
|
<th>Nom</th>
|
||||||
@@ -36,7 +36,9 @@
|
|||||||
<td>{{ site.site_type }}</td>
|
<td>{{ site.site_type }}</td>
|
||||||
<td>{{ site.location || '-' }}</td>
|
<td>{{ site.location || '-' }}</td>
|
||||||
<td>{{ site.capacity_kw ?? '-' }}</td>
|
<td>{{ site.capacity_kw ?? '-' }}</td>
|
||||||
<td><ev-badge [tone]="badgeToneForStatus(site.status)">{{ site.status ?? '-' }}</ev-badge></td>
|
<td>
|
||||||
|
<ev-badge [tone]="badgeToneForStatus(site.status)">{{ site.status ?? '-' }}</ev-badge>
|
||||||
|
</td>
|
||||||
<td><a [routerLink]="['/sites', site.site_id]" class="ev-link">Détail</a></td>
|
<td><a [routerLink]="['/sites', site.site_id]" class="ev-link">Détail</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,32 +32,3 @@
|
|||||||
display: block;
|
display: block;
|
||||||
margin: 0 0 1.5rem;
|
margin: 0 0 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-card {
|
|
||||||
padding: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sites-table {
|
|
||||||
width: 100%;
|
|
||||||
border-collapse: collapse;
|
|
||||||
|
|
||||||
th,
|
|
||||||
td {
|
|
||||||
padding: 0.85rem 1.25rem;
|
|
||||||
text-align: left;
|
|
||||||
border-bottom: 1px solid var(--color-border-light);
|
|
||||||
}
|
|
||||||
|
|
||||||
th {
|
|
||||||
font-size: 0.8rem;
|
|
||||||
color: var(--color-text-muted);
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.02em;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
tr:last-child td {
|
|
||||||
border-bottom: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
@use 'styles/forms';
|
@use 'styles/forms';
|
||||||
@use 'styles/auth-page';
|
@use 'styles/auth-page';
|
||||||
@use 'styles/links';
|
@use 'styles/links';
|
||||||
|
@use 'styles/tables';
|
||||||
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
.ev-table-card {
|
||||||
|
padding: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ev-table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
|
||||||
|
th,
|
||||||
|
td {
|
||||||
|
padding: 0.85rem 1.25rem;
|
||||||
|
text-align: left;
|
||||||
|
border-bottom: 1px solid var(--color-border-light);
|
||||||
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
font-size: var(--font-size-xs);
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--color-text-muted);
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody tr:last-child td {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody tr:hover td {
|
||||||
|
background: var(--color-bg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ev-table__number {
|
||||||
|
font-weight: 600;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ev-table__muted {
|
||||||
|
color: var(--color-text-muted);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user