script-server icon indicating copy to clipboard operation
script-server copied to clipboard

Adding "splash" screen [feature]

Open giliredbaron opened this issue 6 years ago • 20 comments

Can be nice to have the ability to put some text in the empty output place before running the actual script. This can be like a splash screen for every task. I find it useful because it can show the current state of service/task before running the script server.

Screen Shot 2019-05-21 at 16 13 34

giliredbaron avatar May 21 '19 13:05 giliredbaron

Hi @giliredbaron, thanks for the idea! Do you have a proposal what image/text could be there?

bugy avatar May 21 '19 13:05 bugy

One option is a script output. Second is to read it from a file.

The purpose of this was born when we run some script that makes some change. Before we run this script (from our script server) we have a look at some other screen (web page, monitoring stuff) and take action according to it. My thought was, to use the same tool, script server, to both, create a change, and watch the state.

Gili

giliredbaron avatar May 21 '19 13:05 giliredbaron

Hi Gili, thanks for the explanation. So you mean it could be some pre-script, which is executed each time, when a user opens a page. Is it correct?

bugy avatar May 21 '19 13:05 bugy

Correct...! :)

giliredbaron avatar May 21 '19 13:05 giliredbaron

hi @bugy / @giliredbaron , how can we implement this pre-script ? can you please point me to the documentation if it's documented, or else can you please let me know here?

lokeshkh92 avatar Jun 09 '21 04:06 lokeshkh92

Hi Lokesh,

I don't have development documentation. If you want to implement it, start with model/server_conf.py, it should be extended with a new field Also it should be added in external_model.py

Then, on the UI, web-src/src/main-app/components/scripts/script-view.vue Should be able to setLog not only from executor, but also from the script config

Lokesh Khandelwal @.***> schrieb am Mi., 9. Juni 2021, 06:56:

hi @bugy https://github.com/bugy / @giliredbaron https://github.com/giliredbaron , how can we implement this pre-script ? can you please point me to the documentation if it's documented, or else can you please let me know here?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bugy/script-server/issues/218#issuecomment-857372469, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJXPJLEWIG46EC35BJ7IYTTR3YA3ANCNFSM4HOK324Q .

bugy avatar Jun 09 '21 09:06 bugy

@lokeshkh92 @giliredbaron @mneill73 Do you think that for your use cases, generating dynamic description (above parameters section) would be enough? Or do you need almost the full screen?

bugy avatar Oct 20 '22 18:10 bugy

In theory this would work.

In my head, I'm pondering having one of my report scripts tee the output into a defined static file whenever it runs, so that current status report would be shown as the first thing when a user logs in to "do things" with the environment management system running inside this instance of script-server.

The script isn't super intensive, so either one of "running a script", or "rendering a file contents", would work for my use case. Said contents would be HTML, though, so I'd either need the main window contents to accept HTML, or I'd need to preprocess the HTML table through lynx when I save it.

MNeill73 avatar Oct 20 '22 18:10 MNeill73

Done, now it's possible to configure preload script (only via json, as this is a preview feature). Example:

  "preload_script": {
    "script": "echo 'This is a <b>preload</b> script showing some info.</br>'",
    "output_format": "html"
  }

output_format is optional, it's the same as output format in normal configuration

bugy avatar Mar 10 '23 15:03 bugy

Did this make it into the Dev branch yet?

On Fri, Mar 10, 2023 at 10:07 AM Iaroslav Shepilov @.***> wrote:

Done, now it's possible to configure preload script (only via json, as this is a preview feature). Example:

"preload_script": { "script": "echo 'This is a preload script showing some info.'", "output_format": "html" }

output_format is optional, it's the same as output format in normal configuration

— Reply to this email directly, view it on GitHub https://github.com/bugy/script-server/issues/218#issuecomment-1463937909, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3HBI3V2J2E7BAHJBHNRI7LW3M7RRANCNFSM4HOK324Q . You are receiving this because you were mentioned.Message ID: @.***>

MNeill73 avatar Mar 10 '23 20:03 MNeill73

It should, yes

MNeill73 @.***> schrieb am Fr., 10. März 2023, 21:36:

Did this make it into the Dev branch yet?

On Fri, Mar 10, 2023 at 10:07 AM Iaroslav Shepilov @.***> wrote:

Done, now it's possible to configure preload script (only via json, as this is a preview feature). Example:

"preload_script": { "script": "echo 'This is a preload script showing some info.'", "output_format": "html" }

output_format is optional, it's the same as output format in normal configuration

— Reply to this email directly, view it on GitHub < https://github.com/bugy/script-server/issues/218#issuecomment-1463937909>, or unsubscribe < https://github.com/notifications/unsubscribe-auth/A3HBI3V2J2E7BAHJBHNRI7LW3M7RRANCNFSM4HOK324Q

