From c50de528832163b32689b2aaf0e7a42c8efad319 Mon Sep 17 00:00:00 2001 From: David Huynh Date: Mon, 22 Feb 2010 06:31:09 +0000 Subject: [PATCH] Improved the "extract operations" dialog to let user select which operations to extract. Also show history entries that cannot be abstracted. git-svn-id: http://google-refine.googlecode.com/svn/trunk@118 7d457c2a-affb-35e4-300a-418c747d4874 --- .../commands/info/GetOperationsCommand.java | 6 +- .../webapp/scripts/project/history-widget.js | 63 +++++++++++++++++-- 2 files changed, 63 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/metaweb/gridworks/commands/info/GetOperationsCommand.java b/src/main/java/com/metaweb/gridworks/commands/info/GetOperationsCommand.java index cca378d6c..13552d6c0 100644 --- a/src/main/java/com/metaweb/gridworks/commands/info/GetOperationsCommand.java +++ b/src/main/java/com/metaweb/gridworks/commands/info/GetOperationsCommand.java @@ -29,12 +29,16 @@ public class GetOperationsCommand extends Command { JSONWriter writer = new JSONWriter(response.getWriter()); writer.object(); - writer.key("operations"); writer.array(); + writer.key("entries"); writer.array(); for (HistoryEntry entry : project.history.getLastPastEntries(-1)) { + writer.object(); + writer.key("description"); writer.value(entry.description); if (entry.operation != null) { + writer.key("operation"); entry.operation.write(writer, options); } + writer.endObject(); } writer.endArray(); writer.endObject(); diff --git a/src/main/webapp/scripts/project/history-widget.js b/src/main/webapp/scripts/project/history-widget.js index 6fff05f96..3fe4911a5 100644 --- a/src/main/webapp/scripts/project/history-widget.js +++ b/src/main/webapp/scripts/project/history-widget.js @@ -109,8 +109,8 @@ HistoryWidget.prototype._extractOperations = function() { "/command/get-operations?" + $.param({ project: theProject.id }), null, function(data) { - if ("operations" in data) { - self._showExtractOperationsDialog(data.operations); + if ("entries" in data) { + self._showExtractOperationsDialog(data); } }, "jsonp" @@ -130,8 +130,55 @@ HistoryWidget.prototype._showExtractOperationsDialog = function(json) { "The following JSON code encodes the operations you have done that can be abstracted. " + "You can copy and save it in order to apply the same operations in the future.").appendTo(body); - var textarea = $('