Skip to content

Commit

Permalink
fix: actions
Browse files Browse the repository at this point in the history
  • Loading branch information
lideming committed Nov 25, 2023
1 parent ba44768 commit ff5ac89
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion neetbox/daemon/server/_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def handle_ws_message(client, server: WebsocketServer, message):
_target_bridge = Bridge(name=_project_name) # create new bridge for this name
__BRIDGES[_project_name] = _target_bridge
__BRIDGES[_project_name].cli_ws = client # assign cli to bridge
connected_clients[client["id"]] = (_project_name, "web")
connected_clients[client["id"]] = (_project_name, "cli")
server.send_message(
client=client,
msg=json.dumps(
Expand Down
11 changes: 7 additions & 4 deletions neetbox/frontend/src/components/dashboard/project/actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,21 @@ export function ActionItem({
{options.description}
</div>
)}
{options.args.map((argName) => (
<Row align="middle" style={{ alignSelf: "stretch" }}>
<Col span={6}>
{Object.entries(options.args).map(([argName, argType]) => (
<Row align="middle" type="flex" justify="space-between" style={{ alignSelf: "stretch" }}>
<Col span={4}>
<Typography.Text ellipsis>{argName}</Typography.Text>
</Col>
<Col span={18}>
<Col span={16}>
<Input
size="small"
value={args[argName]}
onChange={(val) => setArgs({ ...args, [argName]: val })}
/>
</Col>
<Col span={3}>
<Typography.Text ellipsis>({argType})</Typography.Text>
</Col>
</Row>
))}
<Button
Expand Down
2 changes: 1 addition & 1 deletion neetbox/frontend/src/services/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export interface ProjectStatus {
Record<
string,
{
args: string[];
args: Record<string, string>;
blocking: boolean;
description: string;
}
Expand Down
2 changes: 2 additions & 0 deletions tests/client/test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import time
from random import random
from time import sleep

Expand Down Expand Up @@ -72,6 +73,7 @@ def action_2(text1, text2):
def action_2(sec):
sec = int(sec)
logger.log(f"wait for {sec} sec.")
time.sleep(sec)


@action(name="shutdown", description="shutdown your process", blocking=True)
Expand Down

0 comments on commit ff5ac89

Please sign in to comment.