Files
start-os/frontend/projects/ui/src/app/pages/updates/updates.page.html
Matt Hill 4d3df867da Better Updates Tab and updates count (#2151)
* wip

* should be working now

* delete unused function

* delete 2 more unused functions

* update fixture to include beta registry

* address comments

* wait for connection to get local packages
2023-03-07 19:09:10 -07:00

112 lines
4.2 KiB
HTML

<ion-header>
<ion-toolbar>
<ion-title>Updates</ion-title>
<ion-buttons slot="end">
<badge-menu-button></badge-menu-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content class="ion-padding">
<ion-item-group *ngIf="data$ | async as data">
<ng-container *ngFor="let host of data.hosts">
<ion-item-divider class="header">
<div class="inline">
<h1>{{ host.name }}</h1>
<store-icon [url]="host.url" size="24px"></store-icon>
</div>
</ion-item-divider>
<div class="ion-padding-start ion-padding-bottom">
<ion-item *ngIf="data.errors.includes(host.url)">
<ion-text color="danger">Request Failed</ion-text>
</ion-item>
<ng-container
*ngIf="data.marketplace[host.url]?.packages as packages else loading"
>
<ng-container
*ngIf="packages | filterUpdates : data.localPkgs as updates"
>
<div *ngFor="let pkg of updates" class="item-container">
<ion-item lines="none">
<ng-container *ngIf="data.localPkgs[pkg.manifest.id] as local">
<ion-thumbnail
slot="start"
style="cursor: pointer"
(click)="viewInMarketplace(local)"
>
<img
[src]="'data:image/png;base64,' + pkg.icon | trustUrl"
/>
</ion-thumbnail>
<ion-label>
<h1
(click)="viewInMarketplace(local)"
style="cursor: pointer"
>
{{ pkg.manifest.title }}
</h1>
<h2 class="inline">
<span>{{ local.manifest.version | displayEmver }}</span>
&nbsp;<ion-icon name="arrow-forward"></ion-icon>&nbsp;
<ion-text color="success">
{{ pkg.manifest.version | displayEmver }}
</ion-text>
</h2>
<p
*ngIf="marketplaceService.updateErrors[pkg.manifest.id] as error"
>
<ion-text color="danger">{{ error }}</ion-text>
</p>
</ion-label>
<div slot="end" style="margin-left: 8px">
<round-progress
*ngIf="local.state === PackageState.Updating else notUpdating"
[current]="local['install-progress'] | installProgress"
[max]="100"
[radius]="24"
[stroke]="4"
[rounded]="true"
color="var(--ion-color-primary)"
></round-progress>
<ng-template #notUpdating>
<ion-spinner
*ngIf="marketplaceService.updateQueue[pkg.manifest.id] else updateBtn"
color="dark"
></ion-spinner>
<ng-template #updateBtn>
<ion-button
(click)="tryUpdate(pkg.manifest, host.url, local)"
[color]="marketplaceService.updateErrors[pkg.manifest.id] ? 'danger' : 'dark'"
strong
>
{{ marketplaceService.updateErrors[pkg.manifest.id] ?
'Retry' : 'Update' }}
</ion-button>
</ng-template>
</ng-template>
</div>
</ng-container>
</ion-item>
<div class="notes">
<h5><b>What's New</b></h5>
<p [innerHTML]="pkg.manifest['release-notes'] | markdown"></p>
</div>
</div>
<ion-item *ngIf="!updates.length">
<p>All services are up to date!</p>
</ion-item>
</ng-container>
</ng-container>
<ng-template #loading>
<skeleton-list [showAvatar]="true" [rows]="2"></skeleton-list>
</ng-template>
</div>
</ng-container>
</ion-item-group>
</ion-content>