Zend Framework: Zend_ProgessBar Component Proposal
| Proposed Component Name | Zend_ProgessBar |
|---|---|
| Developer Notes | http://framework.zend.com/wiki/display/ZFDEV/Zend_ProgessBar |
| Proposers | Ben Scholzen Zend Liaison Ralph Schindler |
| Revision | 1.0 - 20 August 2008: Initial proposal. 2.0 - 06 September 2008: Refactoring from Zend_Console_ProgressBar to Zend_ProgressBar. (wiki revision: 9) |
Table of Contents
1. Overview
Zend_ProgessBar is designed to give developers a simple option to display progess to the user in multiple enviroments. In the first stage, it will support a console adapter, which supports three elements, which are a percentage value, a bar, and an automatic calculated ETA, of which all can be custom arranged and partially leaved out. Another available adapter will be Comet, which serves the purpose of updating progressbars in the web.
2. References
http://en.wikipedia.org/wiki/Progress_bar
3. Component Requirements, Constraints, and Acceptance Criteria
- This component will not be able to watch other classes (this would require some hacky multi-processing, which would not work on windows).
- This component will automatically calculate an ETA.
- This component will allow to set an additional status text.
- The console adapter will work on both nix (linux, bsd, solaris, mac, etc) and win systems.
- The console adapter will automatically try to determine the terminal width in auto mode.
- The console adapter will allow setting a custom width.
- The console adapter will allow to customize the style of the progressbar.
- The comet adapter will allow updating a progressbar via javascript, while an action is running.
4. Dependencies on Other Framework Components
- Zend_Exception
- Zend_Json
5. Theory of Operation
First an instance of Zend_ProgessBar is created, with setting min-, max value (those default to 0 and 100), as well as a frontend adapter. After that the user can call the ::update($value, $text) method to update the progessbar.
6. Milestones / Tasks
- Milestone 1: [DONE] Working prototype checked into the incubator.
- Milestone 2: [DONE] Unit tests exist, work, and are checked into SVN.
- Milestone 3: [DONE] Documentation exists.
- Milestone 4: Component is approved and moved into trunk.
7. Class Index
- Zend_ProgessBar
- Zend_ProgessBar_Adapter_Interface
- Zend_ProgessBar_Adapter_Console
- Zend_ProgessBar_Adapter_Comet
8. Use Cases
| UC-01 |
|---|
9. Class Skeletons
Great component, it's perfect ![]()
As for it has been discussed thoroughly on irc already, it can be moved to incubator right-away ![]()
I think that I should rename the component to Zend_ProgressMeter, as ProgressBar just describes the bar-element itself, not all the stuff around it (ETA, absolute values, percentage, etc.). What do you think?
Technically spoken you may be right, as for Zend_ProgressMeter better describes the functionality of the component. However, because ProgressBar is so common and well-known, I think it would be more appropriate to keep it Zend_ProgressBar.
I think it would make sense to have an indeterminate mode. The reason why this should not be considered out of scope for this component is that sometime indeterminately long work has to be done in the same operation as determinately long work. You therefore might want to show a percentage progress bar, then an indeterminate one, then a percentage one, etc. in the same style. The visualization of the indeterminate progress bar can be an old school Cylon eye. ![]()
Also, what would the comet adapter look like? Would it have associated view helpers to render it?
The comet adapter doesnt has a view helper. The reason for that is, that the progress is usually done in after some event in the user browser, so it is fully created by JavaScript. At that point, a view helper doesn't has any effect. I could probalby create a view helper which directly loads a specific action (url) and creates a Dojo Progressbar, but that would (imho) be way to specific.
As for the indeterminate mode: That would be possible with comet, to be more exacly with JavaScript (as it has nothing to do with actual progress), but not with the console adapter, as that would require multithreading, which is not there (one thread for the actual process and one thread for the progressbar animation).
ZF Home Page
Code Browser
Wiki Dashboard
Nice Package!
I'd love to see an optional status-text-element, that displays a text beneath the bar, that can be updated, too.
Example: