Add guid to partition type (#1932)

* add guid to partitions and implement pipe in shared to return guid for any disk

* fix bug and clean up
This commit is contained in:
Matt Hill
2022-11-10 10:20:52 -07:00
committed by Aiden McClelland
parent 22b273b145
commit 45a6a930c9
21 changed files with 393 additions and 131 deletions

View File

@@ -0,0 +1,8 @@
import { NgModule } from '@angular/core'
import { GuidPipe } from './guid.pipe'
@NgModule({
declarations: [GuidPipe],
exports: [GuidPipe],
})
export class GuidPipePipesModule {}

View File

@@ -0,0 +1,11 @@
import { Pipe, PipeTransform } from '@angular/core'
import { DiskInfo } from '../../types/api'
@Pipe({
name: 'guid',
})
export class GuidPipe implements PipeTransform {
transform(disk: DiskInfo): string | null {
return disk.guid || disk.partitions.find(p => p.guid)?.guid || null
}
}

View File

@@ -24,6 +24,8 @@ export * from './directives/safe-links/safe-links.module'
export * from './pipes/emver/emver.module'
export * from './pipes/emver/emver.pipe'
export * from './pipes/guid/guid.module'
export * from './pipes/guid/guid.pipe'
export * from './pipes/markdown/markdown.module'
export * from './pipes/markdown/markdown.pipe'
export * from './pipes/shared/shared.module'

View File

@@ -32,6 +32,7 @@ export interface PartitionInfo {
capacity: number
used: number | null
'embassy-os': EmbassyOSDiskInfo | null
guid: string | null
}
export type EmbassyOSDiskInfo = {