mirror of
https://github.com/amidaware/tacticalrmm.git
synced 2026-04-26 06:55:52 +03:00
[GH-ISSUE #702] Expose script parameters in Run dialogs #2391
Labels
No labels
In Process
bug
bug
dev-triage
documentation
duplicate
enhancement
fixed
good first issue
help wanted
integration
invalid
pull-request
question
requires agent update
security
ui tweak
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tacticalrmm#2391
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @silversword411 on GitHub (Sep 10, 2021).
Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/702
Originally assigned to: @sadnub on GitHub.
Can never remember what the command parameters are for scripts.
Option 1
Add a new item in the .json tip and show under script name selection. In this example I tried to emulate powershell notation (successfully=unsure)
Maybe call it "syntax"? Eg
Option 2
Display the description I can work on a standardized format for parameters. Support for new line (with /n?) a bonus.
@bradhawkins85 commented on GitHub (Sep 14, 2021):
This will add script arguments to the community scripts json
They will be pre-filled then, you can just remove and re-add to change the values.
May not achieve exactly what you want but will serve as a workaround for the short term.
@silversword411 commented on GitHub (Sep 15, 2021):
Would probably work just dandy :)
Gonna be a booger to write the defaults, lots of different scripts with different defaults.
@bradhawkins85 Can you think of how to write up something similar to the powershell syntax that would be TRMM specific (looking for something for the docs).
I look at this
and only when I get it color-coded in VSCode does it help to be more readable (for me at least)
@silversword411 commented on GitHub (Sep 15, 2021):
As an example what would the one for https://github.com/wh1te909/tacticalrmm/blob/develop/scripts/Win_Chocolatey_Manage_Apps_Bulk.ps1
Look like?
@silversword411 commented on GitHub (Sep 15, 2021):
So trying to follow powershell's example from here: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_command_syntax?view=powershell-7.1
TRMM Standard json format would look something like:
eg for https://github.com/wh1te909/tacticalrmm/blob/develop/scripts/Win_User_Create.ps1
json would be
So TRMM docs description on a structured format should be:
Anyone see any problems?
@dinger1986 commented on GitHub (Sep 15, 2021):
looks right to me using that script as an example
@silversword411 commented on GitHub (Sep 21, 2021):
This commit is a test of the concept. Not sure how it'll go, can back it out if necessary.
github.com/wh1te909/tacticalrmm@8f9ad15108@sadnub commented on GitHub (Oct 11, 2021):
This will break the existing arg functionality since that arg file is copied right to the script default args. Can we use another field like "help" or "syntax"?
@silversword411 commented on GitHub (Oct 11, 2021):
@sadnub I was working around not having another field added to the run script like: help/syntax etc.
See the "rename computer" script from the library in the current TRMM v0.8.5. If you wanted to have a new field I can definitely not do this, and put it into a dedicated new field loaded from the json (probably better anyway).
@sadnub commented on GitHub (Oct 11, 2021):
Yeah might have to use another field. I'm not sure how else to do it. As it stands, it will try and send the args as they are to the agent and the variable replacement would stop working
@silversword411 commented on GitHub (Oct 11, 2021):
As it stands you just type new parameters...and then delete all the pre-filled ones ;) It makes for lots more clicking/deleting but it shows you the format of what you need to do.
If you do build a new part for the script GUI's, it'd be nice to have some color categories that can be applied to that somehow so you know required/optional/multiple options differentiation.
@sadnub commented on GitHub (Oct 11, 2021):
I'm thinking for a script that has only optional parameters, it would require the box to be cleared in order to run properly. I think that anything that is copied into the args field should be a valid set of args since the args field in the community.json was intended to be for default args. It works really well scripts like ScreenConnect install because it needs certain args to run correctly and they don't change.
There definitely should be an indication of what is allowed though in the run script modal. Actually displaying the expected and optional args is really useful.
@silversword411 commented on GitHub (Oct 11, 2021):
I'll reverse out my parameters and await something from you on guidance/a course.
@sadnub commented on GitHub (Oct 11, 2021):
What you did here will work. Creating another key for the command usage.
I just need to then created a db field for the usage data and display it in the UI
@silversword411 commented on GitHub (Oct 11, 2021):
Sounds good.
Can you have the field parse, and colorize based on structure?
@sadnub commented on GitHub (Oct 11, 2021):
Yeah should be able to work that out too