mirror of
				https://github.com/node-red/node-red-nodes.git
				synced 2025-03-01 10:37:43 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			89 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			89 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
 | 
						|
<script type="text/html" data-template-name="MySQLdatabase">
 | 
						|
    <div class="form-row">
 | 
						|
        <label for="node-config-input-host"><i class="fa fa-globe"></i> Host</label>
 | 
						|
        <input type="text" id="node-config-input-host">
 | 
						|
    </div>
 | 
						|
    <div class="form-row">
 | 
						|
        <label for="node-config-input-port"><i class="fa fa-random"></i> Port</label>
 | 
						|
        <input type="text" id="node-config-input-port">
 | 
						|
    </div>
 | 
						|
        <div class="form-row">
 | 
						|
        <label for="node-config-input-user"><i class="fa fa-user"></i> User</label>
 | 
						|
        <input type="text" id="node-config-input-user">
 | 
						|
    </div>
 | 
						|
        <div class="form-row">
 | 
						|
        <label for="node-config-input-pass"><i class="fa fa-lock"></i> Password</label>
 | 
						|
        <input type="password" id="node-config-input-password">
 | 
						|
    </div>
 | 
						|
    <div class="form-row">
 | 
						|
        <label for="node-config-input-db"><i class="fa fa-database"></i> Database</label>
 | 
						|
        <input type="text" id="node-config-input-db">
 | 
						|
    </div>
 | 
						|
    <div class="form-row">
 | 
						|
        <label for="node-config-input-tz"><i class="fa fa-clock-o"></i> Timezone</label>
 | 
						|
        <input type="text" id="node-config-input-tz">
 | 
						|
    </div>
 | 
						|
    <div class="form-row">
 | 
						|
        <label for="node-config-input-charset"><i class="fa fa-language"></i> Charset</label>
 | 
						|
        <input type="text" id="node-config-input-charset">
 | 
						|
    </div>
 | 
						|
    <div class="form-row">
 | 
						|
        <label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
 | 
						|
        <input type="text" id="node-config-input-name" placeholder="Name">
 | 
						|
    </div>
 | 
						|
</script>
 | 
						|
 | 
						|
<script type="text/javascript">
 | 
						|
    RED.nodes.registerType('MySQLdatabase',{
 | 
						|
        category: 'config',
 | 
						|
        defaults: {
 | 
						|
            name: {value:""},
 | 
						|
            host: {value:"127.0.0.1",required:true},
 | 
						|
            port: {value:"3306",required:true},
 | 
						|
            db: {value:"",required:true},
 | 
						|
            tz: {value:""},
 | 
						|
            charset: {value:"UTF8"}
 | 
						|
        },
 | 
						|
        credentials: {
 | 
						|
            user: {type: "text"},
 | 
						|
            password: {type: "password"}
 | 
						|
        },
 | 
						|
        label: function() {
 | 
						|
            return this.name || this.db;
 | 
						|
        }
 | 
						|
    });
 | 
						|
</script>
 | 
						|
 | 
						|
<script type="text/html" data-template-name="mysql">
 | 
						|
    <div class="form-row">
 | 
						|
        <label for="node-input-mydb"><i class="fa fa-database"></i> Database</label>
 | 
						|
        <input type="text" id="node-input-mydb">
 | 
						|
    </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/javascript">
 | 
						|
    RED.nodes.registerType('mysql',{
 | 
						|
        category: 'storage-input',
 | 
						|
        color:"#e97b00",
 | 
						|
        defaults: {
 | 
						|
            mydb: {type:"MySQLdatabase",required:true},
 | 
						|
            name: {value:""}
 | 
						|
        },
 | 
						|
        inputs:1,
 | 
						|
        outputs:1,
 | 
						|
        icon: "db.png",
 | 
						|
        label: function() {
 | 
						|
            var levelNode = RED.nodes.node(this.mydb);
 | 
						|
            return this.name||(levelNode?levelNode.label():"mysql");
 | 
						|
        },
 | 
						|
        labelStyle: function() {
 | 
						|
            return this.name?"node_label_italic":"";
 | 
						|
        }
 | 
						|
    });
 | 
						|
</script>
 |