Allow template to be used when changed body blank

This commit is contained in:
Mel O'Hagan 2022-10-12 16:20:11 +01:00
parent 53475f1312
commit 9f60a6c485
2 changed files with 17 additions and 9 deletions

View File

@ -44,9 +44,12 @@
} }
function setEditorTemplate(fromKey, toKey, index) { function setEditorTemplate(fromKey, toKey, index) {
const currentValue = query.fields.steps[index].value.value
if ( if (
!currentValue ||
currentValue.toString().replace("\\s", "").length < 3 ||
schema.steps.filter(step => step.key === fromKey)[0]?.template === schema.steps.filter(step => step.key === fromKey)[0]?.template ===
query.fields.steps[index].value.value currentValue
) { ) {
query.fields.steps[index].value.value = schema.steps.filter( query.fields.steps[index].value.value = schema.steps.filter(
step => step.key === toKey step => step.key === toKey

View File

@ -138,11 +138,16 @@ const SCHEMA: Integration = {
{ {
key: "$geoNear", key: "$geoNear",
template: `{ template: `{
"near": { "type": "Point", "coordinates": [ -73.98142 , 40.71782 ] }, "near": {
"type": "Point",
"coordinates": [
-73.98142, 40.71782
]
},
"key": "location", "key": "location",
"distanceField": "dist.calculated", "distanceField": "dist.calculated",
"query": { "category": "Parks" } "query": { "category": "Parks" }
}` }`,
}, },
{ {
key: "$graphLookup", key: "$graphLookup",
@ -155,7 +160,7 @@ const SCHEMA: Integration = {
"maxDepth": 1, "maxDepth": 1,
"depthField": "", "depthField": "",
"restrictSearchWithMatch": {} "restrictSearchWithMatch": {}
}` }`,
}, },
{ {
key: "$group", key: "$group",
@ -186,7 +191,7 @@ const SCHEMA: Integration = {
"localField": "", "localField": "",
"foreignField": "", "foreignField": "",
"as": "" "as": ""
}` }`,
}, },
{ {
key: "$match", key: "$match",
@ -199,14 +204,14 @@ const SCHEMA: Integration = {
"on": "_id", "on": "_id",
"whenMatched": "replace", "whenMatched": "replace",
"whenNotMatched": "insert" "whenNotMatched": "insert"
}` }`,
}, },
{ {
key: "$out", key: "$out",
template: `{ template: `{
"db": "", "db": "",
"coll": "" "coll": ""
}` }`,
}, },
{ {
key: "$planCacheStats", key: "$planCacheStats",
@ -261,7 +266,7 @@ const SCHEMA: Integration = {
template: `{ template: `{
"coll": "", "coll": "",
"pipeline": [] "pipeline": []
}` }`,
}, },
{ {
key: "$unset", key: "$unset",
@ -273,7 +278,7 @@ const SCHEMA: Integration = {
"path": "", "path": "",
"includeArrayIndex": "", "includeArrayIndex": "",
"preserveNullAndEmptyArrays": true "preserveNullAndEmptyArrays": true
}` }`,
}, },
], ],
}, },