Example #1
0
File: clone.js Project: unistra/one
    $('#' + DIALOG_ID + 'Form', dialog).submit(function() {
      var name = $('input[name="image_clone_name"]', this).val();
      var sel_elems = Sunstone.getDataTable(IMAGES_TAB_ID).elements();

      var extra_info = {};

      var targeDS = that.datastoreTable.retrieveResourceTableSelect();
      if (targeDS) {
        extra_info['target_ds'] = targeDS;
      }

      if (sel_elems.length > 1) {
        for (var i = 0; i < sel_elems.length; i++) {
          //If we are cloning several images we
          //use the name as prefix
          extra_info['name'] = name + OpenNebulaImage.getName(sel_elems[i]);
          Sunstone.runAction('Image.clone', sel_elems[i], extra_info);
        }
      } else {
        extra_info['name'] = name;
        Sunstone.runAction('Image.clone', sel_elems[0], extra_info)
      }

      Sunstone.getDialog(DIALOG_ID).hide();
      Sunstone.getDialog(DIALOG_ID).reset();
      setTimeout(function() {
        Sunstone.runAction('Image.refresh');
      }, 1500);
      return false;
    });
Example #2
0
File: ar.js Project: OpenNebula/one
      context.on("click", 'button#rm_ar_button', function(){
        var ar_id = $(this).attr('ar_id');

        Sunstone.getDialog(CONFIRM_DIALOG_ID).setParams({
          //header :
          headerTabId: TAB_ID,
          body : Locale.tr("This will delete all the addresses in this range"),
          //question :
          submit : function(){
            var obj = {ar_id: ar_id};

            for (i in that.element.TEMPLATE.AR) {
              if ( that.element.TEMPLATE.AR[i].AR_ID == ar_id ) {
                that.element.TEMPLATE.AR.splice(i, 1);
                break;
              }
            }

            delete that.element.TEMPLATE.AR_POOL;

            Sunstone.runAction('VNTemplate.remove_ar', that.element.ID, TemplateUtils.templateToString(that.element.TEMPLATE));

            return false;
          }
        });

        Sunstone.getDialog(CONFIRM_DIALOG_ID).reset();
        Sunstone.getDialog(CONFIRM_DIALOG_ID).show();

        return false;
      });
Example #3
0
    $('#' + DIALOG_ID + 'Form', context).submit(function() {
      var extra_info = {};

      if ($("#selected_resource_id_migrate_vm", context).val()) {
          extra_info['host_id'] = $("#selected_resource_id_migrate_vm", context).val();
      } else {
          Notifier.notifyError(Locale.tr("You have not selected a host"));
          return false;
      }

      extra_info['ds_id'] = $("#selected_resource_id_migrate_vm_ds", context).val() || -1
      extra_info['enforce'] = $("#enforce", context).is(":checked");

      $.each(Sunstone.getDataTable(TAB_ID).elements(), function(index, elem) {
        if (that.live) {
          Sunstone.runAction("VM.migrate_live_action", elem, extra_info);
        } else if (that.type == 0) {
          Sunstone.runAction("VM.migrate_action", elem, extra_info);
        } else if (that.type == 1){
          Sunstone.runAction("VM.migrate_poff_action", elem, extra_info);
        } else if (that.type == 2){
          Sunstone.runAction("VM.migrate_poff_hard_action", elem, extra_info);
        }
      });

      Sunstone.getDialog(DIALOG_ID).hide();
      Sunstone.getDialog(DIALOG_ID).reset();
      return false;
    });
Example #4
0
      callback: function(req) {
        // Reset the wizard
        Sunstone.getDialog(UPDATE_AR_DIALOG_ID).hide();
        Sunstone.getDialog(UPDATE_AR_DIALOG_ID).reset();

        Sunstone.runAction("Network.show",req.request.data[0]);
      },
