mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-01 04:53:40 +00:00
fix: fix build after minor merged into major
This commit is contained in:
32
web/projects/shared/src/components/server.component.ts
Normal file
32
web/projects/shared/src/components/server.component.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { DatePipe } from '@angular/common'
|
||||
import { Component, inject, input } from '@angular/core'
|
||||
import { TuiDialogService, TuiIcon, TuiTitle } from '@taiga-ui/core'
|
||||
import { TuiCell } from '@taiga-ui/layout'
|
||||
import { StartOSDiskInfo } from '../types/api'
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
selector: 'button[server]',
|
||||
template: `
|
||||
<tui-icon icon="@tui.save" />
|
||||
<span tuiTitle>
|
||||
<strong>{{ server().hostname }}.local</strong>
|
||||
<span tuiSubtitle>
|
||||
<b>StartOS Version</b>
|
||||
: {{ server().version }}
|
||||
</span>
|
||||
<span tuiSubtitle>
|
||||
<b>Created</b>
|
||||
: {{ server().timestamp | date: 'medium' }}
|
||||
</span>
|
||||
</span>
|
||||
`,
|
||||
styles: ':host { width: stretch; border-radius: var(--tui-radius-l); }',
|
||||
hostDirectives: [TuiCell],
|
||||
imports: [DatePipe, TuiIcon, TuiTitle],
|
||||
})
|
||||
export class ServerComponent {
|
||||
private readonly dialogs = inject(TuiDialogService)
|
||||
|
||||
readonly server = input.required<StartOSDiskInfo>()
|
||||
}
|
||||
@@ -15,6 +15,7 @@ export * from './components/markdown/markdown.component.module'
|
||||
export * from './components/ticker/ticker.component'
|
||||
export * from './components/ticker/ticker.module'
|
||||
export * from './components/drive.component'
|
||||
export * from './components/server.component'
|
||||
|
||||
export * from './directives/drag-scroller.directive'
|
||||
export * from './directives/safe-links.directive'
|
||||
@@ -50,6 +51,7 @@ export * from './tokens/theme'
|
||||
export * from './util/base-64'
|
||||
export * from './util/convert-ansi'
|
||||
export * from './util/copy-to-clipboard'
|
||||
export * from './util/format-progress'
|
||||
export * from './util/get-new-entries'
|
||||
export * from './util/get-pkg-id'
|
||||
export * from './util/invert'
|
||||
|
||||
33
web/projects/shared/src/util/format-progress.ts
Normal file
33
web/projects/shared/src/util/format-progress.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
// @TODO Matt this is T.FullProgress but shared does not depend on sdk
|
||||
type Progress = null | boolean | { done: number; total: number | null }
|
||||
type NamedProgress = { name: string; progress: Progress }
|
||||
type FullProgress = { overall: Progress; phases: Array<NamedProgress> }
|
||||
|
||||
export function formatProgress({ phases, overall }: FullProgress): {
|
||||
total: number
|
||||
message: string
|
||||
} {
|
||||
return {
|
||||
total: getDecimal(overall),
|
||||
message: phases
|
||||
.filter(p => p.progress !== true && p.progress !== null)
|
||||
.map(p => `${p.name}${getPhaseBytes(p.progress)}`)
|
||||
.join(', '),
|
||||
}
|
||||
}
|
||||
|
||||
function getDecimal(progress: Progress): number {
|
||||
if (progress === true) {
|
||||
return 1
|
||||
} else if (!progress || !progress.total) {
|
||||
return 0
|
||||
} else {
|
||||
return progress.total && progress.done / progress.total
|
||||
}
|
||||
}
|
||||
|
||||
function getPhaseBytes(progress: Progress): string {
|
||||
return progress === true || !progress
|
||||
? ''
|
||||
: `: (${progress.done}/${progress.total})`
|
||||
}
|
||||
Reference in New Issue
Block a user