Skip to content

Commit

Permalink
V1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanopog committed May 24, 2019
1 parent 62baf0b commit 6970436
Show file tree
Hide file tree
Showing 17 changed files with 483 additions and 100 deletions.
92 changes: 86 additions & 6 deletions .gitignore
@@ -1,8 +1,88 @@
getDocuments/icons/.DS_Store
getDocuments/.DS_Store
database/icons/.DS_Store
database/.DS_Store
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# .eslintrc.js

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/
.DS_Store
.vscode/*
.gitignore
.project

# .vscode/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/
14 changes: 14 additions & 0 deletions .vscode/launch.json
@@ -0,0 +1,14 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${file}"
}
]
}
2 changes: 2 additions & 0 deletions .vscode/settings.json
@@ -0,0 +1,2 @@
{
}
5 changes: 5 additions & 0 deletions README.md
Expand Up @@ -19,6 +19,11 @@ As such, it assumes that the **dominodb nodeJS package** is already installed [
Full documentation, including sample NodeRed flows using these nodes, is available [here](https://stefanopog.github.io/node-red-contrib-dominodb-docs/).

# **Changes**
### V 1.2.0 Compute Options
* This version introduces support for the **Compute Options** options when appropriate. You can use this new feature <strong style="color:red">ONLY with V1.0.1 of the AppDev pack, both on the client and on the server</strong>.
The option is **only available** via the nodes Configuration panels (no support in the incoming <code>msg. ...</code> attributes).
* Few cosmetic enhancements and documentation fixes

### V 1.0.1 Bug Fixing
Fixing a bug that prevented the Configuration Node to work with UNsecure Domino Servers.

Expand Down
60 changes: 48 additions & 12 deletions createDocuments/createDocuments.html
Expand Up @@ -18,6 +18,14 @@
value: "",
required: false
},
computeWithForm: {
value: true,
required: false
},
ignoreComputeErrors: {
value: false,
required: false
},
onError: {
value: "ON_ERROR_CONTINUE",
required: true
Expand All @@ -34,9 +42,31 @@
},
paletteLabel: "Create Documents",
align: "left",
oneditprepare: function() {}
oneditprepare: function() {
_D10_createDocumentsPrepare();
}
}
);
function _D10_createDocumentsPrepare() {
if ((this.computeWithForm === undefined) || (this.computeWithForm === null)) {
this.computeWithForm = true;
document.querySelector("#node-input-computeWithForm").value = true;
document.querySelector("#node-input-computeWithForm").checked = true;
}
if ((this.ignoreComputeErrors === undefined) || (this.ignoreComputeErrors === null)) {
this.ignoreComputeErrors = false;
document.querySelector("#node-input-ignoreComputeErrors").value = false;
document.querySelector("#node-input-ignoreComputeErrors").checked = false;
}
_D10_createDocumentsComputeWithForm();
};
function _D10_createDocumentsComputeWithForm() {
if (document.querySelector("#node-input-computeWithForm").checked) {
document.querySelector("#ignoreComputeErrors").style.display = "block";
} else {
document.querySelector("#ignoreComputeErrors").style.display = "none";
}
};
</script>

<script type="text/x-red" data-template-name="D10_createDocuments">
Expand All @@ -45,21 +75,31 @@
<input type="text" id="node-input-application">
</div>

<div id="_itemValuesById" style="display:none">
<br />
<hr style="margin:5px; border-color:black"/>
<div id="_computeOptionsCreateDocuments">
<div class="form-row">
<label for="node-input-itemValuesById" style="width:100px"><i class="fa fa-th-list"></i> Item Values by ID</label>
<input type="text" id="node-input-itemValuesById" placeholder="comma-separated list of itemName=itemValue pairs with IDs">
<label for="node-input-computeWithForm" style="width:40%"><i class="fa fa-check"></i> Compute With Form</label>
<input style="display: inline-block; width: auto; vertical-align: top;" type="checkbox" name="computeWithForm" id="node-input-computeWithForm" onchange="_D10_createDocumentsComputeWithForm()"></input>
</div>
<div class="form-row" id="ignoreComputeErrors">
<label for="node-input-ignoreComputeErrors" style="width:40%"><i class="fa fa-check"></i> Ignore Compute Errors</label>
<input style="display: inline-block; width: auto; vertical-align: top;" type="checkbox" name="ignoreComputeErrors" id="node-input-ignoreComputeErrors"></input>
</div>
</div>

<div class="form-row">
<label for="node-input-onError" style="width:100px"><i class="fa fa-stop-circle"></i> OnError</label>
<label for="node-input-onError"><i class="fa fa-stop-circle"></i> OnError</label>
<select id="node-input-onError">
<option value="ON_ERROR_CONTINUE">Continue...</option>
<option value="ON_ERROR_ABORT_REMAINING">Abort...</option>
</select>
</div>

<br />
<hr style="margin:5px; border-color:black"/>
<br />

<div class="form-row">
<label for="node-input-name" style="width:100px"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
Expand Down Expand Up @@ -98,13 +138,9 @@ <h3>Inputs</h3>
...
</pre>
<br />
This attribute is <strong>only cosidered</strong> if the operation is <code>delete documents by unids</code> or <code>delete items by unids</code>.
In these situations, the attribute provides replacement values that apply to each document as specified by the <code>'@unid'</code> attribute.
<br /><br />
<strong>Note : </strong>If any of the objects in the array <strong>does not</strong> provide the <code>'@unid'</code> attribute, the operation
will fail.
<br /><br />
<strong>Note : </strong>If this attribute is not present when required, the operation will fail.
<br />
<strong>Note : </strong>You <strong style="color:red">do NOT</strong> need to specify the `['@unid']` attribute because it is going to be created by the operation.
</dd>
<h3>Outputs</h3>
<dl class="message-properties">
Expand Down
10 changes: 10 additions & 0 deletions createDocuments/createDocuments.js
Expand Up @@ -62,6 +62,16 @@ module.exports = function(RED) {
bulkCmdConfig.documents = itemValuesById;
bulkCmdConfig.onErrorOptions = config.onError;
//
// Deal with "computeWithForm"
//
if (config.computeWithForm) {
bulkCmdConfig.computeOptions = {};
bulkCmdConfig.computeOptions.computeWithForm = true;
if (config.ignoreComputeErrors) {
bulkCmdConfig.computeOptions.ignoreComputeErrors = true;
}
}
//
// Preparing
//
const serverConfig = node.application.getServerConfig();
Expand Down
75 changes: 63 additions & 12 deletions deleteDocuments/deleteDocuments.html
Expand Up @@ -81,6 +81,14 @@
value: "",
required: false
},
computeWithForm: {
value: true,
required: false
},
ignoreComputeErrors: {
value: false,
required: false
},
onError: {
value: "ON_ERROR_CONTINUE",
required: true
Expand All @@ -102,25 +110,39 @@
paletteLabel: "Delete Docs/Items",
align: "left",
oneditprepare: function() {
if (document.querySelector('#node-input-displayResults').value === '') {
$('#node-input-displayResults').val('Default');
}
_D10_updateQueryOrId_delete();
_D10_updateDocumentsOrItems_delete();
_D10_defaultOptions_delete();
_D10_selectDisplayResults_delete();
_D10_deleteDocumentsPrepare();
}
}
);
function _D10_deleteDocumentsPrepare() {
if ((this.computeWithForm === undefined) || (this.computeWithForm === null)) {
this.computeWithForm = true;
document.querySelector("#node-input-computeWithForm").value = true;
document.querySelector("#node-input-computeWithForm").checked = true;
}
if ((this.ignoreComputeErrors === undefined) || (this.ignoreComputeErrors === null)) {
this.ignoreComputeErrors = false;
document.querySelector("#node-input-ignoreComputeErrors").value = false;
document.querySelector("#node-input-ignoreComputeErrors").checked = false;
}
if (document.querySelector('#node-input-displayResults').value === '') {
$('#node-input-displayResults').val('Default');
}
_D10_updateQueryOrId_delete();
_D10_updateDocumentsOrItems_delete();
_D10_defaultOptions_delete();
_D10_selectDisplayResults_delete();
_D10_deleteDocumentsComputeWithForm();
};
function _D10_updateQueryOrId_delete() {
switch (document.querySelector("#node-input-queryOrId").value) {
case 'query' :
document.querySelector("#_byQuery").style.display = "inline";
document.querySelector("#_byQuery").style.display = "block";
document.querySelector("#_byDocunids").style.display = "none";
break;
case 'ids' :
document.querySelector("#_byQuery").style.display = "none";
document.querySelector("#_byDocunids").style.display = "inline";
document.querySelector("#_byDocunids").style.display = "block";
break;
default:
document.querySelector("#_byQuery").style.display = "none";
Expand All @@ -133,12 +155,15 @@
switch (document.querySelector("#node-input-documentsOrItems").value) {
case 'documents' :
document.querySelector("#_byItems").style.display = "none";
document.querySelector("#_computeOptionsDeleteDocuments").style.display = "none";
break;
case 'items' :
document.querySelector("#_byItems").style.display = "inline";
document.querySelector("#_byItems").style.display = "block";
document.querySelector("#_computeOptionsDeleteDocuments").style.display = "block";
break;
default :
document.querySelector("#_byItems").style.display = "none";
document.querySelector("#_computeOptionsDeleteDocuments").style.display = "none";
break;
}
};
Expand All @@ -164,6 +189,13 @@
break;
}
};
function _D10_deleteDocumentsComputeWithForm() {
if (document.querySelector("#node-input-computeWithForm").checked) {
document.querySelector("#ignoreComputeErrors").style.display = "block";
} else {
document.querySelector("#ignoreComputeErrors").style.display = "none";
}
};
</script>

<script type="text/x-red" data-template-name="D10_deleteDocuments">
Expand Down Expand Up @@ -255,6 +287,19 @@
</div>
</div>

<br />
<hr style="margin:5px; border-color:black"/>
<div id="_computeOptionsDeleteDocuments">
<div class="form-row">
<label for="node-input-computeWithForm" style="width:40%"><i class="fa fa-check"></i> Compute With Form</label>
<input style="display: inline-block; width: auto; vertical-align: top;" type="checkbox" name="computeWithForm" id="node-input-computeWithForm" onchange="_D10_deleteDocumentsComputeWithForm()"></input>
</div>
<div class="form-row" id="ignoreComputeErrors">
<label for="node-input-ignoreComputeErrors" style="width:40%"><i class="fa fa-check"></i> Ignore Compute Errors</label>
<input style="display: inline-block; width: auto; vertical-align: top;" type="checkbox" name="ignoreComputeErrors" id="node-input-ignoreComputeErrors"></input>
</div>
</div>

<div class="form-row">
<label for="node-input-onError"><i class="fa fa-stop-circle"></i> OnError</label>
<select id="node-input-onError">
Expand All @@ -263,6 +308,10 @@
</select>
</div>

<br />
<hr style="margin:5px; border-color:black"/>
<br />

<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
Expand Down Expand Up @@ -296,13 +345,15 @@
The <b>Selectors</b> in the Configuration Panel or the <code>msg.DDB_queryOrId</code> and <code>msg.DDB_documentsOrItems</code> input parameters allow
to properly select the behavior.
<br />
When a <strong>DQL Query</strong> is selected, the operation can affec:
When a <strong>DQL Query</strong> is selected, the operation can affect many records. The number of records can be controlled by the <strong>displayResults</strong>
selector (or by the <code>msg.DDB_displayResults</code> input parameter) as follows:
<ul>
<li>the <strong>Default</strong> number of Documents (as specified by the API)
</li>
<li><strong>All</strong> the documents matching the query
</li>
<li>a <strong>subset</strong> of Documents specified by the <code>start</code> and <code>count</code> parameters
<li>a <strong>subset</strong> of Documents specified by the <code>msg.DDB_startValue</code> and <code>msg.DDB_countValue</code> parameters (or the euqivalent
Configuration Panel inputs)
</li>
</ul>
</p>
Expand Down

0 comments on commit 6970436

Please sign in to comment.