/*
  Retrieve useful information about OpenStack
  a dictionnary of instances
   * Id of instance
   * User
   * Creation date
   * Last time we see the instance
   * Last lease date
   * Lease expiration
*/

/*
    buildInstancesView create a full display of Instance on div_name
*/
function buildInstancesView(div_name, get_option){
    $('#table-' + div_name).DataTable({
        ajax: {
            url: '/instances?' + get_option,
            dataSrc: function(instances) {
                /* We add a lease button @ the end of the End Of Life line */
                for (instance=0; instance < instances.length; instance++) {
                    instances[instance].lease_end += '<span class="waves-effect waves-light ' +
                         ' new badge hoverable"' +
                         ' data-badge-caption="new lease" onClick="updateLease(\''+
                         instances[instance].id + '\')"></span>';
                }
                return instances;
            }
        },
        columns: [
            { data: 'name' },
            { data: 'project' },
            { data: 'created_at' },
            { data: 'lease_end' }
        ]
    });
    $( "#progress-bar-" + div_name ).hide();
}

/*
    Update lease status on click
*/
function updateLease(instance) {
    return $.getJSON("/instances/" + instance, function(data){
    }).success(function(data){
        var text,
            color,
            type;

        try {
            text = data.instance.name;
        } catch(err) {
            text = data.message;
        }
        if (data.status == "success") {
            color = "teal-text";
            type = "check";
        } else {
            color = "red-text";
            type = "clear";
        }
        $('#table-instances').DataTable().ajax.reload();
        /* If table-admin-instances exist, we also update it. */
        if ( $('#table-admin-instances').length ) {
            $('#table-admin-instances').DataTable().ajax.reload();
        }
        Materialize.toast(text + ' <i class="material-icons tiny ' + color + '">' + type + '</i>',
         1000, 'rounded');
    });
}
@@ -1423,26 +1423,8 @@
 olor
-,%0A            type
 ;%0A%0A 
@@ -1610,41 +1610,8 @@
 teal
--text%22;%0A            type = %22check
 %22;%0A 
@@ -1654,41 +1654,8 @@
 %22red
--text%22;%0A            type = %22clear
 %22;%0A 
@@ -1948,101 +1948,21 @@
 text
- + ' %3Ci class=%22material-icons tiny ' + color + '%22%3E' + type + '%3C/i%3E',%0A         1000, 'rounded'
+, 2000, color
 );%0A 

Change toast color and timer