Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server folder or file as input parameter for my script #137

Closed
fabianomenegidio opened this issue Nov 2, 2018 · 7 comments
Closed

Server folder or file as input parameter for my script #137

fabianomenegidio opened this issue Nov 2, 2018 · 7 comments

Comments

@fabianomenegidio
Copy link

How can I select a folder or file as input parameter for my script?

@bugy
Copy link
Owner

bugy commented Nov 2, 2018

Hi @fabianomenegidio, for file parameter you can you file_upload type. There are details on how it works: details

Uploading the folder is not supported. And it would be complicated to implement, because it's not really supported by html standards and would work only in some browsers.

Or did I understand your question wrong and you were asking about selecting a file/folder on the server?

@bugy bugy added the question label Nov 2, 2018
@fabianomenegidio
Copy link
Author

Choose a file or folder on the server (in a container where Script-Server would be installed).

Tnx

@bugy
Copy link
Owner

bugy commented Nov 3, 2018

Hi @fabianomenegidio, unfortunately it's not supported at the moment.

If you have limited amount of files, you can emulate this behaviour with a list parameter, specifying ls/find as a command.
E.g.

{
      "name": "File on server",
      "type": "list",
      "values": {
        "script": "find /home/me/folder -name '*.txt'"
      }
}

@bugy bugy changed the title Folder or file as input parameter for my script Server folder or file as input parameter for my script Nov 3, 2018
@bugy bugy added feature and removed question labels Nov 3, 2018
@bugy
Copy link
Owner

bugy commented Nov 11, 2018

Hi @fabianomenegidio, I'd keep the issue open until I add the feature

@bugy
Copy link
Owner

bugy commented Dec 14, 2018

There is another similar ticket: #147, which I can be addressed together.
In my opinion there could be 2 different options: recursive and not. For recursive option there would be some kind of file selection dialog.
For non-recursive it would be shown as a list.

@bugy
Copy link
Owner

bugy commented Dec 30, 2018

@csphoenix1 I added 'server_file' parameter type. It can be used for non-recursive file selection. For the user only filenames will be shown. In the script full path (i.e. file_dir/filename) will be passed

Also added new parameter configuration fields:
file_dir - (required) where to look for files
file_type - file type filter ('dir' or 'file')
file_extensions - list of file extensions (implicitly applies "file_type": "file")

Example config:

{
    "name": "my file",
    "type": "server_file",
    "file_dir": "/home/me/configs",
    "file_extensions": ["txt", "yml", "json"]
}

Recursive file selection still to be done

@bugy
Copy link
Owner

bugy commented Jan 17, 2019

Added new parameter option: file_recursive (boolean). If it's true, then instead of combobox, user will get a file chooser with the possibility to navigate between folders and select them.
The "root" dir for the user will be the file_dir and user won't be able to see/select anything outside of it.

Also fixed interaction of file_dir and working_dir. Now file_dir is relative to working_dir.

Examples could be found in https://github.com/bugy/script-server/blob/master/samples/configs/parameterized.json

@bugy bugy added the resolved label Jan 17, 2019
@bugy bugy mentioned this issue Jan 17, 2019
@bugy bugy closed this as completed Jan 25, 2019
bugy added a commit that referenced this issue Jan 27, 2019
…breadcrumb + fixed unfocused empty server_file field
bugy added a commit that referenced this issue Jan 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants