add access-token
This commit is contained in:
		
							parent
							
								
									49fb018703
								
							
						
					
					
						commit
						0e05cdca5c
					
				| @ -24,7 +24,7 @@ Blockly.Blocks['sensebox_osem_connection'] = { | |||||||
|             .setAlign(Blockly.ALIGN_LEFT) |             .setAlign(Blockly.ALIGN_LEFT) | ||||||
|             .appendField(Blockly.Msg.senseBox_osem_exposure) |             .appendField(Blockly.Msg.senseBox_osem_exposure) | ||||||
|             .appendField(new Blockly.FieldDropdown([[Blockly.Msg.senseBox_osem_stationary, 'Stationary'], [Blockly.Msg.senseBox_osem_mobile, 'Mobile']]), "type"); |             .appendField(new Blockly.FieldDropdown([[Blockly.Msg.senseBox_osem_stationary, 'Stationary'], [Blockly.Msg.senseBox_osem_mobile, 'Mobile']]), "type"); | ||||||
|         if(!boxes){ |         if (!boxes) { | ||||||
|             this.appendDummyInput() |             this.appendDummyInput() | ||||||
|                 .setAlign(Blockly.ALIGN_LEFT) |                 .setAlign(Blockly.ALIGN_LEFT) | ||||||
|                 .appendField("senseBox ID") |                 .appendField("senseBox ID") | ||||||
| @ -51,6 +51,16 @@ Blockly.Blocks['sensebox_osem_connection'] = { | |||||||
|     }, |     }, | ||||||
|     onchange: function (e) { |     onchange: function (e) { | ||||||
|         selectedBox = this.getFieldValue('BoxID'); |         selectedBox = this.getFieldValue('BoxID'); | ||||||
|  |         console.log(selectedBox) | ||||||
|  |         if (selectedBox !== '' && boxes) { | ||||||
|  |             var accessToken = boxes.find(element => element._id === selectedBox).access_token | ||||||
|  |             if (accessToken !== undefined) { | ||||||
|  |                 this.getField('access_token').setValue(accessToken) | ||||||
|  |             } else { | ||||||
|  |                 this.getField('access_token').setValue('access_token') | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|     }, |     }, | ||||||
|     mutationToDom: function () { |     mutationToDom: function () { | ||||||
|         var container = document.createElement('mutation'); |         var container = document.createElement('mutation'); | ||||||
| @ -99,7 +109,7 @@ Blockly.Blocks['sensebox_send_to_osem'] = { | |||||||
|         this.setColour(getColour().sensebox); |         this.setColour(getColour().sensebox); | ||||||
|         this.appendDummyInput() |         this.appendDummyInput() | ||||||
|             .appendField(Blockly.Msg.senseBox_send_to_osem); |             .appendField(Blockly.Msg.senseBox_send_to_osem); | ||||||
|         if(boxes){ |         if (boxes) { | ||||||
|             this.appendValueInput('Value') |             this.appendValueInput('Value') | ||||||
|                 .appendField('Phänomen') |                 .appendField('Phänomen') | ||||||
|                 .appendField(new Blockly.FieldDropdown( |                 .appendField(new Blockly.FieldDropdown( | ||||||
| @ -119,7 +129,7 @@ Blockly.Blocks['sensebox_send_to_osem'] = { | |||||||
|     generateOptions: function () { |     generateOptions: function () { | ||||||
|         var dropdown = [['', '']]; |         var dropdown = [['', '']]; | ||||||
|         var boxID = selectedBox; |         var boxID = selectedBox; | ||||||
|         if(boxID !== '' && boxes){ |         if (boxID !== '' && boxes) { | ||||||
| 
 | 
 | ||||||
|             let box = boxes.find(el => el._id === boxID); |             let box = boxes.find(el => el._id === boxID); | ||||||
|             if (box !== undefined) { |             if (box !== undefined) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user