mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
sigterm duration and pipe (#954)
* sigterm duration and pipe * comments addressed Co-authored-by: Drew Ansbacher <drew.ansbacher@spiredigital.com>
This commit is contained in:
committed by
Aiden McClelland
parent
60c099f352
commit
cc8979190f
@@ -7,6 +7,7 @@
|
||||
<span *ngIf= "!installProgress">
|
||||
{{ disconnected ? 'Unknown' : rendering.display }}
|
||||
<span *ngIf="rendering.showDots" class="loading-dots"></span>
|
||||
<span *ngIf="rendering.display === PR[PS.Stopping].display && (sigtermTimeout | durationToSeconds) > 30">This may take a while.</span>
|
||||
</span>
|
||||
<span *ngIf="installProgress">
|
||||
<span *ngIf="installProgress < 99">
|
||||
|
||||
@@ -2,6 +2,7 @@ import { NgModule } from '@angular/core'
|
||||
import { CommonModule } from '@angular/common'
|
||||
import { StatusComponent } from './status.component'
|
||||
import { IonicModule } from '@ionic/angular'
|
||||
import { SharingModule } from 'src/app/modules/sharing.module'
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
@@ -10,6 +11,7 @@ import { IonicModule } from '@ionic/angular'
|
||||
imports: [
|
||||
CommonModule,
|
||||
IonicModule,
|
||||
SharingModule,
|
||||
],
|
||||
exports: [StatusComponent],
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, Input } from '@angular/core'
|
||||
import { StatusRendering } from 'src/app/services/pkg-status-rendering.service'
|
||||
import { PrimaryRendering, PrimaryStatus, StatusRendering } from 'src/app/services/pkg-status-rendering.service'
|
||||
|
||||
@Component({
|
||||
selector: 'status',
|
||||
@@ -7,11 +7,15 @@ import { StatusRendering } from 'src/app/services/pkg-status-rendering.service'
|
||||
styleUrls: ['./status.component.scss'],
|
||||
})
|
||||
export class StatusComponent {
|
||||
PS = PrimaryStatus
|
||||
PR = PrimaryRendering
|
||||
|
||||
@Input() rendering: StatusRendering
|
||||
@Input() size?: string
|
||||
@Input() style?: string = 'regular'
|
||||
@Input() weight?: string = 'normal'
|
||||
@Input() disconnected?: boolean = false
|
||||
@Input() installProgress?: number
|
||||
@Input() sigtermTimeout?: string
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import { NotificationColorPipe } from '../pipes/notification-color.pipe'
|
||||
import { InstallState } from '../pipes/install-state.pipe'
|
||||
import { TextSpinnerComponentModule } from '../components/text-spinner/text-spinner.component.module'
|
||||
import { ConvertBytesPipe } from '../pipes/convert-bytes.pipe'
|
||||
import { DurationToSecondsPipe } from '../pipes/unit-conversion.pipe'
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
@@ -30,6 +31,7 @@ import { ConvertBytesPipe } from '../pipes/convert-bytes.pipe'
|
||||
EmptyPipe,
|
||||
NotificationColorPipe,
|
||||
ConvertBytesPipe,
|
||||
DurationToSecondsPipe,
|
||||
],
|
||||
imports: [
|
||||
TextSpinnerComponentModule,
|
||||
@@ -51,6 +53,7 @@ import { ConvertBytesPipe } from '../pipes/convert-bytes.pipe'
|
||||
EmptyPipe,
|
||||
NotificationColorPipe,
|
||||
ConvertBytesPipe,
|
||||
DurationToSecondsPipe,
|
||||
// components
|
||||
TextSpinnerComponentModule,
|
||||
],
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
[installProgress]="pkg.installProgress?.totalProgress"
|
||||
weight="bold"
|
||||
size="small"
|
||||
[sigtermTimeout]="manifest.main['sigterm-timeout']"
|
||||
></status>
|
||||
</ion-label>
|
||||
<ion-button
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
[installProgress]="pkg.installProgress?.totalProgress"
|
||||
weight="bold"
|
||||
size="small"
|
||||
[sigtermTimeout]="pkg.entry.manifest.main['sigterm-timeout']"
|
||||
></status>
|
||||
</ion-label>
|
||||
<ion-icon slot="end" name="reorder-three" color="dark"></ion-icon>
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
weight="500"
|
||||
[installProgress]="installProgress?.totalProgress"
|
||||
[rendering]="PR[statuses.primary]"
|
||||
[sigtermTimeout]="pkg.manifest.main['sigterm-timeout']"
|
||||
></status>
|
||||
</ion-label>
|
||||
<ng-container *ngIf="pkg.state === PackageState.Installed && !connectionFailure">
|
||||
|
||||
24
ui/src/app/pipes/unit-conversion.pipe.ts
Normal file
24
ui/src/app/pipes/unit-conversion.pipe.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core'
|
||||
|
||||
@Pipe({
|
||||
name: 'durationToSeconds',
|
||||
})
|
||||
export class DurationToSecondsPipe implements PipeTransform {
|
||||
transform (duration: string | null): number {
|
||||
if (!duration) return 0
|
||||
const splitUnit = duration.match(/^([0-9]*(\.[0-9]+)?)(ns|µs|ms|s|m|d)$/)
|
||||
const unit = splitUnit[3]
|
||||
const num = splitUnit[1]
|
||||
return Number(num) * unitsToSeconds[unit]
|
||||
}
|
||||
}
|
||||
|
||||
const unitsToSeconds = {
|
||||
'ns': 1e-9,
|
||||
'µs': 1e-6,
|
||||
'ms': 0.001,
|
||||
's': 1,
|
||||
'm': 60,
|
||||
'h': 3600,
|
||||
'd': 86400,
|
||||
}
|
||||
@@ -51,6 +51,7 @@ export module Mock {
|
||||
'io-format': DockerIoFormat.Yaml,
|
||||
'inject': false,
|
||||
'shm-size': '',
|
||||
'sigterm-timeout': '1ms',
|
||||
},
|
||||
'health-checks': { },
|
||||
'config': {
|
||||
@@ -102,6 +103,7 @@ export module Mock {
|
||||
'io-format': DockerIoFormat.Yaml,
|
||||
'inject': false,
|
||||
'shm-size': '',
|
||||
'sigterm-timeout': null,
|
||||
},
|
||||
'restore': {
|
||||
'type': 'docker',
|
||||
@@ -113,6 +115,7 @@ export module Mock {
|
||||
'io-format': DockerIoFormat.Yaml,
|
||||
'inject': false,
|
||||
'shm-size': '',
|
||||
'sigterm-timeout': null,
|
||||
},
|
||||
},
|
||||
'migrations': null,
|
||||
@@ -135,6 +138,7 @@ export module Mock {
|
||||
'io-format': DockerIoFormat.Yaml,
|
||||
'inject': false,
|
||||
'shm-size': '',
|
||||
'sigterm-timeout': null,
|
||||
},
|
||||
'input-spec': {
|
||||
'reason': {
|
||||
@@ -361,6 +365,7 @@ export module Mock {
|
||||
'io-format': DockerIoFormat.Yaml,
|
||||
'inject': false,
|
||||
'shm-size': '',
|
||||
'sigterm-timeout': '10000µs',
|
||||
},
|
||||
'health-checks': { },
|
||||
'config': {
|
||||
@@ -412,6 +417,7 @@ export module Mock {
|
||||
'io-format': DockerIoFormat.Yaml,
|
||||
'inject': false,
|
||||
'shm-size': '',
|
||||
'sigterm-timeout': null,
|
||||
},
|
||||
'restore': {
|
||||
'type': 'docker',
|
||||
@@ -423,6 +429,7 @@ export module Mock {
|
||||
'io-format': DockerIoFormat.Yaml,
|
||||
'inject': false,
|
||||
'shm-size': '',
|
||||
'sigterm-timeout': null,
|
||||
},
|
||||
},
|
||||
'migrations': null,
|
||||
@@ -444,6 +451,7 @@ export module Mock {
|
||||
'io-format': DockerIoFormat.Yaml,
|
||||
'inject': false,
|
||||
'shm-size': '',
|
||||
'sigterm-timeout': null,
|
||||
},
|
||||
'input-spec': null,
|
||||
},
|
||||
@@ -503,6 +511,7 @@ export module Mock {
|
||||
'io-format': DockerIoFormat.Yaml,
|
||||
inject: false,
|
||||
'shm-size': '',
|
||||
'sigterm-timeout': '1m',
|
||||
},
|
||||
'health-checks': { },
|
||||
config: { get: { } as any, set: { } as any },
|
||||
@@ -536,6 +545,7 @@ export module Mock {
|
||||
'io-format': DockerIoFormat.Yaml,
|
||||
inject: false,
|
||||
'shm-size': '',
|
||||
'sigterm-timeout': null,
|
||||
},
|
||||
restore: {
|
||||
type: 'docker',
|
||||
@@ -547,6 +557,7 @@ export module Mock {
|
||||
'io-format': DockerIoFormat.Yaml,
|
||||
inject: false,
|
||||
'shm-size': '',
|
||||
'sigterm-timeout': null,
|
||||
},
|
||||
},
|
||||
migrations: null,
|
||||
@@ -570,6 +581,7 @@ export module Mock {
|
||||
'io-format': DockerIoFormat.Cbor,
|
||||
inject: false,
|
||||
'shm-size': '10m',
|
||||
'sigterm-timeout': null,
|
||||
},
|
||||
'auto-configure': {
|
||||
type: 'docker',
|
||||
@@ -581,6 +593,7 @@ export module Mock {
|
||||
'io-format': DockerIoFormat.Cbor,
|
||||
inject: false,
|
||||
'shm-size': '10m',
|
||||
'sigterm-timeout': null,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -69,6 +69,7 @@ export const mockPatchData: DataModel = {
|
||||
'io-format': DockerIoFormat.Yaml,
|
||||
'inject': false,
|
||||
'shm-size': '',
|
||||
'sigterm-timeout': '.49m',
|
||||
},
|
||||
'health-checks': {
|
||||
'chain-state': { 'name': 'Chain State', 'description': 'Checks the chainstate' },
|
||||
@@ -126,6 +127,7 @@ export const mockPatchData: DataModel = {
|
||||
'io-format': DockerIoFormat.Yaml,
|
||||
'inject': false,
|
||||
'shm-size': '',
|
||||
'sigterm-timeout': null,
|
||||
},
|
||||
'restore': {
|
||||
'type': 'docker',
|
||||
@@ -137,6 +139,7 @@ export const mockPatchData: DataModel = {
|
||||
'io-format': DockerIoFormat.Yaml,
|
||||
'inject': false,
|
||||
'shm-size': '',
|
||||
'sigterm-timeout': null,
|
||||
},
|
||||
},
|
||||
'migrations': null,
|
||||
@@ -159,6 +162,7 @@ export const mockPatchData: DataModel = {
|
||||
'io-format': DockerIoFormat.Yaml,
|
||||
'inject': false,
|
||||
'shm-size': '',
|
||||
'sigterm-timeout': null,
|
||||
},
|
||||
'input-spec': {
|
||||
'reason': {
|
||||
@@ -446,6 +450,7 @@ export const mockPatchData: DataModel = {
|
||||
'io-format': DockerIoFormat.Yaml,
|
||||
'inject': false,
|
||||
'shm-size': '',
|
||||
'sigterm-timeout': '0.5s',
|
||||
},
|
||||
'health-checks': { },
|
||||
'config': {
|
||||
@@ -497,6 +502,7 @@ export const mockPatchData: DataModel = {
|
||||
'io-format': DockerIoFormat.Yaml,
|
||||
'inject': false,
|
||||
'shm-size': '',
|
||||
'sigterm-timeout': null,
|
||||
},
|
||||
'restore': {
|
||||
'type': 'docker',
|
||||
@@ -508,6 +514,7 @@ export const mockPatchData: DataModel = {
|
||||
'io-format': DockerIoFormat.Yaml,
|
||||
'inject': false,
|
||||
'shm-size': '',
|
||||
'sigterm-timeout': null,
|
||||
},
|
||||
},
|
||||
'migrations': null,
|
||||
@@ -529,6 +536,7 @@ export const mockPatchData: DataModel = {
|
||||
'io-format': DockerIoFormat.Yaml,
|
||||
'inject': false,
|
||||
'shm-size': '',
|
||||
'sigterm-timeout': null,
|
||||
},
|
||||
'input-spec': null,
|
||||
},
|
||||
|
||||
@@ -144,6 +144,7 @@ export interface ActionImpl {
|
||||
'io-format': DockerIoFormat | null
|
||||
inject: boolean
|
||||
'shm-size': string
|
||||
'sigterm-timeout': string | null
|
||||
}
|
||||
|
||||
export enum DockerIoFormat {
|
||||
|
||||
Reference in New Issue
Block a user