mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
Misc frontend fixes (#2974)
* fix dependency input warning and extra comma * clean up buttons during install in marketplace preview * chore: grayscale and closing action-bar * fix prerelease precedence * fix duplicate url for addSsl on ssl proto * no warning for soft uninstall * fix: stop logs from repeating disconnected status and add 1 second delay between reconnection attempts * fix stop on reactivation of critical task * fix: fix disconnected toast * fix: updates styles * fix: updates styles * misc fixes * beta.33 * fix updates badge and initialization of marketplace preview controls --------- Co-authored-by: waterplea <alexander@inkin.ru> Co-authored-by: Aiden McClelland <me@drbonez.dev>
This commit is contained in:
@@ -104,7 +104,11 @@ export class Action<Id extends T.ActionId, Type extends Record<string, any>>
|
||||
this.cachedParser = built.validator
|
||||
return {
|
||||
spec: built.spec,
|
||||
value: (await this.getInputFn(options)) || null,
|
||||
value:
|
||||
((await this.getInputFn(options)) as
|
||||
| Record<string, unknown>
|
||||
| null
|
||||
| undefined) || null,
|
||||
}
|
||||
}
|
||||
async run(options: {
|
||||
|
||||
@@ -1,8 +1,18 @@
|
||||
import { ExtendedVersion, VersionRange } from "../exver"
|
||||
import { PackageId, HealthCheckId } from "../types"
|
||||
import {
|
||||
PackageId,
|
||||
HealthCheckId,
|
||||
DependencyRequirement,
|
||||
CheckDependenciesResult,
|
||||
} from "../types"
|
||||
import { Effects } from "../Effects"
|
||||
|
||||
export type CheckDependencies<DependencyId extends PackageId = PackageId> = {
|
||||
infoFor: (packageId: DependencyId) => {
|
||||
requirement: DependencyRequirement
|
||||
result: CheckDependenciesResult
|
||||
}
|
||||
|
||||
installedSatisfied: (packageId: DependencyId) => boolean
|
||||
installedVersionSatisfied: (packageId: DependencyId) => boolean
|
||||
runningSatisfied: (packageId: DependencyId) => boolean
|
||||
@@ -41,7 +51,7 @@ export async function checkDependencies<
|
||||
)
|
||||
}
|
||||
|
||||
const find = (packageId: DependencyId) => {
|
||||
const infoFor = (packageId: DependencyId) => {
|
||||
const dependencyRequirement = dependencies.find((d) => d.id === packageId)
|
||||
const dependencyResult = results.find((d) => d.packageId === packageId)
|
||||
if (!dependencyRequirement || !dependencyResult) {
|
||||
@@ -51,9 +61,9 @@ export async function checkDependencies<
|
||||
}
|
||||
|
||||
const installedSatisfied = (packageId: DependencyId) =>
|
||||
!!find(packageId).result.installedVersion
|
||||
!!infoFor(packageId).result.installedVersion
|
||||
const installedVersionSatisfied = (packageId: DependencyId) => {
|
||||
const dep = find(packageId)
|
||||
const dep = infoFor(packageId)
|
||||
return (
|
||||
!!dep.result.installedVersion &&
|
||||
ExtendedVersion.parse(dep.result.installedVersion).satisfies(
|
||||
@@ -62,18 +72,18 @@ export async function checkDependencies<
|
||||
)
|
||||
}
|
||||
const runningSatisfied = (packageId: DependencyId) => {
|
||||
const dep = find(packageId)
|
||||
const dep = infoFor(packageId)
|
||||
return dep.requirement.kind !== "running" || dep.result.isRunning
|
||||
}
|
||||
const tasksSatisfied = (packageId: DependencyId) =>
|
||||
Object.entries(find(packageId).result.tasks).filter(
|
||||
Object.entries(infoFor(packageId).result.tasks).filter(
|
||||
([_, t]) => t.active && t.task.severity === "critical",
|
||||
).length === 0
|
||||
const healthCheckSatisfied = (
|
||||
packageId: DependencyId,
|
||||
healthCheckId?: HealthCheckId,
|
||||
) => {
|
||||
const dep = find(packageId)
|
||||
const dep = infoFor(packageId)
|
||||
if (
|
||||
healthCheckId &&
|
||||
(dep.requirement.kind !== "running" ||
|
||||
@@ -102,14 +112,14 @@ export async function checkDependencies<
|
||||
: dependencies.every((d) => pkgSatisfied(d.id as DependencyId))
|
||||
|
||||
const throwIfInstalledNotSatisfied = (packageId: DependencyId) => {
|
||||
const dep = find(packageId)
|
||||
const dep = infoFor(packageId)
|
||||
if (!dep.result.installedVersion) {
|
||||
throw new Error(`${dep.result.title || packageId} is not installed`)
|
||||
}
|
||||
return null
|
||||
}
|
||||
const throwIfInstalledVersionNotSatisfied = (packageId: DependencyId) => {
|
||||
const dep = find(packageId)
|
||||
const dep = infoFor(packageId)
|
||||
if (!dep.result.installedVersion) {
|
||||
throw new Error(`${dep.result.title || packageId} is not installed`)
|
||||
}
|
||||
@@ -127,14 +137,14 @@ export async function checkDependencies<
|
||||
return null
|
||||
}
|
||||
const throwIfRunningNotSatisfied = (packageId: DependencyId) => {
|
||||
const dep = find(packageId)
|
||||
const dep = infoFor(packageId)
|
||||
if (dep.requirement.kind === "running" && !dep.result.isRunning) {
|
||||
throw new Error(`${dep.result.title || packageId} is not running`)
|
||||
}
|
||||
return null
|
||||
}
|
||||
const throwIfTasksNotSatisfied = (packageId: DependencyId) => {
|
||||
const dep = find(packageId)
|
||||
const dep = infoFor(packageId)
|
||||
const reqs = Object.entries(dep.result.tasks)
|
||||
.filter(([_, t]) => t.active && t.task.severity === "critical")
|
||||
.map(([id, _]) => id)
|
||||
@@ -149,7 +159,7 @@ export async function checkDependencies<
|
||||
packageId: DependencyId,
|
||||
healthCheckId?: HealthCheckId,
|
||||
) => {
|
||||
const dep = find(packageId)
|
||||
const dep = infoFor(packageId)
|
||||
if (
|
||||
healthCheckId &&
|
||||
(dep.requirement.kind !== "running" ||
|
||||
@@ -205,6 +215,7 @@ export async function checkDependencies<
|
||||
})()
|
||||
|
||||
return {
|
||||
infoFor,
|
||||
installedSatisfied,
|
||||
installedVersionSatisfied,
|
||||
runningSatisfied,
|
||||
|
||||
@@ -753,7 +753,10 @@ export class Version {
|
||||
return "less"
|
||||
}
|
||||
|
||||
const prereleaseLen = Math.max(this.number.length, other.number.length)
|
||||
const prereleaseLen = Math.max(
|
||||
this.prerelease.length,
|
||||
other.prerelease.length,
|
||||
)
|
||||
for (let i = 0; i < prereleaseLen; i++) {
|
||||
if (typeof this.prerelease[i] === typeof other.prerelease[i]) {
|
||||
if (this.prerelease[i] > other.prerelease[i]) {
|
||||
|
||||
@@ -180,8 +180,8 @@ export type KnownError =
|
||||
|
||||
export type Dependencies = Array<DependencyRequirement>
|
||||
|
||||
export type DeepPartial<T> = T extends unknown[]
|
||||
? T
|
||||
export type DeepPartial<T> = T extends [infer A, ...infer Rest]
|
||||
? [DeepPartial<A>, ...DeepPartial<Rest>]
|
||||
: T extends {}
|
||||
? { [P in keyof T]?: DeepPartial<T[P]> }
|
||||
: T
|
||||
|
||||
@@ -26,7 +26,11 @@ export function partialDiff<T>(
|
||||
} else if (typeof prev === "object" && typeof next === "object") {
|
||||
if (prev === null || next === null) return { diff: next }
|
||||
const res = { diff: {} as Record<keyof T, any> }
|
||||
for (let key in next) {
|
||||
const keys = Object.keys(next) as (keyof T)[]
|
||||
for (let key in prev) {
|
||||
if (!keys.includes(key)) keys.push(key)
|
||||
}
|
||||
for (let key of keys) {
|
||||
const diff = partialDiff(prev[key], next[key])
|
||||
if (diff) {
|
||||
res.diff[key] = diff.diff
|
||||
|
||||
@@ -710,7 +710,7 @@ export class StartSdk<Manifest extends T.SDKManifest> {
|
||||
image,
|
||||
mounts,
|
||||
name,
|
||||
)
|
||||
).then((subc) => subc.rc())
|
||||
},
|
||||
/**
|
||||
* @description Run a function with a temporary SubContainer
|
||||
|
||||
4
sdk/package/package-lock.json
generated
4
sdk/package/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@start9labs/start-sdk",
|
||||
"version": "0.4.0-beta.32",
|
||||
"version": "0.4.0-beta.33",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@start9labs/start-sdk",
|
||||
"version": "0.4.0-beta.32",
|
||||
"version": "0.4.0-beta.33",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@iarna/toml": "^3.0.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@start9labs/start-sdk",
|
||||
"version": "0.4.0-beta.32",
|
||||
"version": "0.4.0-beta.33",
|
||||
"description": "Software development kit to facilitate packaging services for StartOS",
|
||||
"main": "./package/lib/index.js",
|
||||
"types": "./package/lib/index.d.ts",
|
||||
|
||||
Reference in New Issue
Block a user