<div dir="ltr">and also thank you for the hint with the ThreadPool, Paul and Ramon.<div>I have to implement this, too!</div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-07-24 12:18 GMT+02:00 Sabine Manaa <span dir="ltr"><<a href="mailto:manaa.sabine@gmail.com" target="_blank">manaa.sabine@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><div dir="ltr">Hi Joachim,<br><br>you are right. This was the point. <br><br>I had another problem with getting the session in the forked process. I asked in Discord and Max Leske helped.<br>To geht the session, I have to do the following in the Ajax request:<br><br>| requestContext |<div> requestContext := WACurrentRequestContext value. </div><div>[ WACurrentRequestContext use: requestContext during: [ self session dosomething ] ] fork.</div><div><br></div><div>Thank you for your help!</div><div>Sabine</div></div></span><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">2017-07-23 10:55 GMT+02:00 jtuchel [via Smalltalk] <span dir="ltr"><<a href="http:///user/SendEmail.jtp?type=node&node=4956534&i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>></span>:<br></div></div><blockquote style="border-left:2px solid #cccccc;padding:0 1em" class="gmail_quote"><div><div class="h5"><span>

        
  
    
  
  
    <div class="m_-4630257752032787947m_3775402937188689763moz-cite-prefix">Sabine,<br>
      <br>
      I think you need to fork  a new (background) process in order to
      have it run independently of the Ajax callbacks. The Ajax
      callbacks will be executed one after the other, there will never
      be any progress reporting.<br>
      <br>
      So I THINK what you absolutely have to do is to start the long
      running Ajax callback as another process. <br>
      <br>
      So start by putting your sequence of process steps in a <br>
      <br>
      [ <br>
       ] fork.<br>
      <br>
      block and see if it improves things.<br>
      <br>
      <br>
      I am using an inst var of the component instead of the session,
      but I guess that doesn't really matter. Using the session is
      probably a much better idea because you could then use this
      facility for a general solution that works for all ajax callbacks
      that run longer...<br>
      <br>
      <br>
      HTH<br>
      <br>
      Joachim<br>
      <br>
      <br>
      <br>
      Am 21.07.17 um 17:31 schrieb Sabine Manaa:<br>
    </div>
    </span></div></div><blockquote style="border-left:2px solid #cccccc;padding:0 1em" type="cite"><div><div class="h5">
      <div dir="ltr">Hi Joachim, all,
        <div><div class="m_-4630257752032787947h5"><div><br>
        </div>
        <div>thanks a lot! I think I am very near to the solution but
          there is one problem remaining: within the Ajax block, the
          JQLoad   seems to be "blocked". I explain:</div>
        <div><br>
        </div>
        <div>* I have an attribute @directUserMessage: in my session
          initialized with an empty string.<br>
        </div>
        <div><br>
        </div>
        <div>*In my main view I have
          >>renderLoadIntervalMessageOn: html</div>
        <div><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>html
          paragraph</div>
        <div><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>id:
          'spf-direct-message';</div>
        <div><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>script:</div>
        <div><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">                        </span>(html
          jQuery this load</div>
        <div><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">                                </span>onComplete:</div>
        <div><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">                                        </span>('
          javascript which shows the snackbar if spa-direct-message is
          set'));</div>
        <div><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">                                </span>html:
          [ :r | self renderMessageOn: r ];</div>
        <div><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">                                </span>interval:
          1 seconds);</div>
        <div><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>with:
          [ self renderMessageOn: html ]</div>
        <div><br>
        </div>
        <div> >>renderMessageOn: html<br>
        </div>
        <div><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>self
          session directUserMessage isEmpty</div>
        <div><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>ifFalse:
          [ html render: self session directUserMessage ]</div>
        <div><br>
        </div>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">I have my button invoking the report
            generation: </div>
          <div class="gmail_quote"><br>
          </div>
          <div class="gmail_quote">
            <div class="gmail_quote">onClick:</div>
            <div class="gmail_quote"><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>(html
              jQuery ajax<br>
            </div>
            <div class="gmail_quote"><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">              </span>script:
              [ :script | </div>
            <div class="gmail_quote"><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">              </span>self
              session generateReportFiles: script.</div>
            <div class="gmail_quote"><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">      </span> ...]);</div>
            <div class="gmail_quote"><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">              </span>with:
              'PDF'.</div>
            <div class="gmail_quote"><br>
            </div>
            <div class="gmail_quote">in >>generateReportFiles:</div>
            <div class="gmail_quote">"i set the directUserMessages:"</div>
            <div class="gmail_quote">self session directUserMessage:
              'Erstelle Reisekostenabrechnungen, bitte warten...'.</div>
            <div class="gmail_quote"><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>RKAPDFWriter
              new createCostReports: self.</div>
            <div class="gmail_quote"><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>self
              session directUserMessage: 'Erstelle Belege, bitte
              warten...'.</div>
            <div class="gmail_quote"><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>RKAPDFWriter
              new createReceiptReports: self.</div>
            <div class="gmail_quote"><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>self
              session directUserMessage: 'Erstelle Fahrten, bitte
              warten...'.</div>
            <div class="gmail_quote"><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>RKAPDFWriter
              new createVehicleReports: self.</div>
            <div class="gmail_quote"><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>self
              session directUserMessage: 'Erstelle Buchungen, bitte
              warten...'.</div>
            <div class="gmail_quote"><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>RKAPDFWriter
              new createBookingReports: self.</div>
            <div class="gmail_quote"><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">      </span>self
              session directUserMessage: ''</div>
            <div class="gmail_quote"><br>
            </div>
            <div class="gmail_quote">I tried I with a test button:</div>
            <div class="gmail_quote">
              <div class="gmail_quote"><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>html
                mdlButton</div>
              <div class="gmail_quote"><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">            </span>onClick:<br>
              </div>
              <div class="gmail_quote"><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">                     </span> (html
                jQuery ajax script: [ :script | self session
                directUserMessage: 'test' ]);</div>
              <div class="gmail_quote"><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">            </span>with:
                'set message'</div>
              <div class="gmail_quote"><br>
              </div>
              <div class="gmail_quote">this works perfect - after
                clicking on the test button, the snackbar is showing
                every second again.</div>
              <div class="gmail_quote">So, I can say that the principle
                was clear and I have a possibility to show individual
                messages by setting the string in the session.</div>
              <div class="gmail_quote"><br>
              </div>
              <div class="gmail_quote">BUT: while I am in the Ajax
                block, it does not work.</div>
              <div class="gmail_quote">I put a console.log() into the
                javascript code and AFTER finishing the Ajax, all the
                messages are put there.</div>
              <div class="gmail_quote">It seems to wait till the Ajax
                call is finished.</div>
              <div class="gmail_quote"><br>
              </div>
              <div class="gmail_quote">I have put an output  into the
                transcript: </div>
              <div class="gmail_quote"><br>
              </div>
              <div class="gmail_quote">
                <div class="gmail_quote">renderMessageOn: html</div>
                <div class="gmail_quote"><span class="m_-4630257752032787947m_3775402937188689763gmail-Apple-tab-span" style="white-space:pre-wrap">  </span>Transcript
                  crShow: Time now printString , '-' , self session
                  directUserMessage.</div>
                <div class="gmail_quote"><br>
                </div>
                <div class="gmail_quote">and there I see, that while I
                  am in the Ajax block, there is no output.</div>
                <div class="gmail_quote">While I am not in the Ajax
                  block, it renders the time into it each second.</div>
              </div>
              <div class="gmail_quote"><br>
              </div>
              <div class="gmail_quote">What is wrong here, can anyone
                explain?</div>
              <div class="gmail_quote">Joachim, do you also set the
                instance variable with the text from an Ajax block? </div>
              <div class="gmail_quote"><br>
              </div>
              <div class="gmail_quote">Regards</div>
              <div class="gmail_quote">Sabine</div>
              <div class="gmail_quote"><br>
              </div>
              <div class="gmail_quote"><br>
              </div>
              <div class="gmail_quote"><br>
              </div>
            </div>
          </div>
        </div>
      </div></div></div>
      <br><span>
      <hr align="left" width="300">
      View this message in context: <a href="http://forum.world.st/immediate-display-alert-to-user-while-Ajax-request-tp4956083p4956113.html" rel="nofollow" link="external" target="_blank">Re:
        immediate display alert to user while Ajax request</a><br>
      Sent from the <a href="http://forum.world.st/Seaside-General-f86180.html" rel="nofollow" link="external" target="_blank">Seaside
        General mailing list archive</a> at Nabble.com.<br>
      <br>
      <fieldset class="m_-4630257752032787947m_3775402937188689763mimeAttachmentHeader"></fieldset>
      <br>
      </span></div></div><pre>______________________________<wbr>_________________
seaside mailing list
<a href="http:///user/SendEmail.jtp?type=node&node=4956392&i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<a class="m_-4630257752032787947m_3775402937188689763moz-txt-link-freetext" href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" rel="nofollow" link="external" target="_blank">http://lists.squeakfoundation.<wbr>org/cgi-bin/mailman/listinfo/s<wbr>easide</a>
</pre>
    </blockquote>
    <br>
    <p><br>
    </p>
    <pre class="m_-4630257752032787947m_3775402937188689763moz-signature" cols="72">-- 
------------------------------<wbr>------------------------------<wbr>-----------
Objektfabrik Joachim Tuchel          <a href="http:///user/SendEmail.jtp?type=node&node=4956392&i=1" rel="nofollow" link="external" target="_blank">[hidden email]</a><span class=""><span>
Fliederweg 1                         <a class="m_-4630257752032787947m_3775402937188689763moz-txt-link-freetext" href="http://www.objektfabrik.de" rel="nofollow" link="external" target="_blank">http://www.objektfabrik.de</a>
D-71640 Ludwigsburg                  <a class="m_-4630257752032787947m_3775402937188689763moz-txt-link-freetext" href="http://joachimtuchel.wordpress.com" rel="nofollow" link="external" target="_blank">http://joachimtuchel.wordpress<wbr>.com</a>
Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1

</span></span></pre><span>
  

<br><span class="">______________________________<wbr>_________________
<br>seaside mailing list
<br><a href="http:///user/SendEmail.jtp?type=node&node=4956392&i=2" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<br><a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" rel="nofollow" link="external" target="_blank">http://lists.squeakfoundation.<wbr>org/cgi-bin/mailman/listinfo/s<wbr>easide</a><br>

        
        
        
        <br>
        <br>
        <hr noshade size="1" color="#cccccc">
        </span></span><span class=""><div style="color:#444;font:12px tahoma,geneva,helvetica,arial,sans-serif"><span>
                <div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
                </span><a href="http://forum.world.st/immediate-display-alert-to-user-while-Ajax-request-tp4956083p4956392.html" rel="nofollow" link="external" target="_blank">http://forum.world.st/immediat<wbr>e-display-alert-to-user-while-<wbr>Ajax-request-tp4956083p4956392<wbr>.html</a>
        </div></span><div class="m_-4630257752032787947HOEnZb"><div class="m_-4630257752032787947h5">
        <div style="color:#666;font:11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
                To start a new topic under Seaside General, email <a href="http:///user/SendEmail.jtp?type=node&node=4956534&i=1" rel="nofollow" link="external" target="_blank">[hidden email]</a> <br><span class="">
                To unsubscribe from Seaside, <a rel="nofollow" link="external">click here</a>.<br>
                <a href="http://forum.world.st/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" link="external" target="_blank">NAML</a>
        </span></div></div></div></blockquote></div><br></div><div class="HOEnZb"><div class="h5">


        
        
        
<br><hr align="left" width="300">
View this message in context: <a href="http://forum.world.st/immediate-display-alert-to-user-while-Ajax-request-tp4956083p4956534.html" target="_blank">Re: immediate display alert to user while Ajax request</a><br>
Sent from the <a href="http://forum.world.st/Seaside-General-f86180.html" target="_blank">Seaside General mailing list archive</a> at Nabble.com.<br></div></div><br>______________________________<wbr>_________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.<wbr>squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" rel="noreferrer" target="_blank">http://lists.squeakfoundation.<wbr>org/cgi-bin/mailman/listinfo/<wbr>seaside</a><br>
<br></blockquote></div><br></div>