new sequencer pages are incomplete
the new sequencer web pages are incomplete. I have an email from Stefan describing the last problems. Need to find it and transfer it here. Target to complete sequencer pages for midas-2020-07 release. K.O.
Comments (56)
-
reporter -
reporter One more snippet
Hi, Stefan, definitely does not look right. In the old code I was unable to decipher when/how it switches between display modes when the script stops. I think for the "stop now" and "stop after current run", I want the sequencer page show the sequencer state right when it stopped. In this case it should have been on the "transition stop" line. Instead, it shows the "wait" line. I will take a look at fixing that.
-
reporter and last? one
Hi Konstantin, for “stop now” and “stop after current run”, people are usually not interested in where they stopped. Usually something is wrong and they have to change hardware, then start again. So they are used to the fact that if the sequencer is stopped, they see no colors there, and I would prefer to keep that scheme also for the future. Next, it would be nice to have the sequencer page “switchable” like we did for the history. Let’s make a “Sequencer” page in the menu and an “OldSequencer” page. So in case of problems, people can go to the old page. Once everybody is happy, we can drop the “OldSequencer” page.
-
reporter To answer some questions: it is quite a bit of work to move the old sequencer from the “sequencer” URL to the “new sequencer” URL - many paths are hardwired. This is why I left the old sequencer in the old place and put the new sequence pages under “NewSequencer”. K.O.
-
reporter More. The current version of the new sequencer pages show the script test in black and white without highlighting the current (or last) executed lines, as requested by Stefan. I am not sure when this change was made. K.O.
-
reporter so the current list of problems with the new sequencer pages is empty? Stefan? K.O.
-
reporter Ok, I see one problem. The new “start sequence” page is not showing the dialog to enter values of parameters. The old one does. This is a bug, I will try to fix it, it used to work. Test script is under examples/sequencer. K.O.
-
Ok, gave another shot to the sequencer pages.
-
When clicking on “NewSequencer” on the menu, the menu item “Sequencer” gets highlighted instead which is confusing. Can be fixed by
<body class="mcss" onload="mhttpd_init('NewSequencer')">
in sequencer.html, but has to be switched back once we do “NewSequencer” → “Sequencer”
-
Using a script of >20 lines or so, I see at the bottom of the script a “down arrow”, indicating that there is more code currently hidden, which is not the case. The old page does not show this:
* In the old file load box, the
COMMENT “This is a simple test file”
contents is shown at the bottom of the file selector box:* If we start from a fresh ODB, the old page shows “No script loaded” and a “New Script” button. The new sequencer page shows “Sequence is finished” which is confusing. Plus there is also the up arrow:
-
-
- Editing a scrip shows the filename in a <textarea> element which allows multi-line file names making no sense. Should be a <input type=”text”> field.
-
-
Clicking on “Syntax Help” during editing should open a new browser window and not replace the current window, loosing all edits.
-
-
-
Having a statement “PARAM <name>” should open a dialog box when starting a script querying this parameter and making it available for the script. Can be testes with the example script from the documentation.
``` COMMENT "This is a MSL test file" RUNDESCRIPTION "Test run" PARAM runs
LOOP $runs TRANSITION START WAIT Seconds 60 TRANSITION STOP ENDLOOP ```
-
-
reporter Ok, good, most problems look easy to fix. I already noticed the broken start page (does not ask for values of parameters, it used to work!). Getting the comment line out of each sequence file will be a bit more more work, but nothing difficult. K.O.
-
reporter script start page fixed. there was a logic error, it only asked for values of script parameters if “edit on sequence” also existed - incorrectly nested “if” statememts. K.O.
-
reporter script edit page - link to “help” fixed. (I use same html as the old page, both pages should do same thing now). K.O.
-
reporter script edit page - “textarea” is used to make the file name editable. Perhaps a better way is to add a button “save as…” and ask for the new filename in a dialog box - as is done in all modern apps. please advise? (On the old page, the filename is a link, clicking on it asks for a file name, but it does not seem to work). K.O.
-
reporter testing “fresh odb”.
If /sequencer does not exist (msequencer was never run), old page reports “/sequencer/state is missing in odb”, new page shows a partially loaded page.
I start msequencer, it creates a blank /sequencer/state. old page shows “no script loaded” and buttons “load script”, “new script” and “start script” (“start script” should not be there). new page shows “sequence finished”.
This confirms Stefan’s report, two problems need fixing:
- no /sequencer, show a dialog “please start msequencer”
- blank /sequencer/state/filename, show message “no script loaded”, and buttons “load script” and “new script”.
K.O.
-
“textarea” should be either replaced with a HTML “input” filed (single-line instead multi-line) or a “Save as…” button.
-
reporter testing the “up arrow” business.
in the old code this is very convoluted and I am not sure I understood the code completely. I think the intent was to implement manual scrolling to how the currently executing line in the middle of the window and have the “up” and “down” arrows to permit the user to scroll up and down.
I would rather not do any of this. How about this - show the script in a text window of fixed size and let the browser take care of all scrolling? I still have to do something to place the currently executing lines in the middle of the scroll area. I think I know how to do this?
But how big should this scrollable area be? We want to see the buttons and status area at the top, we want to see the “messages” area at the bottom, so the script area should fit somewhere in the middle? And automatically resize to prevent the “messages” area from being pushed down off the screen causing scrollbar inside scrollbar confusion.
I think I will try this.
K.O.
-
reporter The business of
mhttpd_init('NewSequencer'
, since we decided to kill the old sequencer pages, this switch will be made as the same time. K.O. -
Agree to replace the arrows with browser’s scroll bars. Seeing like ~15 lines around the current execution point seems ok to me.
-
reporter script load page - show script comments - this requires adding code in mjsonrpc.cxx to read each sequencer file, extract the comment, send it back to the web page. For extracting the comment, I have the option to do it “by hand” or call the MSL parser from the sequencer library.
can we kill this function instead? surely people can write useful and descriptive script comments can use descriptive file names?
K.O.
-
Agree let’s kill it.
-
reporter I think this addresses all reported problems. To answer the new comments:
- “textarea”. I think I tried “input”, but it could only be fixed length, could not even make it be “as wide as there is space on the page”. “textarea” has a “resize” drag-corner, so I used that. I will implement “Save as…” instead.
- scrolling of running script, “~15 lines” noted. I will try to code this.
K.O.
-
reporter script edit page - removed the “textarea”, implemented “save as…”. I use window.prompt() for now, lacking dlgPrompt() similar to dlgConfirm(). K.O.
-
reporter sequencer page - display “please start sequencer” if there is no /Sequencer in ODB, display “new script” if /Sequencer/State/Filename is blank.
script edit page - offer to create a new script if /Sequencer/State/Filename is blank (come here from the “new script” button).
K.O.
-
reporter only the scroll business remains. (it is cosmetic).
Stefan - please run your tests again? Everything you reported should be fixed now. (except for the “up” and “down” arrow business, cosmetic problem).
K.O.
-
So here is my test summary:
- Empty ODB: fixed
- Load first script: Error “javascript exception: Error: Cannot write ODB '/Sequencer/Command/Load filename', status 312, see MIDAS messages”, nothing in MIDAS messages
- Start path when loading a file: NOT fixed. See next message
- Saving a script: Error “avascript exception: Error: Cannot save sequencer file, error: fopen() errno 21 (Is a directory)”
- Starting new script: like the sample file, well done!
… can’t continue since I cannot save any script.
-
Now the “start path” thing. On a fresh ODB, the /Sequencer subdir is non-existent. When I start mhttpd, the /Sequencer subdir gets created. The “path” variable gets set to the current directory where mhttpd got started. If I started it from /usr/bin, then /Sequencer/Path = /usr/bin which is not good. Should set this to the experiment directory.
-
Here is the error when I try to save a script:
-
I like the new “Save as…” button, but not the window.prompt(). Added dlgQuery() for your convenience. Can you replace window.prompt() now?
-
reporter sequencer page - fixed hiding and showing of script lines (up and down arrows). I think it now works the same way it was originally intended to work. K.O.
-
reporter creation of odb /sequencer. This how I did my tests - from mhttpd, delete /sequencer, go to the “new sequencer” page, it complains “please start sequencer”. start msequencer by hand in separate window, this creates ODB /sequencer, “path” is set to… (hmm… it is set to MIDASSYS because that is where I started msequencer). back to the sequencer page, it offers “load” and “new”. In “new”, the “save” button saves $MIDASSYS/new.msl. So everything works. K.O.
-
reporter So it looks like we have 2 problems with /sequencer initialization: mhttpd creates an incomplete tree (no command/filename). and we set a bogus script path. K.O.
-
reporter For the default script path, I vote we use $MIDASSYS/examples/sequencer.
We could use the experiment directory, but then they cannot load any of the example scripts from $MIDASSYS/examples/sequencer.
K.O.
-
reporter dlgQuery() - I see it. can you add a documentation blurb and an example on how to use it? next to dlgMessage() blurb at the start of controls.js? K.O.
-
reporter dlgQuery() - specifically I do not know how use it - what is the arguments passed to callback()? This needs to be documented or exampled. K.O.
-
reporter Fixed both problems - mhttpd creates /sequencer/command same as msequencer and both initialize the default script path to $MIDASSYS/examples/sequencer.
K.O.
-
reporter I have no objection to changing the default script path to something else. Just remember to update code both in mhttpd and in msequencer. K.O.
-
reporter See last bug: if sequencer is not actually running, “load” and “new” result with an empty screen - sequencer must be running for loading of selected script to happen. K.O.
-
reporter sequencer page - show bigger notice about sequencer not running, hide the “load” and “new script” buttons, they will not work until msequencer is started. K.O.
-
reporter mhttpd - in preparation to remove old sequencer code from mhttpd, add #ifdef OLD_SEQUENCER. K.O.
-
reporter my sequencer to-do list is now empty. Stefan - test again?
K.O.
-
Ok.
- start from empty /sequencer, start mhttpd, load script → go to /midas/examples/sequencer, great.
- Start sequence → parameters are queried correctly
- Press “Start”, get following error:
-
- Load long script, start it, up/down arrows are working as previously, great.
-
Press “Save as…”, click on cancel, get following error:
-
I added a description of the dlgQuery() function.
-
Now as we do not use the “COMMENT” functionality of the scripts, we could use that comment to show it prominently on the sequencer page, like under “Sequencer File” → Filename: test.msl - Comment: <copy comment here>. So people who carefully crafted a COMMENT for all their scrips have the feeling that it was not for nothing.
-
reporter Noted:
- empty /sequencer, load, start, (error, /sequencer/variables missing). I will check. I thought /sequencer/variables is created when the script is loaded. Will try it myself.
- “save as…” → cancel. there is no “cancel” there! oh, wait, there is. Ok, I will fix it by switching to dlgQuery().
- display “comment” prominently, easy peasy!
K.O.
-
reporter edit page - “save as …” converted to dlgQuery(). (I added a “value” parameter, propt() allows default value, dlgQuery() does, too, now). “cancel” works now. K.O.
-
reporter start page - confirmed, “load script” creates “param”, but not “variables” and “start” fails with “cannot write /sequencer/variables. K.O.
-
reporter start page - fixed, nobody was creating /sequencer/variables, why did it ever work before?!? K.O.
-
reporter display script comment - show it next to the filename, this is a bit of a hatchet job, I should save the comment into odb and have the web page read it from there. But it should work as is, let me know if I should change it. K.O.
-
reporter my sequencer to-do list is now empty. Stefan - test again?
K.O.
-
Tested all things, can confirm that everything I tested is working. Great job, thanks!
-
reporter sent an email to thomas and ben asking them to try the new sequencer pages. K.O.
-
reporter - changed status to resolved
resolved as of commit 241f5f6. K.O.
- Log in to comment
Found one snippet: