incorporates and implements mobile build service functionality.

This commit is contained in:
2026-07-08 15:02:22 -07:00
parent 7869574fe2
commit 2c66a802c0
12 changed files with 491 additions and 23 deletions
+3 -1
View File
@@ -618,7 +618,9 @@
<div class="artifact-meta">{{ artifact.platform }} • {{ artifact.artifact_type }} • {{
artifact.sha256.slice(0, 12) }}…</div>
</div>
<a class="btn-icon btn-edit" [href]="getArtifactDownloadHref(artifact.download_url)">Download</a>
<button class="btn-icon btn-edit" (click)="downloadArtifact(artifact)" [disabled]="downloadingArtifactId === artifact.id">
{{ downloadingArtifactId === artifact.id ? 'Downloading…' : 'Download' }}
</button>
</div>
} @empty {
<p class="empty-row">No artifacts available yet.</p>
+21
View File
@@ -126,6 +126,7 @@ export class AdminComponent implements OnInit {
mobileBuildErrorMessage = '';
mobileBuildPreflightIssues: string[] = [];
mobileBuildBusy = false;
downloadingArtifactId: number | null = null;
// ── Theme JSON status (mobile build tab) ────────────────────
readonly themeJsonStatus$ = new BehaviorSubject<ThemeStatus | null>(null);
@@ -451,6 +452,26 @@ export class AdminComponent implements OnInit {
return `${getAppConfig().apiBaseUrl}${path}`;
}
async downloadArtifact(artifact: { id: number; file_name: string }): Promise<void> {
try {
this.downloadingArtifactId = artifact.id;
const blob = await firstValueFrom(this.mobileBuildService.downloadArtifact(artifact.id));
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.style.display = 'none';
a.href = url;
a.download = artifact.file_name;
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
document.body.removeChild(a);
} catch {
this.mobileBuildErrorMessage = 'Failed to download artifact.';
} finally {
this.downloadingArtifactId = null;
}
}
// ── Show CRUD ───────────────────────────────────────────
openShowForm(): void {
+7
View File
@@ -80,4 +80,11 @@ export class MobileBuildService {
{},
);
}
downloadArtifact(artifactId: number): Observable<Blob> {
return this.http.get(
`${this.baseUrl}/artifacts/${artifactId}/download`,
{ responseType: 'blob' },
);
}
}