@energyweb/node-red-contrib-green-proof-worker
Version:
55 lines (50 loc) • 1.73 kB
HTML
<script type="text/javascript">
RED.nodes.registerType('sqlite-inject',{
category: 'Generic Green Proofs',
color: '#B28CFF',
icon: 'ewf-logo.svg',
defaults: {
name: { value: "" },
sqliteConfig: { value:"", type: "sqlite-config", required: false },
},
inputs: 1,
outputs: 1,
labelStyle: 'ggp-label-style',
paletteLabel: 'SQLite inject',
label: function() {
return this.name || 'SQLite inject';
}
});
</script>
<script type="text/html" data-template-name="sqlite-inject">
<div class="form-row">
<label for="node-input-sqliteConfig"><i class="fa fa-bookmark"></i> SQLite config (defaults to first found SQLite config)</label>
<input type="text" id="node-input-sqliteConfig">
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
</script>
<script type="text/html" data-help-name="sqlite-inject">
<p>
Injects SQLite database access using SQLite config node from GGP palette.
Database access is injected as `msg.payload.sqlite`, and is a promise that resolves to actual database.
After resolving the promise, Kysely syntax can be used directly on it: `msg.payload.sqlite.then(db => db.selectFrom(...)).catch(node.error)`.
Kysely `sql` function is available through `msg.payload.kyselySql`.
</p>
</script><style>.ggp-label-style {
/** Text color */
/* fill: #fff; */
}
.red-ui-flow-node-icon-group:has(~ .ggp-label-style) {
image {
width: 15px;
height: 15px;
x: 9px;
y: 7.5px;
}
}
.red-ui-flow-node:has(~ .ggp-label-style) {
stroke-width: 0;
}</style>