. You are receiving this because you were mentioned.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/bugy/script-server/issues/218#issuecomment-1464410298, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJXPJKAJTUZW5HZBMLIKRDW3OGGPANCNFSM4HOK324Q . You are receiving this because you were mentioned.Message ID: @.***>

bugy avatar Mar 10 '23 20:03 bugy

Yeah, it's definitely not behaving for me.

I've re-pulled the dev branch, just to make sure. My conf looks like:

{ "title": "XXXXXXX", "auth": {

"type": XXXXXXX,

"expiration_days": 3

},

"access": {

XXXXXXX

"groups": {

XXXXXXX

}

},

"ssl": {

"key_path": "XXXXXXX",

"cert_path": "XXXXXXX"

},

"preload_script": {

"script": "/home/ec2-user/SETLAB/setlabReport.sh"

}

}

That script works when run from the shell prompt, but nothing happens when I log into the SS instance.

On Fri, Mar 10, 2023 at 3:51 PM Iaroslav Shepilov @.***> wrote:

It should, yes

MNeill73 @.***> schrieb am Fr., 10. März 2023, 21:36:

Did this make it into the Dev branch yet?

On Fri, Mar 10, 2023 at 10:07 AM Iaroslav Shepilov @.***> wrote:

Done, now it's possible to configure preload script (only via json, as this is a preview feature). Example:

"preload_script": { "script": "echo 'This is a preload script showing some info.'", "output_format": "html" }

output_format is optional, it's the same as output format in normal configuration

— Reply to this email directly, view it on GitHub < https://github.com/bugy/script-server/issues/218#issuecomment-1463937909 , or unsubscribe <

https://github.com/notifications/unsubscribe-auth/A3HBI3V2J2E7BAHJBHNRI7LW3M7RRANCNFSM4HOK324Q

. You are receiving this because you were mentioned.Message ID: @.***>

— Reply to this email directly, view it on GitHub < https://github.com/bugy/script-server/issues/218#issuecomment-1464410298>, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AAJXPJKAJTUZW5HZBMLIKRDW3OGGPANCNFSM4HOK324Q

. You are receiving this because you were mentioned.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/bugy/script-server/issues/218#issuecomment-1464455187, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3HBI3WYHG76WTYW2I4W3EDW3OH5XANCNFSM4HOK324Q . You are receiving this because you were mentioned.Message ID: @.***>

MNeill73 avatar Mar 14 '23 17:03 MNeill73

Do you see anything in logs/server.log? Also, you might need to reload UI cache, smth like ctrl+R in browser

bugy avatar Mar 14 '23 17:03 bugy

Nothing interesting:

2023-03-14 17:52:55,808 [tornado.access.INFO] 200 GET /login.html?next=%2Findex.html (136.56.30.109) 1.35ms 2023-03-14 17:52:55,844 [tornado.access.INFO] 200 GET /theme/theme.css (136.56.30.109) 1.50ms 2023-03-14 17:52:55,874 [tornado.access.INFO] 200 GET /css/chunk-login-vendors.c0ff70ff.css (136.56.30.109) 26.94ms 2023-03-14 17:52:55,876 [tornado.access.INFO] 200 GET /css/login.21170001.css (136.56.30.109) 14.17ms 2023-03-14 17:52:55,876 [tornado.access.INFO] 200 GET /js/login.591b003a.js (136.56.30.109) 12.34ms 2023-03-14 17:52:55,885 [tornado.access.INFO] 200 GET /js/chunk-login-vendors.e73644a0.js (136.56.30.109) 31.70ms 2023-03-14 17:52:55,943 [tornado.access.INFO] 200 GET /theme/darkBackground_login.jpg (136.56.30.109) 1.35ms 2023-03-14 17:52:55,992 [tornado.access.INFO] 200 GET /auth/config (136.56.30.109) 0.95ms 2023-03-14 17:52:55,994 [tornado.access.INFO] 200 GET /favicon.ico (136.56.30.109) 1.53ms 2023-03-14 17:52:57,341 [script_server.tornado_auth.INFO] Trying to authenticate user 2023-03-14 17:52:57,344 [script_server.tornado_auth.INFO] Authenticated user mneill 2023-03-14 17:52:57,347 [tornado.access.INFO] 200 POST /login (136.56.30.109) 6.77ms 2023-03-14 17:52:57,378 [tornado.access.INFO] 200 GET /index.html (136.56.30.109) 2.14ms 2023-03-14 17:52:57,489 [tornado.access.INFO] 304 GET /conf (136.56.30.109) 0.90ms 2023-03-14 17:52:57,495 [tornado.access.INFO] 304 GET /scripts (136.56.30.109) 5.68ms 2023-03-14 17:52:57,497 [tornado.access.INFO] 304 GET /auth/info (136.56.30.109) 1.33ms 2023-03-14 17:52:57,499 [tornado.access.INFO] 304 GET /executions/active (136.56.30.109) 0.92ms 2023-03-14 17:52:59,298 [tornado.access.INFO] 200 GET /index.html (136.56.30.109) 1.69ms 2023-03-14 17:52:59,332 [tornado.access.INFO] 200 GET /theme/theme.css (136.56.30.109) 1.40ms 2023-03-14 17:52:59,353 [tornado.access.INFO] 200 GET /css/index.f9a37de9.css (136.56.30.109) 17.16ms 2023-03-14 17:52:59,361 [tornado.access.INFO] 200 GET /css/chunk-index-vendors.f4386b5c.css (136.56.30.109) 23.07ms 2023-03-14 17:52:59,372 [tornado.access.INFO] 200 GET /js/index.3b22c294.js (136.56.30.109) 24.46ms 2023-03-14 17:52:59,394 [tornado.access.INFO] 200 GET /js/chunk-index-vendors.3b1a376b.js (136.56.30.109) 50.93ms 2023-03-14 17:52:59,440 [tornado.access.INFO] 200 GET /favicon.ico (136.56.30.109) 1.06ms 2023-03-14 17:52:59,449 [tornado.access.INFO] 200 GET /auth/info (136.56.30.109) 1.96ms 2023-03-14 17:52:59,450 [tornado.access.INFO] 200 GET /executions/active (136.56.30.109) 0.87ms 2023-03-14 17:52:59,456 [tornado.access.INFO] 200 GET /scripts (136.56.30.109) 5.19ms 2023-03-14 17:52:59,458 [tornado.access.INFO] 200 GET /conf (136.56.30.109) 0.92ms 2023-03-14 17:52:59,461 [tornado.access.INFO] 200 GET /theme/darkBackground_header.jpg (136.56.30.109) 1.08ms 2023-03-14 17:52:59,482 [tornado.access.INFO] 200 GET /fonts/MaterialIcons-Regular.570eb838.woff2 (136.56.30.109) 1.98ms

