-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
258 additions
and
301 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,17 @@ | ||
# @wq/progress-element | ||
[![@wq/progress-element][logo]][docs] | ||
|
||
**@wq/progress-element** provides a simple way to create fetch()-powered auto-updating HTML5 [progress] elements. @wq/progress-element is meant to be used with a JSON web service that provides updates as to the current status of a long-running task. @wq/progress-element is primarily intended for (and bundled with) the [Django Data Wizard] package. | ||
|
||
## Installation | ||
### [Documentation][docs] | ||
|
||
```bash | ||
npm install @wq/progress-element | ||
``` | ||
[**Installation**][installation] | ||
• | ||
[**API**][api] | ||
|
||
> Note: @wq/progress-element is designed for Django Data Wizard's Admin-style UI, and is enabled automatically by default. If you are using a wq framework / React UI, use [@wq/wizard] rather than @wq/progress-element. | ||
#### API | ||
|
||
@wq/progress-element scans the page for `<progress>` elements during initialization, and can be configured via `data-wq-*` attributes. | ||
|
||
- `data-wq-url` configures the URL to use for the AJAX request to update the progress status. | ||
- `data-wq-interval` defines the polling frequency in seconds (default 0.5). | ||
- `data-wq-status` can be used to specify an element which will be used to display `error` or `message` attributes from the JSON response. | ||
|
||
```xml | ||
<progress data-wq-url="/getstatus.json" | ||
data-wq-interval=0.25 | ||
data-wq-status="status-info"></progress> | ||
<div id="status-info"></div> | ||
``` | ||
|
||
For older browsers, the `<progress>` bar will automatically fall back to text showing the current status. | ||
|
||
@wq/progress-element automatically configures a [@wq/progress] client to start polling the web service. See [@wq/progress] for more details on the expected data structure. | ||
[logo]: https://django-data-wizard.wq.io/images/@wq/progress-element.svg | ||
[docs]: https://django-data-wizard.wq.io/@wq/progress-element | ||
[installation]: https://django-data-wizard.wq.io/@wq/progress-element#installation | ||
[api]: https://django-data-wizard.wq.io/@wq/progress-element#api | ||
|
||
[progress]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/progress | ||
[django data wizard]: https://github.com/wq/django-data-wizard | ||
[@wq/wizard]: https://github.com/wq/django-data-wizard/tree/main/packages/wizard | ||
[@wq/progress]: https://github.com/wq/django-data-progress/tree/main/packages/progress | ||
[Django Data Wizard]: https://django-data-wizard.wq.io/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,21 @@ | ||
# @wq/progress | ||
[![@wq/progress][logo]][docs] | ||
|
||
**@wq/progress** provides a simple API client for auto-updating [progress] elements. @wq/progress is meant to be used with a JSON web service that provides updates as to the current status of a long-running task, such as the data import tasks in the [Django Data Wizard] package. | ||
|
||
> Note: The jQuery and HTML `<progress>` integration has moved to a separate package, [@wq/progress-element]. wq framework / React UI integration is provided by [@wq/wizard]. | ||
## Installation | ||
### [Documentation][docs] | ||
|
||
```bash | ||
npm install @wq/progress | ||
``` | ||
[**Installation**][installation] | ||
• | ||
[**API**][api] | ||
|
||
#### API | ||
[logo]: https://django-data-wizard.wq.io/images/@wq/progress.svg | ||
[docs]: https://django-data-wizard.wq.io/@wq/progress | ||
[installation]: https://django-data-wizard.wq.io/@wq/progress#installation | ||
[api]: https://django-data-wizard.wq.io/@wq/progress#api | ||
|
||
@wq/progress should be configured with a url and polling interval, as well as up to three custom callback functions (`onComplete`, `onFail`, and `onProgress`). The callback functions will be passed the most recent JSON data from the web service. | ||
|
||
```javascript | ||
// src/index.js | ||
import { Progress } from '@wq/progress'; | ||
|
||
const progress = new Progress({ | ||
url: 'http://some-web-service/', | ||
interval: 0.5, | ||
onProgress(data) { | ||
console.log(data); | ||
}, | ||
}); | ||
|
||
progress.start(); | ||
``` | ||
|
||
@wq/progress assumes a specific structure for the data from the web service. The following attributes should be specified on the returned JSON object: | ||
|
||
- `total`: the total number of items being processed | ||
- `current`: the rank of the currently processing item. (`current / total` will be used to determine the % complete) | ||
- `status`: A text status indicating task state. A status of `"SUCCESS"` or `"FAILURE"` will cause polling to cease and the `onComplete` or `onFailure` callbacks to be called. The status names were originally based on [Celery's state names][celery-states], though Celery is no longer required for [Django Data Wizard]. | ||
- `error` or `message`: Will be displayed with the `data-wq-status` option. | ||
|
||
[django data wizard]: https://github.com/wq/django-data-wizard | ||
[@wq/progress-element]: https://github.com/wq/django-data-wizard/tree/main/packages/progress-element | ||
[@wq/wizard]: https://github.com/wq/django-data-wizard/tree/main/packages/wizard | ||
[celery-states]: http://docs.celeryproject.org/en/latest/userguide/tasks.html#states | ||
[progress]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/progress | ||
[Django Data Wizard]: https://django-data-wizard.wq.io/ | ||
[@wq/progress-element]: https://django-data-wizard.wq.io/@wq/progress-element | ||
[@wq/wizard]: https://django-data-wizard.wq.io/@wq/wizard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,17 @@ | ||
# @wq/wizard | ||
[![@wq/wizard][logo]][docs] | ||
|
||
**@wq/wizard** is a [@wq/app plugin][plugins] providing a complete React UI for the [Django Data Wizard] package. | ||
|
||
## Installation | ||
### [Documentation][docs] | ||
|
||
### wq.app for PyPI | ||
[**Installation**][installation] | ||
• | ||
[**API**][api] | ||
|
||
When using Django Data Wizard together with [wq.app]'s [wq.js] build, update app/js/{project_name}.js to import and register wizard.js, which is provided by data_wizard's static/app/js directory. | ||
|
||
```bash | ||
pip install wq.app data-wizard | ||
``` | ||
|
||
```javascript | ||
import wq from './wq.js'; | ||
import config from './data/config.js'; | ||
import wizard from './wizard.js'; | ||
|
||
wq.use([wizard]); | ||
|
||
wq.init(config).then(...); | ||
``` | ||
|
||
### @wq/app for npm | ||
|
||
When using @wq/app for npm, install and import the @wq/wizard npm package. | ||
|
||
```bash | ||
npm install @wq/wizard | ||
``` | ||
|
||
```javascript | ||
import app from '@wq/app'; | ||
import material from '@wq/material'; | ||
import mapgl from '@wq/map-gl'; | ||
import wizard from '@wq/wizard'; | ||
import config from './config'; | ||
|
||
app.use([material, mapgl, wizard]); | ||
|
||
app.init(config).then(...); | ||
``` | ||
[logo]: https://django-data-wizard.wq.io/images/@wq/wizard.svg | ||
[docs]: https://django-data-wizard.wq.io/@wq/wizard | ||
[installation]: https://django-data-wizard.wq.io/@wq/wizard#installation | ||
[api]: https://django-data-wizard.wq.io/@wq/wizard#api | ||
|
||
[plugins]: https://wq.io/plugins/ | ||
[django data wizard]: https://github.com/wq/django-data-wizard | ||
[wq.app]: https://wq.io/wq.app/ | ||
[wq.js]: https://wq.io/wq | ||
[@wq/app]: https://wq.io/@wq/app | ||
[Django Data Wizard]: https://django-data-wizard.wq.io/ |
Oops, something went wrong.