Skip to content

Commit

Permalink
v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sheppard committed Jun 23, 2022
1 parent e3bfddd commit 926e982
Show file tree
Hide file tree
Showing 16 changed files with 258 additions and 301 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2013-2021, S. Andrew Sheppard, https://wq.io/
Copyright (c) 2013-2022, S. Andrew Sheppard, https://wq.io/

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion data_wizard/static/app/js/wizard.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data_wizard/static/app/js/wizard.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data_wizard/static/data_wizard/js/progress-element.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion data_wizard/templates/data_wizard/run_serializers.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h2>Data Format</h2>
<ul class="messagelist">
<li class="error">No serializers registered.</li>
</ul>
<p>See <a href="https://github.com/wq/django-data-wizard#target-model-registration">https://github.com/wq/django-data-wizard#target-model-registration</a> for more information.
<p>See <a href="https://django-data-wizard.wq.io/overview/setup#target-model-registration">https://django-data-wizard.wq.io/overview/setup#target-model-registration</a> for more information.
{% else %}
<ul class="messagelist">
<li class="warning">Select a format (serializer) to continue.</li>
Expand Down
38 changes: 10 additions & 28 deletions packages/progress-element/README.md
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]
&bull;
[**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/
8 changes: 4 additions & 4 deletions packages/progress-element/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions packages/progress-element/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wq/progress-element",
"version": "1.2.0",
"version": "2.0.0",
"description": "fetch()-powered auto-updating HTML5 <progress> element",
"main": "src/progress.js",
"type": "module",
Expand All @@ -23,11 +23,11 @@
"bugs": {
"url": "https://github.com/wq/django-data-wizard/issues"
},
"homepage": "https://github.com/wq/django-data-wizard",
"homepage": "https://django-data-wizard.wq.io/@wq/progress-element",
"devDependencies": {
"jquery": "^3.4.1"
},
"dependencies": {
"@wq/progress": "^1.2.0"
"@wq/progress": "^2.0.0"
}
}
47 changes: 13 additions & 34 deletions packages/progress/README.md
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]
&bull;
[**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
4 changes: 2 additions & 2 deletions packages/progress/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wq/progress",
"version": "1.2.0",
"version": "2.0.0",
"description": "Progress tracking client for monitoring server tasks",
"main": "src/progress.js",
"type": "module",
Expand All @@ -22,5 +22,5 @@
"bugs": {
"url": "https://github.com/wq/django-data-wizard/issues"
},
"homepage": "https://github.com/wq/django-data-wizard"
"homepage": "https://django-data-wizard.wq.io/@wq/progress"
}
52 changes: 10 additions & 42 deletions packages/wizard/README.md
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]
&bull;
[**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/
Loading

0 comments on commit 926e982

Please sign in to comment.