mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
feat: enable strictNullChecks
feat: enable `noImplicitAny` chore: remove sync data access fix loading package data for affected dependencies chore: properly get alt marketplace data update patchdb client to allow for emit on undefined values
This commit is contained in:
11
frontend/projects/ui/src/app/util/get-project-id.ts
Normal file
11
frontend/projects/ui/src/app/util/get-project-id.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { ActivatedRoute } from '@angular/router'
|
||||
|
||||
export function getProjectId({ snapshot }: ActivatedRoute): string {
|
||||
const projectId = snapshot.paramMap.get('projectId')
|
||||
|
||||
if (!projectId) {
|
||||
throw new Error('projectId is missing from route params')
|
||||
}
|
||||
|
||||
return projectId
|
||||
}
|
||||
@@ -3,9 +3,9 @@ import { InstallProgress } from 'src/app/types/install-progress'
|
||||
import { ProgressData } from 'src/app/types/progress-data'
|
||||
|
||||
export function packageLoadingProgress(
|
||||
loadData: InstallProgress,
|
||||
loadData?: InstallProgress,
|
||||
): ProgressData | null {
|
||||
if (isEmptyObject(loadData)) {
|
||||
if (!loadData || isEmptyObject(loadData)) {
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ export function packageLoadingProgress(
|
||||
} = loadData
|
||||
|
||||
// only permit 100% when "complete" == true
|
||||
size = size || 0
|
||||
downloaded = downloadComplete ? size : Math.max(downloaded - 1, 0)
|
||||
validated = validationComplete ? size : Math.max(validated - 1, 0)
|
||||
unpacked = unpackComplete ? size : Math.max(unpacked - 1, 0)
|
||||
|
||||
@@ -5,12 +5,12 @@ import {
|
||||
} from 'src/app/services/patch-db/data-model'
|
||||
|
||||
export function parseDataModel(data: DataModel): ParsedData {
|
||||
const all = JSON.parse(JSON.stringify(data['package-data'])) as {
|
||||
[id: string]: PackageDataEntry
|
||||
}
|
||||
const all: Record<string, PackageDataEntry> = JSON.parse(
|
||||
JSON.stringify(data['package-data']),
|
||||
)
|
||||
|
||||
const order = [...(data.ui['pkg-order'] || [])]
|
||||
const pkgs = []
|
||||
const pkgs: PackageDataEntry[] = []
|
||||
const recoveredPkgs = Object.entries(data['recovered-packages'])
|
||||
.filter(([id, _]) => !all[id])
|
||||
.map(([id, val]) => ({
|
||||
|
||||
@@ -29,7 +29,7 @@ const matchPropertiesV1 = shape(
|
||||
qr: boolean,
|
||||
},
|
||||
['description', 'copyable', 'qr'],
|
||||
{ description: null as null, copyable: false, qr: false } as const,
|
||||
{ copyable: false, qr: false } as const,
|
||||
)
|
||||
type PropertiesV1 = typeof matchPropertiesV1._TYPE
|
||||
|
||||
@@ -49,7 +49,6 @@ const matchPackagePropertyString = shape(
|
||||
},
|
||||
['description', 'copyable', 'qr', 'masked'],
|
||||
{
|
||||
description: null as null,
|
||||
copyable: false,
|
||||
qr: false,
|
||||
masked: false,
|
||||
@@ -100,16 +99,16 @@ export function parsePropertiesPermissive(
|
||||
name,
|
||||
value: {
|
||||
value: String(value),
|
||||
description: null,
|
||||
copyable: false,
|
||||
qr: false,
|
||||
masked: false,
|
||||
},
|
||||
}))
|
||||
.reduce((acc, { name, value }) => {
|
||||
acc[name] = value
|
||||
// TODO: Fix type
|
||||
acc[name] = value as any
|
||||
return acc
|
||||
}, {})
|
||||
}, {} as PackageProperties)
|
||||
}
|
||||
switch (properties.version) {
|
||||
case 1:
|
||||
|
||||
Reference in New Issue
Block a user