Closed heavyB closed 6 months ago
So right now the user can do this via the builder by selecting the ! command and entering ifconfig in the arguments field. Are we wanting to create a 'freetext' option that just uses an argument field without any command prefix?
@ksalamy @heavyB I would recommend either adding a 'freetext' command that uses a singular syntax to the actual API endpoint that lists available commands for the command builder - this would be the /commands
endpoint called by:
https://github.com/mbari-org/dash5/blob/develop/packages/api-client/src/axios/Command/getCommands.ts
Or you could inject a fake command into the data on line 80 of the command modal:
const { data: commandData } = useCommands()
if (commandData?.commands.find((c) => c.keyword === ' ') === undefined) {
commandData?.commands.unshift({
advanced: false,
description:
'Enter custom text to send to the vehicle. This command is not validated by the system. Use with caution.',
keyword: ' ',
syntaxList: [
{
argList: [
{
argType: 'ARG_STRING',
required: 'REQUIRED',
},
],
help: 'free text',
},
],
})
}
I would caution or even advise against adding this type of command unless you have a real use case for it. Maybe you should just use push
instead of unshift so this command appears last in the list. The example command in the issue can easily be created with the !
bash command that already exists. I'm not sure you want to introduce a work around to using the command builder as the entire point of creating the builder is to reduce user input errors with commands right? You run the risk of everyone just defaulting to this free text command because it's "easier" only to introduce errors. Just my thoughts.
@heavyB What is your decision on this? How would you like to proceed? I agree with @jimjeffers that we want to limit the introduction of command errors within missions. Let me know. -K
Sorry for the delay here. Okay I didn't think to just select the ! command first. I was going to try it just now but dash5 appears to be down. Given this discussion I agree with you both that it's probably best to keep the user restricted and not allow free text. I'm clearly too used to just typing stuff in which is definitely more error prone.
If a user wants to send a custom command there is no place to insert custom text. For example a recent command was "! ifconfig"
Let's add a way to just pass through user text.