mbari-org / dash5

Web based UI and client applications for MBARI.
mbari.vercel.app
0 stars 2 forks source link

Command menu doesn't allow free text #304

Closed heavyB closed 6 months ago

heavyB commented 9 months ago

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.

image

jimjeffers commented 7 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?

CleanShot 2024-03-23 at 09 07 21@2x

jimjeffers commented 7 months ago

@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.

CleanShot 2024-03-23 at 09 31 45@2x

CleanShot 2024-03-23 at 09 31 37@2x

ksalamy commented 7 months ago

@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

heavyB commented 7 months ago

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.