Creating a Multiple Operation Progress Bar

18

1

I've currently using Tridion 2011 SP1 and would like to create a long running process.

The process receives update by polling a external service till it's done.

Example of this bar:

enter image description here

So what I would like to happen:

  1. Start the Operation on the Service and receive a token which I can poll.
  2. Show the multiple operations bar
  3. The Code does a Poll against the service every x ms / s.
  4. The status on the multiple operations bar is then updated or a error is shown, if a error was encountered.
  5. When the status is received as done execute my callback to let me show the results to the user.

I've had a look at how Outbound E-Mail handles this implementation but I'm not able to get a working sample.

What would be the simplest way for my to implement this ? I see that Outbound E-Mail is defining it as a model and then return the model from a Model Factory. Is this the only way ?

Any Help / Advice ?

===== Update

Ended using Chris Summers's answer and implemented it as follows:

// Create a progress message
var progress_msg = $messages.registerProgress('Doing something 1/3', 'Really important');

// For each Update
progress_msg.setTitle('Doing something n/3');

// When you are done hide the progress
progress_msg.finish();
progress_msg.dispose();

// Show Success or Failure (Error)
$messages.registerGoal("Your success");
$messages.registerError("Your error");

Johann du Toit

Posted 2013-02-20T13:33:36.760

Reputation: 235

Answers

20

Take a look at the PowerTools Example Tool. The JS for the tool is visible at http://code.google.com/p/tridion-2011-power-tools/source/browse/trunk/PowerTools.Editor/PowerTools/Client/Example/Example.js - It has a progress bar which polls a background service, take a look at the PowerTools.Popups.Example.prototype._onExecuteButtonClicked() method. If you want this info in the message center (as shown in your graphic) rather than the default powertool bar, just output your message to the message center instead. You can use something like the following:

$messages.registerNotification("Your message");
$messages.registerGoal("Your success");
$messages.registerError("Your error");

Generally creating a model is the easiest way to achieve this, as the Anguilla Framework will generate all of your JavaScript proxies for your services for you.

Chris Summers

Posted 2013-02-20T13:33:36.760

Reputation: 7 657

Thanks for the link ! Currently looking at it. So the method you recommend is precisely the same that happens when copy / pasting a items ? It logs using the methods mentioned above ? – Johann du Toit – 2013-02-20T15:03:32.770

Correct - If you use firefox you will see all the methods on the $messages object – Chris Summers – 2013-02-20T18:55:44.480

Thanks for pointing me the right way, ended up creating a single progress item with $messages.registerProgress and changing the title of it after each poll. And then closing it and showing a error or success. – Johann du Toit – 2013-02-21T07:14:02.203