Commands are now registered in association with their modules, so to avoid name collision.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@1193 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-08-22 06:16:13 +00:00
parent 3b043b7970
commit c94abd0427
37 changed files with 240 additions and 266 deletions

View File

@ -40,13 +40,13 @@ function init() {
* Commands * Commands
*/ */
var GridworksServlet = Packages.com.google.gridworks.GridworksServlet; var GridworksServlet = Packages.com.google.gridworks.GridworksServlet;
GridworksServlet.registerCommand("save-rdf-schema", new SaveRdfSchemaCommand()); GridworksServlet.registerCommand(module, "save-rdf-schema", new SaveRdfSchemaCommand());
GridworksServlet.registerCommand("preview-rdf",new PreviewRdfCommand()); GridworksServlet.registerCommand(module, "preview-rdf", new PreviewRdfCommand());
GridworksServlet.registerCommand("save-baseURI",new SaveBaseURI()); GridworksServlet.registerCommand(module, "save-baseURI", new SaveBaseURI());
GridworksServlet.registerCommand("suggest-term",new SuggestTermCommand()); GridworksServlet.registerCommand(module, "suggest-term", new SuggestTermCommand());
GridworksServlet.registerCommand("import-vocabulary",new ImportVocabularyCommand()); GridworksServlet.registerCommand(module, "import-vocabulary", new ImportVocabularyCommand());
GridworksServlet.registerCommand("list-vocabularies",new ListVocabulariesCommand()); GridworksServlet.registerCommand(module, "list-vocabularies", new ListVocabulariesCommand());
GridworksServlet.registerCommand("delete-vocabulary",new DeleteVocabularyCommand()); GridworksServlet.registerCommand(module, "delete-vocabulary", new DeleteVocabularyCommand());
/* /*
* Client-side Resources * Client-side Resources

View File

@ -46,7 +46,7 @@ RdfExporterMenuBar.rdfExportRows = function(format, ext) {
$(form) $(form)
.css("display", "none") .css("display", "none")
.attr("method", "post") .attr("method", "post")
.attr("action", "/command/export-rows/" + name + "." + ext) .attr("action", "/command/core/export-rows/" + name + "." + ext)
.attr("target", "gridworks-export"); .attr("target", "gridworks-export");
$('<input />') $('<input />')

View File

@ -808,7 +808,7 @@ RdfSchemaAlignmentDialog.RdfResourceDialog = function(elmt,lookFor,onDone,defaul
});*/ });*/
//Autocomplete //Autocomplete
/*elmts.newResourceUri.autoComplete({ /*elmts.newResourceUri.autoComplete({
script:'/command/search-vocabularies?type=' + lookFor + '&', script:'/command/rdf-exporter-extension/search-vocabularies?type=' + lookFor + '&',
varname:'input', varname:'input',
json:true, json:true,
shownoresults:true, shownoresults:true,

View File

@ -41,6 +41,7 @@ RdfSchemaAlignmentDialog.prototype._constructFooter = function(footer) {
$('<button></button>').html("&nbsp;&nbsp;OK&nbsp;&nbsp;").click(function() { $('<button></button>').html("&nbsp;&nbsp;OK&nbsp;&nbsp;").click(function() {
var schema = self.getJSON(); var schema = self.getJSON();
Gridworks.postProcess( Gridworks.postProcess(
"rdf-exporter-extension",
"save-rdf-schema", "save-rdf-schema",
{}, {},
{ schema: JSON.stringify(schema) }, { schema: JSON.stringify(schema) },
@ -100,7 +101,7 @@ RdfSchemaAlignmentDialog.prototype._previewRdf = function(){
var schema = this.getJSON(); var schema = this.getJSON();
self._previewPane.empty().html('<img src="images/large-spinner.gif" title="loading..."/>'); self._previewPane.empty().html('<img src="images/large-spinner.gif" title="loading..."/>');
$.post( $.post(
"/command/preview-rdf?" + $.param({ project: theProject.id }), "/command/rdf-exporter-extension/preview-rdf?" + $.param({ project: theProject.id }),
{ schema: JSON.stringify(schema), engine: JSON.stringify(ui.browsingEngine.getJSON()) }, { schema: JSON.stringify(schema), engine: JSON.stringify(ui.browsingEngine.getJSON()) },
function(data) { function(data) {
self._previewPane.empty(); self._previewPane.empty();
@ -160,7 +161,7 @@ RdfSchemaAlignmentDialog.prototype._listVocabularies = function(){
self._renderVocabularyFooter(); self._renderVocabularyFooter();
$.get("/command/list-vocabularies",{},function(o){ $.get("/command/rdf-exporter-extension/list-vocabularies",{},function(o){
var vocab_table = $('<table></table>').width('100%').addClass('data-table')[0]; var vocab_table = $('<table></table>').width('100%').addClass('data-table')[0];
var tr = vocab_table.insertRow(vocab_table.rows.length); var tr = vocab_table.insertRow(vocab_table.rows.length);
$(tr).addClass(''); $(tr).addClass('');
@ -212,7 +213,7 @@ RdfSchemaAlignmentDialog.prototype._renderVocabularyFooter = function(){
return ; return ;
} }
var dismissBusy = DialogSystem.showBusy('Importing vocabulary from: ' + url); var dismissBusy = DialogSystem.showBusy('Importing vocabulary from: ' + url);
$.get("/command/import-vocabulary",{prefix:prefix,namespace:namespace,url:url},function(data){ $.get("/command/rdf-exporter-extension/import-vocabulary",{prefix:prefix,namespace:namespace,url:url},function(data){
dismissBusy(); dismissBusy();
if (data.code === "error"){ if (data.code === "error"){
alert('Error:' + data.message) alert('Error:' + data.message)
@ -228,7 +229,7 @@ RdfSchemaAlignmentDialog.prototype._renderVocabularyFooter = function(){
RdfSchemaAlignmentDialog.prototype._deleteVocabulary = function(uri){ RdfSchemaAlignmentDialog.prototype._deleteVocabulary = function(uri){
var self = this; var self = this;
var dismissBusy = DialogSystem.showBusy('Deleteing vocabulary: ' + uri); var dismissBusy = DialogSystem.showBusy('Deleteing vocabulary: ' + uri);
$.post("/command/delete-vocabulary",{uri:uri},function(data){ $.post("/command/rdf-exporter-extension/delete-vocabulary",{uri:uri},function(data){
dismissBusy(); dismissBusy();
if (data.code === "error"){ if (data.code === "error"){
alert('Error:' + data.message) alert('Error:' + data.message)
@ -289,7 +290,7 @@ RdfSchemaAlignmentDialog.prototype._editBaseUri = function(src){
RdfSchemaAlignmentDialog.prototype._replaceBaseUri = function(newBaseUri){ RdfSchemaAlignmentDialog.prototype._replaceBaseUri = function(newBaseUri){
var self = this; var self = this;
RdfSchemaAlignment._defaultNamespace = newBaseUri; RdfSchemaAlignment._defaultNamespace = newBaseUri;
$.post("/command/save-baseURI?" + $.param({project: theProject.id }),{baseURI:newBaseUri},function(data){ $.post("/command/rdf-exporter-extension/save-baseURI?" + $.param({project: theProject.id }),{baseURI:newBaseUri},function(data){
if (data.code === "error"){ if (data.code === "error"){
alert('Error:' + data.message) alert('Error:' + data.message)
}else{ }else{

View File

@ -74,7 +74,7 @@
$.extend($.suggest.suggestterm, { $.extend($.suggest.suggestterm, {
defaults: $.extend(true, {}, $.suggest.suggest.defaults, { defaults: $.extend(true, {}, $.suggest.suggest.defaults, {
service_url: "", service_url: "",
service_path: "/command/suggest-term", service_path: "/command/rdf-exporter-extension/suggest-term",
type_strict:"classes", type_strict:"classes",
suggest_new:"Add it" suggest_new:"Add it"
}) })

View File

@ -218,7 +218,7 @@ tool_download() {
load_data() { load_data() {
FILE=$1 FILE=$1
NAME=$2 NAME=$2
URL="http://${GRIDWORKS_HOST}:${GRIDWORKS_PORT}/command/create-project-from-upload" URL="http://${GRIDWORKS_HOST}:${GRIDWORKS_PORT}/command/core/create-project-from-upload"
CURL="`which curl 2> /dev/null`" CURL="`which curl 2> /dev/null`"
if [ -z "$CURL" ]; then if [ -z "$CURL" ]; then

View File

@ -19,6 +19,7 @@ import com.google.gridworks.commands.Command;
import com.google.gridworks.io.FileProjectManager; import com.google.gridworks.io.FileProjectManager;
import edu.mit.simile.butterfly.Butterfly; import edu.mit.simile.butterfly.Butterfly;
import edu.mit.simile.butterfly.ButterflyModule;
public class GridworksServlet extends Butterfly { public class GridworksServlet extends Butterfly {
@ -38,93 +39,6 @@ public class GridworksServlet extends Butterfly {
final static Logger logger = LoggerFactory.getLogger("gridworks"); final static Logger logger = LoggerFactory.getLogger("gridworks");
// TODO: This belongs in an external config file somewhere
private static final String[][] commandNames = {
{"create-project-from-upload", "com.google.gridworks.commands.project.CreateProjectCommand"},
{"import-project", "com.google.gridworks.commands.project.ImportProjectCommand"},
{"export-project", "com.google.gridworks.commands.project.ExportProjectCommand"},
{"export-rows", "com.google.gridworks.commands.project.ExportRowsCommand"},
{"get-project-metadata", "com.google.gridworks.commands.project.GetProjectMetadataCommand"},
{"get-all-project-metadata", "com.google.gridworks.commands.workspace.GetAllProjectMetadataCommand"},
{"delete-project", "com.google.gridworks.commands.project.DeleteProjectCommand"},
{"rename-project", "com.google.gridworks.commands.project.RenameProjectCommand"},
{"get-models", "com.google.gridworks.commands.project.GetModelsCommand"},
{"get-rows", "com.google.gridworks.commands.row.GetRowsCommand"},
{"get-processes", "com.google.gridworks.commands.history.GetProcessesCommand"},
{"get-history", "com.google.gridworks.commands.history.GetHistoryCommand"},
{"get-operations", "com.google.gridworks.commands.history.GetOperationsCommand"},
{"get-columns-info", "com.google.gridworks.commands.column.GetColumnsInfoCommand"},
{"get-scatterplot", "com.google.gridworks.commands.browsing.GetScatterplotCommand"},
{"undo-redo", "com.google.gridworks.commands.history.UndoRedoCommand"},
{"apply-operations", "com.google.gridworks.commands.history.ApplyOperationsCommand"},
{"cancel-processes", "com.google.gridworks.commands.history.CancelProcessesCommand"},
{"compute-facets", "com.google.gridworks.commands.browsing.ComputeFacetsCommand"},
{"compute-clusters", "com.google.gridworks.commands.browsing.ComputeClustersCommand"},
{"edit-one-cell", "com.google.gridworks.commands.cell.EditOneCellCommand"},
{"text-transform", "com.google.gridworks.commands.cell.TextTransformCommand"},
{"mass-edit", "com.google.gridworks.commands.cell.MassEditCommand"},
{"join-multi-value-cells", "com.google.gridworks.commands.cell.JoinMultiValueCellsCommand"},
{"split-multi-value-cells", "com.google.gridworks.commands.cell.SplitMultiValueCellsCommand"},
{"fill-down", "com.google.gridworks.commands.cell.FillDownCommand"},
{"blank-down", "com.google.gridworks.commands.cell.BlankDownCommand"},
{"transpose-columns-into-rows", "com.google.gridworks.commands.cell.TransposeColumnsIntoRowsCommand"},
{"transpose-rows-into-columns", "com.google.gridworks.commands.cell.TransposeRowsIntoColumnsCommand"},
{"add-column", "com.google.gridworks.commands.column.AddColumnCommand"},
{"remove-column", "com.google.gridworks.commands.column.RemoveColumnCommand"},
{"rename-column", "com.google.gridworks.commands.column.RenameColumnCommand"},
{"move-column", "com.google.gridworks.commands.column.MoveColumnCommand"},
{"split-column", "com.google.gridworks.commands.column.SplitColumnCommand"},
{"extend-data", "com.google.gridworks.commands.column.ExtendDataCommand"},
{"denormalize", "com.google.gridworks.commands.row.DenormalizeCommand"},
{"reconcile", "com.google.gridworks.commands.recon.ReconcileCommand"},
{"recon-match-best-candidates", "com.google.gridworks.commands.recon.ReconMatchBestCandidatesCommand"},
{"recon-mark-new-topics", "com.google.gridworks.commands.recon.ReconMarkNewTopicsCommand"},
{"recon-discard-judgments", "com.google.gridworks.commands.recon.ReconDiscardJudgmentsCommand"},
{"recon-match-specific-topic-to-cells", "com.google.gridworks.commands.recon.ReconMatchSpecificTopicCommand"},
{"recon-judge-one-cell", "com.google.gridworks.commands.recon.ReconJudgeOneCellCommand"},
{"recon-judge-similar-cells", "com.google.gridworks.commands.recon.ReconJudgeSimilarCellsCommand"},
{"annotate-one-row", "com.google.gridworks.commands.row.AnnotateOneRowCommand"},
{"annotate-rows", "com.google.gridworks.commands.row.AnnotateRowsCommand"},
{"remove-rows", "com.google.gridworks.commands.row.RemoveRowsCommand"},
{"reorder-rows", "com.google.gridworks.commands.row.ReorderRowsCommand"},
{"save-protograph", "com.google.gridworks.commands.freebase.SaveProtographCommand"},
{"get-expression-language-info", "com.google.gridworks.commands.expr.GetExpressionLanguageInfoCommand"},
{"get-expression-history", "com.google.gridworks.commands.expr.GetExpressionHistoryCommand"},
{"log-expression", "com.google.gridworks.commands.expr.LogExpressionCommand"},
{"preview-expression", "com.google.gridworks.commands.expr.PreviewExpressionCommand"},
{"preview-extend-data", "com.google.gridworks.commands.column.PreviewExtendDataCommand"},
{"preview-protograph", "com.google.gridworks.commands.freebase.PreviewProtographCommand"},
{"guess-types-of-column", "com.google.gridworks.commands.freebase.GuessTypesOfColumnCommand"},
{"check-authorization", "com.google.gridworks.commands.auth.CheckAuthorizationCommand"},
{"authorize", "com.google.gridworks.commands.auth.AuthorizeCommand"},
{"deauthorize", "com.google.gridworks.commands.auth.DeAuthorizeCommand"},
{"user-badges", "com.google.gridworks.commands.auth.GetUserBadgesCommand"},
{"upload-data", "com.google.gridworks.commands.freebase.UploadDataCommand"},
{"import-qa-data", "com.google.gridworks.commands.freebase.ImportQADataCommand"},
{"mqlread", "com.google.gridworks.commands.freebase.MQLReadCommand"},
{"mqlwrite", "com.google.gridworks.commands.freebase.MQLWriteCommand"},
{"get-preference", "com.google.gridworks.commands.GetPreferenceCommand"},
{"get-all-preferences", "com.google.gridworks.commands.GetAllPreferencesCommand"},
{"set-preference", "com.google.gridworks.commands.SetPreferenceCommand"},
};
public static String getVersion() { public static String getVersion() {
return VERSION; return VERSION;
} }
@ -159,8 +73,6 @@ public class GridworksServlet extends Butterfly {
throw new ServletException("can't find servlet init config 'gridworks.data', I have to give up initializing"); throw new ServletException("can't find servlet init config 'gridworks.data', I have to give up initializing");
} }
registerCommands(commandNames);
s_dataDir = new File(data); s_dataDir = new File(data);
FileProjectManager.initialize(s_dataDir); FileProjectManager.initialize(s_dataDir);
@ -195,18 +107,18 @@ public class GridworksServlet extends Butterfly {
@Override @Override
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
if (request.getPathInfo().startsWith("/command")) { if (request.getPathInfo().startsWith("/command/")) {
String commandName = getCommandName(request); String commandKey = getCommandKey(request);
Command command = commands.get(commandName); Command command = commands.get(commandKey);
if (command != null) { if (command != null) {
if (request.getMethod().equals("GET")) { if (request.getMethod().equals("GET")) {
logger.trace("> GET {}", commandName); logger.trace("> GET {}", commandKey);
command.doGet(request, response); command.doGet(request, response);
logger.trace("< GET {}", commandName); logger.trace("< GET {}", commandKey);
} else if (request.getMethod().equals("POST")) { } else if (request.getMethod().equals("POST")) {
logger.trace("> POST {}", commandName); logger.trace("> POST {}", commandKey);
command.doPost(request, response); command.doPost(request, response);
logger.trace("< POST {}", commandName); logger.trace("< POST {}", commandKey);
} else { } else {
response.sendError(405); response.sendError(405);
} }
@ -218,13 +130,20 @@ public class GridworksServlet extends Butterfly {
} }
} }
protected String getCommandName(HttpServletRequest request) { protected String getCommandKey(HttpServletRequest request) {
// Remove extraneous path segments that might be there for other purposes, // A command path has this format: /command/module-name/command-name/...
// e.g., for /export-rows/filename.ext, export-rows is the command while
// filename.ext is only for the browser to prompt a convenient filename. String path = request.getPathInfo().substring("/command/".length());
String commandName = request.getPathInfo().substring("/command/".length());
int slash = commandName.indexOf('/'); int slash1 = path.indexOf('/');
return slash > 0 ? commandName.substring(0, slash) : commandName; if (slash1 >= 0) {
int slash2 = path.indexOf('/', slash1 + 1);
if (slash2 > 0) {
path = path.substring(0, slash2);
}
}
return path;
} }
private File tempDir = null; private File tempDir = null;
@ -253,71 +172,33 @@ public class GridworksServlet extends Butterfly {
public String getConfiguration(String name, String def) { public String getConfiguration(String name, String def) {
return null; return null;
} }
/**
* Register an array of commands
*
* @param commands
* An array of arrays containing pairs of strings with the
* command name in the first element of the tuple and the fully
* qualified class name of the class implementing the command in
* the second.
* @return false if any commands failed to load
*/
private boolean registerCommands(String[][] commands) {
boolean status = true;
for (String[] command : commandNames) {
String commandName = command[0];
String className = command[1];
status |= registerOneCommand(commandName, className);
}
return status;
}
/** /**
* Register a single command given its class name. * Register a single command.
* *
* @param name * @param module the module the command belongs to
* command verb for command * @param name command verb for command
* @param className * @param commandObject object implementing the command
* class name of command class
* @return true if command was loaded and registered successfully * @return true if command was loaded and registered successfully
*/ */
protected boolean registerOneCommand(String commandName, String className) { protected boolean registerOneCommand(ButterflyModule module, String name, Command commandObject) {
logger.debug("Loading command " + commandName + " class: " + className); return registerOneCommand(module.getName() + "/" + name, commandObject);
Command cmd;
try {
cmd = (Command) this.getClass().getClassLoader().loadClass(className).newInstance();
return registerOneCommand(commandName, cmd);
} catch (InstantiationException e) {
logger.error("Failed to load command class " + className, e);
return false;
} catch (IllegalAccessException e) {
logger.error("Failed to load command class " + className, e);
return false;
} catch (ClassNotFoundException e) {
logger.error("Failed to load command class " + className, e);
return false;
}
} }
/** /**
* Register a single command. * Register a single command.
* *
* @param name * @param path path for command
* command verb for command * @param commandObject object implementing the command
* @param commandObject
* object implementing the command
* @return true if command was loaded and registered successfully * @return true if command was loaded and registered successfully
*/ */
protected boolean registerOneCommand(String name, Command commandObject) { protected boolean registerOneCommand(String path, Command commandObject) {
if (commands.containsKey(name)) { if (commands.containsKey(path)) {
return false; return false;
} }
commandObject.init(this); commandObject.init(this);
commands.put(name, commandObject); commands.put(path, commandObject);
return true; return true;
} }
@ -330,15 +211,14 @@ public class GridworksServlet extends Butterfly {
/** /**
* Register a single command. Used by extensions. * Register a single command. Used by extensions.
* *
* @param name * @param module the module the command belongs to
* command verb for command * @param name command verb for command
* @param commandObject * @param commandObject object implementing the command
* object implementing the command
* *
* @return true if command was loaded and registered successfully * @return true if command was loaded and registered successfully
*/ */
static public boolean registerCommand(String commandName, Command commandObject) { static public boolean registerCommand(ButterflyModule module, String commandName, Command commandObject) {
return s_singleton.registerOneCommand(commandName, commandObject); return s_singleton.registerOneCommand(module, commandName, commandObject);
} }
static public Class<?> getClass(String className) throws ClassNotFoundException { static public Class<?> getClass(String className) throws ClassNotFoundException {
@ -347,5 +227,4 @@ public class GridworksServlet extends Butterfly {
} }
return Class.forName(className); return Class.forName(className);
} }
} }

