Re: Showing progress

Maarten Mostert <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.squeak.seaside
Message-ID <[email protected]>
Hi,

I do this within a modal

handleCreditCardForm(options) {
	
	var aProgress = $t.application.makeProgressBar("20","20% Processing");		
	$('#processProgressIDl').replaceWith(aProgress);
	
	$t.application.updateprogressBarInTime(2000,"30","40% Processing ...") ;
	$t.application.updateprogressBarInTime(3000,"40","40% Processing Credit card") ;
	$t.application.updateprogressBarInTime(4000,"50","50% Processing Credit card") ;
	$t.application.updateprogressBarInTime(5000,"60","60% Processing Credit card") ;
	$t.application.updateprogressBarInTime(6000,"70","70% Processing Credit card") ;
	$t.application.updateprogressBarInTime(7000,"80","80% Processing Credit card") ;
	$t.application.updateprogressBarInTime(8000,"90","90% Processing Credit card") ;
	$t.application.updateprogressBarInTime(9000,"98","98% Processing Credit card") ;
 
	return this.handleCreditCardToServer("register-creditcard", options);

Where:

makeProgressBar(aValue,aText){

	var aProgress = this.elementNameClass("div", "progress-bar progress-bar-success progress-bar-striped active");
	aProgress.setAttribute("role", "progressbar");
	 
	var str1 ="width: ";
	var str2 = aValue.toString();
        var mywidth = str1.concat(str2).concat("%");
	
	aProgress.setAttribute("id", "processProgressIDl");
	aProgress.setAttribute("aria-valuenow", Number(aValue));
	aProgress.setAttribute("aria-valuemin", "0");
	aProgress.setAttribute("aria-valuemax", "100");
	aProgress.setAttribute("style", mywidth);
	//var newSpan = $t.application.spanWithClassText("sr-only","60% Cretating Licences"); 
	var newSpan = this.spanWithClassText("sr-only",aText); 
	aProgress.appendChild(newSpan);
 
	return aProgress;
	
	
	}

And:

updateprogressBarInTime(mymiliseconds,myPercentage,myText) {
	//for creating a new server as opposed to adding a preconfigured server.
	//return a ServerResponse
	//alert("Hi this is me handleCreditCardForm");
	
setTimeout(function(){
	  if ($t.application.session["showwaitdialog"] ) {  
//	
    var aProgress = $t.application.makeProgressBar(myPercentage,myText);		
	$('#processProgressIDl').replaceWith(aProgress);
} 
else {$('#processingModalID').modal('hide'); }


}, mymiliseconds);


You can call $('#processingModalID').modal('hide');  if you are finished before

Hope this gives indications

Regards,

Maarten MOSTERT



> Le 3 mars 2017 à 10:07, Maarten Mostert <[email protected]> a écrit :
> 
> Hi,
> 
> I do this within a modal
> 
> handleCreditCardForm(options) {
> 	
> 	var aProgress = $t.application.makeProgressBar("20","20% Processing");		
> 	$('#processProgressIDl').replaceWith(aProgress);
> 	
> 	$t.application.updateprogressBarInTime(2000,"30","40% Processing ...") ;
> 	$t.application.updateprogressBarInTime(3000,"40","40% Processing Credit card") ;
> 	$t.application.updateprogressBarInTime(4000,"50","50% Processing Credit card") ;
> 	$t.application.updateprogressBarInTime(5000,"60","60% Processing Credit card") ;
> 	$t.application.updateprogressBarInTime(6000,"70","70% Processing Credit card") ;
> 	$t.application.updateprogressBarInTime(7000,"80","80% Processing Credit card") ;
> 	$t.application.updateprogressBarInTime(8000,"90","90% Processing Credit card") ;
> 	$t.application.updateprogressBarInTime(9000,"98","98% Processing Credit card") ;
>  
> 	return this.handleCreditCardToServer("register-creditcard", options);
> 
> Where:
> 
> makeProgressBar(aValue,aText){
> 
> 	var aProgress = this.elementNameClass("div", "progress-bar progress-bar-success progress-bar-striped active");
> 	aProgress.setAttribute("role", "progressbar");
> 	 
> 	var str1 ="width: ";
> 	var str2 = aValue.toString();
>         var mywidth = str1.concat(str2).concat("%");
> 	
> 	aProgress.setAttribute("id", "processProgressIDl");
> 	aProgress.setAttribute("aria-valuenow", Number(aValue));
> 	aProgress.setAttribute("aria-valuemin", "0");
> 	aProgress.setAttribute("aria-valuemax", "100");
> 	aProgress.setAttribute("style", mywidth);
> 	//var newSpan = $t.application.spanWithClassText("sr-only","60% Cretating Licences"); 
> 	var newSpan = this.spanWithClassText("sr-only",aText); 
> 	aProgress.appendChild(newSpan);
>  
> 	return aProgress;
> 	
> 	
> 	}
> 
> And:
> 
> updateprogressBarInTime(mymiliseconds,myPercentage,myText) {
> 	//for creating a new server as opposed to adding a preconfigured server.
> 	//return a ServerResponse
> 	//alert("Hi this is me handleCreditCardForm");
> 	
> setTimeout(function(){
> 	  if ($t.application.session["showwaitdialog"] ) {  
> //	
>     var aProgress = $t.application.makeProgressBar(myPercentage,myText);		
> 	$('#processProgressIDl').replaceWith(aProgress);
> } 
> else {$('#processingModalID').modal('hide'); }
> 
> 
> }, mymiliseconds);
> 
> 
> You can call $('#processingModalID').modal('hide');  if you are finished before
> 
> Hope this gives indications
> 
> Regards,
> Maarten MOSTERT
>  
> 
>  
> 28 Av Alphonse Denis
> 83400 Hyères, France
> +33 676411296 
> http://stakepoint.com/ <http://stakepoint.com/>
> 
> Now the most popular Project Management Tool on MacOS
> 
>> Le 3 mars 2017 à 05:33, [email protected] <mailto:[email protected]> a écrit :
>> 
>> Jupiter.
>> 
>> not a perfect answer, but what I'd try is forking the actual processing as a background process on the server and add two inst vars to the component:
>> 
>> * processingDone
>> * currentProgressMessage
>> 
>> which would be updated by the background process as it progresses through its job.
>> 
>> The first ajax call would be finished right after forking the background process, so teh browser would get an instant answer. All you need to do then is set up a timeOut() and have the browser ask for the current progress by issueing ajax calls every, say, 750-1000msec, until the server responds with "processingDone=true".
>> 
>> The problem is, I have written something like this in Javascript, where I registered a callback for the progress message in renderContentOn: , but have no idea how to do it in Seaside's javascript rendering methods.
>> 
>> I hope this idea helps you get a step further.
>> 
>> Joachim
>> 
>> 
>> 
>> 
>> Am 03.03.17 um 03:54 schrieb Jupiter Jones:
>>> Hi all,
>>> 
>>> I have a relatively short process (about 5 to 10 seconds) that I would like to show the progress of.
>>> 
>>> It’s triggered by ajax:
>>> 
>>> html button
>>>             bePush;
>>>             onClick:
>>>                 (html jQuery ajax script: [ :s | self fetchShowingProgressOnScript: s ]);
>>> 
>>> fetchShowingProgressOnScript: s
>>> 
>>>   s << (s jQuery id: ‘progress')
>>>     html: [ :r | r paragraph: 'Connecting to Downer...' ].
>>>   integration connect.
>>>   s << (s jQuery id: ‘progress')
>>>     html: [ :r | r paragraph: 'Logging In...' ].
>>>   integration login.
>>>   s << (s jQuery id: ‘progress')
>>>     html: [ :r | r paragraph: 'Looking up ' , self idToFetch ].
>>>   integration find: self idToFetch..
>>>   s << (s jQuery id: ‘progress') html: [ :r | r paragraph: 'Done.' ].
>>>   integration quit
>>> 
>>> However this won’t work because the script will not be returned to the browser until the method completes.
>>> 
>>> What’s the recommended way of going about this? Can you push a partial result without a streaming server?
>>> 
>>> Is there a way of doing this without some kind of polling loop and running the long operation in a separate thread?
>>> 
>>> Cheers,
>>> 
>>> Jupiter
>>> _______________________________________________
>>> seaside mailing list
>>> [email protected] <mailto:[email protected]>
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>> 
>> 
>> -- 
>> -----------------------------------------------------------------------
>> Objektfabrik Joachim Tuchel          mailto:[email protected] <mailto:[email protected]>
>> Fliederweg 1                         http://www.objektfabrik.de <http://www.objektfabrik.de/>
>> D-71640 Ludwigsburg                  http://joachimtuchel.wordpress.com <http://joachimtuchel.wordpress.com/>
>> Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1
>> 
>> _______________________________________________
>> seaside mailing list
>> [email protected] <mailto:[email protected]>
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>

_______________________________________________
seaside mailing list
[email protected]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.