Example #5
0
    $('#' + DIALOG_ID + 'Form', context).submit(function() {
      var template_name = $('#template_name', this).val();
      var persistent = $('#saveas_persistency', this).is(":checked") ? true : false;
      var vm_id = Sunstone.getDataTable(TAB_ID).elements();

      OpenNebula.VM.save_as_template({
        data : {
          id: vm_id,
          extra_param: {
            name : template_name,
            persistent : persistent
          }
        },
        success: function(request, response){
          OpenNebula.Action.clear_cache("VMTEMPLATE");
          Notifier.notifyMessage(Locale.tr("VM Template") + ' ' + template_name + ' ' + Locale.tr("saved successfully"))
        },
        error: function(request, response){
          Notifier.onError(request, response);
        }
      })

      Sunstone.getDialog(DIALOG_ID).hide();
      Sunstone.getDialog(DIALOG_ID).reset();
      return false;
    });
Example #6
0
          call: function() {
            Sunstone.getDialog(CONFIRM_DIALOG_ID).setParams({
              //header :
              headerTabId: TAB_ID,
              body : Locale.tr("This will delete the Template.<br/>You can also delete any Image referenced inside this Template"),
              //question :
              buttons : [
                Locale.tr("Delete all images"),
                Locale.tr("Delete"),
              ],
              submit : [
                function(){
                  Sunstone.runAction(RESOURCE+'.delete_recursive', Sunstone.getDataTable(TAB_ID).elements());
                  return false;
                },
                function(){
                  Sunstone.runAction(RESOURCE+'.delete', Sunstone.getDataTable(TAB_ID).elements());
                  return false;
                }
              ]
            });

            Sunstone.getDialog(CONFIRM_DIALOG_ID).reset();
            Sunstone.getDialog(CONFIRM_DIALOG_ID).show();
          }
Example #7
0
        call: function() {
          Sunstone.getDialog(CONFIRM_DIALOG_ID).setParams({
            //header :
            headerTabId: TAB_ID,
            body : Locale.tr(
              "Please note: each time the rules are edited, the commit operation is done automatically. "+
              "<br/><br/>"+
              "This action will force the propagation of security group changes to VMs. "+
              "The operation takes time to iterate over all VMs in the security group, "+
              "the progress can be checked in the \"VMs\" panel."),
            //question :
            buttons : [
              Locale.tr("Commit"),
            ],
            submit : [
              function(){
                Sunstone.runAction('SecurityGroup.commit', Sunstone.getDataTable(TAB_ID).elements(), false);
                return false;
              }
            ]
          });

          Sunstone.getDialog(CONFIRM_DIALOG_ID).reset();
          Sunstone.getDialog(CONFIRM_DIALOG_ID).show();
        }
Example #8
0
File: clone.js Project: melehin/one
    $('#' + DIALOG_ID + 'Form', context).submit(function() {
      var extra_info;
      var name = $('input[name="name"]', this).val();
      var sel_elems = Sunstone.getDataTable(ONEFLOW_TEMPLATES_TAB_ID).elements();

      if (!name || !sel_elems.length)
        Notifier.notifyError('A name or prefix is needed!');

      if (sel_elems.length > 1) {
        for (var i = 0; i < sel_elems.length; i++) {
          //If we are cloning several images we
          //use the name as prefix
          extra_info = name + OpenNebulaServiceTemplate.getName(sel_elems[i]);
          Sunstone.runAction('ServiceTemplate.clone', sel_elems[i], extra_info);
        }
      } else {
        extra_info = name;
        Sunstone.runAction('ServiceTemplate.clone', sel_elems[0], extra_info)
      }

      Sunstone.getDialog(DIALOG_ID).hide();
      Sunstone.getDialog(DIALOG_ID).reset();
      setTimeout(function() {
        Sunstone.runAction('ServiceTemplate.refresh');
      }, 1500);
      return false;
    });
Example #9
0
      context.on("click", 'button#update_ar_button', function(){
        var id = that.element.ID;
        var ar_id = $(this).attr('ar_id');

        var ar = getAR(that.element, ar_id);

        if(ar != undefined){
          Sunstone.getDialog(INSTANTIATE_UPDATE_AR_DIALOG_ID).reset();

          Sunstone.getDialog(INSTANTIATE_UPDATE_AR_DIALOG_ID).setParams({
            'vntmplId': id,
            'arId': ar_id,
            'element': that.element,
            'arData': $.extend({}, ar),
            'table': "ar_list_datatable",
            'context': context
          });

          Sunstone.getDialog(INSTANTIATE_UPDATE_AR_DIALOG_ID).show();

        } else {
          Notifier.notifyError(Locale.tr("The Address Range was not found"));
        }

        return false;
      });
