mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +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">
|
<span *ngIf= "!installProgress">
|
||||||
{{ disconnected ? 'Unknown' : rendering.display }}
|
{{ disconnected ? 'Unknown' : rendering.display }}
|
||||||
<span *ngIf="rendering.showDots" class="loading-dots"></span>
|
<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>
|
||||||
<span *ngIf="installProgress">
|
<span *ngIf="installProgress">
|
||||||
<span *ngIf="installProgress < 99">
|
<span *ngIf="installProgress < 99">
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { NgModule } from '@angular/core'
|
|||||||
import { CommonModule } from '@angular/common'
|
import { CommonModule } from '@angular/common'
|
||||||
import { StatusComponent } from './status.component'
|
import { StatusComponent } from './status.component'
|
||||||
import { IonicModule } from '@ionic/angular'
|
import { IonicModule } from '@ionic/angular'
|
||||||
|
import { SharingModule } from 'src/app/modules/sharing.module'
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
@@ -10,6 +11,7 @@ import { IonicModule } from '@ionic/angular'
|
|||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
IonicModule,
|
IonicModule,
|
||||||
|
SharingModule,
|
||||||
],
|
],
|
||||||
exports: [StatusComponent],
|
exports: [StatusComponent],
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Component, Input } from '@angular/core'
|
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({
|
@Component({
|
||||||
selector: 'status',
|
selector: 'status',
|
||||||
@@ -7,11 +7,15 @@ import { StatusRendering } from 'src/app/services/pkg-status-rendering.service'
|
|||||||
styleUrls: ['./status.component.scss'],
|
styleUrls: ['./status.component.scss'],
|
||||||
})
|
})
|
||||||
export class StatusComponent {
|
export class StatusComponent {
|
||||||
|
PS = PrimaryStatus
|
||||||
|
PR = PrimaryRendering
|
||||||
|
|
||||||
@Input() rendering: StatusRendering
|
@Input() rendering: StatusRendering
|
||||||
@Input() size?: string
|
@Input() size?: string
|
||||||
@Input() style?: string = 'regular'
|
@Input() style?: string = 'regular'
|
||||||
@Input() weight?: string = 'normal'
|
@Input() weight?: string = 'normal'
|
||||||
@Input() disconnected?: boolean = false
|
@Input() disconnected?: boolean = false
|
||||||
@Input() installProgress?: number
|
@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 { InstallState } from '../pipes/install-state.pipe'
|
||||||
import { TextSpinnerComponentModule } from '../components/text-spinner/text-spinner.component.module'
|
import { TextSpinnerComponentModule } from '../components/text-spinner/text-spinner.component.module'
|
||||||
import { ConvertBytesPipe } from '../pipes/convert-bytes.pipe'
|
import { ConvertBytesPipe } from '../pipes/convert-bytes.pipe'
|
||||||
|
import { DurationToSecondsPipe } from '../pipes/unit-conversion.pipe'
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
@@ -30,6 +31,7 @@ import { ConvertBytesPipe } from '../pipes/convert-bytes.pipe'
|
|||||||
EmptyPipe,
|
EmptyPipe,
|
||||||
NotificationColorPipe,
|
NotificationColorPipe,
|
||||||
ConvertBytesPipe,
|
ConvertBytesPipe,
|
||||||
|
DurationToSecondsPipe,
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
TextSpinnerComponentModule,
|
TextSpinnerComponentModule,
|
||||||
@@ -51,6 +53,7 @@ import { ConvertBytesPipe } from '../pipes/convert-bytes.pipe'
|
|||||||
EmptyPipe,
|
EmptyPipe,
|
||||||
NotificationColorPipe,
|
NotificationColorPipe,
|
||||||
ConvertBytesPipe,
|
ConvertBytesPipe,
|
||||||
|
DurationToSecondsPipe,
|
||||||
// components
|
// components
|
||||||
TextSpinnerComponentModule,
|
TextSpinnerComponentModule,
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
[installProgress]="pkg.installProgress?.totalProgress"
|
[installProgress]="pkg.installProgress?.totalProgress"
|
||||||
weight="bold"
|
weight="bold"
|
||||||
size="small"
|
size="small"
|
||||||
|
[sigtermTimeout]="manifest.main['sigterm-timeout']"
|
||||||
></status>
|
></status>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
<ion-button
|
<ion-button
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
[installProgress]="pkg.installProgress?.totalProgress"
|
[installProgress]="pkg.installProgress?.totalProgress"
|
||||||
weight="bold"
|
weight="bold"
|
||||||
size="small"
|
size="small"
|
||||||
|
[sigtermTimeout]="pkg.entry.manifest.main['sigterm-timeout']"
|
||||||
></status>
|
></status>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
<ion-icon slot="end" name="reorder-three" color="dark"></ion-icon>
|
<ion-icon slot="end" name="reorder-three" color="dark"></ion-icon>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
weight="500"
|
weight="500"
|
||||||
[installProgress]="installProgress?.totalProgress"
|
[installProgress]="installProgress?.totalProgress"
|
||||||
[rendering]="PR[statuses.primary]"
|
[rendering]="PR[statuses.primary]"
|
||||||
|
[sigtermTimeout]="pkg.manifest.main['sigterm-timeout']"
|
||||||
></status>
|
></status>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
<ng-container *ngIf="pkg.state === PackageState.Installed && !connectionFailure">
|
<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,
|
'io-format': DockerIoFormat.Yaml,
|
||||||
'inject': false,
|
'inject': false,
|
||||||
'shm-size': '',
|
'shm-size': '',
|
||||||
|
'sigterm-timeout': '1ms',
|
||||||
},
|
},
|
||||||
'health-checks': { },
|
'health-checks': { },
|
||||||
'config': {
|
'config': {
|
||||||
@@ -102,6 +103,7 @@ export module Mock {
|
|||||||
'io-format': DockerIoFormat.Yaml,
|
'io-format': DockerIoFormat.Yaml,
|
||||||
'inject': false,
|
'inject': false,
|
||||||
'shm-size': '',
|
'shm-size': '',
|
||||||
|
'sigterm-timeout': null,
|
||||||
},
|
},
|
||||||
'restore': {
|
'restore': {
|
||||||
'type': 'docker',
|
'type': 'docker',
|
||||||
@@ -113,6 +115,7 @@ export module Mock {
|
|||||||
'io-format': DockerIoFormat.Yaml,
|
'io-format': DockerIoFormat.Yaml,
|
||||||
'inject': false,
|
'inject': false,
|
||||||
'shm-size': '',
|
'shm-size': '',
|
||||||
|
'sigterm-timeout': null,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'migrations': null,
|
'migrations': null,
|
||||||
@@ -135,6 +138,7 @@ export module Mock {
|
|||||||
'io-format': DockerIoFormat.Yaml,
|
'io-format': DockerIoFormat.Yaml,
|
||||||
'inject': false,
|
'inject': false,
|
||||||
'shm-size': '',
|
'shm-size': '',
|
||||||
|
'sigterm-timeout': null,
|
||||||
},
|
},
|
||||||
'input-spec': {
|
'input-spec': {
|
||||||
'reason': {
|
'reason': {
|
||||||
@@ -361,6 +365,7 @@ export module Mock {
|
|||||||
'io-format': DockerIoFormat.Yaml,
|
'io-format': DockerIoFormat.Yaml,
|
||||||
'inject': false,
|
'inject': false,
|
||||||
'shm-size': '',
|
'shm-size': '',
|
||||||
|
'sigterm-timeout': '10000µs',
|
||||||
},
|
},
|
||||||
'health-checks': { },
|
'health-checks': { },
|
||||||
'config': {
|
'config': {
|
||||||
@@ -412,6 +417,7 @@ export module Mock {
|
|||||||
'io-format': DockerIoFormat.Yaml,
|
'io-format': DockerIoFormat.Yaml,
|
||||||
'inject': false,
|
'inject': false,
|
||||||
'shm-size': '',
|
'shm-size': '',
|
||||||
|
'sigterm-timeout': null,
|
||||||
},
|
},
|
||||||
'restore': {
|
'restore': {
|
||||||
'type': 'docker',
|
'type': 'docker',
|
||||||
@@ -423,6 +429,7 @@ export module Mock {
|
|||||||
'io-format': DockerIoFormat.Yaml,
|
'io-format': DockerIoFormat.Yaml,
|
||||||
'inject': false,
|
'inject': false,
|
||||||
'shm-size': '',
|
'shm-size': '',
|
||||||
|
'sigterm-timeout': null,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'migrations': null,
|
'migrations': null,
|
||||||
@@ -444,6 +451,7 @@ export module Mock {
|
|||||||
'io-format': DockerIoFormat.Yaml,
|
'io-format': DockerIoFormat.Yaml,
|
||||||
'inject': false,
|
'inject': false,
|
||||||
'shm-size': '',
|
'shm-size': '',
|
||||||
|
'sigterm-timeout': null,
|
||||||
},
|
},
|
||||||
'input-spec': null,
|
'input-spec': null,
|
||||||
},
|
},
|
||||||
@@ -503,6 +511,7 @@ export module Mock {
|
|||||||
'io-format': DockerIoFormat.Yaml,
|
'io-format': DockerIoFormat.Yaml,
|
||||||
inject: false,
|
inject: false,
|
||||||
'shm-size': '',
|
'shm-size': '',
|
||||||
|
'sigterm-timeout': '1m',
|
||||||
},
|
},
|
||||||
'health-checks': { },
|
'health-checks': { },
|
||||||
config: { get: { } as any, set: { } as any },
|
config: { get: { } as any, set: { } as any },
|
||||||
@@ -536,6 +545,7 @@ export module Mock {
|
|||||||
'io-format': DockerIoFormat.Yaml,
|
'io-format': DockerIoFormat.Yaml,
|
||||||
inject: false,
|
inject: false,
|
||||||
'shm-size': '',
|
'shm-size': '',
|
||||||
|
'sigterm-timeout': null,
|
||||||
},
|
},
|
||||||
restore: {
|
restore: {
|
||||||
type: 'docker',
|
type: 'docker',
|
||||||
@@ -547,6 +557,7 @@ export module Mock {
|
|||||||
'io-format': DockerIoFormat.Yaml,
|
'io-format': DockerIoFormat.Yaml,
|
||||||
inject: false,
|
inject: false,
|
||||||
'shm-size': '',
|
'shm-size': '',
|
||||||
|
'sigterm-timeout': null,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
migrations: null,
|
migrations: null,
|
||||||
@@ -570,6 +581,7 @@ export module Mock {
|
|||||||
'io-format': DockerIoFormat.Cbor,
|
'io-format': DockerIoFormat.Cbor,
|
||||||
inject: false,
|
inject: false,
|
||||||
'shm-size': '10m',
|
'shm-size': '10m',
|
||||||
|
'sigterm-timeout': null,
|
||||||
},
|
},
|
||||||
'auto-configure': {
|
'auto-configure': {
|
||||||
type: 'docker',
|
type: 'docker',
|
||||||
@@ -581,6 +593,7 @@ export module Mock {
|
|||||||
'io-format': DockerIoFormat.Cbor,
|
'io-format': DockerIoFormat.Cbor,
|
||||||
inject: false,
|
inject: false,
|
||||||
'shm-size': '10m',
|
'shm-size': '10m',
|
||||||
|
'sigterm-timeout': null,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ export const mockPatchData: DataModel = {
|
|||||||
'io-format': DockerIoFormat.Yaml,
|
'io-format': DockerIoFormat.Yaml,
|
||||||
'inject': false,
|
'inject': false,
|
||||||
'shm-size': '',
|
'shm-size': '',
|
||||||
|
'sigterm-timeout': '.49m',
|
||||||
},
|
},
|
||||||
'health-checks': {
|
'health-checks': {
|
||||||
'chain-state': { 'name': 'Chain State', 'description': 'Checks the chainstate' },
|
'chain-state': { 'name': 'Chain State', 'description': 'Checks the chainstate' },
|
||||||
@@ -126,6 +127,7 @@ export const mockPatchData: DataModel = {
|
|||||||
'io-format': DockerIoFormat.Yaml,
|
'io-format': DockerIoFormat.Yaml,
|
||||||
'inject': false,
|
'inject': false,
|
||||||
'shm-size': '',
|
'shm-size': '',
|
||||||
|
'sigterm-timeout': null,
|
||||||
},
|
},
|
||||||
'restore': {
|
'restore': {
|
||||||
'type': 'docker',
|
'type': 'docker',
|
||||||
@@ -137,6 +139,7 @@ export const mockPatchData: DataModel = {
|
|||||||
'io-format': DockerIoFormat.Yaml,
|
'io-format': DockerIoFormat.Yaml,
|
||||||
'inject': false,
|
'inject': false,
|
||||||
'shm-size': '',
|
'shm-size': '',
|
||||||
|
'sigterm-timeout': null,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'migrations': null,
|
'migrations': null,
|
||||||
@@ -159,6 +162,7 @@ export const mockPatchData: DataModel = {
|
|||||||
'io-format': DockerIoFormat.Yaml,
|
'io-format': DockerIoFormat.Yaml,
|
||||||
'inject': false,
|
'inject': false,
|
||||||
'shm-size': '',
|
'shm-size': '',
|
||||||
|
'sigterm-timeout': null,
|
||||||
},
|
},
|
||||||
'input-spec': {
|
'input-spec': {
|
||||||
'reason': {
|
'reason': {
|
||||||
@@ -446,6 +450,7 @@ export const mockPatchData: DataModel = {
|
|||||||
'io-format': DockerIoFormat.Yaml,
|
'io-format': DockerIoFormat.Yaml,
|
||||||
'inject': false,
|
'inject': false,
|
||||||
'shm-size': '',
|
'shm-size': '',
|
||||||
|
'sigterm-timeout': '0.5s',
|
||||||
},
|
},
|
||||||
'health-checks': { },
|
'health-checks': { },
|
||||||
'config': {
|
'config': {
|
||||||
@@ -497,6 +502,7 @@ export const mockPatchData: DataModel = {
|
|||||||
'io-format': DockerIoFormat.Yaml,
|
'io-format': DockerIoFormat.Yaml,
|
||||||
'inject': false,
|
'inject': false,
|
||||||
'shm-size': '',
|
'shm-size': '',
|
||||||
|
'sigterm-timeout': null,
|
||||||
},
|
},
|
||||||
'restore': {
|
'restore': {
|
||||||
'type': 'docker',
|
'type': 'docker',
|
||||||
@@ -508,6 +514,7 @@ export const mockPatchData: DataModel = {
|
|||||||
'io-format': DockerIoFormat.Yaml,
|
'io-format': DockerIoFormat.Yaml,
|
||||||
'inject': false,
|
'inject': false,
|
||||||
'shm-size': '',
|
'shm-size': '',
|
||||||
|
'sigterm-timeout': null,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'migrations': null,
|
'migrations': null,
|
||||||
@@ -529,6 +536,7 @@ export const mockPatchData: DataModel = {
|
|||||||
'io-format': DockerIoFormat.Yaml,
|
'io-format': DockerIoFormat.Yaml,
|
||||||
'inject': false,
|
'inject': false,
|
||||||
'shm-size': '',
|
'shm-size': '',
|
||||||
|
'sigterm-timeout': null,
|
||||||
},
|
},
|
||||||
'input-spec': null,
|
'input-spec': null,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ export interface ActionImpl {
|
|||||||
'io-format': DockerIoFormat | null
|
'io-format': DockerIoFormat | null
|
||||||
inject: boolean
|
inject: boolean
|
||||||
'shm-size': string
|
'shm-size': string
|
||||||
|
'sigterm-timeout': string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum DockerIoFormat {
|
export enum DockerIoFormat {
|
||||||
|
|||||||
Reference in New Issue
Block a user