From 19017b3612b4567ced3b8ac9cfe816e6cf80e0f8 Mon Sep 17 00:00:00 2001 From: Robert Newson Date: Wed, 14 Nov 2012 19:32:23 +0000 Subject: Backport new /_active_tasks API Improved _active_tasks API Tasks are now free to set any properties they wish (as an Erlang proplist). Different tasks can have different properties and the status string doesn't exist anymore - instead client applications can build it using more granular properties from _active_tasks. Some of these properties are: 1) "progress" (an integer percentage, for all tasks) 2) "database" (for compactions and indexer tasks) 3) "design_document" (for indexer and view compaction tasks) 4) "source" and "target" (for replications) 5) "docs_read", "docs_written", "doc_write_failures", "missing_revs_found", "missing_revs_checked", "source_seq", "checkpointed_source_seq" and "continuous" for replications BugzID: 14269 Conflicts: apps/couch/src/couch_db_updater.erl apps/couch/src/couch_rep.erl apps/couch/src/couch_task_status.erl apps/couch/src/couch_view_compactor.erl apps/couch/src/couch_view_updater.erl --- rel/overlay/share/www/status.html | 41 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) (limited to 'rel') diff --git a/rel/overlay/share/www/status.html b/rel/overlay/share/www/status.html index 2067ab9b..c9fecc60 100644 --- a/rel/overlay/share/www/status.html +++ b/rel/overlay/share/www/status.html @@ -65,11 +65,46 @@ specific language governing permissions and limitations under the License. .appendTo("#status tbody.content"); } else { $.each(tasks, function(idx, task) { + var status, type, object; + + switch (task.type) { + case "database_compaction": + type = "Database compaction"; + object = task.database + (task.retry ? " retry" : ""); + status = "Copied " + task.changes_done + " of " + + task.total_changes + " changes (" + task.progress + "%)"; + break; + case "view_compaction": + type = "View compaction"; + object = task.database + ", " + task.design_document; + status = "Progress " + task.progress + "%"; + break; + case "indexer": + type = "Indexer"; + object = task.database + ", " + task.design_document; + status = "Processed " + task.changes_done + " of " + + task.total_changes + " changes (" + task.progress + "%)"; + break; + case "replication": + type = "Replication"; + object = task.source + " to " + task.target; + status = "Checkpointed source sequence " + + task.checkpointed_source_seq + ", current source sequence " + + task.source_seq + ", progress " + task.progress + "%"; + break; + case "search_indexer": + type = "Search Indexer"; + object = task.database + ", " + task.design_document; + status = "Processed " + task.changes_done + " of " + + task.total_changes + " changes (" + task.progress + "%)"; + break; + } + $("") - .find("th").text(task.type).end() - .find("td.object").text(task.task).end() + .find("th").text(type).end() + .find("td.object").text(object).end() .find("td.pid").text(task.pid).end() - .find("td.status").text(task.status).end() + .find("td.status").text(status).end() .appendTo("#status tbody.content"); }); } -- cgit v1.2.3