I've dumped the entire cache for the site, as well as command-shift-R'd (Mac) the pages, still no preload script running

On Tue, Mar 14, 2023 at 1:40 PM Iaroslav Shepilov @.***> wrote:

Do you see anything in logs/server.log? Also, you might need to reload UI cache, smth like ctrl+R in browser

— Reply to this email directly, view it on GitHub https://github.com/bugy/script-server/issues/218#issuecomment-1468544785, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3HBI3SOHMI36CJ5HDSWCWTW4CUPNANCNFSM4HOK324Q . You are receiving this because you were mentioned.Message ID: @.***>

MNeill73 avatar Mar 14 '23 17:03 MNeill73

Oh, @MNeill73 I just noticed it, this preload script should be specified per script (see the first comment in this ticket)

bugy avatar Mar 15 '23 13:03 bugy

OH, so this is a preload that displays on the screen for a given script, not for the login page?

That's still partly useful for me, I think...but is there a possibility to extend this to the login page? In my case, I have a script that dumps the status of multiple environments, I'd like it to be the first thing people see if they log in

On Wed, Mar 15, 2023 at 9:55 AM Iaroslav Shepilov @.***> wrote:

Oh, @MNeill73 https://github.com/MNeill73 I just noticed it, this preload script should be specified per script (see the first comment in this ticket)

— Reply to this email directly, view it on GitHub https://github.com/bugy/script-server/issues/218#issuecomment-1470054218, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3HBI3SVRQDA6ULNUOHIS7TW4HC4RANCNFSM4HOK324Q . You are receiving this because you were mentioned.Message ID: @.***>

MNeill73 avatar Mar 15 '23 15:03 MNeill73

Hi, @MNeill73 unfortunately this is a completely separate feature. And with a quite big backlog, I won't give priority to it (since noone else requested to it). I'll move it to a separate ticket.

bugy avatar Mar 16 '23 09:03 bugy

This looks like the perfect solution for what I'm after however it's not working for me. I'm running script-server v1.17.1

I created the following script: $ cat Hello_World.json

{ "name": "Hello World", "script_path": "/bin/echo", "group": "TEST", "requires_terminal": false, "output_format": "text", "preload_script": { "script": "echo 'This is a preload script showing some info.'", "output_format": "html" }, "parameters": [ { "name": "Who do you want to say hello to?", "param": "Hello ", "same_arg_param": true, "type": "text", "default": "World" } ] }

I restarted the script-server and cleared all browser history. Only log entry was 2023-04-30 14:25:56,067 [tornado.access.INFO] 101 GET /scripts/Hello%20World?initWithValues=false (127.0.0.1) 0.92ms

Can you tell me where I went wrong.

Thank you

chellige avatar Apr 30 '23 14:04 chellige

You have to use dev version for it.

bugy avatar Apr 30 '23 17:04 bugy

That worked. Thanks for all you do!

chellige avatar Apr 30 '23 19:04 chellige