Example #10
0
 $("#link_"+Views.types[view_type].preview.split(".")[0], context).on("click", function(){
   Sunstone.getDialog(IMAGE_DIALOG_ID).setParams({element: {
                                                   "preview":Views.types[view_type].preview, 
                                                   "name": Views.types[view_type].name}});
   Sunstone.getDialog(IMAGE_DIALOG_ID).reset();
   Sunstone.getDialog(IMAGE_DIALOG_ID).show();
 });
Example #11
0
    $('#' + DIALOG_ID + 'Form', context).on("click", "button", function() {
      if(!$('#' + DIALOG_ID + 'Form', context)[0].checkValidity()){
        if ($(this).val() == that.resource+".clone_recursive"){
          $('#' + DIALOG_ID + 'Form button[type="submit"]', context).click();
          return true;
        } else {
          return true;
        }
      }

      var extra_info;
      var name = $('#' + DIALOG_ID + 'Form input[name="name"]').val();
      var sel_elems = Sunstone.getDataTable(that.tabId).elements();

      if (sel_elems.length > 1) {
        for (var i = 0; i < sel_elems.length; i++) {
          //If we are cloning several images we
          //use the name as prefix
          extra_info = name + OpenNebulaTemplate.getName(sel_elems[i]);
          Sunstone.runAction($(this).val(), sel_elems[i], extra_info);
        }
      } else {
        extra_info = name;
        Sunstone.runAction($(this).val(), sel_elems[0], extra_info)
      }

      Sunstone.getDialog(DIALOG_ID).hide();
      Sunstone.getDialog(DIALOG_ID).reset();
      setTimeout(function() {
        Sunstone.runAction(that.resource+'.refresh');
      }, 1500);

      return false;
    });
Example #12
0
File: clone.js Project: tinova/one
    $("#" + DIALOG_ID + "Form", context).submit(function() {
      var extra_info;
      var name = $("input[name=\"name\"]", this).val();
      var sel_elems = Sunstone.getDataTable(ONEFLOW_TEMPLATES_TAB_ID).elements();

      if (sel_elems.length > 1) {
        for (var i = 0; i < sel_elems.length; i++) {
          //If we are cloning several images we
          //use the name as prefix
          extra_info = name + OpenNebulaServiceTemplate.getName(sel_elems[i]);
          Sunstone.runAction("ServiceTemplate.clone", sel_elems[i], extra_info);
        }
      } else {
        extra_info = name;
        Sunstone.runAction("ServiceTemplate.clone", sel_elems[0], extra_info);
      }

      Sunstone.getDialog(DIALOG_ID).hide();
      Sunstone.getDialog(DIALOG_ID).reset();
      setTimeout(function() {
        console.log("e");
        Sunstone.runAction("ServiceTemplate.refresh");
      }, 1500);
      return false;
    });
Example #13
0
          success: function(request, img_json){
            var img = img_json[XML_ROOT];

            if (OpenNebula.Datastore.isMarketExportSupported(img.DATASTORE_ID)){
              Sunstone.showTab(MARKETPLACEAPPS_TAB_ID);
              Sunstone.showFormPanel(MARKETPLACEAPPS_TAB_ID, CREATE_APP_DIALOG_ID, "export",
                function(formPanelInstance, context) {
                  formPanelInstance.setImageId(resourceId);
                });
            } else {
              Sunstone.getDialog(CONFIRM_DIALOG_ID).setParams({
                header : Locale.tr("Error"),
                body : Locale.tr("This Image resides in Datastore ") +
                  img.DATASTORE_ID + " (" + img.DATASTORE + ")" +
                  Locale.tr(". The export action is not supported for that Datastore DS_MAD driver."),
                question : "",
                buttons : [
                  Locale.tr("Ok"),
                ],
                submit : [
                  function(){
                    return false;
                  }
                ]
              });

              Sunstone.getDialog(CONFIRM_DIALOG_ID).reset();
              Sunstone.getDialog(CONFIRM_DIALOG_ID).show();
            }
          },
