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:
parent
3b043b7970
commit
c94abd0427
@ -40,13 +40,13 @@ function init() {
|
||||
* Commands
|
||||
*/
|
||||
var GridworksServlet = Packages.com.google.gridworks.GridworksServlet;
|
||||
GridworksServlet.registerCommand("save-rdf-schema", new SaveRdfSchemaCommand());
|
||||
GridworksServlet.registerCommand("preview-rdf",new PreviewRdfCommand());
|
||||
GridworksServlet.registerCommand("save-baseURI",new SaveBaseURI());
|
||||
GridworksServlet.registerCommand("suggest-term",new SuggestTermCommand());
|
||||
GridworksServlet.registerCommand("import-vocabulary",new ImportVocabularyCommand());
|
||||
GridworksServlet.registerCommand("list-vocabularies",new ListVocabulariesCommand());
|
||||
GridworksServlet.registerCommand("delete-vocabulary",new DeleteVocabularyCommand());
|
||||
GridworksServlet.registerCommand(module, "save-rdf-schema", new SaveRdfSchemaCommand());
|
||||
GridworksServlet.registerCommand(module, "preview-rdf", new PreviewRdfCommand());
|
||||
GridworksServlet.registerCommand(module, "save-baseURI", new SaveBaseURI());
|
||||
GridworksServlet.registerCommand(module, "suggest-term", new SuggestTermCommand());
|
||||
GridworksServlet.registerCommand(module, "import-vocabulary", new ImportVocabularyCommand());
|
||||
GridworksServlet.registerCommand(module, "list-vocabularies", new ListVocabulariesCommand());
|
||||
GridworksServlet.registerCommand(module, "delete-vocabulary", new DeleteVocabularyCommand());
|
||||
|
||||
/*
|
||||
* Client-side Resources
|
||||
|
@ -46,7 +46,7 @@ RdfExporterMenuBar.rdfExportRows = function(format, ext) {
|
||||
$(form)
|
||||
.css("display", "none")
|
||||
.attr("method", "post")
|
||||
.attr("action", "/command/export-rows/" + name + "." + ext)
|
||||
.attr("action", "/command/core/export-rows/" + name + "." + ext)
|
||||
.attr("target", "gridworks-export");
|
||||
|
||||
$('<input />')
|
||||
|
@ -808,7 +808,7 @@ RdfSchemaAlignmentDialog.RdfResourceDialog = function(elmt,lookFor,onDone,defaul
|
||||
});*/
|
||||
//Autocomplete
|
||||
/*elmts.newResourceUri.autoComplete({
|
||||
script:'/command/search-vocabularies?type=' + lookFor + '&',
|
||||
script:'/command/rdf-exporter-extension/search-vocabularies?type=' + lookFor + '&',
|
||||
varname:'input',
|
||||
json:true,
|
||||
shownoresults:true,
|
||||
|
@ -41,6 +41,7 @@ RdfSchemaAlignmentDialog.prototype._constructFooter = function(footer) {
|
||||
$('<button></button>').html(" OK ").click(function() {
|
||||
var schema = self.getJSON();
|
||||
Gridworks.postProcess(
|
||||
"rdf-exporter-extension",
|
||||
"save-rdf-schema",
|
||||
{},
|
||||
{ schema: JSON.stringify(schema) },
|
||||
@ -100,7 +101,7 @@ RdfSchemaAlignmentDialog.prototype._previewRdf = function(){
|
||||
var schema = this.getJSON();
|
||||
self._previewPane.empty().html('<img src="images/large-spinner.gif" title="loading..."/>');
|
||||
$.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()) },
|
||||
function(data) {
|
||||
self._previewPane.empty();
|
||||
@ -160,7 +161,7 @@ RdfSchemaAlignmentDialog.prototype._listVocabularies = function(){
|
||||
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 tr = vocab_table.insertRow(vocab_table.rows.length);
|
||||
$(tr).addClass('');
|
||||
@ -212,7 +213,7 @@ RdfSchemaAlignmentDialog.prototype._renderVocabularyFooter = function(){
|
||||
return ;
|
||||
}
|
||||
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();
|
||||
if (data.code === "error"){
|
||||
alert('Error:' + data.message)
|
||||
@ -228,7 +229,7 @@ RdfSchemaAlignmentDialog.prototype._renderVocabularyFooter = function(){
|
||||
RdfSchemaAlignmentDialog.prototype._deleteVocabulary = function(uri){
|
||||
var self = this;
|
||||
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();
|
||||
if (data.code === "error"){
|
||||
alert('Error:' + data.message)
|
||||
@ -289,7 +290,7 @@ RdfSchemaAlignmentDialog.prototype._editBaseUri = function(src){
|
||||
RdfSchemaAlignmentDialog.prototype._replaceBaseUri = function(newBaseUri){
|
||||
var self = this;
|
||||
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"){
|
||||
alert('Error:' + data.message)
|
||||
}else{
|
||||
|
@ -74,7 +74,7 @@
|
||||
$.extend($.suggest.suggestterm, {
|
||||
defaults: $.extend(true, {}, $.suggest.suggest.defaults, {
|
||||
service_url: "",
|
||||
service_path: "/command/suggest-term",
|
||||
service_path: "/command/rdf-exporter-extension/suggest-term",
|
||||
type_strict:"classes",
|
||||
suggest_new:"Add it"
|
||||
})
|
||||
|
@ -218,7 +218,7 @@ tool_download() {
|
||||
load_data() {
|
||||
FILE=$1
|
||||
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`"
|
||||
|
||||
if [ -z "$CURL" ]; then
|
||||
|
@ -19,6 +19,7 @@ import com.google.gridworks.commands.Command;
|
||||
import com.google.gridworks.io.FileProjectManager;
|
||||
|
||||
import edu.mit.simile.butterfly.Butterfly;
|
||||
import edu.mit.simile.butterfly.ButterflyModule;
|
||||
|
||||
public class GridworksServlet extends Butterfly {
|
||||
|
||||
@ -38,93 +39,6 @@ public class GridworksServlet extends Butterfly {
|
||||
|
||||
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() {
|
||||
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");
|
||||
}
|
||||
|
||||
registerCommands(commandNames);
|
||||
|
||||
s_dataDir = new File(data);
|
||||
FileProjectManager.initialize(s_dataDir);
|
||||
|
||||
@ -195,18 +107,18 @@ public class GridworksServlet extends Butterfly {
|
||||
|
||||
@Override
|
||||
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||
if (request.getPathInfo().startsWith("/command")) {
|
||||
String commandName = getCommandName(request);
|
||||
Command command = commands.get(commandName);
|
||||
if (request.getPathInfo().startsWith("/command/")) {
|
||||
String commandKey = getCommandKey(request);
|
||||
Command command = commands.get(commandKey);
|
||||
if (command != null) {
|
||||
if (request.getMethod().equals("GET")) {
|
||||
logger.trace("> GET {}", commandName);
|
||||
logger.trace("> GET {}", commandKey);
|
||||
command.doGet(request, response);
|
||||
logger.trace("< GET {}", commandName);
|
||||
logger.trace("< GET {}", commandKey);
|
||||
} else if (request.getMethod().equals("POST")) {
|
||||
logger.trace("> POST {}", commandName);
|
||||
logger.trace("> POST {}", commandKey);
|
||||
command.doPost(request, response);
|
||||
logger.trace("< POST {}", commandName);
|
||||
logger.trace("< POST {}", commandKey);
|
||||
} else {
|
||||
response.sendError(405);
|
||||
}
|
||||
@ -218,13 +130,20 @@ public class GridworksServlet extends Butterfly {
|
||||
}
|
||||
}
|
||||
|
||||
protected String getCommandName(HttpServletRequest request) {
|
||||
// Remove extraneous path segments that might be there for other purposes,
|
||||
// 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 commandName = request.getPathInfo().substring("/command/".length());
|
||||
int slash = commandName.indexOf('/');
|
||||
return slash > 0 ? commandName.substring(0, slash) : commandName;
|
||||
protected String getCommandKey(HttpServletRequest request) {
|
||||
// A command path has this format: /command/module-name/command-name/...
|
||||
|
||||
String path = request.getPathInfo().substring("/command/".length());
|
||||
|
||||
int slash1 = path.indexOf('/');
|
||||
if (slash1 >= 0) {
|
||||
int slash2 = path.indexOf('/', slash1 + 1);
|
||||
if (slash2 > 0) {
|
||||
path = path.substring(0, slash2);
|
||||
}
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
private File tempDir = null;
|
||||
@ -253,71 +172,33 @@ public class GridworksServlet extends Butterfly {
|
||||
public String getConfiguration(String name, String def) {
|
||||
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
|
||||
* command verb for command
|
||||
* @param className
|
||||
* class name of command class
|
||||
* @param module the module the command belongs to
|
||||
* @param name command verb for command
|
||||
* @param commandObject object implementing the command
|
||||
* @return true if command was loaded and registered successfully
|
||||
*/
|
||||
protected boolean registerOneCommand(String commandName, String className) {
|
||||
logger.debug("Loading command " + commandName + " class: " + className);
|
||||
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;
|
||||
}
|
||||
protected boolean registerOneCommand(ButterflyModule module, String name, Command commandObject) {
|
||||
return registerOneCommand(module.getName() + "/" + name, commandObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a single command.
|
||||
*
|
||||
* @param name
|
||||
* command verb for command
|
||||
* @param commandObject
|
||||
* object implementing the command
|
||||
* @param path path for command
|
||||
* @param commandObject object implementing the command
|
||||
* @return true if command was loaded and registered successfully
|
||||
*/
|
||||
protected boolean registerOneCommand(String name, Command commandObject) {
|
||||
if (commands.containsKey(name)) {
|
||||
protected boolean registerOneCommand(String path, Command commandObject) {
|
||||
if (commands.containsKey(path)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
commandObject.init(this);
|
||||
commands.put(name, commandObject);
|
||||
commands.put(path, commandObject);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -330,15 +211,14 @@ public class GridworksServlet extends Butterfly {
|
||||
/**
|
||||
* Register a single command. Used by extensions.
|
||||
*
|
||||
* @param name
|
||||
* command verb for command
|
||||
* @param commandObject
|
||||
* object implementing the command
|
||||
* @param module the module the command belongs to
|
||||
* @param name command verb for command
|
||||
* @param commandObject object implementing the command
|
||||
*
|
||||
* @return true if command was loaded and registered successfully
|
||||
*/
|
||||
static public boolean registerCommand(String commandName, Command commandObject) {
|
||||
return s_singleton.registerOneCommand(commandName, commandObject);
|
||||
static public boolean registerCommand(ButterflyModule module, String commandName, Command commandObject) {
|
||||
return s_singleton.registerOneCommand(module, commandName, commandObject);
|
||||
}
|
||||
|
||||
static public Class<?> getClass(String className) throws ClassNotFoundException {
|
||||
@ -347,5 +227,4 @@ public class GridworksServlet extends Butterfly {
|
||||
}
|
||||
return Class.forName(className);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -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.");
|
||||
}
|
||||
}
|
||||
return "http://" + host + "/command/authorize/" + provider.getHost();
|
||||
return "http://" + host + "/command/core/authorize/" + provider.getHost();
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class GridworksServletStub extends GridworksServlet {
|
||||
}
|
||||
|
||||
public String wrapGetCommandName(HttpServletRequest request){
|
||||
return super.getCommandName(request);
|
||||
return super.getCommandKey(request);
|
||||
}
|
||||
|
||||
//-------------------helper methods--------------
|
||||
@ -32,8 +32,8 @@ public class GridworksServletStub extends GridworksServlet {
|
||||
* @param commandName
|
||||
* @param command
|
||||
*/
|
||||
public void insertCommand( String commandName, Command command ){
|
||||
registerCommand(commandName, command);
|
||||
public void insertCommand(String commandName, Command command ){
|
||||
registerOneCommand("core/" + commandName, command);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,7 +32,7 @@ public class GridworksServletTests extends GridworksTest {
|
||||
|
||||
//variables
|
||||
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 POST = "POST";
|
||||
|
@ -10,12 +10,102 @@ var templatedFiles = {
|
||||
"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.
|
||||
*/
|
||||
function init() {
|
||||
// Packages.java.lang.System.err.println("Initializing by script " + module);
|
||||
|
||||
registerCommands();
|
||||
|
||||
ClientSideResourceManager.addPaths(
|
||||
"project/scripts",
|
||||
module,
|
||||
|
@ -55,7 +55,7 @@
|
||||
|
||||
<td id="forms">
|
||||
<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">
|
||||
<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 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">
|
||||
<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>
|
||||
|
@ -202,7 +202,7 @@ ClusteringDialog.prototype._cluster = function() {
|
||||
this._elmts.resultSummary.empty();
|
||||
|
||||
$.post(
|
||||
"/command/compute-clusters?" + $.param({ project: theProject.id }),
|
||||
"/command/core/compute-clusters?" + $.param({ project: theProject.id }),
|
||||
{
|
||||
engine: JSON.stringify(ui.browsingEngine.getJSON()),
|
||||
clusterer: JSON.stringify({
|
||||
@ -293,7 +293,7 @@ ClusteringDialog.prototype._apply = function(onDone) {
|
||||
}
|
||||
|
||||
if (edits.length > 0) {
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"mass-edit",
|
||||
{},
|
||||
{
|
||||
|
@ -113,7 +113,7 @@ ExpressionPreviewDialog.Widget.prototype.getExpression = function(commit) {
|
||||
s = this._getLanguage() + ":" + s;
|
||||
if (commit) {
|
||||
$.post(
|
||||
"/command/log-expression?" + $.param({ project: theProject.id, expression: s }),
|
||||
"/command/core/log-expression?" + $.param({ project: theProject.id, expression: s }),
|
||||
null,
|
||||
function(data) {
|
||||
},
|
||||
@ -131,7 +131,7 @@ ExpressionPreviewDialog.Widget.prototype._getLanguage = function() {
|
||||
ExpressionPreviewDialog.Widget.prototype._renderHelpTab = function() {
|
||||
var self = this;
|
||||
$.getJSON(
|
||||
"/command/get-expression-language-info",
|
||||
"/command/core/get-expression-language-info",
|
||||
null,
|
||||
function(data) {
|
||||
self._renderHelp(data);
|
||||
@ -212,7 +212,7 @@ ExpressionPreviewDialog.Widget.prototype._renderHelp = function(data) {
|
||||
ExpressionPreviewDialog.Widget.prototype._renderExpressionHistoryTab = function() {
|
||||
var self = this;
|
||||
$.getJSON(
|
||||
"/command/get-expression-history?" + $.param({ project: theProject.id }),
|
||||
"/command/core/get-expression-history?" + $.param({ project: theProject.id }),
|
||||
null,
|
||||
function(data) {
|
||||
self._renderExpressionHistory(data);
|
||||
@ -276,7 +276,7 @@ ExpressionPreviewDialog.Widget.prototype.update = function() {
|
||||
this._prepareUpdate(params);
|
||||
|
||||
$.post(
|
||||
"/command/preview-expression?" + $.param(params),
|
||||
"/command/core/preview-expression?" + $.param(params),
|
||||
{
|
||||
rowIndices: JSON.stringify(this._rowIndices)
|
||||
},
|
||||
|
@ -135,7 +135,7 @@ ExtendDataPreviewDialog.prototype._update = function() {
|
||||
};
|
||||
|
||||
$.post(
|
||||
"/command/preview-extend-data?" + $.param(params),
|
||||
"/command/core/preview-extend-data?" + $.param(params),
|
||||
{
|
||||
rowIndices: JSON.stringify(this._rowIndices),
|
||||
extension: JSON.stringify(this._extension)
|
||||
|
@ -15,7 +15,7 @@ FreebaseLoadingDialog.prototype._createDialog = function() {
|
||||
var loadButton = this._elmts.loadButton;
|
||||
|
||||
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") {
|
||||
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() {
|
||||
@ -42,7 +42,7 @@ FreebaseLoadingDialog.prototype._createDialog = function() {
|
||||
};
|
||||
|
||||
var check_allowed = function(user_id, cont) {
|
||||
$.get("/command/user-badges/" + provider,
|
||||
$.get("/command/core/user-badges/" + provider,
|
||||
{ "user_id" : user_id },
|
||||
function(data) {
|
||||
if ("status" in data && data.code == "/api/status/ok") {
|
||||
@ -74,7 +74,7 @@ FreebaseLoadingDialog.prototype._createDialog = function() {
|
||||
"guid": null
|
||||
}];
|
||||
|
||||
$.post("/command/mqlwrite/" + provider,
|
||||
$.post("/command/core/mqlwrite/" + provider,
|
||||
{ "query" : JSON.stringify(mql_query) },
|
||||
function(data) {
|
||||
if ("status" in data && data.code == "/api/status/ok") {
|
||||
@ -90,7 +90,7 @@ FreebaseLoadingDialog.prototype._createDialog = function() {
|
||||
|
||||
var show_triples = function(cont) {
|
||||
$.post(
|
||||
"/command/preview-protograph?" + $.param({ project: theProject.id }),
|
||||
"/command/core/preview-protograph?" + $.param({ project: theProject.id }),
|
||||
{
|
||||
protograph: JSON.stringify(theProject.overlayModels.freebaseProtograph || {}),
|
||||
engine: JSON.stringify(ui.browsingEngine.getJSON())
|
||||
@ -165,7 +165,7 @@ FreebaseLoadingDialog.prototype._load = function() {
|
||||
var doLoad = function() {
|
||||
var dismissBusy = DialogSystem.showBusy();
|
||||
|
||||
$.post("/command/upload-data",
|
||||
$.post("/command/core/upload-data",
|
||||
{
|
||||
project: theProject.id,
|
||||
"graph" : (freebase) ? "otg" : "sandbox",
|
||||
|
@ -52,7 +52,7 @@ ScatterplotDialog.prototype._renderMatrix = function() {
|
||||
var params = {
|
||||
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') {
|
||||
container.html("Error calling 'get-columns-info'");
|
||||
return;
|
||||
@ -89,7 +89,7 @@ ScatterplotDialog.prototype._renderMatrix = function() {
|
||||
engine: JSON.stringify(ui.browsingEngine.getJSON()),
|
||||
plotter: JSON.stringify(plotter_params)
|
||||
};
|
||||
var url = "/command/get-scatterplot?" + $.param(params);
|
||||
var url = "/command/core/get-scatterplot?" + $.param(params);
|
||||
|
||||
var attrs = [
|
||||
'width="' + self._plot_size + '"',
|
||||
|
@ -46,7 +46,7 @@ TemplatingExporterDialog.prototype._dismiss = function() {
|
||||
TemplatingExporterDialog.prototype._updatePreview = function() {
|
||||
var self = this;
|
||||
$.post(
|
||||
"/command/export-rows/preview.txt",
|
||||
"/command/core/export-rows/preview.txt",
|
||||
{
|
||||
"project" : theProject.id,
|
||||
"format" : "template",
|
||||
@ -71,7 +71,7 @@ TemplatingExporterDialog.prototype._export = function() {
|
||||
$(form)
|
||||
.css("display", "none")
|
||||
.attr("method", "post")
|
||||
.attr("action", "/command/export-rows/" + name + ".txt")
|
||||
.attr("action", "/command/core/export-rows/" + name + ".txt")
|
||||
.attr("target", "gridworks-export");
|
||||
|
||||
var appendField = function(name, value) {
|
||||
|
@ -495,7 +495,7 @@ ListFacet.prototype._editChoice = function(choice, choiceDiv) {
|
||||
edit.from = [ originalContent ];
|
||||
}
|
||||
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"mass-edit",
|
||||
{},
|
||||
{
|
||||
|
@ -240,7 +240,7 @@ ScatterplotFacet.prototype._formulateImageUrl = function(engineConfig, conf) {
|
||||
engine: JSON.stringify(engineConfig),
|
||||
plotter: JSON.stringify(options)
|
||||
};
|
||||
return "/command/get-scatterplot?" + $.param(params);
|
||||
return "/command/core/get-scatterplot?" + $.param(params);
|
||||
};
|
||||
|
||||
ScatterplotFacet.prototype.updateState = function(data) {
|
||||
|
@ -9,7 +9,7 @@ function onClickUploadFileButton(evt) {
|
||||
|
||||
} else {
|
||||
$("#file-upload-form").attr("action",
|
||||
"/command/create-project-from-upload?" + [
|
||||
"/command/core/create-project-from-upload?" + [
|
||||
"url=" + escape(dataURL),
|
||||
"split-into-columns=" + $("#split-into-columns-input")[0].checked,
|
||||
"separator=" + $("#separator-input")[0].value,
|
||||
@ -72,7 +72,7 @@ function isThereNewRelease() {
|
||||
|
||||
function fetchProjects() {
|
||||
$.getJSON(
|
||||
"/command/get-all-project-metadata",
|
||||
"/command/core/get-all-project-metadata",
|
||||
null,
|
||||
function(data) {
|
||||
renderProjects(data);
|
||||
@ -135,7 +135,7 @@ function renderProjects(data) {
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/command/rename-project",
|
||||
url: "/command/core/rename-project",
|
||||
data: { "project" : project.id, "name" : name },
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
@ -163,7 +163,7 @@ function renderProjects(data) {
|
||||
if (window.confirm("Are you sure you want to delete project \"" + project.name + "\"?")) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/command/delete-project",
|
||||
url: "/command/core/delete-project",
|
||||
data: { "project" : project.id },
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
|
@ -2,7 +2,7 @@ var preferenceUIs = [];
|
||||
|
||||
function onLoad() {
|
||||
$.post(
|
||||
"/command/get-all-preferences",
|
||||
"/command/core/get-all-preferences",
|
||||
null,
|
||||
populatePreferences,
|
||||
"json"
|
||||
@ -33,7 +33,7 @@ function populatePreferences(prefs) {
|
||||
preferenceUIs.push(new PreferenceUI(tr, key, value));
|
||||
|
||||
$.post(
|
||||
"/command/set-preference",
|
||||
"/command/core/set-preference",
|
||||
{
|
||||
name : key,
|
||||
value : JSON.stringify(value)
|
||||
@ -66,7 +66,7 @@ function PreferenceUI(tr, key, value) {
|
||||
if (newValue != null) {
|
||||
$(td1).text(newValue);
|
||||
$.post(
|
||||
"/command/set-preference",
|
||||
"/command/core/set-preference",
|
||||
{
|
||||
name : key,
|
||||
value : JSON.stringify(newValue)
|
||||
@ -84,7 +84,7 @@ function PreferenceUI(tr, key, value) {
|
||||
$('<button>').text("Delete").appendTo(td2).click(function() {
|
||||
if (window.confirm("Delete preference key " + key + "?")) {
|
||||
$.post(
|
||||
"/command/set-preference",
|
||||
"/command/core/set-preference",
|
||||
{
|
||||
name : key
|
||||
},
|
||||
|
@ -135,11 +135,11 @@ Gridworks.setTitle = function(status) {
|
||||
|
||||
Gridworks.reinitializeProjectData = function(f) {
|
||||
Ajax.chainGetJSON(
|
||||
"/command/get-project-metadata?" + $.param({ project: theProject.id }), null,
|
||||
"/command/core/get-project-metadata?" + $.param({ project: theProject.id }), null,
|
||||
function(data) {
|
||||
theProject.metadata = data;
|
||||
},
|
||||
"/command/get-models?" + $.param({ project: theProject.id }), null,
|
||||
"/command/core/get-models?" + $.param({ project: theProject.id }), null,
|
||||
function(data) {
|
||||
for (var n in data) {
|
||||
if (data.hasOwnProperty(n)) {
|
||||
@ -209,7 +209,11 @@ Gridworks.update = function(options, onFinallyDone) {
|
||||
}, 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 || {};
|
||||
callbacks = callbacks || {};
|
||||
|
||||
@ -277,7 +281,7 @@ Gridworks.postProcess = function(command, params, body, updateOptions, callbacks
|
||||
Gridworks.setAjaxInProgress();
|
||||
|
||||
$.post(
|
||||
"/command/" + command + "?" + $.param(params),
|
||||
"/command/" + moduleName + "/" + command + "?" + $.param(params),
|
||||
body,
|
||||
onDone,
|
||||
"json"
|
||||
@ -358,7 +362,7 @@ Gridworks.fetchRows = function(start, limit, onDone, sorting) {
|
||||
}
|
||||
|
||||
$.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,
|
||||
function(data) {
|
||||
theProject.rowModel = data;
|
||||
|
@ -213,7 +213,7 @@ BrowsingEngine.prototype.update = function(onDone) {
|
||||
this._elmts.indicator.css("visibility", "visible");
|
||||
|
||||
$.post(
|
||||
"/command/compute-facets?" + $.param({ project: theProject.id }),
|
||||
"/command/core/compute-facets?" + $.param({ project: theProject.id }),
|
||||
{ engine: JSON.stringify(this.getJSON(true)) },
|
||||
function(data) {
|
||||
var facetData = data.facets;
|
||||
|
@ -241,7 +241,7 @@ MenuBar.handlers.exportRows = function(format, ext) {
|
||||
$(form)
|
||||
.css("display", "none")
|
||||
.attr("method", "post")
|
||||
.attr("action", "/command/export-rows/" + name + "." + ext)
|
||||
.attr("action", "/command/core/export-rows/" + name + "." + ext)
|
||||
.attr("target", "gridworks-export");
|
||||
|
||||
$('<input />')
|
||||
@ -271,7 +271,7 @@ MenuBar.handlers.exportProject = function() {
|
||||
$(form)
|
||||
.css("display", "none")
|
||||
.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");
|
||||
$('<input />')
|
||||
.attr("name", "project")
|
||||
@ -299,7 +299,7 @@ MenuBar.handlers.renameProject = function() {
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/command/rename-project",
|
||||
url: "/command/core/rename-project",
|
||||
data: { "project" : theProject.id, "name" : name },
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
@ -327,7 +327,7 @@ MenuBar.handlers.loadIntoFreebase = function() {
|
||||
};
|
||||
|
||||
MenuBar.handlers.importQAData = function() {
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"import-qa-data",
|
||||
{},
|
||||
{},
|
||||
|
@ -169,7 +169,7 @@ SchemaAlignmentDialog.prototype._constructFooter = function(footer) {
|
||||
$('<button></button>').html(" OK ").click(function() {
|
||||
var protograph = self.getJSON();
|
||||
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"save-protograph",
|
||||
{},
|
||||
{ protograph: JSON.stringify(protograph) },
|
||||
@ -263,7 +263,7 @@ SchemaAlignmentDialog.prototype.preview = function() {
|
||||
|
||||
var protograph = this.getJSON();
|
||||
$.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()) },
|
||||
function(data) {
|
||||
if ("mqllike" in data) {
|
||||
|
@ -91,7 +91,7 @@ ReconFreebaseQueryPanel.prototype.start = function() {
|
||||
};
|
||||
}
|
||||
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"reconcile",
|
||||
{},
|
||||
bodyParams,
|
||||
|
@ -81,7 +81,7 @@ ReconciliationManager.save = function(f) {
|
||||
$.ajax({
|
||||
async: false,
|
||||
type: "POST",
|
||||
url: "/command/set-preference?" + $.param({
|
||||
url: "/command/core/set-preference?" + $.param({
|
||||
name: "reconciliation.standardServices"
|
||||
}),
|
||||
data: { "value" : JSON.stringify(ReconciliationManager.standardServices) },
|
||||
@ -100,7 +100,7 @@ ReconciliationManager.save = function(f) {
|
||||
|
||||
$.ajax({
|
||||
async: false,
|
||||
url: "/command/get-preference?" + $.param({
|
||||
url: "/command/core/get-preference?" + $.param({
|
||||
name: "reconciliation.standardServices"
|
||||
}),
|
||||
success: function(data) {
|
||||
|
@ -12,7 +12,7 @@ ReconStandardServicePanel.prototype._guessTypes = function(f) {
|
||||
var dismissBusy = DialogSystem.showBusy();
|
||||
|
||||
$.post(
|
||||
"/command/guess-types-of-column?" + $.param({
|
||||
"/command/core/guess-types-of-column?" + $.param({
|
||||
project: theProject.id,
|
||||
columnName: this._column.name,
|
||||
service: this._service.url
|
||||
@ -271,7 +271,7 @@ ReconStandardServicePanel.prototype.start = function() {
|
||||
}
|
||||
);
|
||||
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"reconcile",
|
||||
{},
|
||||
{
|
||||
|
@ -69,7 +69,7 @@
|
||||
},
|
||||
|
||||
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) {
|
||||
newwin.opener = window;
|
||||
@ -80,7 +80,7 @@
|
||||
window.location.reload();
|
||||
} else {
|
||||
$.ajax({
|
||||
url: "/command/check-authorization/" + provider,
|
||||
url: "/command/core/check-authorization/" + provider,
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
window.user = data;
|
||||
@ -105,7 +105,7 @@
|
||||
|
||||
signout : function(success,provider) {
|
||||
$.ajax({
|
||||
url: "/command/deauthorize/" + provider,
|
||||
url: "/command/core/deauthorize/" + provider,
|
||||
success: function() {
|
||||
if (typeof success == 'undefined') {
|
||||
window.location.reload();
|
||||
|
@ -303,7 +303,7 @@ DataTableCellUI.prototype._searchForMatch = function(suggestOptions) {
|
||||
DataTableCellUI.prototype._postProcessOneCell = function(command, params, bodyParams, columnStatsChanged) {
|
||||
var self = this;
|
||||
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
command,
|
||||
params,
|
||||
bodyParams,
|
||||
@ -324,7 +324,7 @@ DataTableCellUI.prototype._postProcessOneCell = function(command, params, bodyPa
|
||||
};
|
||||
|
||||
DataTableCellUI.prototype._postProcessSeveralCells = function(command, params, bodyParams, columnStatsChanged) {
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
command,
|
||||
params,
|
||||
bodyParams,
|
||||
@ -410,7 +410,7 @@ DataTableCellUI.prototype._startEdit = function(elmt) {
|
||||
MenuSystem.dismissAll();
|
||||
|
||||
if (applyOthers) {
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"mass-edit",
|
||||
{},
|
||||
{
|
||||
@ -425,7 +425,7 @@ DataTableCellUI.prototype._startEdit = function(elmt) {
|
||||
{ cellsChanged: true }
|
||||
);
|
||||
} else {
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"edit-one-cell",
|
||||
{
|
||||
row: self._rowIndex,
|
||||
|
@ -280,7 +280,7 @@ DataTableView.prototype._renderDataTable = function(table) {
|
||||
.click(function() {
|
||||
var newStarred = !row.starred;
|
||||
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"annotate-one-row",
|
||||
{ row: row.i, starred: newStarred },
|
||||
null,
|
||||
@ -301,7 +301,7 @@ DataTableView.prototype._renderDataTable = function(table) {
|
||||
.click(function() {
|
||||
var newFlagged = !row.flagged;
|
||||
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"annotate-one-row",
|
||||
{ row: row.i, flagged: newFlagged },
|
||||
null,
|
||||
@ -471,33 +471,33 @@ DataTableView.prototype._createMenuForAllColumns = function(elmt) {
|
||||
{
|
||||
label: "Star Rows",
|
||||
click: function() {
|
||||
Gridworks.postProcess("annotate-rows", { "starred" : "true" }, null, { rowMetadataChanged: true });
|
||||
Gridworks.postCoreProcess("annotate-rows", { "starred" : "true" }, null, { rowMetadataChanged: true });
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "Unstar Rows",
|
||||
click: function() {
|
||||
Gridworks.postProcess("annotate-rows", { "starred" : "false" }, null, { rowMetadataChanged: true });
|
||||
Gridworks.postCoreProcess("annotate-rows", { "starred" : "false" }, null, { rowMetadataChanged: true });
|
||||
}
|
||||
},
|
||||
{},
|
||||
{
|
||||
label: "Flag Rows",
|
||||
click: function() {
|
||||
Gridworks.postProcess("annotate-rows", { "flagged" : "true" }, null, { rowMetadataChanged: true });
|
||||
Gridworks.postCoreProcess("annotate-rows", { "flagged" : "true" }, null, { rowMetadataChanged: true });
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "Unflag Rows",
|
||||
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",
|
||||
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",
|
||||
"click" : function() {
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"reorder-rows",
|
||||
null,
|
||||
{ "sorting" : JSON.stringify(self._sorting) },
|
||||
|
@ -1,6 +1,6 @@
|
||||
DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
var doTextTransform = function(expression, onError, repeat, repeatCount) {
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"text-transform",
|
||||
{
|
||||
columnName: column.name,
|
||||
@ -54,7 +54,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
};
|
||||
|
||||
var doFillDown = function() {
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"fill-down",
|
||||
{
|
||||
columnName: column.name
|
||||
@ -65,7 +65,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
};
|
||||
|
||||
var doBlankDown = function() {
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"blank-down",
|
||||
{
|
||||
columnName: column.name
|
||||
@ -78,7 +78,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
var doJoinMultiValueCells = function() {
|
||||
var separator = window.prompt("Enter separator to use between values", ", ");
|
||||
if (separator !== null) {
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"join-multi-value-cells",
|
||||
{
|
||||
columnName: column.name,
|
||||
@ -94,7 +94,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
var doSplitMultiValueCells = function() {
|
||||
var separator = window.prompt("What separator currently separates the values?", ",");
|
||||
if (separator !== null) {
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"split-multi-value-cells",
|
||||
{
|
||||
columnName: column.name,
|
||||
@ -194,7 +194,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
ignoreBlankCells: elmts.ignoreBlankCellsCheckbox[0].checked
|
||||
};
|
||||
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"transpose-columns-into-rows",
|
||||
config,
|
||||
null,
|
||||
@ -254,7 +254,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
rowCount: rowCount
|
||||
};
|
||||
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"transpose-rows-into-columns",
|
||||
config,
|
||||
null,
|
||||
|
@ -19,7 +19,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
return;
|
||||
}
|
||||
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"add-column",
|
||||
{
|
||||
baseColumnName: column.name,
|
||||
@ -51,7 +51,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
columnIndex,
|
||||
o.rowIndices,
|
||||
function(extension) {
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"extend-data",
|
||||
{
|
||||
baseColumnName: column.name,
|
||||
@ -67,7 +67,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
};
|
||||
|
||||
var doRemoveColumn = function() {
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"remove-column",
|
||||
{
|
||||
columnName: column.name
|
||||
@ -80,7 +80,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
var doRenameColumn = function() {
|
||||
var newColumnName = window.prompt("Enter new column name", column.name);
|
||||
if (newColumnName !== null) {
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"rename-column",
|
||||
{
|
||||
oldColumnName: column.name,
|
||||
@ -93,7 +93,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
};
|
||||
|
||||
var doMoveColumnTo = function(index) {
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"move-column",
|
||||
{
|
||||
columnName: column.name,
|
||||
@ -105,7 +105,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
};
|
||||
|
||||
var doMoveColumnBy = function(change) {
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"move-column",
|
||||
{
|
||||
columnName: column.name,
|
||||
@ -169,7 +169,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
config.fieldLengths = JSON.stringify(lengths);
|
||||
}
|
||||
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"split-column",
|
||||
config,
|
||||
null,
|
||||
|
@ -4,7 +4,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
};
|
||||
|
||||
var doReconDiscardJudgments = function() {
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"recon-discard-judgments",
|
||||
{ columnName: column.name },
|
||||
null,
|
||||
@ -13,7 +13,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
};
|
||||
|
||||
var doReconMatchBestCandidates = function() {
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"recon-match-best-candidates",
|
||||
{ columnName: column.name },
|
||||
null,
|
||||
@ -22,7 +22,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
};
|
||||
|
||||
var doReconMarkNewTopics = function(shareNewTopics) {
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"recon-mark-new-topics",
|
||||
{ columnName: column.name, shareNewTopics: shareNewTopics },
|
||||
null,
|
||||
@ -56,7 +56,7 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
||||
function(o) {
|
||||
var types = "result" in o ? o.result.type : [];
|
||||
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"recon-match-specific-topic-to-cells",
|
||||
{
|
||||
columnName: column.name,
|
||||
|
@ -15,7 +15,7 @@ HistoryWidget.prototype.resize = function() {
|
||||
HistoryWidget.prototype.update = function(onDone) {
|
||||
var self = this;
|
||||
Ajax.chainGetJSON(
|
||||
"/command/get-history?" + $.param({ project: theProject.id }), null,
|
||||
"/command/core/get-history?" + $.param({ project: theProject.id }), null,
|
||||
function(data) {
|
||||
self._data = data;
|
||||
self._render();
|
||||
@ -100,7 +100,7 @@ HistoryWidget.prototype._render = function() {
|
||||
HistoryWidget.prototype._onClickHistoryEntry = function(evt, entry, lastDoneID) {
|
||||
var self = this;
|
||||
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"undo-redo",
|
||||
{ lastDoneID: lastDoneID },
|
||||
null,
|
||||
@ -111,7 +111,7 @@ HistoryWidget.prototype._onClickHistoryEntry = function(evt, entry, lastDoneID)
|
||||
HistoryWidget.prototype._extractOperations = function() {
|
||||
var self = this;
|
||||
$.getJSON(
|
||||
"/command/get-operations?" + $.param({ project: theProject.id }),
|
||||
"/command/core/get-operations?" + $.param({ project: theProject.id }),
|
||||
null,
|
||||
function(data) {
|
||||
if ("entries" in data) {
|
||||
@ -218,7 +218,7 @@ HistoryWidget.prototype._showApplyOperationsDialog = function() {
|
||||
return;
|
||||
}
|
||||
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"apply-operations",
|
||||
{},
|
||||
{ operations: JSON.stringify(json) },
|
||||
|
@ -45,7 +45,7 @@ ProcessWidget.prototype.update = function(updateOptions, onDone) {
|
||||
|
||||
var self = this;
|
||||
Ajax.chainGetJSON(
|
||||
"/command/get-processes?" + $.param({ project: theProject.id }), null,
|
||||
"/command/core/get-processes?" + $.param({ project: theProject.id }), null,
|
||||
function(data) {
|
||||
self._latestHistoryEntry = null;
|
||||
self._render(data);
|
||||
@ -72,7 +72,7 @@ ProcessWidget.prototype.showUndo = function(historyEntry) {
|
||||
|
||||
ProcessWidget.prototype.undo = function() {
|
||||
if (this._latestHistoryEntry !== null) {
|
||||
Gridworks.postProcess(
|
||||
Gridworks.postCoreProcess(
|
||||
"undo-redo",
|
||||
{ undoID: this._latestHistoryEntry.id },
|
||||
null,
|
||||
@ -84,7 +84,7 @@ ProcessWidget.prototype.undo = function() {
|
||||
ProcessWidget.prototype._cancelAll = function() {
|
||||
var self = this;
|
||||
$.post(
|
||||
"/command/cancel-processes?" + $.param({ project: theProject.id }),
|
||||
"/command/core/cancel-processes?" + $.param({ project: theProject.id }),
|
||||
null,
|
||||
function(o) {
|
||||
self._data = null;
|
||||
|
Loading…
Reference in New Issue
Block a user