id summary reporter owner description type status priority milestone component version resolution keywords cc 12810 Create a type for easy progress notifiaction handling. Marek Lewandowski "= Overview We need to create a convenient way to handle notification will display a progress for related items. Eg. editor is waiting for 5 JSON responses. It would be nice if we'll display a progress notification like ""Waiting for response 0/5"". Then when the first is done, it will be changed to ""Waiting for response 1/5"", updating the progress bar to 20% and so on. http://i.imgur.com/14RBHju.png At the end we ither show a success information, or just hide the notification. == Proposed API API should be very simple. Aggregator instance would be created as follows (note {{{CKEDITOR.plugins.notificationaggregator}}} is a temp name): {{{ var notification = new CKEDITOR.plugins.notificationaggregator( editor, 'Loading process {current} / {max}' ); var fooRequestDone = notification.createThread(); framework.getJson( '//foobar.dev/baz.json' ) .done( function() { // Success! } ) .always( fooRequestDone ); // (...) }}} So as we can see {{{createThread()}}} returns a callback that should be called in order to mark a thread as completed. == More complex case Upload plugin would need more complex solution, as it is preferred to give end user constant feedback of the process progression. Consider uploading three 200 Mb files. But problem with files is that they might have different size, and our progress needs to be reliable. We could workaround it by giving bytes count to the API. {{{ var notification = new ComplexAggregator( editor, 'Uploading file {current} / {max}' ), thread; xhr.upload.addEventListener( 'loadstart', function() { // Create a new thread once upload was started. thread = notification.createThread( e.total ); } ); xhr.upload.addEventListener( 'progress', function() { // Update the progress with every progress tick. thread.update( e.loaded ); } ); xhr.upload.addEventListener( 'loadend', function() { // Make sure that thread was marked as done. The same would do thread.update( e.total ); thread.done(); } ); }}} So the object would expose 2 properties - {{{update}}} and {{{done}}}. ''As a side note:'' This case shows that internal aggregator update method should be throttled, becuase considering eg. 10 files upload, there would be a ridiculus ammount of calls to the ui update funciton. == Different title if only one item remaining Initialy I thought about possibility to displayh a different title if only one element remains. Eg. ""Uploading files... 1/5"" 3 files later would print ""Uploading 'myCustomImage.png'... 43%"" rather than ""Uploading files... 4/5"". This functionallity would be totally optional, so if one want to use it he needs only to specify extra parameter to the constructor, like so: {{{ var notification = new ComplexAggregator( editor, 'Uploading file {current} / {max}', 'Uploading \'{name}\'... {percentage}%' ); }}} But at the end I was wondering if the effor is **really worth it**? Because it will also require us to modify {{{createThread()}}} method (because we'll need to keep track of the {{{name}}})." Bug new Normal CKEditor 4.5.0 Beta General