Example #14
0
      callback: function(req) {
        // Reset the wizard
        Sunstone.getDialog(ADD_AR_DIALOG_ID).hide();
        Sunstone.getDialog(ADD_AR_DIALOG_ID).reset();

        Sunstone.runAction("VNTemplate.show",req.request.data[0]);
      },
Example #15
0
          success: function(request,app_json){
            var zone = app_json[XML_ROOT].ZONE_ID;

            if (zone != config.zone_id){
              Sunstone.getDialog(CONFIRM_DIALOG_ID).setParams({
                header : Locale.tr("Error"),
                headerTabId: TAB_ID,
                body : Locale.tr(
                  "This MarketPlace App resides in Zone ") +
                  zone + " (" + OpenNebula.Zone.getName(zone) + ")" +
                  Locale.tr(". To delete it you need to switch to that Zone from the zone selector in the top-right corner." ),
                question : "",
                buttons : [
                  Locale.tr("Ok"),
                ],
                submit : [
                  function(){
                    $("a#zonelector").focus().click();
                    return false;
                  }
                ]
              });

              Sunstone.getDialog(CONFIRM_DIALOG_ID).reset();
              Sunstone.getDialog(CONFIRM_DIALOG_ID).show();
            } else {
              _commonActions.del().call(params);
            }
          },
Example #16
0
      context.on('click', '.disk_snapshot_delete', function() {
        var snapshotsSection = $(this).closest('.snapshots');

        var disk_id = snapshotsSection.attr('disk_id');
        var snapshot_id = $(".snapshot_check_item:checked", snapshotsSection).attr('snapshot_id');

        Sunstone.getDialog(CONFIRM_DIALOG_ID).setParams({
          //header :
          body : Locale.tr("This will delete the disk snapshot "+snapshot_id),
          //question :
          submit : function(){
            Sunstone.runAction(
              'VM.disk_snapshot_delete',
              that.element.ID,
              { "disk_id": disk_id,
                "snapshot_id": snapshot_id
              });
          }
        });

        Sunstone.getDialog(CONFIRM_DIALOG_ID).reset();
        Sunstone.getDialog(CONFIRM_DIALOG_ID).show();

        return false;
      });
Example #17
0
File: ar.js Project: hydro-b/one
      context.on("click", 'button#add_ar_button', function(){
        var id = that.element.ID;

        Sunstone.getDialog(ADD_AR_DIALOG_ID).setId(id);
        Sunstone.getDialog(ADD_AR_DIALOG_ID).show();

        return false;
      });
Example #18
0
      call: function() {
        var selected_nodes = Sunstone.getDataTable(TAB_ID).elements();
        var resource_id = "" + selected_nodes[0];

        Sunstone.getDialog(UPLOAD_DIALOG_ID).setParams({requestId: resource_id});
        Sunstone.getDialog(UPLOAD_DIALOG_ID).reset();
        Sunstone.getDialog(UPLOAD_DIALOG_ID).show();
      }
Example #19
0
      callback: function(req) {
        // Reset the wizard
        Sunstone.getDialog(RESERVE_DIALOG_ID).hide();
        Sunstone.getDialog(RESERVE_DIALOG_ID).reset();

        OpenNebulaAction.clear_cache("VNET");
        Sunstone.runAction("Network.show",req.request.data[0]);
      },
Example #20
0
 call: function(){
   Sunstone.getDialog(CLONE_DIALOG_ID).setParams(
     { tabId : TAB_ID,
       resource : resource
     });
   Sunstone.getDialog(CLONE_DIALOG_ID).reset();
   Sunstone.getDialog(CLONE_DIALOG_ID).show();
 }
