Merge branch 'bugfix/misc' of github.com:Start9Labs/start-os into bugfix/misc

This commit is contained in:
Aiden McClelland
2024-07-25 16:14:06 -06:00
6 changed files with 35 additions and 9 deletions

View File

@@ -64,7 +64,7 @@ const runType = object({
input: any,
timeout: number,
},
["timeout"],
["timeout", "input"],
),
})
const sandboxRunType = object({
@@ -77,7 +77,7 @@ const sandboxRunType = object({
input: any,
timeout: number,
},
["timeout"],
["timeout", "input"],
),
})
const callbackType = object({

View File

@@ -232,7 +232,7 @@ export class SystemForEmbassy implements System {
effects: Effects,
options: {
procedure: JsonPath
input: unknown
input?: unknown
timeout?: number | undefined
},
): Promise<RpcResult> {
@@ -294,7 +294,7 @@ export class SystemForEmbassy implements System {
effects: Effects,
options: {
procedure: JsonPath
input: unknown
input?: unknown
timeout?: number | undefined
},
): Promise<unknown> {

View File

@@ -75,7 +75,7 @@ export class SystemForStartOs implements System {
effects: Effects,
options: {
procedure: Procedure
input: unknown
input?: unknown
timeout?: number | undefined
},
): Promise<RpcResult> {
@@ -137,7 +137,7 @@ export class SystemForStartOs implements System {
effects: Effects | MainEffects,
options: {
procedure: Procedure
input: unknown
input?: unknown
timeout?: number | undefined
},
): Promise<unknown> {
@@ -219,7 +219,7 @@ export class SystemForStartOs implements System {
async sandbox(
effects: Effects,
options: { procedure: Procedure; input: unknown; timeout?: number },
options: { procedure: Procedure; input?: unknown; timeout?: number },
): Promise<RpcResult> {
return this.execute(effects, options)
}

View File

@@ -58,6 +58,7 @@ pub struct ActionParams {
pub action_id: ActionId,
#[command(flatten)]
#[ts(type = "{ [key: string]: any } | null")]
#[serde(default)]
pub input: StdinDeserializable<Option<Config>>,
}
// impl C

View File

@@ -568,6 +568,14 @@ where
#[derive(Deserialize, Serialize, TS)]
pub struct StdinDeserializable<T>(pub T);
impl<T> Default for StdinDeserializable<T>
where
T: Default,
{
fn default() -> Self {
Self(T::default())
}
}
impl<T> FromArgMatches for StdinDeserializable<T>
where
T: DeserializeOwned,

View File

@@ -20,6 +20,20 @@ import {
import { getAllPackages, getManifest } from 'src/app/util/get-package-data'
import { hasCurrentDeps } from 'src/app/util/has-deps'
const allowedStatuses = {
onlyRunning: new Set(['running']),
onlyStopped: new Set(['stopped']),
any: new Set([
'running',
'stopped',
'restarting',
'restoring',
'stopping',
'starting',
'backingUp',
]),
}
@Component({
selector: 'app-actions',
templateUrl: './app-actions.page.html',
@@ -46,7 +60,10 @@ export class AppActionsPage {
status: T.Status,
action: { key: string; value: T.ActionMetadata },
) {
if (status && action.value.allowedStatuses.includes(status.main.status)) {
if (
status &&
allowedStatuses[action.value.allowedStatuses].has(status.main.status)
) {
if (!isEmptyObject(action.value.input || {})) {
this.formDialog.open(FormComponent, {
label: action.value.name,
@@ -84,7 +101,7 @@ export class AppActionsPage {
await alert.present()
}
} else {
const statuses = [...action.value.allowedStatuses]
const statuses = [...allowedStatuses[action.value.allowedStatuses]]
const last = statuses.pop()
let statusesStr = statuses.join(', ')
let error = ''