Skip to content

Commit

Permalink
#208 removing cts query blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
sashamitrovich committed Jun 29, 2020
1 parent 92623ca commit b4331b9
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 331 deletions.
143 changes: 0 additions & 143 deletions ml-backend/src/main/ml-modules/root/custom-modules/pipes/core.sjs
Original file line number Diff line number Diff line change
Expand Up @@ -428,27 +428,6 @@ function init (LiteGraph) {
}


},
{
"functionName": "fn_collection",
"blockName": "collection",
"library": "Query",
"inputs": [
{
name: "collectionName",
type: "xs:string"
}
],
"outputs": [
{
"name": "docs",
"type": "node()*"
}
],
"function": {
"ref": "fn.collection",
"code": null
}
},
{
"functionName": "fn_baseUri",
Expand Down Expand Up @@ -513,82 +492,6 @@ function init (LiteGraph) {
"code": null
}
},
{
"functionName": "cts_andQuery",
"blockName": "andQuery",
"library": "Query",
"inputs": [
{
name: "query1",
type: "cts:query"
},
{
name: "query2",
type: "cts:query"
},
{
name: "query3",
type: "cts:query"
},
{
name: "query4",
type: "cts:query"
}
],
"outputs": [
{
"name": "query",
"type": "cts:query"
}
],
"function": {
"ref": null,
"code": "let queries = [];" +
" if(this.getInputData(0)!=undefined) queries.push(this.getInputData(0));" +
" if(this.getInputData(1)!=undefined) queries.push(this.getInputData(1));" +
" if(this.getInputData(2)!=undefined) queries.push(this.getInputData(2));" +
" if(this.getInputData(3)!=undefined) queries.push(this.getInputData(3));" +
" this.setOutputData( 0, cts.andQuery(queries));"
}
},
{
"functionName": "cts_orQuery",
"blockName": "orQuery",
"library": "Query",
"inputs": [
{
name: "query1",
type: "cts:query"
},
{
name: "query2",
type: "cts:query"
},
{
name: "query3",
type: "cts:query"
},
{
name: "query4",
type: "cts:query"
}
],
"outputs": [
{
"name": "query",
"type": "cts:query"
}
],
"function": {
"ref": null,
"code": "let queries = [];" +
" if(this.getInputData(0)!=undefined) queries.push(this.getInputData(0));" +
" if(this.getInputData(1)!=undefined) queries.push(this.getInputData(1));" +
" if(this.getInputData(2)!=undefined) queries.push(this.getInputData(2));" +
" if(this.getInputData(3)!=undefined) queries.push(this.getInputData(3));" +
" this.setOutputData( 0, cts.orQuery(queries));"
}
},
{
"functionName": "cts_search",
"blockName": "search",
Expand Down Expand Up @@ -638,28 +541,6 @@ function init (LiteGraph) {
"code": null
}
},
{
"functionName": "cts_collectionQuery",
"blockName": "collectionQuery",
"library": "Query",
"inputs": [
{
name: "collectionName",
type: "xs:string"
}
],
"outputs": [
{
"name": "query",
"type": "cts:query"
}
],
"function": {
"ref": "cts.collectionQuery",
"code": null
}
},