Example #21
0
      callback: function(request, response) {
        Sunstone.getDialog(CLUSTERS_DIALOG_ID).setParams({
          element: response[XML_ROOT],
          resource:"vnet"
        });

        Sunstone.getDialog(CLUSTERS_DIALOG_ID).reset();
        Sunstone.getDialog(CLUSTERS_DIALOG_ID).show();
      },
Example #22
0
      callback: function(request, response) {
        if (response['status'] && response['status'] != 'ready') {
            Notifier.notifyError(Locale.tr("The appliance is not ready"));
            return;
        }

        Sunstone.getDialog(IMPORT_DIALOG_ID).setParams({element: response});
        Sunstone.getDialog(IMPORT_DIALOG_ID).reset();
        Sunstone.getDialog(IMPORT_DIALOG_ID).show();
      },
Example #23
0
      call: function(){
        selected = roleElements();

        if(selected.lenght == 0){
          return;
        }

        Sunstone.getDialog(SCALE_DIALOG_ID).setParams({roleIds: selected});
        Sunstone.getDialog(SCALE_DIALOG_ID).reset();
        Sunstone.getDialog(SCALE_DIALOG_ID).show();
      }
Example #24
0
    }).on('valid.fndtn.abide', '#' + DIALOG_ID + 'Form', function(e) {
      var inputs = that.userCreation.retrieve(context);

      Sunstone.runAction('User.passwd', that.selectedElements, inputs.password);

      Sunstone.getDialog(DIALOG_ID).hide();
      Sunstone.getDialog(DIALOG_ID).reset();
      Sunstone.runAction('User.refresh');

      return false;
    });
Example #25
0
      .on('formvalid.zf.abide', function(ev, frm) {
        var inputs = that.userCreation.retrieve(context);

        Sunstone.runAction('User.passwd', that.selectedElements, inputs.password);

        Sunstone.getDialog(DIALOG_ID).hide();
        Sunstone.getDialog(DIALOG_ID).reset();
        if (Config.isTabEnabled("users-tab")){
          Sunstone.runAction('User.refresh');
        }
      })
Example #26
0
      callback: function(request, response) {
        Sunstone.getDialog(CLUSTERS_DIALOG_ID).setParams({
          element: response[XML_ROOT],
          resource:"vntemplate",
          resource_name: RESOURCE,
          only_update_template: true
        });

        Sunstone.getDialog(CLUSTERS_DIALOG_ID).reset();
        Sunstone.getDialog(CLUSTERS_DIALOG_ID).show();
      },
Example #27
0
      .on('formvalid.zf.abide', function(ev, frm) {
        var inputs = that.userCreation.retrieve(context);

        var selElems = Sunstone.getDataTable(TAB_ID).elements();

        Sunstone.runAction('User.chauth', selElems, inputs.auth_driver);

        Sunstone.getDialog(DIALOG_ID).hide();
        Sunstone.getDialog(DIALOG_ID).reset();
        Sunstone.runAction('User.refresh');
      })
Example #28
0
File: ar.js Project: OpenNebula/one
      context.on("click", 'button#add_ar_button', function(){
        var id = that.element.ID;

        Sunstone.getDialog(ADD_AR_DIALOG_ID).setParams({
          'id': id,
          'element': that.element,
        });

        Sunstone.getDialog(ADD_AR_DIALOG_ID).show();

        return false;
      });
Example #29
0
    $('#' + DIALOG_ID + 'Form', context).submit(function() {
      var templateJSON = NicsSection.retrieve($(".nicsContext", context));
      var obj = {
        "NIC": templateJSON
      };

      Sunstone.runAction('VirtualRouter.attachnic', that.element.ID, obj);

      Sunstone.getDialog(DIALOG_ID).hide();
      Sunstone.getDialog(DIALOG_ID).reset();
      return false;
    });
Example #30
0
    $('#' + DIALOG_ID + 'Form', context).submit(function() {
      var templateJSON = that.diskTab.retrieve(context);
      var obj = {
        "DISK": templateJSON
      }

      Sunstone.runAction('VM.attachdisk', that.element.ID, obj);

      Sunstone.getDialog(DIALOG_ID).hide();
      Sunstone.getDialog(DIALOG_ID).reset();
      return false;
    });