Guide on setting up a configuration node in Node-RED

I am attempting to create a config node similar to this example, but it only displays a text box and not the configuration options. I want the projectid to be a config node, and despite trying various nodes with config setups, nothing seems to work for me. How can I resolve this issue?

graphql_query.js

module.exports = function(RED) {
    function netpie_graphql_query(nodeConfig) {
        RED.nodes.createNode(this,nodeConfig);
        var node = this;
        node.on('input', function(msg) {
            var gqlquery = nodeConfig.gqlquery;

            nodeConfig.projectid = RED.nodes.getNode(nodeConfig.projectid).projectid;

            const axios = require('axios');
            let data = JSON.stringify({
            query: gqlquery,
            variables: {}
            });

            let axiosConfig = {
            method: 'post',
            maxBodyLength: Infinity,
            url: 'http://gqlv2.aaaaa.io/',
            headers: { 
                'Authorization': 'bearer '+auth.token, 
                'Content-Type': 'application/json'
            },
            data : data
            };

            axios.request(axiosConfig)
            .then((response) => {
            data = (JSON.stringify(response.data));
            msg.payload = data;
            node.send(msg);
            })
            .catch((error) => {
            //console.log(error);
            this.error("Request failed with status code 400, please check your schema");
            });
        });
    }
    RED.nodes.registerType("netpie_graphql_query",netpie_graphql_query);
}

graphql_query.html

    RED.nodes.registerType('netpie_graphql_query',{
        category: 'graphql',
        color:'#00adff',
        defaults:{

            projectid:{value:"", type:"projectid"},

            name:{value:""},
            gqlquery:{value:""}

        },
        inputs:1,
        outputs:1,
        icon:"template.svg",
        label:function(){
            return this.name||"netpie graphql";
        },
        oneditprepare: function() {
            this.editor = RED.editor.createEditor({
            id: 'gqlquery-message-editor',
            mode: 'ace/mode/text',
            value: $("#node-input-gqlquery").val()
        });
        },
        oneditsave: function() {
            $("#node-input-gqlquery").val(this.editor.getValue());
            this.editor.destroy();
            delete this.editor;
        },
        oneditcancel: function() {
            this.editor.destroy();
            delete this.editor;
        }
            
    });
    </script>

    <script type="text/html" data-template-name="netpie_graphql_query">
        <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>

...

but projectid is not config node https://i.sstatic.net/cwbLB.png

Answer №1

The issue was resolved after I included the configuration node in package.json.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Hide the Select Column from the material-react-table

Can someone help me with hiding specific columns in the material-react-table component? I've searched the documentation but couldn't find any relevant information. import { useMemo, useState } from "react"; import { MaterialReactTable } ...

error detection in AJAX response handler

My web-application was created using PHP, AJAX, and jQuery, and the development process went smoothly. The majority of the requests to the application are made via AJAX for operations such as insert, update, delete, and select. I have already implemented ...

Error message: The Liferay JavaScript Function has not been defined

I am a newcomer to Liferay and have been attempting to utilize Ajax within my scripts, but unfortunately, the code does not seem to load correctly in the browser. I even tried testing it by simply adding an alert. Every time I try, I encounter the "functi ...

Join the geomarkers in two datasets using connecting lines

I am currently developing a leaflet.js map incorporating two distinct sets of JSON data layers stored as js-files. The first dataset comprises the geographical locations of various newsrooms along with their respective IDs, while the second dataset contai ...

Using the spread operator to modify an array containing objects

I am facing a challenge with updating specific properties of an object within an array. I have an array of objects and I need to update only certain properties of a single object in that array. Here is the code snippet I tried: setRequiredFields(prevRequir ...

The timestamp will display a different date and time on the local system if it is generated using Go on AWS

My angular application is connected to a REST API built with golang. I have implemented a todo list feature where users can create todos for weekly or monthly tasks. When creating a todo, I use JavaScript to generate the first timestamp and submit it to th ...

access pictures from a different directory using JavaScript

I am working with an images array that contains three jpg files. I am trying to set the background image of a class called pic using images from the array. The issue I'm facing is that the images are stored in an images folder with the URL images/. I ...

Three.js Pin Placement for Clothing

I am in need of assistance! I am currently working on a simulation involving a cloth that is attached to four corners. I am attempting to reposition the pins at coordinates 0, 10, 88, 98 within a 10x10 array. My goal is to place each pin at a different pos ...

Having trouble with publishing to npm as public with the --access flag not functioning properly?

When trying to publish a fresh scoped package on NPM using the command npm publish --access public, I encountered the following error: ole@mki:~/cli$ npm publish --access public npm ERR! publish Failed PUT 403 npm ERR! code E403 npm ERR! F ...

Identify and react to an unexpected termination of an ajax upload process

My ajax uploading code can determine if a file was successfully uploaded only after the upload has completed. If the upload is terminated before completion, no data is returned. Is there a way to detect when an upload is unexpectedly terminated and alert t ...

Unable to successfully update DIV content in JavaScript due to incorrect file path specified

I came across this code online and it seems to be functioning properly. However, no matter what name I give the file that is supposed to load into the DIV, I consistently receive an error message stating "Object was not found." What specific steps do I nee ...

Neglecting specific packages in package-lock.json

Currently facing a perplexing dilemma with no clear solution in sight. In our ongoing project, we rely on npm for package management. Although we haven't been utilizing package-lock.json file lately, the need to reintroduce it has emerged. The issue ...

Emulate an AngularJS ng-click action

My website has HTML code with three buttons: <button ng-click='showStats(player.data,0)'>Death Match</button> <button ng-click='showStats(player.data,1)'>Champions Rumble</button> <button ng-click='sho ...

when webpack loads the bundle.js file, the mime type is converted to text/html

I'm currently working on implementing server side rendering for an application using react-redux and express for the server. We are also utilizing webpack to bundle our assets. To get started, I referred to the following documentation: https://redux ...

What is the best way to connect a relative CSS stylesheet to a master page?

My Java application generates several HTML pages, organized in different directories: html_pages/ | ----> landin_page.html html_pages/details | ----> index1.html html_pages/more_details | ----> index2.html html_pages/css | ...

The hit detection algorithm seems to be malfunctioning, and the reason behind it is unclear. (Using Javascript/Processing

I am a beginner in game programming and programming in general. In the past, I have created a clone of "Flappy Bird" and some other games using the hit detection algorithm from the Mozilla Developer Network here. Currently, I am facing an issue while tryi ...

What is the best way to dynamically validate the fields and generate an array?

Currently in my Angular application, I've successfully implemented a pivot table using pivot.js. Now, I am faced with the task of loading all the indexes from elastic search whenever the user switches the index. Once the index is changed, the corresp ...

What is the best way to output information to a webpage using json_encode in PHP?

I've implemented a button on my webpage that triggers a database call using ajax, so the page can dynamically display the data without requiring a refresh. Oddly, when I click the button and inspect the source and network tab, everything seems to be f ...

Can a client-side React component or application be hosted on a server-side Express route?

Currently, I have a Node/Express backend that utilizes Pug.js to render various server-side routes for a basic, static website. In React.js, I have developed an interactive "builder" component through CRA, enabling visitors to configure products interacti ...

Is it necessary for TypeScript classes that are intended for use by other classes to be explicitly exported and imported?

Is it necessary to explicitly export and import all classes intended for use by other classes? After upgrading my project from Angular 8 to Angular 10, I encountered errors that were not present before. These issues may be attributed to poor design or a m ...