View File

@ -129,6 +129,6 @@ public class AuthorizeCommand extends Command {
throw new RuntimeException("neither the 'host' nor 'referer' headers were present in the HTTP response, I can't determine what URL gridworks is listening to."); throw new RuntimeException("neither the 'host' nor 'referer' headers were present in the HTTP response, I can't determine what URL gridworks is listening to.");
} }
} }
return "http://" + host + "/command/authorize/" + provider.getHost(); return "http://" + host + "/command/core/authorize/" + provider.getHost();
} }
} }

View File

@ -23,7 +23,7 @@ public class GridworksServletStub extends GridworksServlet {
} }
public String wrapGetCommandName(HttpServletRequest request){ public String wrapGetCommandName(HttpServletRequest request){
return super.getCommandName(request); return super.getCommandKey(request);
} }
//-------------------helper methods-------------- //-------------------helper methods--------------
@ -32,8 +32,8 @@ public class GridworksServletStub extends GridworksServlet {
* @param commandName * @param commandName
* @param command * @param command
*/ */
public void insertCommand( String commandName, Command command ){ public void insertCommand(String commandName, Command command ){
registerCommand(commandName, command); registerOneCommand("core/" + commandName, command);
} }
/** /**

View File

@ -32,7 +32,7 @@ public class GridworksServletTests extends GridworksTest {
//variables //variables
final static private String TEST_COMMAND_NAME = "test-command"; final static private String TEST_COMMAND_NAME = "test-command";
final static private String TEST_COMMAND_PATH = "/command/test-command/foobar"; final static private String TEST_COMMAND_PATH = "/command/core/test-command/foobar";
final static private String BAD_COMMAND_PATH = "/command-does-not-exist"; final static private String BAD_COMMAND_PATH = "/command-does-not-exist";
final static private String POST = "POST"; final static private String POST = "POST";

View File

@ -10,12 +10,102 @@ var templatedFiles = {
"preferences" : true "preferences" : true
}; };
function registerCommands() {
var GS = Packages.com.google.gridworks.GridworksServlet;
GS.registerCommand(module, "create-project-from-upload", new Packages.com.google.gridworks.commands.project.CreateProjectCommand());
GS.registerCommand(module, "import-project", new Packages.com.google.gridworks.commands.project.ImportProjectCommand());
GS.registerCommand(module, "export-project", new Packages.com.google.gridworks.commands.project.ExportProjectCommand());
GS.registerCommand(module, "export-rows", new Packages.com.google.gridworks.commands.project.ExportRowsCommand());
GS.registerCommand(module, "get-project-metadata", new Packages.com.google.gridworks.commands.project.GetProjectMetadataCommand());
GS.registerCommand(module, "get-all-project-metadata", new Packages.com.google.gridworks.commands.workspace.GetAllProjectMetadataCommand());
GS.registerCommand(module, "delete-project", new Packages.com.google.gridworks.commands.project.DeleteProjectCommand());
GS.registerCommand(module, "rename-project", new Packages.com.google.gridworks.commands.project.RenameProjectCommand());
GS.registerCommand(module, "get-models", new Packages.com.google.gridworks.commands.project.GetModelsCommand());
GS.registerCommand(module, "get-rows", new Packages.com.google.gridworks.commands.row.GetRowsCommand());
GS.registerCommand(module, "get-processes", new Packages.com.google.gridworks.commands.history.GetProcessesCommand());
GS.registerCommand(module, "get-history", new Packages.com.google.gridworks.commands.history.GetHistoryCommand());
GS.registerCommand(module, "get-operations", new Packages.com.google.gridworks.commands.history.GetOperationsCommand());
GS.registerCommand(module, "get-columns-info", new Packages.com.google.gridworks.commands.column.GetColumnsInfoCommand());
GS.registerCommand(module, "get-scatterplot", new Packages.com.google.gridworks.commands.browsing.GetScatterplotCommand());
GS.registerCommand(module, "undo-redo", new Packages.com.google.gridworks.commands.history.UndoRedoCommand());
GS.registerCommand(module, "apply-operations", new Packages.com.google.gridworks.commands.history.ApplyOperationsCommand());
GS.registerCommand(module, "cancel-processes", new Packages.com.google.gridworks.commands.history.CancelProcessesCommand());
GS.registerCommand(module, "compute-facets", new Packages.com.google.gridworks.commands.browsing.ComputeFacetsCommand());
GS.registerCommand(module, "compute-clusters", new Packages.com.google.gridworks.commands.browsing.ComputeClustersCommand());
GS.registerCommand(module, "edit-one-cell", new Packages.com.google.gridworks.commands.cell.EditOneCellCommand());
GS.registerCommand(module, "text-transform", new Packages.com.google.gridworks.commands.cell.TextTransformCommand());
GS.registerCommand(module, "mass-edit", new Packages.com.google.gridworks.commands.cell.MassEditCommand());
GS.registerCommand(module, "join-multi-value-cells", new Packages.com.google.gridworks.commands.cell.JoinMultiValueCellsCommand());
GS.registerCommand(module, "split-multi-value-cells", new Packages.com.google.gridworks.commands.cell.SplitMultiValueCellsCommand());
GS.registerCommand(module, "fill-down", new Packages.com.google.gridworks.commands.cell.FillDownCommand());
GS.registerCommand(module, "blank-down", new Packages.com.google.gridworks.commands.cell.BlankDownCommand());
GS.registerCommand(module, "transpose-columns-into-rows", new Packages.com.google.gridworks.commands.cell.TransposeColumnsIntoRowsCommand());
GS.registerCommand(module, "transpose-rows-into-columns", new Packages.com.google.gridworks.commands.cell.TransposeRowsIntoColumnsCommand());
GS.registerCommand(module, "add-column", new Packages.com.google.gridworks.commands.column.AddColumnCommand());
GS.registerCommand(module, "remove-column", new Packages.com.google.gridworks.commands.column.RemoveColumnCommand());
GS.registerCommand(module, "rename-column", new Packages.com.google.gridworks.commands.column.RenameColumnCommand());
GS.registerCommand(module, "move-column", new Packages.com.google.gridworks.commands.column.MoveColumnCommand());
GS.registerCommand(module, "split-column", new Packages.com.google.gridworks.commands.column.SplitColumnCommand());
GS.registerCommand(module, "extend-data", new Packages.com.google.gridworks.commands.column.ExtendDataCommand());
GS.registerCommand(module, "denormalize", new Packages.com.google.gridworks.commands.row.DenormalizeCommand());
GS.registerCommand(module, "reconcile", new Packages.com.google.gridworks.commands.recon.ReconcileCommand());
GS.registerCommand(module, "recon-match-best-candidates", new Packages.com.google.gridworks.commands.recon.ReconMatchBestCandidatesCommand());
GS.registerCommand(module, "recon-mark-new-topics", new Packages.com.google.gridworks.commands.recon.ReconMarkNewTopicsCommand());
GS.registerCommand(module, "recon-discard-judgments", new Packages.com.google.gridworks.commands.recon.ReconDiscardJudgmentsCommand());
GS.registerCommand(module, "recon-match-specific-topic-to-cells", new Packages.com.google.gridworks.commands.recon.ReconMatchSpecificTopicCommand());
GS.registerCommand(module, "recon-judge-one-cell", new Packages.com.google.gridworks.commands.recon.ReconJudgeOneCellCommand());
GS.registerCommand(module, "recon-judge-similar-cells", new Packages.com.google.gridworks.commands.recon.ReconJudgeSimilarCellsCommand());
GS.registerCommand(module, "annotate-one-row", new Packages.com.google.gridworks.commands.row.AnnotateOneRowCommand());
GS.registerCommand(module, "annotate-rows", new Packages.com.google.gridworks.commands.row.AnnotateRowsCommand());
GS.registerCommand(module, "remove-rows", new Packages.com.google.gridworks.commands.row.RemoveRowsCommand());
GS.registerCommand(module, "reorder-rows", new Packages.com.google.gridworks.commands.row.ReorderRowsCommand());
GS.registerCommand(module, "save-protograph", new Packages.com.google.gridworks.commands.freebase.SaveProtographCommand());
GS.registerCommand(module, "get-expression-language-info", new Packages.com.google.gridworks.commands.expr.GetExpressionLanguageInfoCommand());
GS.registerCommand(module, "get-expression-history", new Packages.com.google.gridworks.commands.expr.GetExpressionHistoryCommand());
GS.registerCommand(module, "log-expression", new Packages.com.google.gridworks.commands.expr.LogExpressionCommand());
GS.registerCommand(module, "preview-expression", new Packages.com.google.gridworks.commands.expr.PreviewExpressionCommand());
GS.registerCommand(module, "preview-extend-data", new Packages.com.google.gridworks.commands.column.PreviewExtendDataCommand());
GS.registerCommand(module, "preview-protograph", new Packages.com.google.gridworks.commands.freebase.PreviewProtographCommand());
GS.registerCommand(module, "guess-types-of-column", new Packages.com.google.gridworks.commands.freebase.GuessTypesOfColumnCommand());
GS.registerCommand(module, "check-authorization", new Packages.com.google.gridworks.commands.auth.CheckAuthorizationCommand());
GS.registerCommand(module, "authorize", new Packages.com.google.gridworks.commands.auth.AuthorizeCommand());
GS.registerCommand(module, "deauthorize", new Packages.com.google.gridworks.commands.auth.DeAuthorizeCommand());
GS.registerCommand(module, "user-badges", new Packages.com.google.gridworks.commands.auth.GetUserBadgesCommand());
GS.registerCommand(module, "upload-data", new Packages.com.google.gridworks.commands.freebase.UploadDataCommand());
GS.registerCommand(module, "import-qa-data", new Packages.com.google.gridworks.commands.freebase.ImportQADataCommand());
GS.registerCommand(module, "mqlread", new Packages.com.google.gridworks.commands.freebase.MQLReadCommand());
GS.registerCommand(module, "mqlwrite", new Packages.com.google.gridworks.commands.freebase.MQLWriteCommand());
GS.registerCommand(module, "get-preference", new Packages.com.google.gridworks.commands.GetPreferenceCommand());
GS.registerCommand(module, "get-all-preferences", new Packages.com.google.gridworks.commands.GetAllPreferencesCommand());
GS.registerCommand(module, "set-preference", new Packages.com.google.gridworks.commands.SetPreferenceCommand());
}
/* /*
* This optional function is invoked from the module's init() Java function. * This optional function is invoked from the module's init() Java function.
*/ */
function init() { function init() {
// Packages.java.lang.System.err.println("Initializing by script " + module); // Packages.java.lang.System.err.println("Initializing by script " + module);
registerCommands();
ClientSideResourceManager.addPaths( ClientSideResourceManager.addPaths(
"project/scripts", "project/scripts",
module, module,

View File

@ -55,7 +55,7 @@
<td id="forms"> <td id="forms">
<div class="island"> <div class="island">
<form id="file-upload-form" method="post" enctype="multipart/form-data" action="/command/create-project-from-upload" accept-charset="UTF-8"> <form id="file-upload-form" method="post" enctype="multipart/form-data" action="/command/core/create-project-from-upload" accept-charset="UTF-8">
<div id="form-tabs-create-project" class="round-corners"> <div id="form-tabs-create-project" class="round-corners">
<a class="form-tab-link" href="javascript:showHide('file-upload-form', 'project-upload-form')">or Import an Existing Project</a> <a class="form-tab-link" href="javascript:showHide('file-upload-form', 'project-upload-form')">or Import an Existing Project</a>
@ -120,7 +120,7 @@
</form> </form>
<form id="project-upload-form" method="post" enctype="multipart/form-data" action="/command/import-project" accept-charset="UTF-8" style="display:none;"> <form id="project-upload-form" method="post" enctype="multipart/form-data" action="/command/core/import-project" accept-charset="UTF-8" style="display:none;">
<div id="form-tabs-import-project" class="round-corners"> <div id="form-tabs-import-project" class="round-corners">
<a class="form-tab-link" href="javascript:showHide('project-upload-form', 'file-upload-form')">or Create a New Project</a> <a class="form-tab-link" href="javascript:showHide('project-upload-form', 'file-upload-form')">or Create a New Project</a>
<h1>Import an Existing Project</h1> <h1>Import an Existing Project</h1>

View File

@ -202,7 +202,7 @@ ClusteringDialog.prototype._cluster = function() {
this._elmts.resultSummary.empty(); this._elmts.resultSummary.empty();
$.post( $.post(
"/command/compute-clusters?" + $.param({ project: theProject.id }), "/command/core/compute-clusters?" + $.param({ project: theProject.id }),
{ {
engine: JSON.stringify(ui.browsingEngine.getJSON()), engine: JSON.stringify(ui.browsingEngine.getJSON()),
clusterer: JSON.stringify({ clusterer: JSON.stringify({
@ -293,7 +293,7 @@ ClusteringDialog.prototype._apply = function(onDone) {
} }
if (edits.length > 0) { if (edits.length > 0) {
Gridworks.postProcess( Gridworks.postCoreProcess(
"mass-edit", "mass-edit",
{}, {},
{ {

View File

@ -113,7 +113,7 @@ ExpressionPreviewDialog.Widget.prototype.getExpression = function(commit) {
s = this._getLanguage() + ":" + s; s = this._getLanguage() + ":" + s;
if (commit) { if (commit) {
$.post( $.post(
"/command/log-expression?" + $.param({ project: theProject.id, expression: s }), "/command/core/log-expression?" + $.param({ project: theProject.id, expression: s }),
null, null,
function(data) { function(data) {
}, },
@ -131,7 +131,7 @@ ExpressionPreviewDialog.Widget.prototype._getLanguage = function() {
ExpressionPreviewDialog.Widget.prototype._renderHelpTab = function() { ExpressionPreviewDialog.Widget.prototype._renderHelpTab = function() {
var self = this; var self = this;
$.getJSON( $.getJSON(
"/command/get-expression-language-info", "/command/core/get-expression-language-info",
null, null,
function(data) { function(data) {
self._renderHelp(data); self._renderHelp(data);
@ -212,7 +212,7 @@ ExpressionPreviewDialog.Widget.prototype._renderHelp = function(data) {
ExpressionPreviewDialog.Widget.prototype._renderExpressionHistoryTab = function() { ExpressionPreviewDialog.Widget.prototype._renderExpressionHistoryTab = function() {
var self = this; var self = this;
$.getJSON( $.getJSON(
"/command/get-expression-history?" + $.param({ project: theProject.id }), "/command/core/get-expression-history?" + $.param({ project: theProject.id }),
null, null,
function(data) { function(data) {
self._renderExpressionHistory(data); self._renderExpressionHistory(data);
@ -276,7 +276,7 @@ ExpressionPreviewDialog.Widget.prototype.update = function() {
this._prepareUpdate(params); this._prepareUpdate(params);
$.post( $.post(
"/command/preview-expression?" + $.param(params), "/command/core/preview-expression?" + $.param(params),
{ {
rowIndices: JSON.stringify(this._rowIndices) rowIndices: JSON.stringify(this._rowIndices)
}, },

View File

@ -135,7 +135,7 @@ ExtendDataPreviewDialog.prototype._update = function() {
}; };
$.post( $.post(
"/command/preview-extend-data?" + $.param(params), "/command/core/preview-extend-data?" + $.param(params),
{ {
rowIndices: JSON.stringify(this._rowIndices), rowIndices: JSON.stringify(this._rowIndices),
extension: JSON.stringify(this._extension) extension: JSON.stringify(this._extension)

View File

@ -15,7 +15,7 @@ FreebaseLoadingDialog.prototype._createDialog = function() {
var loadButton = this._elmts.loadButton; var loadButton = this._elmts.loadButton;
var check_authorization = function(cont) { var check_authorization = function(cont) {
$.get("/command/check-authorization/" + provider, function(data) { $.get("/command/core/check-authorization/" + provider, function(data) {
if ("status" in data && data.code == "/api/status/ok") { if ("status" in data && data.code == "/api/status/ok") {
authorization.html('Signed in as: <a target="_new" href="http://www.freebase.com/view/user/' + data.username + '">' + data.username + '</a> | <a href="javascript:{}" bind="signout">Sign Out</a>').show(); authorization.html('Signed in as: <a target="_new" href="http://www.freebase.com/view/user/' + data.username + '">' + data.username + '</a> | <a href="javascript:{}" bind="signout">Sign Out</a>').show();
DOM.bind(authorization).signout.click(function() { DOM.bind(authorization).signout.click(function() {
@ -42,7 +42,7 @@ FreebaseLoadingDialog.prototype._createDialog = function() {
}; };
var check_allowed = function(user_id, cont) { var check_allowed = function(user_id, cont) {
$.get("/command/user-badges/" + provider, $.get("/command/core/user-badges/" + provider,
{ "user_id" : user_id }, { "user_id" : user_id },
function(data) { function(data) {
if ("status" in data && data.code == "/api/status/ok") { if ("status" in data && data.code == "/api/status/ok") {
@ -74,7 +74,7 @@ FreebaseLoadingDialog.prototype._createDialog = function() {
"guid": null "guid": null
}]; }];
$.post("/command/mqlwrite/" + provider, $.post("/command/core/mqlwrite/" + provider,
{ "query" : JSON.stringify(mql_query) }, { "query" : JSON.stringify(mql_query) },
function(data) { function(data) {
if ("status" in data && data.code == "/api/status/ok") { if ("status" in data && data.code == "/api/status/ok") {
@ -90,7 +90,7 @@ FreebaseLoadingDialog.prototype._createDialog = function() {
var show_triples = function(cont) { var show_triples = function(cont) {
$.post( $.post(
"/command/preview-protograph?" + $.param({ project: theProject.id }), "/command/core/preview-protograph?" + $.param({ project: theProject.id }),
{ {
protograph: JSON.stringify(theProject.overlayModels.freebaseProtograph || {}), protograph: JSON.stringify(theProject.overlayModels.freebaseProtograph || {}),
engine: JSON.stringify(ui.browsingEngine.getJSON()) engine: JSON.stringify(ui.browsingEngine.getJSON())
@ -165,7 +165,7 @@ FreebaseLoadingDialog.prototype._load = function() {
var doLoad = function() { var doLoad = function() {
var dismissBusy = DialogSystem.showBusy(); var dismissBusy = DialogSystem.showBusy();
$.post("/command/upload-data", $.post("/command/core/upload-data",
{ {
project: theProject.id, project: theProject.id,
"graph" : (freebase) ? "otg" : "sandbox", "graph" : (freebase) ? "otg" : "sandbox",

View File

@ -52,7 +52,7 @@ ScatterplotDialog.prototype._renderMatrix = function() {
var params = { var params = {
project: theProject.id project: theProject.id
}; };
$.getJSON("/command/get-columns-info?" + $.param(params),function(data) { $.getJSON("/command/core/get-columns-info?" + $.param(params),function(data) {
if (data === null || typeof data.length == 'undefined') { if (data === null || typeof data.length == 'undefined') {
container.html("Error calling 'get-columns-info'"); container.html("Error calling 'get-columns-info'");
return; return;
@ -89,7 +89,7 @@ ScatterplotDialog.prototype._renderMatrix = function() {
engine: JSON.stringify(ui.browsingEngine.getJSON()), engine: JSON.stringify(ui.browsingEngine.getJSON()),
plotter: JSON.stringify(plotter_params) plotter: JSON.stringify(plotter_params)
}; };
var url = "/command/get-scatterplot?" + $.param(params); var url = "/command/core/get-scatterplot?" + $.param(params);
var attrs = [ var attrs = [
'width="' + self._plot_size + '"', 'width="' + self._plot_size + '"',

View File

@ -46,7 +46,7 @@ TemplatingExporterDialog.prototype._dismiss = function() {
TemplatingExporterDialog.prototype._updatePreview = function() { TemplatingExporterDialog.prototype._updatePreview = function() {
var self = this; var self = this;
$.post( $.post(
"/command/export-rows/preview.txt", "/command/core/export-rows/preview.txt",
{ {
"project" : theProject.id, "project" : theProject.id,
"format" : "template", "format" : "template",
@ -71,7 +71,7 @@ TemplatingExporterDialog.prototype._export = function() {
$(form) $(form)
.css("display", "none") .css("display", "none")
.attr("method", "post") .attr("method", "post")
.attr("action", "/command/export-rows/" + name + ".txt") .attr("action", "/command/core/export-rows/" + name + ".txt")
.attr("target", "gridworks-export"); .attr("target", "gridworks-export");
var appendField = function(name, value) { var appendField = function(name, value) {

View File

@ -495,7 +495,7 @@ ListFacet.prototype._editChoice = function(choice, choiceDiv) {
edit.from = [ originalContent ]; edit.from = [ originalContent ];
} }
Gridworks.postProcess( Gridworks.postCoreProcess(
"mass-edit", "mass-edit",
{}, {},
{ {

View File

@ -240,7 +240,7 @@ ScatterplotFacet.prototype._formulateImageUrl = function(engineConfig, conf) {
engine: JSON.stringify(engineConfig), engine: JSON.stringify(engineConfig),
plotter: JSON.stringify(options) plotter: JSON.stringify(options)
}; };
return "/command/get-scatterplot?" + $.param(params); return "/command/core/get-scatterplot?" + $.param(params);
}; };
ScatterplotFacet.prototype.updateState = function(data) { ScatterplotFacet.prototype.updateState = function(data) {

View File

@ -9,7 +9,7 @@ function onClickUploadFileButton(evt) {
} else { } else {
$("#file-upload-form").attr("action", $("#file-upload-form").attr("action",
"/command/create-project-from-upload?" + [ "/command/core/create-project-from-upload?" + [
"url=" + escape(dataURL), "url=" + escape(dataURL),
"split-into-columns=" + $("#split-into-columns-input")[0].checked, "split-into-columns=" + $("#split-into-columns-input")[0].checked,
"separator=" + $("#separator-input")[0].value, "separator=" + $("#separator-input")[0].value,
@ -72,7 +72,7 @@ function isThereNewRelease() {
function fetchProjects() { function fetchProjects() {
$.getJSON( $.getJSON(
"/command/get-all-project-metadata", "/command/core/get-all-project-metadata",
null, null,
function(data) { function(data) {
renderProjects(data); renderProjects(data);
@ -135,7 +135,7 @@ function renderProjects(data) {
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "/command/rename-project", url: "/command/core/rename-project",
data: { "project" : project.id, "name" : name }, data: { "project" : project.id, "name" : name },
dataType: "json", dataType: "json",
success: function (data) { success: function (data) {
@ -163,7 +163,7 @@ function renderProjects(data) {
if (window.confirm("Are you sure you want to delete project \"" + project.name + "\"?")) { if (window.confirm("Are you sure you want to delete project \"" + project.name + "\"?")) {
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "/command/delete-project", url: "/command/core/delete-project",
data: { "project" : project.id }, data: { "project" : project.id },
dataType: "json", dataType: "json",
success: function (data) { success: function (data) {

View File

@ -2,7 +2,7 @@ var preferenceUIs = [];
function onLoad() { function onLoad() {
$.post( $.post(
"/command/get-all-preferences", "/command/core/get-all-preferences",
null, null,
populatePreferences, populatePreferences,
"json" "json"
@ -33,7 +33,7 @@ function populatePreferences(prefs) {
preferenceUIs.push(new PreferenceUI(tr, key, value)); preferenceUIs.push(new PreferenceUI(tr, key, value));
$.post( $.post(
"/command/set-preference", "/command/core/set-preference",
{ {
name : key, name : key,
value : JSON.stringify(value) value : JSON.stringify(value)
@ -66,7 +66,7 @@ function PreferenceUI(tr, key, value) {
if (newValue != null) { if (newValue != null) {
$(td1).text(newValue); $(td1).text(newValue);
$.post( $.post(
"/command/set-preference", "/command/core/set-preference",
{ {
name : key, name : key,
value : JSON.stringify(newValue) value : JSON.stringify(newValue)
@ -84,7 +84,7 @@ function PreferenceUI(tr, key, value) {
$('<button>').text("Delete").appendTo(td2).click(function() { $('<button>').text("Delete").appendTo(td2).click(function() {
if (window.confirm("Delete preference key " + key + "?")) { if (window.confirm("Delete preference key " + key + "?")) {
$.post( $.post(
"/command/set-preference", "/command/core/set-preference",
{ {
name : key name : key
}, },

View File

@ -135,11 +135,11 @@ Gridworks.setTitle = function(status) {
Gridworks.reinitializeProjectData = function(f) { Gridworks.reinitializeProjectData = function(f) {
Ajax.chainGetJSON( Ajax.chainGetJSON(
"/command/get-project-metadata?" + $.param({ project: theProject.id }), null, "/command/core/get-project-metadata?" + $.param({ project: theProject.id }), null,
function(data) { function(data) {
theProject.metadata = data; theProject.metadata = data;
}, },
"/command/get-models?" + $.param({ project: theProject.id }), null, "/command/core/get-models?" + $.param({ project: theProject.id }), null,
function(data) { function(data) {
for (var n in data) { for (var n in data) {
if (data.hasOwnProperty(n)) { if (data.hasOwnProperty(n)) {
@ -209,7 +209,11 @@ Gridworks.update = function(options, onFinallyDone) {
}, 500); }, 500);
}; };
Gridworks.postProcess = function(command, params, body, updateOptions, callbacks) { Gridworks.postCoreProcess = function(command, params, body, updateOptions, callbacks) {
Gridworks.postProcess("core", command, params, body, updateOptions, callbacks);
};
Gridworks.postProcess = function(moduleName, command, params, body, updateOptions, callbacks) {
updateOptions = updateOptions || {}; updateOptions = updateOptions || {};
callbacks = callbacks || {}; callbacks = callbacks || {};
@ -277,7 +281,7 @@ Gridworks.postProcess = function(command, params, body, updateOptions, callbacks
Gridworks.setAjaxInProgress(); Gridworks.setAjaxInProgress();
$.post( $.post(
"/command/" + command + "?" + $.param(params), "/command/" + moduleName + "/" + command + "?" + $.param(params),
body, body,
onDone, onDone,
"json" "json"
@ -358,7 +362,7 @@ Gridworks.fetchRows = function(start, limit, onDone, sorting) {
} }
$.post( $.post(
"/command/get-rows?" + $.param({ project: theProject.id, start: start, limit: limit }) + "&callback=?", "/command/core/get-rows?" + $.param({ project: theProject.id, start: start, limit: limit }) + "&callback=?",
body, body,
function(data) { function(data) {
theProject.rowModel = data; theProject.rowModel = data;

View File

@ -213,7 +213,7 @@ BrowsingEngine.prototype.update = function(onDone) {
this._elmts.indicator.css("visibility", "visible"); this._elmts.indicator.css("visibility", "visible");
$.post( $.post(
"/command/compute-facets?" + $.param({ project: theProject.id }), "/command/core/compute-facets?" + $.param({ project: theProject.id }),
{ engine: JSON.stringify(this.getJSON(true)) }, { engine: JSON.stringify(this.getJSON(true)) },
function(data) { function(data) {
var facetData = data.facets; var facetData = data.facets;

View File

@ -241,7 +241,7 @@ MenuBar.handlers.exportRows = function(format, ext) {
$(form) $(form)
.css("display", "none") .css("display", "none")
.attr("method", "post") .attr("method", "post")
.attr("action", "/command/export-rows/" + name + "." + ext) .attr("action", "/command/core/export-rows/" + name + "." + ext)
.attr("target", "gridworks-export"); .attr("target", "gridworks-export");
$('<input />') $('<input />')
@ -271,7 +271,7 @@ MenuBar.handlers.exportProject = function() {
$(form) $(form)
.css("display", "none") .css("display", "none")
.attr("method", "post") .attr("method", "post")
.attr("action", "/command/export-project/" + name + ".gridworks.tar.gz") .attr("action", "/command/core/export-project/" + name + ".gridworks.tar.gz")
.attr("target", "gridworks-export"); .attr("target", "gridworks-export");
$('<input />') $('<input />')
.attr("name", "project") .attr("name", "project")
@ -299,7 +299,7 @@ MenuBar.handlers.renameProject = function() {
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "/command/rename-project", url: "/command/core/rename-project",
data: { "project" : theProject.id, "name" : name }, data: { "project" : theProject.id, "name" : name },
dataType: "json", dataType: "json",
success: function (data) { success: function (data) {
@ -327,7 +327,7 @@ MenuBar.handlers.loadIntoFreebase = function() {
}; };
MenuBar.handlers.importQAData = function() { MenuBar.handlers.importQAData = function() {
Gridworks.postProcess( Gridworks.postCoreProcess(
"import-qa-data", "import-qa-data",
{}, {},
{}, {},

View File

@ -169,7 +169,7 @@ SchemaAlignmentDialog.prototype._constructFooter = function(footer) {
$('<button></button>').html("&nbsp;&nbsp;OK&nbsp;&nbsp;").click(function() { $('<button></button>').html("&nbsp;&nbsp;OK&nbsp;&nbsp;").click(function() {
var protograph = self.getJSON(); var protograph = self.getJSON();
Gridworks.postProcess( Gridworks.postCoreProcess(
"save-protograph", "save-protograph",
{}, {},
{ protograph: JSON.stringify(protograph) }, { protograph: JSON.stringify(protograph) },
@ -263,7 +263,7 @@ SchemaAlignmentDialog.prototype.preview = function() {
var protograph = this.getJSON(); var protograph = this.getJSON();
$.post( $.post(
"/command/preview-protograph?" + $.param({ project: theProject.id }), "/command/core/preview-protograph?" + $.param({ project: theProject.id }),
{ protograph: JSON.stringify(protograph), engine: JSON.stringify(ui.browsingEngine.getJSON()) }, { protograph: JSON.stringify(protograph), engine: JSON.stringify(ui.browsingEngine.getJSON()) },
function(data) { function(data) {
if ("mqllike" in data) { if ("mqllike" in data) {

View File

@ -91,7 +91,7 @@ ReconFreebaseQueryPanel.prototype.start = function() {
}; };
} }
Gridworks.postProcess( Gridworks.postCoreProcess(
"reconcile", "reconcile",
{}, {},
bodyParams, bodyParams,

View File

@ -81,7 +81,7 @@ ReconciliationManager.save = function(f) {
$.ajax({ $.ajax({
async: false, async: false,
type: "POST", type: "POST",
url: "/command/set-preference?" + $.param({ url: "/command/core/set-preference?" + $.param({
name: "reconciliation.standardServices" name: "reconciliation.standardServices"
}), }),
data: { "value" : JSON.stringify(ReconciliationManager.standardServices) }, data: { "value" : JSON.stringify(ReconciliationManager.standardServices) },
@ -100,7 +100,7 @@ ReconciliationManager.save = function(f) {
$.ajax({ $.ajax({
async: false, async: false,
url: "/command/get-preference?" + $.param({ url: "/command/core/get-preference?" + $.param({
name: "reconciliation.standardServices" name: "reconciliation.standardServices"
}), }),
success: function(data) { success: function(data) {

View File

@ -12,7 +12,7 @@ ReconStandardServicePanel.prototype._guessTypes = function(f) {
var dismissBusy = DialogSystem.showBusy(); var dismissBusy = DialogSystem.showBusy();
$.post( $.post(
"/command/guess-types-of-column?" + $.param({ "/command/core/guess-types-of-column?" + $.param({
project: theProject.id, project: theProject.id,
columnName: this._column.name, columnName: this._column.name,
service: this._service.url service: this._service.url
@ -271,7 +271,7 @@ ReconStandardServicePanel.prototype.start = function() {
} }
); );
Gridworks.postProcess( Gridworks.postCoreProcess(
"reconcile", "reconcile",
{}, {},
{ {

View File

@ -69,7 +69,7 @@
}, },
signin : function(success, provider, width, height) { signin : function(success, provider, width, height) {
var newwin = window.Sign.popup("/command/authorize/" + provider, width, height); var newwin = window.Sign.popup("/command/core/authorize/" + provider, width, height);
if (newwin !== null) { if (newwin !== null) {
newwin.opener = window; newwin.opener = window;
@ -80,7 +80,7 @@
window.location.reload(); window.location.reload();
} else { } else {
$.ajax({ $.ajax({
url: "/command/check-authorization/" + provider, url: "/command/core/check-authorization/" + provider,
dataType: "json", dataType: "json",
success: function(data) { success: function(data) {
window.user = data; window.user = data;
@ -105,7 +105,7 @@
signout : function(success,provider) { signout : function(success,provider) {
$.ajax({ $.ajax({
url: "/command/deauthorize/" + provider, url: "/command/core/deauthorize/" + provider,
success: function() { success: function() {
if (typeof success == 'undefined') { if (typeof success == 'undefined') {
window.location.reload(); window.location.reload();

View File

@ -303,7 +303,7 @@ DataTableCellUI.prototype._searchForMatch = function(suggestOptions) {
DataTableCellUI.prototype._postProcessOneCell = function(command, params, bodyParams, columnStatsChanged) { DataTableCellUI.prototype._postProcessOneCell = function(command, params, bodyParams, columnStatsChanged) {
var self = this; var self = this;
Gridworks.postProcess( Gridworks.postCoreProcess(
command, command,
params, params,
bodyParams, bodyParams,
@ -324,7 +324,7 @@ DataTableCellUI.prototype._postProcessOneCell = function(command, params, bodyPa
}; };
DataTableCellUI.prototype._postProcessSeveralCells = function(command, params, bodyParams, columnStatsChanged) { DataTableCellUI.prototype._postProcessSeveralCells = function(command, params, bodyParams, columnStatsChanged) {
Gridworks.postProcess( Gridworks.postCoreProcess(
command, command,
params, params,
bodyParams, bodyParams,
@ -410,7 +410,7 @@ DataTableCellUI.prototype._startEdit = function(elmt) {
MenuSystem.dismissAll(); MenuSystem.dismissAll();
if (applyOthers) { if (applyOthers) {
Gridworks.postProcess( Gridworks.postCoreProcess(
"mass-edit", "mass-edit",
{}, {},
{ {
@ -425,7 +425,7 @@ DataTableCellUI.prototype._startEdit = function(elmt) {
{ cellsChanged: true } { cellsChanged: true }
); );
} else { } else {
Gridworks.postProcess( Gridworks.postCoreProcess(
"edit-one-cell", "edit-one-cell",
{ {
row: self._rowIndex, row: self._rowIndex,

View File

@ -280,7 +280,7 @@ DataTableView.prototype._renderDataTable = function(table) {
.click(function() { .click(function() {
var newStarred = !row.starred; var newStarred = !row.starred;
Gridworks.postProcess( Gridworks.postCoreProcess(
"annotate-one-row", "annotate-one-row",
{ row: row.i, starred: newStarred }, { row: row.i, starred: newStarred },
null, null,
@ -301,7 +301,7 @@ DataTableView.prototype._renderDataTable = function(table) {
.click(function() { .click(function() {
var newFlagged = !row.flagged; var newFlagged = !row.flagged;
Gridworks.postProcess( Gridworks.postCoreProcess(
"annotate-one-row", "annotate-one-row",
{ row: row.i, flagged: newFlagged }, { row: row.i, flagged: newFlagged },
null, null,
@ -471,33 +471,33 @@ DataTableView.prototype._createMenuForAllColumns = function(elmt) {
{ {
label: "Star Rows", label: "Star Rows",
click: function() { click: function() {
Gridworks.postProcess("annotate-rows", { "starred" : "true" }, null, { rowMetadataChanged: true }); Gridworks.postCoreProcess("annotate-rows", { "starred" : "true" }, null, { rowMetadataChanged: true });
} }
}, },
{ {
label: "Unstar Rows", label: "Unstar Rows",
click: function() { click: function() {
Gridworks.postProcess("annotate-rows", { "starred" : "false" }, null, { rowMetadataChanged: true }); Gridworks.postCoreProcess("annotate-rows", { "starred" : "false" }, null, { rowMetadataChanged: true });
} }
}, },
{}, {},
{ {
label: "Flag Rows", label: "Flag Rows",
click: function() { click: function() {
Gridworks.postProcess("annotate-rows", { "flagged" : "true" }, null, { rowMetadataChanged: true }); Gridworks.postCoreProcess("annotate-rows", { "flagged" : "true" }, null, { rowMetadataChanged: true });
} }
}, },
{ {
label: "Unflag Rows", label: "Unflag Rows",
click: function() { click: function() {
Gridworks.postProcess("annotate-rows", { "flagged" : "false" }, null, { rowMetadataChanged: true }); Gridworks.postCoreProcess("annotate-rows", { "flagged" : "false" }, null, { rowMetadataChanged: true });
} }
}, },
{}, {},
{ {
label: "Remove All Matching Rows", label: "Remove All Matching Rows",
click: function() { click: function() {
Gridworks.postProcess("remove-rows", {}, null, { rowMetadataChanged: true }); Gridworks.postCoreProcess("remove-rows", {}, null, { rowMetadataChanged: true });
} }
} }
] ]
@ -538,7 +538,7 @@ DataTableView.prototype._createSortingMenu = function(elmt) {
{ {
"label" : "Reorder Rows Permanently", "label" : "Reorder Rows Permanently",
"click" : function() { "click" : function() {
Gridworks.postProcess( Gridworks.postCoreProcess(
"reorder-rows", "reorder-rows",
null, null,
{ "sorting" : JSON.stringify(self._sorting) }, { "sorting" : JSON.stringify(self._sorting) },

View File

@ -1,6 +1,6 @@
DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) { DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
var doTextTransform = function(expression, onError, repeat, repeatCount) { var doTextTransform = function(expression, onError, repeat, repeatCount) {
Gridworks.postProcess( Gridworks.postCoreProcess(
"text-transform", "text-transform",
{ {
columnName: column.name, columnName: column.name,
@ -54,7 +54,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
}; };
var doFillDown = function() { var doFillDown = function() {
Gridworks.postProcess( Gridworks.postCoreProcess(
"fill-down", "fill-down",
{ {
columnName: column.name columnName: column.name
@ -65,7 +65,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
}; };
var doBlankDown = function() { var doBlankDown = function() {
Gridworks.postProcess( Gridworks.postCoreProcess(
"blank-down", "blank-down",
{ {
columnName: column.name columnName: column.name
@ -78,7 +78,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
var doJoinMultiValueCells = function() { var doJoinMultiValueCells = function() {
var separator = window.prompt("Enter separator to use between values", ", "); var separator = window.prompt("Enter separator to use between values", ", ");
if (separator !== null) { if (separator !== null) {
Gridworks.postProcess( Gridworks.postCoreProcess(
"join-multi-value-cells", "join-multi-value-cells",
{ {
columnName: column.name, columnName: column.name,
@ -94,7 +94,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
var doSplitMultiValueCells = function() { var doSplitMultiValueCells = function() {
var separator = window.prompt("What separator currently separates the values?", ","); var separator = window.prompt("What separator currently separates the values?", ",");
if (separator !== null) { if (separator !== null) {
Gridworks.postProcess( Gridworks.postCoreProcess(
"split-multi-value-cells", "split-multi-value-cells",
{ {
columnName: column.name, columnName: column.name,
@ -194,7 +194,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
ignoreBlankCells: elmts.ignoreBlankCellsCheckbox[0].checked ignoreBlankCells: elmts.ignoreBlankCellsCheckbox[0].checked
}; };
Gridworks.postProcess( Gridworks.postCoreProcess(
"transpose-columns-into-rows", "transpose-columns-into-rows",
config, config,
null, null,
@ -254,7 +254,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
rowCount: rowCount rowCount: rowCount
}; };
Gridworks.postProcess( Gridworks.postCoreProcess(
"transpose-rows-into-columns", "transpose-rows-into-columns",
config, config,
null, null,

View File

@ -19,7 +19,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
return; return;
} }
Gridworks.postProcess( Gridworks.postCoreProcess(
"add-column", "add-column",
{ {
baseColumnName: column.name, baseColumnName: column.name,
@ -51,7 +51,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
columnIndex, columnIndex,
o.rowIndices, o.rowIndices,
function(extension) { function(extension) {
Gridworks.postProcess( Gridworks.postCoreProcess(
"extend-data", "extend-data",
{ {
baseColumnName: column.name, baseColumnName: column.name,
@ -67,7 +67,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
}; };
var doRemoveColumn = function() { var doRemoveColumn = function() {
Gridworks.postProcess( Gridworks.postCoreProcess(
"remove-column", "remove-column",
{ {
columnName: column.name columnName: column.name
@ -80,7 +80,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
var doRenameColumn = function() { var doRenameColumn = function() {
var newColumnName = window.prompt("Enter new column name", column.name); var newColumnName = window.prompt("Enter new column name", column.name);
if (newColumnName !== null) { if (newColumnName !== null) {
Gridworks.postProcess( Gridworks.postCoreProcess(
"rename-column", "rename-column",
{ {
oldColumnName: column.name, oldColumnName: column.name,
@ -93,7 +93,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
}; };
var doMoveColumnTo = function(index) { var doMoveColumnTo = function(index) {
Gridworks.postProcess( Gridworks.postCoreProcess(
"move-column", "move-column",
{ {
columnName: column.name, columnName: column.name,
@ -105,7 +105,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
}; };
var doMoveColumnBy = function(change) { var doMoveColumnBy = function(change) {
Gridworks.postProcess( Gridworks.postCoreProcess(
"move-column", "move-column",
{ {
columnName: column.name, columnName: column.name,
@ -169,7 +169,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
config.fieldLengths = JSON.stringify(lengths); config.fieldLengths = JSON.stringify(lengths);
} }
Gridworks.postProcess( Gridworks.postCoreProcess(
"split-column", "split-column",
config, config,
null, null,

View File

@ -4,7 +4,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
}; };
var doReconDiscardJudgments = function() { var doReconDiscardJudgments = function() {
Gridworks.postProcess( Gridworks.postCoreProcess(
"recon-discard-judgments", "recon-discard-judgments",
{ columnName: column.name }, { columnName: column.name },
null, null,
@ -13,7 +13,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
}; };
var doReconMatchBestCandidates = function() { var doReconMatchBestCandidates = function() {
Gridworks.postProcess( Gridworks.postCoreProcess(
"recon-match-best-candidates", "recon-match-best-candidates",
{ columnName: column.name }, { columnName: column.name },
null, null,
@ -22,7 +22,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
}; };
var doReconMarkNewTopics = function(shareNewTopics) { var doReconMarkNewTopics = function(shareNewTopics) {
Gridworks.postProcess( Gridworks.postCoreProcess(
"recon-mark-new-topics", "recon-mark-new-topics",
{ columnName: column.name, shareNewTopics: shareNewTopics }, { columnName: column.name, shareNewTopics: shareNewTopics },
null, null,
@ -56,7 +56,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
function(o) { function(o) {
var types = "result" in o ? o.result.type : []; var types = "result" in o ? o.result.type : [];
Gridworks.postProcess( Gridworks.postCoreProcess(
"recon-match-specific-topic-to-cells", "recon-match-specific-topic-to-cells",
{ {
columnName: column.name, columnName: column.name,

View File

@ -15,7 +15,7 @@ HistoryWidget.prototype.resize = function() {
HistoryWidget.prototype.update = function(onDone) { HistoryWidget.prototype.update = function(onDone) {
var self = this; var self = this;
Ajax.chainGetJSON( Ajax.chainGetJSON(
"/command/get-history?" + $.param({ project: theProject.id }), null, "/command/core/get-history?" + $.param({ project: theProject.id }), null,
function(data) { function(data) {
self._data = data; self._data = data;
self._render(); self._render();
@ -100,7 +100,7 @@ HistoryWidget.prototype._render = function() {
HistoryWidget.prototype._onClickHistoryEntry = function(evt, entry, lastDoneID) { HistoryWidget.prototype._onClickHistoryEntry = function(evt, entry, lastDoneID) {
var self = this; var self = this;
Gridworks.postProcess( Gridworks.postCoreProcess(
"undo-redo", "undo-redo",
{ lastDoneID: lastDoneID }, { lastDoneID: lastDoneID },
null, null,
@ -111,7 +111,7 @@ HistoryWidget.prototype._onClickHistoryEntry = function(evt, entry, lastDoneID)
HistoryWidget.prototype._extractOperations = function() { HistoryWidget.prototype._extractOperations = function() {
var self = this; var self = this;
$.getJSON( $.getJSON(
"/command/get-operations?" + $.param({ project: theProject.id }), "/command/core/get-operations?" + $.param({ project: theProject.id }),
null, null,
function(data) { function(data) {
if ("entries" in data) { if ("entries" in data) {
@ -218,7 +218,7 @@ HistoryWidget.prototype._showApplyOperationsDialog = function() {
return; return;
} }
Gridworks.postProcess( Gridworks.postCoreProcess(
"apply-operations", "apply-operations",
{}, {},
{ operations: JSON.stringify(json) }, { operations: JSON.stringify(json) },

View File

@ -45,7 +45,7 @@ ProcessWidget.prototype.update = function(updateOptions, onDone) {
var self = this; var self = this;
Ajax.chainGetJSON( Ajax.chainGetJSON(
"/command/get-processes?" + $.param({ project: theProject.id }), null, "/command/core/get-processes?" + $.param({ project: theProject.id }), null,
function(data) { function(data) {
self._latestHistoryEntry = null; self._latestHistoryEntry = null;
self._render(data); self._render(data);
@ -72,7 +72,7 @@ ProcessWidget.prototype.showUndo = function(historyEntry) {
ProcessWidget.prototype.undo = function() { ProcessWidget.prototype.undo = function() {
if (this._latestHistoryEntry !== null) { if (this._latestHistoryEntry !== null) {
Gridworks.postProcess( Gridworks.postCoreProcess(
"undo-redo", "undo-redo",
{ undoID: this._latestHistoryEntry.id }, { undoID: this._latestHistoryEntry.id },
null, null,
@ -84,7 +84,7 @@ ProcessWidget.prototype.undo = function() {
ProcessWidget.prototype._cancelAll = function() { ProcessWidget.prototype._cancelAll = function() {
var self = this; var self = this;
$.post( $.post(
"/command/cancel-processes?" + $.param({ project: theProject.id }), "/command/core/cancel-processes?" + $.param({ project: theProject.id }),
null, null,
function(o) { function(o) {
self._data = null; self._data = null;