fix: keep uptime width constant and service table DOM cached (#3078)

* fix: keep uptime width constant and service table DOM cached

* show error status and fix columns spacing

* revert const

---------

Co-authored-by: Matt Hill <mattnine@protonmail.com>
This commit is contained in:
Alex Inkin
2025-12-18 18:51:34 +04:00
committed by GitHub
parent bf8ff84522
commit 720e0fcdab
7 changed files with 38 additions and 34 deletions

View File

@@ -48,7 +48,7 @@ import { HintPipe } from '../pipes/hint.pipe'
} }
@if (!mobile) { @if (!mobile) {
<tui-data-list *tuiTextfieldDropdown> <tui-data-list *tuiTextfieldDropdown>
@for (item of items; track $index) { @for (item of items; track item) {
<button <button
tuiOption tuiOption
new new

View File

@@ -50,7 +50,7 @@ import { InterfaceComponent } from './interface.component'
{{ 'Add' | i18n }} {{ 'Add' | i18n }}
</button> </button>
</header> </header>
@for (domain of privateDomains(); track $index) { @for (domain of privateDomains(); track domain) {
<div tuiCell="s"> <div tuiCell="s">
<span tuiTitle>{{ domain }}</span> <span tuiTitle>{{ domain }}</span>
<button <button

View File

@@ -54,7 +54,7 @@ type OnionForm = {
{{ 'Add' | i18n }} {{ 'Add' | i18n }}
</button> </button>
</header> </header>
@for (domain of torDomains(); track $index) { @for (domain of torDomains(); track domain) {
<div tuiCell="s"> <div tuiCell="s">
<span tuiTitle>{{ domain }}</span> <span tuiTitle>{{ domain }}</span>
<button <button

View File

@@ -5,9 +5,7 @@ import {
input, input,
} from '@angular/core' } from '@angular/core'
import { i18nPipe } from '@start9labs/shared' import { i18nPipe } from '@start9labs/shared'
import { TuiLoader } from '@taiga-ui/core'
import { ServiceUptimeComponent } from 'src/app/routes/portal/routes/services/components/uptime.component' import { ServiceUptimeComponent } from 'src/app/routes/portal/routes/services/components/uptime.component'
import { getProgressText } from 'src/app/routes/portal/routes/services/pipes/install-progress.pipe'
import { PackageDataEntry } from 'src/app/services/patch-db/data-model' import { PackageDataEntry } from 'src/app/services/patch-db/data-model'
import { import {
getInstalledPrimaryStatus, getInstalledPrimaryStatus,
@@ -19,14 +17,6 @@ import {
template: ` template: `
<header>{{ 'Status' | i18n }}</header> <header>{{ 'Status' | i18n }}</header>
<div> <div>
@if (info()) {
<h3>
<tui-loader size="s" [inheritColor]="true" />
{{ 'Installing' | i18n }}
<span class="loading-dots"></span>
{{ info() | i18n }}
</h3>
} @else {
<h3 [class]="class()"> <h3 [class]="class()">
{{ text() || 'Unknown' | i18n }} {{ text() || 'Unknown' | i18n }}
@if (text() === 'Task Required') { @if (text() === 'Task Required') {
@@ -41,7 +31,6 @@ import {
<service-uptime [started]="started" /> <service-uptime [started]="started" />
} }
</h3> </h3>
}
<ng-content /> <ng-content />
</div> </div>
`, `,
@@ -112,7 +101,7 @@ import {
`, `,
host: { class: 'g-card' }, host: { class: 'g-card' },
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
imports: [TuiLoader, i18nPipe, ServiceUptimeComponent], imports: [i18nPipe, ServiceUptimeComponent],
}) })
export class ServiceStatusComponent { export class ServiceStatusComponent {
readonly pkg = input.required<PackageDataEntry>() readonly pkg = input.required<PackageDataEntry>()
@@ -143,9 +132,4 @@ export class ServiceStatusComponent {
return null return null
} }
}) })
protected readonly info = computed(
(progress = this.pkg().stateInfo.installingInfo?.progress.overall) =>
progress ? getProgressText(progress) : '',
)
} }

View File

@@ -24,7 +24,7 @@ import { StatusComponent } from './status.component'
<td class="title"> <td class="title">
<a [routerLink]="routerLink">{{ manifest.title }}</a> <a [routerLink]="routerLink">{{ manifest.title }}</a>
</td> </td>
<td [style.grid-area]="'3 / 2'"> <td class="status" [style.grid-area]="'3 / 2'">
<app-status [pkg]="pkg" [hasDepErrors]="hasError(depErrors)" /> <app-status [pkg]="pkg" [hasDepErrors]="hasError(depErrors)" />
</td> </td>
<td class="version">{{ manifest.version }}</td> <td class="version">{{ manifest.version }}</td>
@@ -69,6 +69,22 @@ import { StatusComponent } from './status.component'
display: none; display: none;
} }
.title {
width: 21rem;
}
.status {
width: 21rem;
}
.uptime {
width: 13rem;
}
.version {
width: 21rem;
}
:host-context(tui-root._mobile) { :host-context(tui-root._mobile) {
position: relative; position: relative;
display: grid; display: grid;

View File

@@ -57,7 +57,7 @@ import { RouterLink } from '@angular/router'
[appTable]="[null, 'Name', 'Status', 'Version', 'Uptime']" [appTable]="[null, 'Name', 'Status', 'Version', 'Uptime']"
[appTableSorters]="[null, name, status]" [appTableSorters]="[null, name, status]"
> >
@for (service of services() | tuiTableSort; track service) { @for (service of services() | tuiTableSort; track $index) {
<tr <tr
appService appService
[pkg]="service" [pkg]="service"

View File

@@ -22,6 +22,10 @@ export function renderPkgStatus(pkg: PackageDataEntry): PackageStatus {
} }
export function getInstalledBaseStatus(statusInfo: T.StatusInfo): BaseStatus { export function getInstalledBaseStatus(statusInfo: T.StatusInfo): BaseStatus {
if (statusInfo.error) {
return 'error'
}
if ( if (
statusInfo.desired.main === 'running' && statusInfo.desired.main === 'running' &&
(!statusInfo.started || (!statusInfo.started ||