Revision 30a93dde

View differences:

install.sh
1736 1736
                        src/sunstone/public/images/favicon.ico \
1737 1737
                        src/sunstone/public/images/login_over.png \
1738 1738
                        src/sunstone/public/images/login.png \
1739
                        src/sunstone/public/images/advanced_layout.png \
1740
                        src/sunstone/public/images/cloud_layout.png \
1739 1741
                        src/sunstone/public/images/opennebula-sunstone-big.png \
1740 1742
                        src/sunstone/public/images/opennebula-sunstone-small.png \
1741 1743
                        src/sunstone/public/images/opennebula-sunstone-v4.0.png \
src/sunstone/public/js/plugins/groups-tab.js
394 394
Sunstone.addMainTab('groups-tab',groups_tab);
395 395
Sunstone.addInfoPanel("group_info_panel",group_info_panel);
396 396

  
397
function generateViewTable(views, dialog_name) {
398
  var headers     = "<tr><th/>";
399
  var row         = "<tr><td>"+tr("Users")+"</td>";
400
  var admin_row   = "<tr><td>"+tr("Admins")+"</td>";
401
  var default_row = "<tr><td>"+tr("Users default")+"</td>";
402
  var default_admin_row = "<tr><td>"+tr("Admins default")+"</td>";
403

  
404
  $.each(views, function(id, view){
405
      headers += "<th>" + 
406
          view.name +
407
          '<span class="tip">'+view.description+'</span>'+
408
        "</th>";
409

  
410
      var checked = view.id == 'cloud' ? "checked" : "";
411

  
412
      row += '<td>\
413
            <input type="checkbox" \
414
              id="group_view_'+dialog_name+'_'+view.id+'" \
415
              value="'+view.id+'" '+checked+'/>\
416
          </td>';
417

  
418
      checked = view.id == 'groupadmin' ? "checked" : "";
419

  
420
      admin_row += '<td>\
421
            <input type="checkbox" \
422
              id="group_admin_view_'+dialog_name+'_'+view.id+'" \
423
              value="'+view.id+'" '+checked+'/>\
424
          </td>';
425

  
426
      default_row += '<td>\
427
            <input type="radio" \
428
              name="group_default_view_'+dialog_name+'" \
429
              id="group_default_view_'+dialog_name+'_'+view.id+'" \
430
              value="'+view.id+'"/>\
431
          </td>'
432

  
433
      default_admin_row += '<td>\
434
            <input type="radio" \
435
              name="group_default_admin_view_'+dialog_name+'" \
436
              id="group_default_admin_view_'+dialog_name+'_'+view.id+'" \
437
              value="'+view.id+'"/>\
438
          </td>'
439
  });
440

  
441
  headers     += "</tr>";
442
  row         += "</tr>";
443
  admin_row   += "</tr>";
444
  default_row += "</tr>";
445
  default_admin_row += "</tr>";
446

  
447
  return '<table class="dataTable extended_table">'+
448
          headers+
449
          row+
450
          default_row+
451
          admin_row+
452
          default_admin_row+
453
      "</table>";
454
} 
455

  
397 456
function insert_views(dialog_name){
398
    var headers     = "<tr><th/>";
399
    var row         = "<tr><td>"+tr("Users")+"</td>";
400
    var admin_row   = "<tr><td>"+tr("Admins")+"</td>";
401
    var default_row = "<tr><td>"+tr("Users default")+"</td>";
402
    var default_admin_row = "<tr><td>"+tr("Admins default")+"</td>";
403

  
404
    var views_array = config['all_views'];
405

  
406
    for (var i = 0; i < views_array.length; i++){
407
        headers += "<th>"+views_array[i]+"</th>";
408

  
409
        var checked = views_array[i] == 'cloud' ? "checked" : "";
410

  
411
        row += '<td>\
412
              <input type="checkbox" \
413
                id="group_view_'+dialog_name+'_'+views_array[i]+'" \
414
                value="'+views_array[i]+'" '+checked+'/>\
415
            </td>';
416

  
417
        checked = views_array[i] == 'groupadmin' ? "checked" : "";
418

  
419
        admin_row += '<td>\
420
              <input type="checkbox" \
421
                id="group_admin_view_'+dialog_name+'_'+views_array[i]+'" \
422
                value="'+views_array[i]+'" '+checked+'/>\
423
            </td>';
424

  
425
        default_row += '<td>\
426
              <input type="radio" \
427
                name="group_default_view_'+dialog_name+'" \
428
                id="group_default_view_'+dialog_name+'_'+views_array[i]+'" \
429
                value="'+views_array[i]+'"/>\
430
            </td>'
431

  
432
        default_admin_row += '<td>\
433
              <input type="radio" \
434
                name="group_default_admin_view_'+dialog_name+'" \
435
                id="group_default_admin_view_'+dialog_name+'_'+views_array[i]+'" \
436
                value="'+views_array[i]+'"/>\
437
            </td>'
457
  var filtered_views = {
458
    advanced : [],
459
    cloud : [],
460
    vcenter : [],
461
    other : []
462
  }
463

  
464
  var view_info;
465
  $.each(config['all_views'], function(index, view_id) {
466
    view_info = views_info[view_id];
467
    if (view_info) {
468
      switch (view_info.type) {
469
        case 'advanced':
470
          filtered_views.advanced.push(view_info);
471
          break;
472
        case 'cloud':
473
          filtered_views.cloud.push(view_info);
474
          break;
475
        case 'vcenter':
476
          filtered_views.vcenter.push(view_info);
477
          break;
478
        default:
479
          filtered_views.other.push({
480
            id: view_id,
481
            name: view_id,
482
            description: null,
483
            type: "other"
484
          });
485
          break;
486
      }
487
    } else {
488
      filtered_views.other.push({
489
        id: view_id,
490
        name: view_id,
491
        description: null,
492
        type: "other"
493
      });
494
    }
495
  })
496

  
497
  var str = "";
498
  $.each(filtered_views, function(view_type, views){
499
    // todo description
500
    // 
501
    
502
    if (views.length > 0) {
503
      str += '<div class="row">'+
504
          '<div class="large-12 columns">'+
505
            '<h4>'+view_types[view_type].name+'</h4>'+
506
          '</div>'+
507
          '<div class="large-6 columns">'+
508
            '<p>'+view_types[view_type].description+'</p>'+
509
          '</div>'+
510
          '<div class="large-6 columns">'+
511
            (view_types[view_type].preview ?
512
              '<img src="images/' + view_types[view_type].preview +'">' :
513
              '') +
514
          '</div>'+
515
        '</div>';
516

  
517
      str += generateViewTable(views, dialog_name);
438 518
    }
519
  })
439 520

  
440
    headers     += "</tr>";
441
    row         += "</tr>";
442
    admin_row   += "</tr>";
443
    default_row += "</tr>";
444
    default_admin_row += "</tr>";
445

  
446
    return '<table style="table-layout:fixed">'+
447
            headers+
448
            row+
449
            default_row+
450
            headers+
451
            admin_row+
452
            default_admin_row+
453
        "</table>";
521
  return str;
454 522
}
455 523

  
456 524
function groupElements(){
src/sunstone/public/js/sunstone.js
8399 8399
        graphics.TYPE.toLowerCase() == "spice" &&
8400 8400
        $.inArray(state, VNCstates)!=-1);
8401 8401
}
8402

  
8403
var view_types = {
8404
    advanced : {
8405
        name: 'Advanced',
8406
        description : tr("This layout exposes a complete view of the cloud, allowing administrators and advanced users to have full control of any physical or virtual resource of the cloud."),
8407
        preview: "advanced_layout.png"
8408
    },
8409
    cloud : {
8410
        name: 'Cloud',
8411
        description : tr("This layout exposes a simplified version of the cloud where group administrators and cloud end-users will be able to manage any virtual resource of the cloud, without taking care of the physical resources management."),
8412
        preview: "cloud_layout.png"
8413
    },
8414
    vcenter : {
8415
        name: 'vCenter',
8416
        description : tr("Set of views to present the valid operation against a vCenter infrastructure"),
8417
        preview: null
8418
    },
8419
    other : {
8420
        name: 'Other',
8421
        description : '',
8422
        preview: null
8423
    }
8424
};
8425

  
8426
var views_info = {
8427
    admin : {
8428
        id: 'admin',
8429
        name: "Admin",
8430
        description: tr("This view provides full control of the cloud"),
8431
        type: "advanced"
8432
    },
8433
    user : {
8434
        id: 'user',
8435
        name: "User",
8436
        description: tr("In this view users will not be able to manage nor retrieve the hosts and clusters of the cloud. They will be able to see Datastores and Virtual Networks in order to use them when creating a new Image or Virtual Machine, but they will not be able to create new ones."),
8437
        type: "advanced"
8438
    },
8439
    groupadmin : {
8440
        id: 'groupadmin',
8441
        name: "Group Admin",
8442
        description: tr("This view provides control of all the resources belonging to a group, but with no access to resources outside that group, that is, restricted to the physical and virtual resources of the group. This view features the ability to create new users within the group as well as set and keep track of user quotas."),
8443
        type: "cloud"
8444
    },
8445
    cloud : {
8446
        id: 'cloud',
8447
        name: "Cloud",
8448
        description: tr("This is a simplified view mainly intended for user that just require a portal where they can provision new virtual machines easily from pre-defined Templates."),
8449
        type: "cloud"
8450
    },
8451
    admin_vcenter : {
8452
        id: 'admin_vcenter',
8453
        name: "Admin vCenter",
8454
        description: tr("View designed to present the valid operations against a vCenter infrastructure to a cloud administrator"),
8455
        type: "vcenter"
8456
    },
8457
    groupadmin_vcenter : {
8458
        id: 'groupadmin_vcenter',
8459
        name: "Group Admin vCenter",
8460
        description: tr("View designed to present the valid operations agaist a vCenter infrastructure to a group administrator"),
8461
        type: "vcenter"
8462
    },
8463
    cloud_vcenter : {
8464
        id: 'cloud_vcenter',
8465
        name: "Cloud vCenter",
8466
        description: tr("View designed to present the valid operations against a vCenter infrastructure to a cloud consumer"),
8467
        type: "vcenter"
8468
    }
8469
};

Also available in: Unified diff