{
"functionName": "toEnvelope",
"blockName": "to Envelope",
Expand Down Expand Up @@ -900,30 +781,6 @@ function init (LiteGraph) {

LiteGraph.registerNodeType("Generate/constant", StringConstant);

function featureLookupBlock () {
this.addInput("var1");
this.addInput("var2");
this.nbOutputValues = this.addWidget("text", "nbOutputValues", "string", function (v) { }, {});
console.log("this.nbOutputValues = " + this.nbOutputValues.value)
this.database = this.addWidget("text", "database", "string", function (v) { }, {});
const OUTPUTS = 20;
for (var vp = 0; vp < OUTPUTS; vp++) {
var varName = 'value' + vp + 'Path'
this[varName] = this.addWidget("text", "nbOutputValues", "", function (v) { }, {});
this.addOutput("val" + vp);
}

}
featureLookupBlock.title = "Lookup";

featureLookupBlock.prototype.onExecute = function () {
let var1 = this.getInputData(0);
let var2 = this.getInputData(1);
coreFunctions.lookUp(this, var1, var2, this.nbOutputValues.value, this.properties.ctsQuery)
}

LiteGraph.registerNodeType("Query/Lookup", featureLookupBlock);

/*
featureLookupByValueBlock
*/
Expand Down
3 changes: 1 addition & 2 deletions src/components/liteGraphHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ const blockMapping = new Map([
["date/FormatDateAuto", FORMAT + "/FormatDateAuto"],
["date/FormatDate", FORMAT + "/FormatDate"],
["date/FormatDateTimeAuto", FORMAT + "/FormatDateTimeAuto"],
["feature/LookupCollectionPropertyValue", FIND + "/LookupByValue"],
["feature/Lookup", FIND + "/Lookup"]
["feature/LookupCollectionPropertyValue", FIND + "/LookupByValue"]
]);


Expand Down
186 changes: 0 additions & 186 deletions src/statics/library/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,29 +381,6 @@
"code": null
}
},
{
"functionName": "fn_collection",
"blockName": "collection",
"title": "Documents from Collection",
"description": "Loads documents from a specific database collection",
"library": "Query",
"inputs": [
{
"name": "collectionName",
"type": "xs:string"
}
],
"outputs": [
{
"name": "docs",
"type": "node()*"
}
],
"function": {
"ref": "fn.collection",
"code": null
}
},
{
"functionName": "fn_baseUri",
"blockName": "baseUri",
Expand Down Expand Up @@ -721,76 +698,6 @@
"code": ""
}
},
{
"functionName": "Lookup",
"blockName": "Lookup",
"title": "Lookup",
"description": "Retrieves data from a document matching a query (double click block to configure)",
"library": "Query",
"events": {
"onConfigure": "let v = this.widgets[0].value;if (this.widgets.length == (parseInt(v) + 2)) return; this.widgets=this.widgets.slice(0,2);for (let x=0;x < v ;x++) {this.addWidget(\"text\", \"value\" + x + \"Path\" , this.widgets_values[x+2], function (v) {})};return;",
"beforePropSave": "validation.override = true; return ctx.validateCtsQuery(v)"
},
"inputs": [
{
"name": "var1",
"type": null
},
{
"name": "var2",
"type": null
}
],
"properties": [
{
"name": "ctsQuery",
"type": "cts.collectionQuery(\"${var1}\")"
},
{
"name": "editProp",
"type": "ctsQuery"
},
{
"name": "editWindowTitle",
"type": "Edit Query"
},
{
"name": "hoverText",
"type": "Double click block to edit the lookup query"
}
],
"widgets": [
{
"type": "text",
"name": "nbOutputValues",
"default": "1",
"values": "1",
"callback": "let nb = this.outputs.length;let vInt = parseInt(v); if (vInt < nb) {for (let i=0;i<(nb - vInt);i++){this.removeOutput(this.outputs.length-1);this.widgets.pop()}} else if (vInt > nb) { this.widgets=this.widgets.slice(0,2 + nb);for(let i=nb;i<vInt;i++) {this.addOutput('value' + i,null);this.addWidget(\"text\", \"value\" + i + \"Path\" , '', function (v) {})};}"
},
{
"type": "combo",
"name": "database",
"default": "#DATABASES#",
"values": []
},
{
"type": "text",
"name": "value0Path",
"default": "/path/to/value/string()",
"values": []
}
],
"outputs": [
{
"name": "value0",
"type": null
}
],
"function": {
"ref": null,
"code": ""
}
},
{
"functionName": "ExpertQueryBuilder",
"blockName": "ExpertQueryBuilder",
Expand Down Expand Up @@ -992,76 +899,6 @@
"code": null
}
},
{
"functionName": "cts_andQuery",
"blockName": "andQuery",
"library": "Query",
"description": "Builds a query using cts.Query",
"title": "cts.andQuery",
"inputs": [
{
"name": "query1",
"type": "cts:query"
},
{
"name": "query2",
"type": "cts:query"
},
{
"name": "query3",
"type": "cts:query"
},
{
"name": "query4",
"type": "cts:query"
}
],
"outputs": [
{
"name": "query",
"type": "cts:query"
}
],
"function": {
"ref": null,
"code": ""
}
},
{
"functionName": "cts_orQuery",
"blockName": "orQuery",
"library": "Query",
"title": "cts.orQuery",
"description": "Builds an or query",
"inputs": [
{
"name": "query1",
"type": "cts:query"
},
{
"name": "query2",
"type": "cts:query"
},
{
"name": "query3",
"type": "cts:query"
},
{
"name": "query4",
"type": "cts:query"
}
],
"outputs": [
{
"name": "query",
"type": "cts:query"
}
],
"function": {
"ref": null,
"code": ""
}
},
{
"functionName": "cts_search",
"blockName": "search",
Expand Down Expand Up @@ -1237,29 +1074,6 @@
"code": ""
}
},
{
"functionName": "cts_collectionQuery",
"blockName": "collectionQuery",
"title": "cts.collectionQuery",
"description": "cts.collectionQuery",
"library": "Query",
"inputs": [
{
"name": "collectionName",
"type": "xs:string"
}
],
"outputs": [
{
"name": "query",
"type": "cts:query"
}
],
"function": {
"ref": "cts.collectionQuery",
"code": null
}
},
{
"functionName": "JsonValidate",
"blockName": "JsonValidate",
Expand Down

0 comments on commit b4331b9

Please sign in to comment.