diff --git a/api/sm/sm-client.ts b/api/sm/sm-client.ts index 8759255..2d6b667 100644 --- a/api/sm/sm-client.ts +++ b/api/sm/sm-client.ts @@ -15,6 +15,7 @@ import playProcessSchema from "./schemas/play-process"; import pauseProcessSchema from "./schemas/pause-process"; import stopProcessSchema from "./schemas/stop-process"; import killProcessSchema from "./schemas/kill-process"; +import commandSchema from "./schemas/command"; export class SMClient { schemaClient: SchemaClient @@ -33,6 +34,16 @@ export class SMClient { } } + async getCommand(name: string): Promise> { + let { responseData, headers } = await this.schemaClient.send(commandSchema, { + commandName: name + }) + return { + data: responseData, + headers: headers + } + } + async runCommand(data: any): Promise { let { headers } = await this.schemaClient.send(runCommandsSchema, data) return { diff --git a/components/elements/commands/elements/argument/index.tsx b/components/elements/commands/elements/argument/index.tsx index 4fe6b69..a7024f6 100644 --- a/components/elements/commands/elements/argument/index.tsx +++ b/components/elements/commands/elements/argument/index.tsx @@ -28,8 +28,7 @@ export default function Argument(argument: ArgumentInterface) { } return ( -   - {/* */} +   ) } diff --git a/components/elements/commands/elements/command/index.tsx b/components/elements/commands/elements/command/index.tsx index a207c4f..147bb9a 100644 --- a/components/elements/commands/elements/command/index.tsx +++ b/components/elements/commands/elements/command/index.tsx @@ -17,11 +17,13 @@ export interface CommandInterface { interface CommandComponentInterface { command: CommandInterface, callback: any, + optionsParams?: Record, + argumentsParams?: Record, } -export default function Command({command, callback}: CommandComponentInterface) { - const [optionList, setOptionList] = useState>({}); - const [argumentList, setArgumentList] = useState>({}); +export default function Command({command, callback, optionsParams, argumentsParams}: CommandComponentInterface) { + const [optionList, setOptionList] = useState>(optionsParams || {}); + const [argumentList, setArgumentList] = useState>(argumentsParams || {}); useEffect(() => { callback && callback(command.name, optionList, argumentList) @@ -31,7 +33,6 @@ export default function Command({command, callback}: CommandComponentInterface)
- {command.name} 
diff --git a/components/elements/commands/elements/options/index.tsx b/components/elements/commands/elements/options/index.tsx index c2b6e49..4e0a236 100644 --- a/components/elements/commands/elements/options/index.tsx +++ b/components/elements/commands/elements/options/index.tsx @@ -2,7 +2,7 @@ import styles from './styles.module.css' import Option, {OptionInterface} from '../option' import {useContext, useEffect, useState} from "react"; import Context, {ContextInterface} from "../command/context"; -import {Select, MenuItem, Checkbox, ListItemText} from "@mui/material"; +import {Select, OutlinedInput, FormControl, MenuItem, Checkbox, ListItemText} from "@mui/material"; interface OptionsInterface { optionList: OptionInterface[] @@ -45,10 +45,11 @@ export default function Options({optionList}: OptionsInterface) { <>