Read the statement by Michael Teeuw here.
Need some advise. Digital Ocean Modules
-
where do i add the very last part ?
-
@andrewchumchal also in MMM-Digital-Ocean.js
-
Any where ? or in a function called socketNotificationReceived
-
socketNotificationReceived: function(notification, payload){ if(notification === "DATA"){ this.droplets = payload; } }, -
@strawberry-3.141
Thanks again for all of you help. Now I just need to get the getDom to work :) -
Any ideas where i can start? like where i can get the name and status.
-
for(var i = 0; i < this.droplets.droplets.length; i++;){ var name = this.droplets.droplets[i].name; var status = this.droplets.droplets[i].status; var ip = ''; for(var n = 0; n < this.droplets.droplets[i].networks['v4'].length; n++;){ ip += this.droplets.droplets[i].networks['v4'].ip_address + ' | '; } for(var n = 0; n < this.droplets.droplets[i].networks['v6'].length; n++;){ ip += this.droplets.droplets[i].networks['v6'].ip_address + ' | '; } ip = ip.replace(/ | $/, ''); } -
@strawberry-3.141
sorry to bug you so much dose that go in the get dom ? -
@andrewchumchal this is just how you can access status name and the ip in getDom for example but you still need to render this
-
This post is deleted! -
@strawberry-3-141 Hey. I was not able to get it to display it last night. I try everything i could. Any more ideas ?
-
getDom: function() { var wrapper = document.createElement("div"); if(this.droplets){ var table = document.createElement("table"); for(var i = 0; i < this.droplets.droplets.length; i++){ var row = document.createElement("tr"); var name = document.createElement("td"); name.innerHTML = this.droplets.droplets[i].name; row.appendChild(name); var status = document.createElement("td"); status.innerHTML = this.droplets.droplets[i].status; row.appendChild(status); var ips = ''; for(var n = 0; n < this.droplets.droplets[i].networks['v4'].length; n++;){ ips += this.droplets.droplets[i].networks['v4'][n].ip_address + ' | '; } for(var n = 0; n < this.droplets.droplets[i].networks['v6'].length; n++;){ ips += this.droplets.droplets[i].networks['v6'][n].ip_address + ' | '; } ips = ips.replace(/ | $/, ''); var ip = document.createElement("td"); ip.innerHTML = ips; row.appendChild(ip); table.appendChild(row); } wrapper.appendChild(table); } else { wrapper.innerHTML = "No data to show!"; } return wrapper; }, -
I just update my code.
And i have a droplet created but it shows no data to show ?
-
@andrewchumchal this is all untested and should give you just a direction on how it could be solved. make sure you update the dom when receiving data
socketNotificationReceived: function(notification, payload){ if(notification === "DATA"){ this.droplets = payload; this.updateDom(); } }, -
Thanks you so much @strawberry-3-141.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login