MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Need some advise. Digital Ocean Modules

    Scheduled Pinned Locked Moved Development
    19 Posts 2 Posters 10.6k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • strawberry 3.141S Offline
      strawberry 3.141 Project Sponsor Module Developer @andrewchumchal
      last edited by

      @andrewchumchal this is just how you can access status name and the ip in getDom for example but you still need to render this

      Please create a github issue if you need help, so I can keep track

      1 Reply Last reply Reply Quote 0
      • andrewchumchalA Offline
        andrewchumchal
        last edited by andrewchumchal

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • andrewchumchalA Offline
          andrewchumchal
          last edited by

          @strawberry-3-141 Hey. I was not able to get it to display it last night. I try everything i could. Any more ideas ?

          strawberry 3.141S 1 Reply Last reply Reply Quote 0
          • strawberry 3.141S Offline
            strawberry 3.141 Project Sponsor Module Developer @andrewchumchal
            last edited by strawberry 3.141

            @andrewchumchal

            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;
            },
            

            Please create a github issue if you need help, so I can keep track

            andrewchumchalA 1 Reply Last reply Reply Quote 0
            • andrewchumchalA Offline
              andrewchumchal @strawberry 3.141
              last edited by

              @strawberry-3.141

              I just update my code.

              And i have a droplet created but it shows no data to show ?

              strawberry 3.141S 1 Reply Last reply Reply Quote 0
              • strawberry 3.141S Offline
                strawberry 3.141 Project Sponsor Module Developer @andrewchumchal
                last edited by

                @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();
                    }
                },
                

                Please create a github issue if you need help, so I can keep track

                1 Reply Last reply Reply Quote 0
                • andrewchumchalA Offline
                  andrewchumchal
                  last edited by

                  Thanks you so much @strawberry-3-141.

                  1 Reply Last reply Reply Quote 0
                  • 1
                  • 2
                  • 2 / 2
                  • First post
                    Last post
                  Enjoying MagicMirror? Please consider a donation!
                  MagicMirror created by Michael Teeuw.
                  Forum managed by Sam, technical setup by Karsten.
                  This forum is using NodeBB as its core | Contributors
                  Contact | Privacy Policy