Ajout d'un script pour installation automatique du produit
Ajout d'une partie mise à jour automatique : plus besoin de docker pull en ligne de commande ; on peut passer par l'interface Refactoring partie Java pour respecter d'avantage le DDD : plus de jackson dans la partie domain Passage version 0.6.6
This commit is contained in:
@@ -148,4 +148,54 @@
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Bloc Mises a jour -->
|
||||
<section class="card" *ngIf="config.updateCheckEnabled">
|
||||
<h2>Mises a jour</h2>
|
||||
<p class="hint">Verifie aupres du registry Docker si une nouvelle version
|
||||
des conteneurs (core, brain, web) est disponible. Postgres et MinIO sont
|
||||
exclus — ils sont mis a jour manuellement.</p>
|
||||
|
||||
<div class="form-row">
|
||||
<button type="button" class="btn-secondary" (click)="checkUpdates()" [disabled]="updateChecking">
|
||||
<lucide-icon [img]="RefreshCw" [size]="14"></lucide-icon>
|
||||
<span>{{ updateChecking ? 'Verification...' : 'Verifier maintenant' }}</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div *ngIf="updateStatus && !updateStatus.enabled" class="hint">
|
||||
Feature non configuree (WATCHTOWER_TOKEN absent).
|
||||
</div>
|
||||
|
||||
<div *ngIf="updateStatus?.enabled">
|
||||
<div *ngIf="updateStatus?.updateAvailable" class="alert alert-success">
|
||||
<lucide-icon [img]="Download" [size]="16"></lucide-icon>
|
||||
<span>Une mise a jour est disponible.</span>
|
||||
</div>
|
||||
<div *ngIf="!updateStatus?.updateAvailable" class="hint">
|
||||
Tout est a jour (verifie le {{ updateStatus?.checkedAt | date:'short' }}).
|
||||
</div>
|
||||
|
||||
<ul class="update-images" *ngIf="updateStatus?.images?.length">
|
||||
<li *ngFor="let img of updateStatus?.images">
|
||||
<strong>{{ img.image }}</strong>
|
||||
<span *ngIf="img.updateAvailable" class="badge-update">MAJ dispo</span>
|
||||
<span *ngIf="!img.updateAvailable && img.remoteDigest" class="badge-ok">a jour</span>
|
||||
<span *ngIf="!img.remoteDigest" class="badge-warn">indisponible</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="form-row" *ngIf="updateStatus?.updateAvailable">
|
||||
<button type="button" class="btn-primary" (click)="applyUpdate()" [disabled]="updateApplying">
|
||||
<lucide-icon [img]="Download" [size]="16"></lucide-icon>
|
||||
<span>{{ updateApplying ? 'Mise a jour en cours...' : 'Mettre a jour maintenant' }}</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div *ngIf="updateMessage" class="alert alert-success">
|
||||
<lucide-icon [img]="Check" [size]="16"></lucide-icon>
|
||||
<span>{{ updateMessage }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -153,3 +153,46 @@
|
||||
width: 100%;
|
||||
accent-color: #6c63ff;
|
||||
}
|
||||
|
||||
.update-images {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0.75rem 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
.update-images li {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.6rem;
|
||||
padding: 0.4rem 0.6rem;
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
border-radius: 4px;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
.badge-update {
|
||||
margin-left: auto;
|
||||
background: #6c63ff;
|
||||
color: white;
|
||||
font-size: 0.7rem;
|
||||
font-weight: 700;
|
||||
padding: 0.15rem 0.5rem;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.badge-ok {
|
||||
margin-left: auto;
|
||||
background: rgba(76, 175, 80, 0.2);
|
||||
color: #81c784;
|
||||
font-size: 0.7rem;
|
||||
padding: 0.15rem 0.5rem;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.badge-warn {
|
||||
margin-left: auto;
|
||||
background: rgba(255, 152, 0, 0.2);
|
||||
color: #ffb74d;
|
||||
font-size: 0.7rem;
|
||||
padding: 0.15rem 0.5rem;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@ import { Component, OnInit } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import { LucideAngularModule, ArrowLeft, RefreshCw, Save, Check, AlertCircle } from 'lucide-angular';
|
||||
import { LucideAngularModule, ArrowLeft, RefreshCw, Save, Check, AlertCircle, Download } from 'lucide-angular';
|
||||
import { SettingsService, AppSettings, AppSettingsUpdate, OneMinModelGroup } from '../services/settings.service';
|
||||
import { UpdatesService, UpdateStatus } from '../services/updates.service';
|
||||
import { ConfigService } from '../services/config.service';
|
||||
|
||||
/**
|
||||
* Ecran de parametrage du LLM utilise par le Brain.
|
||||
@@ -30,6 +32,13 @@ export class SettingsComponent implements OnInit {
|
||||
readonly Save = Save;
|
||||
readonly Check = Check;
|
||||
readonly AlertCircle = AlertCircle;
|
||||
readonly Download = Download;
|
||||
|
||||
// Mises a jour conteneurs
|
||||
updateStatus: UpdateStatus | null = null;
|
||||
updateChecking = false;
|
||||
updateApplying = false;
|
||||
updateMessage = '';
|
||||
|
||||
settings: AppSettings | null = null;
|
||||
ollamaModels: string[] = [];
|
||||
@@ -61,11 +70,51 @@ export class SettingsComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private settingsService: SettingsService,
|
||||
private router: Router
|
||||
private router: Router,
|
||||
private updatesService: UpdatesService,
|
||||
public config: ConfigService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.loadSettings();
|
||||
if (this.config.updateCheckEnabled) {
|
||||
this.checkUpdates();
|
||||
}
|
||||
}
|
||||
|
||||
checkUpdates(): void {
|
||||
this.updateChecking = true;
|
||||
this.updateMessage = '';
|
||||
this.updatesService.checkNow().subscribe({
|
||||
next: (s) => {
|
||||
this.updateStatus = s;
|
||||
this.updateChecking = false;
|
||||
},
|
||||
error: () => {
|
||||
this.updateChecking = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
applyUpdate(): void {
|
||||
if (!confirm('Telecharger et redemarrer les conteneurs maintenant ? L\'app sera indisponible quelques secondes.')) {
|
||||
return;
|
||||
}
|
||||
this.updateApplying = true;
|
||||
this.updateMessage = '';
|
||||
this.updatesService.apply().subscribe({
|
||||
next: (r) => {
|
||||
this.updateApplying = false;
|
||||
// Le redemarrage de core peut couper la connexion avant la reponse —
|
||||
// dans ce cas r vaut null (gere par catchError dans le service).
|
||||
this.updateMessage = r?.message
|
||||
?? 'Mise a jour declenchee. Rechargez la page dans 30s.';
|
||||
},
|
||||
error: () => {
|
||||
this.updateApplying = false;
|
||||
this.updateMessage = 'Mise a jour declenchee. Rechargez la page dans 30s.';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
loadSettings(): void {
|
||||
|
||||
Reference in New Issue
Block a user