new sequencer pages are incomplete

Create issue
Issue #232 resolved
dd1 created an issue

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)

  1. dd1 reporter

    Found one snippet:

    The next pending thing is the new sequencer pages.
    To get into the new sequencer pages, go to "?cmd=Seq”.
    
    Just gave a quick look. The sequence is stopped, so the old page gives me something completely different than the new one (see below).
    So still not ready for prime time.
    
    
    
    I cannot see the pictures from home, but nothing works at all? The buttons
    to load new sequence, edit the current sequence and start the current sequence
    should be there, and with luck do something? Can you try?
    
    Most things work. To reproduce the problem I saw do the following:
    
    - Run this script:
    
    LOOP 5
      TRANSITION start
      WAIT seconds, 3
      TRANSITION stop
    ENDLOOP
    
    - Start script
    
    - Press “stop after current run”
    
    Then the sequencer stops correctly, but the sequencer page still shows the “Loop” bar graph and the script has dark blue and green
    colors which are only shown if a script is running. Once the sequencer stopped, the script should become black on white background. Here
    again the picture: ...
    

  2. dd1 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.
    

  3. dd1 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.
    

  4. dd1 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.

  5. dd1 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.

  6. dd1 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.

  7. Stefan Ritt

    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:

  8. Stefan Ritt
    • 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.

  9. Stefan Ritt
    • Clicking on “Syntax Help” during editing should open a new browser window and not replace the current window, loosing all edits.

  10. Stefan Ritt
    • 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 ```

  11. dd1 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.

  12. dd1 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.

  13. dd1 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.

  14. dd1 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.

  15. dd1 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.

  16. Stefan Ritt

    “textarea” should be either replaced with a HTML “input” filed (single-line instead multi-line) or a “Save as…” button.

  17. dd1 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.

  18. dd1 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.

  19. Stefan Ritt

    Agree to replace the arrows with browser’s scroll bars. Seeing like ~15 lines around the current execution point seems ok to me.

  20. dd1 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.

  21. dd1 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.

  22. dd1 reporter

    script edit page - removed the “textarea”, implemented “save as…”. I use window.prompt() for now, lacking dlgPrompt() similar to dlgConfirm(). K.O.

  23. dd1 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.

  24. dd1 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.

  25. Stefan Ritt

    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.

  26. Stefan Ritt

    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.

  27. Stefan Ritt

    I like the new “Save as…” button, but not the window.prompt(). Added dlgQuery() for your convenience. Can you replace window.prompt() now?

  28. dd1 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.

  29. dd1 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.

  30. dd1 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.

  31. dd1 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.

  32. dd1 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.

  33. dd1 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.

  34. dd1 reporter

    Fixed both problems - mhttpd creates /sequencer/command same as msequencer and both initialize the default script path to $MIDASSYS/examples/sequencer.

    K.O.

  35. dd1 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.

  36. dd1 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.

  37. dd1 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.

  38. dd1 reporter

    mhttpd - in preparation to remove old sequencer code from mhttpd, add #ifdef OLD_SEQUENCER. K.O.

  39. Stefan Ritt

    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:

  40. Stefan Ritt

    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.

  41. dd1 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.

  42. dd1 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.

  43. dd1 reporter

    start page - confirmed, “load script” creates “param”, but not “variables” and “start” fails with “cannot write /sequencer/variables. K.O.

  44. dd1 reporter

    start page - fixed, nobody was creating /sequencer/variables, why did it ever work before?!? K.O.

  45. dd1 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.

  46. Log in to comment