cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jessicaw...@apache.org
Subject [13/39] Format JS
Date Fri, 19 Jul 2013 17:01:26 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f766a9e5/ui/scripts/ui-custom/ipRules.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui-custom/ipRules.js b/ui/scripts/ui-custom/ipRules.js
index 34b2398..28ec8db 100644
--- a/ui/scripts/ui-custom/ipRules.js
+++ b/ui/scripts/ui-custom/ipRules.js
@@ -15,152 +15,149 @@
 // specific language governing permissions and limitations
 // under the License.
 (function($, cloudStack) {
-  cloudStack.ipRules = function(args) {
-    return function(detailArgs) {
-      var context = detailArgs.context;
-
-      var portMultiEdit = function(args) {
-        return $('<div>').multiEdit(args);
-      };
-
-      var makeMultiEditPanel = function($item) {
-        if ($item.closest('li').hasClass('disabled'))
-          return false;
-
-        var targetId = $item.attr('net-target');
-        var targetName = $item.parent().find('.name').find('span').html();
-        var target = args[targetId];
-
-        var $browser = $item.closest('.detail-view').data('view-args').$browser;
-
-        $browser.cloudBrowser('addPanel', {
-          title: targetName,
-          maximizeIfSelected: true,
-          complete: function($newPanel) {
-            $newPanel.detailView({
-              $browser: $browser,
-              name: targetId,
-              context: context,
-              tabs: {
-                network: {
-                  title: targetName,
-                  custom: function(args) {
-                    return portMultiEdit($.extend(target, {
-                      context: context
-                    }));
-                  }
-                }
-              }
-            });
-          }
-        });
-
-        return true;
-      };
-
-      var staticNATChart = function(args, includingFirewall) {
-        var $chart = $('#template').find('.network-chart.static-nat').clone();
-        var $vmName = $chart.find('li.static-nat-enabled .vmname');
-        var $browser = $('#browser .container');
-        var vmDataProvider = args.vmDataProvider;
-        var vmDetails = args.vmDetails;
-
-        args.staticNATDataProvider({
-          context: context,
-          response: {
-            success: function(args) {
-              var vmID = args.data.virtualmachineid;
-              var vmIP = args.data.vmipaddress;
-              var vmName = args.data.virtualmachinename;
-
-              $vmName.append(
-                $('<span>').html('VM: ' + _s(vmName)),
-                $('<span>').html('<br/>VM IP: ' + vmIP)
-              );
-
-              $vmName.click(function() {
+    cloudStack.ipRules = function(args) {
+        return function(detailArgs) {
+            var context = detailArgs.context;
+
+            var portMultiEdit = function(args) {
+                return $('<div>').multiEdit(args);
+            };
+
+            var makeMultiEditPanel = function($item) {
+                if ($item.closest('li').hasClass('disabled'))
+                    return false;
+
+                var targetId = $item.attr('net-target');
+                var targetName = $item.parent().find('.name').find('span').html();
+                var target = args[targetId];
+
+                var $browser = $item.closest('.detail-view').data('view-args').$browser;
+
                 $browser.cloudBrowser('addPanel', {
-                  title: _l('label.static.nat.vm.details'),
-                  complete: function($newPanel) {
-                    vmDataProvider({
-                      context: context,
-                      response: {
-                        success: function(args) {
-                          var instance = args.data;
-                          var detailViewArgs = $.extend(true, {}, vmDetails, {
+                    title: targetName,
+                    maximizeIfSelected: true,
+                    complete: function($newPanel) {
+                        $newPanel.detailView({
                             $browser: $browser,
-                            context: $.extend(true, {}, context, {
-                              instances: [instance]
-                            }),
-                            jsonObj: instance,
-                            id: instance.id
-                          });
+                            name: targetId,
+                            context: context,
+                            tabs: {
+                                network: {
+                                    title: targetName,
+                                    custom: function(args) {
+                                        return portMultiEdit($.extend(target, {
+                                            context: context
+                                        }));
+                                    }
+                                }
+                            }
+                        });
+                    }
+                });
+
+                return true;
+            };
 
-                          // No actions available
-                          detailViewArgs.actions = {};
+            var staticNATChart = function(args, includingFirewall) {
+                var $chart = $('#template').find('.network-chart.static-nat').clone();
+                var $vmName = $chart.find('li.static-nat-enabled .vmname');
+                var $browser = $('#browser .container');
+                var vmDataProvider = args.vmDataProvider;
+                var vmDetails = args.vmDetails;
 
-                          $newPanel.detailView(detailViewArgs);
+                args.staticNATDataProvider({
+                    context: context,
+                    response: {
+                        success: function(args) {
+                            var vmID = args.data.virtualmachineid;
+                            var vmIP = args.data.vmipaddress;
+                            var vmName = args.data.virtualmachinename;
+
+                            $vmName.append(
+                                $('<span>').html('VM: ' + _s(vmName)),
+                                $('<span>').html('<br/>VM IP: ' + vmIP)
+                            );
+
+                            $vmName.click(function() {
+                                $browser.cloudBrowser('addPanel', {
+                                    title: _l('label.static.nat.vm.details'),
+                                    complete: function($newPanel) {
+                                        vmDataProvider({
+                                            context: context,
+                                            response: {
+                                                success: function(args) {
+                                                    var instance = args.data;
+                                                    var detailViewArgs = $.extend(true, {},
vmDetails, {
+                                                        $browser: $browser,
+                                                        context: $.extend(true, {}, context,
{
+                                                            instances: [instance]
+                                                        }),
+                                                        jsonObj: instance,
+                                                        id: instance.id
+                                                    });
+
+                                                    // No actions available
+                                                    detailViewArgs.actions = {};
+
+                                                    $newPanel.detailView(detailViewArgs);
+                                                }
+                                            }
+                                        });
+                                    }
+                                });
+                            });
                         }
-                      }
+                    }
+                });
+
+                if (includingFirewall == true) {
+                    $chart.find('li.firewall .view-details').click(function() {
+                        //makeMultiEditPanel($(this), { title: _l('label.nat.port.range')});
+                        makeMultiEditPanel($(this));
                     });
-                  }
+                } else {
+                    $chart.find('li.firewall').hide();
+                }
+
+                return $chart;
+            };
+
+            var netChart = function(args) {
+
+                var $chart = $('#template').find('.network-chart.normal').clone();
+                var preFilter = args.preFilter ? args.preFilter({
+                    items: ['firewall', 'portForwarding', 'loadBalancing'],
+                    context: context
+                }) : [];
+
+                // 1. choose between staticNAT chart and non-staticNAT chart  2. filter disabled
tabs
+                if (preFilter.length) {
+                    if ($.inArray('nonStaticNATChart', preFilter) != -1) { //choose static
NAT chart
+                        if ($.inArray('firewall', preFilter) == -1) {
+                            return staticNATChart(args, true); //static NAT including Firewall
+                        } else {
+                            return staticNATChart(args, false); //static NAT excluding Firewall
+                        }
+                    } else { //choose non-static NAT chart
+                        $(preFilter).each(function() {
+                            var id = this;
+
+                            var $li = $chart.find('li').filter(function() {
+                                return $(this).hasClass(id);
+                            }).addClass('disabled');
+                        });
+                    }
+                }
+
+                $chart.find('.view-details').click(function() {
+                    makeMultiEditPanel($(this));
+                    return false;
                 });
-              });
-            }
-          }
-        });
-
-        if(includingFirewall == true) {
-          $chart.find('li.firewall .view-details').click(function() {
-            //makeMultiEditPanel($(this), { title: _l('label.nat.port.range')});
-            makeMultiEditPanel($(this));
-          });
-        }
-        else {
-          $chart.find('li.firewall').hide();
-        }
-
-        return $chart;
-      };
-
-      var netChart = function(args) {
-
-        var $chart = $('#template').find('.network-chart.normal').clone();
-        var preFilter = args.preFilter ? args.preFilter({
-          items: ['firewall', 'portForwarding', 'loadBalancing'],
-          context: context
-        }) : [];
-
-        // 1. choose between staticNAT chart and non-staticNAT chart  2. filter disabled
tabs
-        if (preFilter.length) {
-          if($.inArray('nonStaticNATChart', preFilter) != -1) { //choose static NAT chart
-            if($.inArray('firewall', preFilter) == -1) {
-              return staticNATChart(args, true); //static NAT including Firewall
-            }
-            else {
-              return staticNATChart(args, false); //static NAT excluding Firewall
-            }
-          }
-          else {  //choose non-static NAT chart
-            $(preFilter).each(function() {
-              var id = this;
-
-              var $li = $chart.find('li').filter(function() {
-                return $(this).hasClass(id);
-              }).addClass('disabled');
-            });
-          }
-        }
-
-        $chart.find('.view-details').click(function() {
-          makeMultiEditPanel($(this));
-          return false;
-        });
-
-        return $chart;
-      };
-
-      return netChart(args);
+
+                return $chart;
+            };
+
+            return netChart(args);
+        };
     };
-  };
 })(jQuery, cloudStack);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f766a9e5/ui/scripts/ui-custom/login.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui-custom/login.js b/ui/scripts/ui-custom/login.js
index 0dbbf82..de192ee 100644
--- a/ui/scripts/ui-custom/login.js
+++ b/ui/scripts/ui-custom/login.js
@@ -15,133 +15,135 @@
 // specific language governing permissions and limitations
 // under the License.
 (function($, cloudStack) {
-  /**
-   * Login process
-   */
-  cloudStack.uiCustom.login = function(args) {
-    var $container = args.$container;
-    var $login = $('#template').find('.login').clone();
-    var $form = $login.find('form');
-    var $inputs = $form.find('input[type=text], input[type=password]');
-    var complete = args.complete;
-    var bypass = args.bypassLoginCheck && args.bypassLoginCheck();
-
-    // Check to see if we can bypass login screen
-    if (bypass) {
-      complete({
-        user: bypass.user
-      });
-      $(window).trigger('cloudStack.init');
-
-      return;
-    }
-
-    $login.appendTo('html body');
-    $('html body').addClass('login');
-
-    // Remove label if field was auto filled
-    $.each($form.find('label'), function() {
-      var $label = $(this);
-      var $input = $form.find('input').filter(function() {
-        return $(this).attr('name') == $label.attr('for');
-      });
-      if ($input.val()) {
-        $label.hide();
-      }
-    });
-
-    // Form validation
-    $form.validate();
-
-    // Form label behavior
-    $inputs.bind('keydown focus click blur', function(event) {
-      var $target = $(event.target);
-      var $label = $form.find('label').filter(function() {
-        return $(this).attr('for') == $target.attr('name');
-      });
-
-      if (event.type == 'keydown') {
-        $label.hide();
-
-        return true;
-      } else if (event.type == 'blur') {
-        if ($target.hasClass('first-input')) {
-          $target.removeClass('first-input');
-        }
-        if (!$(this).val()) {
-          $label.show();
-        }
-      } else {
-        if (!$target.hasClass('first-input')) {
-            $label.hide();
-        }
-      }
-
-      return true;
-    });
-
-    if (!args.hasLogo) $login.addClass('nologo');
-
-    // Labels cause related input to be focused
-    $login.find('label').click(function() {
-      var $input = $inputs.filter('[name=' + $(this).attr('for') + ']');
-      var $label = $(this);
-
-      $input.focus();
-      $label.hide();
-    });
+    /**
+     * Login process
+     */
+    cloudStack.uiCustom.login = function(args) {
+        var $container = args.$container;
+        var $login = $('#template').find('.login').clone();
+        var $form = $login.find('form');
+        var $inputs = $form.find('input[type=text], input[type=password]');
+        var complete = args.complete;
+        var bypass = args.bypassLoginCheck && args.bypassLoginCheck();
+
+        // Check to see if we can bypass login screen
+        if (bypass) {
+            complete({
+                user: bypass.user
+            });
+            $(window).trigger('cloudStack.init');
 
-    $inputs.filter(':first').addClass('first-input').focus();
+            return;
+        }
 
-    // Login action
-    $login.find('input[type=submit]').click(function() {
-      if (!$form.valid()) return false;
+        $login.appendTo('html body');
+        $('html body').addClass('login');
 
-      var data = cloudStack.serializeForm($form);
+        // Remove label if field was auto filled
+        $.each($form.find('label'), function() {
+            var $label = $(this);
+            var $input = $form.find('input').filter(function() {
+                return $(this).attr('name') == $label.attr('for');
+            });
+            if ($input.val()) {
+                $label.hide();
+            }
+        });
+
+        // Form validation
+        $form.validate();
+
+        // Form label behavior
+        $inputs.bind('keydown focus click blur', function(event) {
+            var $target = $(event.target);
+            var $label = $form.find('label').filter(function() {
+                return $(this).attr('for') == $target.attr('name');
+            });
 
-      args.loginAction({
-        data: data,
-        response: {
-          success: function(args) {
-            $login.remove();
-            $('html body').removeClass('login');
-            complete({
-              user: args.data.user
+            if (event.type == 'keydown') {
+                $label.hide();
+
+                return true;
+            } else if (event.type == 'blur') {
+                if ($target.hasClass('first-input')) {
+                    $target.removeClass('first-input');
+                }
+                if (!$(this).val()) {
+                    $label.show();
+                }
+            } else {
+                if (!$target.hasClass('first-input')) {
+                    $label.hide();
+                }
+            }
+
+            return true;
+        });
+
+        if (!args.hasLogo) $login.addClass('nologo');
+
+        // Labels cause related input to be focused
+        $login.find('label').click(function() {
+            var $input = $inputs.filter('[name=' + $(this).attr('for') + ']');
+            var $label = $(this);
+
+            $input.focus();
+            $label.hide();
+        });
+
+        $inputs.filter(':first').addClass('first-input').focus();
+
+        // Login action
+        $login.find('input[type=submit]').click(function() {
+            if (!$form.valid()) return false;
+
+            var data = cloudStack.serializeForm($form);
+
+            args.loginAction({
+                data: data,
+                response: {
+                    success: function(args) {
+                        $login.remove();
+                        $('html body').removeClass('login');
+                        complete({
+                            user: args.data.user
+                        });
+                    },
+                    error: function(args) {
+                        cloudStack.dialog.notice({
+                            message: args
+                        });
+                    }
+                }
             });
-          },
-          error: function(args) {
-            cloudStack.dialog.notice({ message: args });
-          }
+
+            return false;
+        });
+
+        // Select language
+        var $languageSelect = $login.find('select[name=language]');
+        $languageSelect.change(function() {
+            if ($(this).val() != '') //language dropdown is not blank
+                $.cookie('lang', $(this).val()); //the selected option in language dropdown
will be used (instead of browser's default language)
+            else //language dropdown is blank
+                $.cookie('lang', null); //null $.cookie('lang'), so browser's default language
will be used.
+            document.location.reload();
+        });
+
+        $languageSelect.val($.cookie('lang'));
+
+        // Hide login screen, mainly for SSO
+        if (args.hideLoginScreen) {
+            $login.children().hide();
+            $login.append($('<div>').addClass('loading-overlay').append(
+                $('<span>').html(
+                    // _l is not set yet, so localize directly to dictionary
+                    // [should fix in future]
+                    dictionary['label.loading'] + '...'
+                )
+            ));
         }
-      });
-
-      return false;
-    });
-
-    // Select language
-    var $languageSelect = $login.find('select[name=language]');
-    $languageSelect.change(function() {
-		  if($(this).val() != '') //language dropdown is not blank
-        $.cookie('lang', $(this).val()); //the selected option in language dropdown will
be used (instead of browser's default language) 
-			else //language dropdown is blank
-			  $.cookie('lang', null); //null $.cookie('lang'), so browser's default language will
be used.
-      document.location.reload();
-    });
-    
-    $languageSelect.val($.cookie('lang'));
-
-    // Hide login screen, mainly for SSO
-    if (args.hideLoginScreen) {
-      $login.children().hide();
-      $login.append($('<div>').addClass('loading-overlay').append(
-        $('<span>').html(
-          // _l is not set yet, so localize directly to dictionary
-          // [should fix in future]
-          dictionary['label.loading'] + '...'
-        )
-      ));
-    }
-
-    $(window).trigger('cloudStack.init');
-  };
+
+        $(window).trigger('cloudStack.init');
+    };
 })(jQuery, cloudStack);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f766a9e5/ui/scripts/ui-custom/physicalResources.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui-custom/physicalResources.js b/ui/scripts/ui-custom/physicalResources.js
index 5173172..f1492eb 100644
--- a/ui/scripts/ui-custom/physicalResources.js
+++ b/ui/scripts/ui-custom/physicalResources.js
@@ -15,123 +15,139 @@
 // specific language governing permissions and limitations
 // under the License.
 (function(cloudStack, $) {
-  cloudStack.uiCustom.physicalResources = function(args) {
-    var listView = function(targetID) {
-      var target = args.sections.physicalResources.listView[targetID];
-      var listViewArgs = $.isFunction(target) ? target() : target;
+    cloudStack.uiCustom.physicalResources = function(args) {
+        var listView = function(targetID) {
+            var target = args.sections.physicalResources.listView[targetID];
+            var listViewArgs = $.isFunction(target) ? target() : target;
 
-      return $('<div>').listView(
-        (listViewArgs.listView || listViewArgs.sections) ? listViewArgs : { listView: listViewArgs
}
-      );
-    };
-    var $dashboard = $('#template').find('.system-dashboard-view').clone();
-    var getData = function() {
-      // Populate data
-      $dashboard.find('[data-item]').hide();
-      cloudStack.sections.system.dashboard.dataProvider({
-        response: {
-          success: function(args) {
-            var data = args.data;
-            $.each(data, function(key, value) {
-              var $elem = $dashboard.find('[data-item=' + key + ']');
-              $elem.hide().html(value).fadeIn();
-            });
-          }
-        }
-      });
-    };
-    var resourceChart = function(args) {
-      getData();
-      return $dashboard
-        .click(function(event) {
-          var $target = $(event.target);
-          if ($target.closest('[view-all-target]').size()) {
-            var targetID = $target.closest('[view-all-target]').attr('view-all-target');
-            args.$browser.cloudBrowser('addPanel', {
-              title: $target.closest('[view-all-title]').attr('view-all-title'),
-              data: '',
-              noSelectPanel: true,
-              maximizeIfSelected: true,
-              complete: function($newPanel) {
-                listView(targetID).appendTo($newPanel);
-              }
+            return $('<div>').listView(
+                (listViewArgs.listView || listViewArgs.sections) ? listViewArgs : {
+                    listView: listViewArgs
+                }
+            );
+        };
+        var $dashboard = $('#template').find('.system-dashboard-view').clone();
+        var getData = function() {
+            // Populate data
+            $dashboard.find('[data-item]').hide();
+            cloudStack.sections.system.dashboard.dataProvider({
+                response: {
+                    success: function(args) {
+                        var data = args.data;
+                        $.each(data, function(key, value) {
+                            var $elem = $dashboard.find('[data-item=' + key + ']');
+                            $elem.hide().html(value).fadeIn();
+                        });
+                    }
+                }
             });
-          }
-        });
-    };
-    $(window).bind('cloudStack.fullRefresh cloudStack.updateResources', function() {
-      if ($dashboard.is(':visible')) {
-        getData();
-      }
-    });
-    return function(args) {
-      $dashboard.find('#update_ssl_button').click(function() {
-        cloudStack.dialog.createForm({
-          form: {
-            title: 'label.update.ssl',
-            desc: 'message.update.ssl',
-            fields: {
-              certificate: { label: 'label.certificate', isTextarea: true },
-              privatekey: { label: 'label.privatekey', isTextarea: true },
-              domainsuffix: { label: 'label.domain.suffix' }
+        };
+        var resourceChart = function(args) {
+            getData();
+            return $dashboard
+                .click(function(event) {
+                    var $target = $(event.target);
+                    if ($target.closest('[view-all-target]').size()) {
+                        var targetID = $target.closest('[view-all-target]').attr('view-all-target');
+                        args.$browser.cloudBrowser('addPanel', {
+                            title: $target.closest('[view-all-title]').attr('view-all-title'),
+                            data: '',
+                            noSelectPanel: true,
+                            maximizeIfSelected: true,
+                            complete: function($newPanel) {
+                                listView(targetID).appendTo($newPanel);
+                            }
+                        });
+                    }
+                });
+        };
+        $(window).bind('cloudStack.fullRefresh cloudStack.updateResources', function() {
+            if ($dashboard.is(':visible')) {
+                getData();
             }
-          },
-          after: function(args) {
-            var $loading = $('<div>').addClass('loading-overlay');
-            $('.system-dashboard-view:visible').prepend($loading);
-            $.ajax({
-              type: "POST",
-              url: createURL('uploadCustomCertificate'),
-              data: {
-                certificate: encodeURIComponent(args.data.certificate),
-                privatekey: encodeURIComponent(args.data.privatekey),
-                domainsuffix: args.data.domainsuffix
-              },
-              dataType: 'json',
-              success: function(json) {
-                var jid = json.uploadcustomcertificateresponse.jobid;
-                var uploadCustomCertificateIntervalID = setInterval(function() { 	
-                  $.ajax({
-                    url: createURL("queryAsyncJobResult&jobId=" + jid),
-                    dataType: "json",
-                    success: function(json) {
-                      var result = json.queryasyncjobresultresponse;
-                      if (result.jobstatus == 0) {
-                        return; //Job has not completed
-                      }
-                      else {
-                        clearInterval(uploadCustomCertificateIntervalID); 
-                        if (result.jobstatus == 1) {
-                          cloudStack.dialog.notice({ message: 'Update SSL Certiciate succeeded'
});
-                        }
-                        else if (result.jobstatus == 2) {
-                          cloudStack.dialog.notice({ message: 'Failed to update SSL Certificate.
' + _s(result.jobresult.errortext) });
+        });
+        return function(args) {
+            $dashboard.find('#update_ssl_button').click(function() {
+                cloudStack.dialog.createForm({
+                    form: {
+                        title: 'label.update.ssl',
+                        desc: 'message.update.ssl',
+                        fields: {
+                            certificate: {
+                                label: 'label.certificate',
+                                isTextarea: true
+                            },
+                            privatekey: {
+                                label: 'label.privatekey',
+                                isTextarea: true
+                            },
+                            domainsuffix: {
+                                label: 'label.domain.suffix'
+                            }
                         }
-                        $loading.remove();
-                      }
                     },
-                    error: function(XMLHttpResponse) {
-                      cloudStack.dialog.notice({ message: 'Failed to update SSL Certificate.
' + parseXMLHttpResponse(XMLHttpResponse) });
-                      $loading.remove();
-                    }
-                  });
-                }, g_queryAsyncJobResultInterval); 		
-              },
-              error: function(XMLHttpResponse) {
-                cloudStack.dialog.notice({ message: 'Failed to update SSL Certificate. '
+ parseXMLHttpResponse(XMLHttpResponse) });
-                $loading.remove();
-              }
+                    after: function(args) {
+                        var $loading = $('<div>').addClass('loading-overlay');
+                        $('.system-dashboard-view:visible').prepend($loading);
+                        $.ajax({
+                            type: "POST",
+                            url: createURL('uploadCustomCertificate'),
+                            data: {
+                                certificate: encodeURIComponent(args.data.certificate),
+                                privatekey: encodeURIComponent(args.data.privatekey),
+                                domainsuffix: args.data.domainsuffix
+                            },
+                            dataType: 'json',
+                            success: function(json) {
+                                var jid = json.uploadcustomcertificateresponse.jobid;
+                                var uploadCustomCertificateIntervalID = setInterval(function()
{
+                                    $.ajax({
+                                        url: createURL("queryAsyncJobResult&jobId=" +
jid),
+                                        dataType: "json",
+                                        success: function(json) {
+                                            var result = json.queryasyncjobresultresponse;
+                                            if (result.jobstatus == 0) {
+                                                return; //Job has not completed
+                                            } else {
+                                                clearInterval(uploadCustomCertificateIntervalID);
+                                                if (result.jobstatus == 1) {
+                                                    cloudStack.dialog.notice({
+                                                        message: 'Update SSL Certiciate succeeded'
+                                                    });
+                                                } else if (result.jobstatus == 2) {
+                                                    cloudStack.dialog.notice({
+                                                        message: 'Failed to update SSL Certificate.
' + _s(result.jobresult.errortext)
+                                                    });
+                                                }
+                                                $loading.remove();
+                                            }
+                                        },
+                                        error: function(XMLHttpResponse) {
+                                            cloudStack.dialog.notice({
+                                                message: 'Failed to update SSL Certificate.
' + parseXMLHttpResponse(XMLHttpResponse)
+                                            });
+                                            $loading.remove();
+                                        }
+                                    });
+                                }, g_queryAsyncJobResultInterval);
+                            },
+                            error: function(XMLHttpResponse) {
+                                cloudStack.dialog.notice({
+                                    message: 'Failed to update SSL Certificate. ' + parseXMLHttpResponse(XMLHttpResponse)
+                                });
+                                $loading.remove();
+                            }
+                        });
+                    },
+                    context: {}
+                });
+                return false;
             });
-          },
-          context: {}
-        });
-        return false;
-      });
-      $dashboard.find('#refresh_button').click(function() {
-        getData();
-        return false;
-      });
-      return resourceChart(args);
+            $dashboard.find('#refresh_button').click(function() {
+                getData();
+                return false;
+            });
+            return resourceChart(args);
+        };
     };
-  };
 }(cloudStack, jQuery));

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f766a9e5/ui/scripts/ui-custom/pluginListing.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui-custom/pluginListing.js b/ui/scripts/ui-custom/pluginListing.js
index 3dcce98..1d4a090 100644
--- a/ui/scripts/ui-custom/pluginListing.js
+++ b/ui/scripts/ui-custom/pluginListing.js
@@ -15,95 +15,107 @@
 // specific language governing permissions and limitations
 // under the License.
 (function($, cloudStack) {
-  var elems = {
-    pluginItem: function(args) {
-      var id = args.id;
-      var title = args.title;
-      var desc = args.desc;
-      var iconURL = args.iconURL;
-      var $pluginItem = $('<li>').addClass('plugin-item').addClass(id);
-      var $title = $('<span>').addClass('title').html(title);
-      var $desc = $('<span>').addClass('desc').html(desc);
-      var $icon = $('<span>').addClass('icon').append(
-        $('<img>').attr({ src: iconURL })
-      );
+    var elems = {
+        pluginItem: function(args) {
+            var id = args.id;
+            var title = args.title;
+            var desc = args.desc;
+            var iconURL = args.iconURL;
+            var $pluginItem = $('<li>').addClass('plugin-item').addClass(id);
+            var $title = $('<span>').addClass('title').html(title);
+            var $desc = $('<span>').addClass('desc').html(desc);
+            var $icon = $('<span>').addClass('icon').append(
+                $('<img>').attr({
+                    src: iconURL
+                })
+            );
 
-      $pluginItem.append(
-        $icon, $title, $desc
-      );
+            $pluginItem.append(
+                $icon, $title, $desc
+            );
 
-      return $pluginItem;
-    },
-    pluginListing: function(args) {
-      var plugins = args.plugins;
-      var $plugins = $('<ul>');
-      var $pluginsListing = $('<div>').addClass('plugins-listing');
+            return $pluginItem;
+        },
+        pluginListing: function(args) {
+            var plugins = args.plugins;
+            var $plugins = $('<ul>');
+            var $pluginsListing = $('<div>').addClass('plugins-listing');
 
-      $(plugins).each(function() {
-        var plugin = this;
-        var $plugin = elems.pluginItem({
-          id: plugin.id,
-          title: plugin.title,
-          desc: plugin.desc,
-          iconURL: 'plugins/' + plugin.id + '/icon.png'
-        });
-        var $browser = $('#browser .container');
+            $(plugins).each(function() {
+                var plugin = this;
+                var $plugin = elems.pluginItem({
+                    id: plugin.id,
+                    title: plugin.title,
+                    desc: plugin.desc,
+                    iconURL: 'plugins/' + plugin.id + '/icon.png'
+                });
+                var $browser = $('#browser .container');
 
-        $plugin.click(function() {
-          $browser.cloudBrowser('addPanel', {
-            title: plugin.title,
-            $parent: $('.panel:first'),
-            complete: function($panel) {
-              $panel.detailView({
-                name: 'Plugin details',
-                tabs: {
-                  details: {
-                    title: 'label.plugin.details',
-                    fields: [
-                      {
-                        name: { label: 'label.name' }
-                      },
-                      {
-                        desc: { label: 'label.description' },
-                        externalLink: {
-                          isExternalLink: true,
-                          label: 'label.external.link'
+                $plugin.click(function() {
+                    $browser.cloudBrowser('addPanel', {
+                        title: plugin.title,
+                        $parent: $('.panel:first'),
+                        complete: function($panel) {
+                            $panel.detailView({
+                                name: 'Plugin details',
+                                tabs: {
+                                    details: {
+                                        title: 'label.plugin.details',
+                                        fields: [{
+                                            name: {
+                                                label: 'label.name'
+                                            }
+                                        }, {
+                                            desc: {
+                                                label: 'label.description'
+                                            },
+                                            externalLink: {
+                                                isExternalLink: true,
+                                                label: 'label.external.link'
+                                            }
+                                        }, {
+                                            authorName: {
+                                                label: 'label.author.name'
+                                            },
+                                            authorEmail: {
+                                                label: 'label.author.email'
+                                            },
+                                            id: {
+                                                label: 'label.id'
+                                            }
+                                        }],
+                                        dataProvider: function(args) {
+                                            args.response.success({
+                                                data: plugin
+                                            });
+                                        }
+                                    }
+                                }
+                            });
                         }
-                      },
-                      {
-                        authorName: { label: 'label.author.name' },
-                        authorEmail: { label: 'label.author.email' },
-                        id: { label: 'label.id' }
-                      }
-                    ],
-                    dataProvider: function(args) {
-                      args.response.success({ data: plugin });
-                    }
-                  }
-                }
-              });
-            }
-          });
-        });
+                    });
+                });
 
-        $plugin.appendTo($plugins);
-      });
+                $plugin.appendTo($plugins);
+            });
 
-      $pluginsListing.append($plugins);
+            $pluginsListing.append($plugins);
 
-      return $pluginsListing;
-    }
-  };
+            return $pluginsListing;
+        }
+    };
 
-  cloudStack.uiCustom.pluginListing = function() {
-    var plugins = cloudStack.plugins;
+    cloudStack.uiCustom.pluginListing = function() {
+        var plugins = cloudStack.plugins;
 
-    return elems.pluginListing({
-      plugins: $(plugins).map(function(index, pluginID) {
-        var plugin = cloudStack.plugins[pluginID].config;
+        return elems.pluginListing({
+            plugins: $(plugins).map(function(index, pluginID) {
+                var plugin = cloudStack.plugins[pluginID].config;
 
-        return $.extend(plugin, { id: pluginID });
-      })
-    });
-  };
+                return $.extend(plugin, {
+                    id: pluginID
+                });
+            })
+        });
+    };
 }(jQuery, cloudStack));

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f766a9e5/ui/scripts/ui-custom/projectSelect.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui-custom/projectSelect.js b/ui/scripts/ui-custom/projectSelect.js
index aef49ed..ba4c7c7 100644
--- a/ui/scripts/ui-custom/projectSelect.js
+++ b/ui/scripts/ui-custom/projectSelect.js
@@ -16,51 +16,52 @@
 // under the License.
 
 (function($, cloudStack) {
-  $(window).bind('cloudStack.ready', function() {
-    var $header = $('#header .controls');
-    var $projectSwitcher = $('<div>').addClass('project-switcher');
-    var $projectSelect = $('<select>').append(
-      $('<option>').attr('value', '-1').html(_l('Default view'))
-    );
-    var $label = $('<label>').html('Project:');
+    $(window).bind('cloudStack.ready', function() {
+        var $header = $('#header .controls');
+        var $projectSwitcher = $('<div>').addClass('project-switcher');
+        var $projectSelect = $('<select>').append(
+            $('<option>').attr('value', '-1').html(_l('Default view'))
+        );
+        var $label = $('<label>').html('Project:');
 
-    // Get project list
-    cloudStack.projects.dataProvider({
-      context: cloudStack.context,
-      response: {
-        success: function(args) {
-          var projects = args.data;
+        // Get project list
+        cloudStack.projects.dataProvider({
+            context: cloudStack.context,
+            response: {
+                success: function(args) {
+                    var projects = args.data;
 
-          $(projects).map(function(index, project) {
-            var $option = $('<option>').val(_s(project.id));
+                    $(projects).map(function(index, project) {
+                        var $option = $('<option>').val(_s(project.id));
 
-            $option.html(_s(project.displaytext ? project.displaytext : project.name));
-            $option.appendTo($projectSelect);
-          });
-        },
-        error: function() {}
-      }
-    });
+                        $option.html(_s(project.displaytext ? project.displaytext : project.name));
+                        $option.appendTo($projectSelect);
+                    });
+                },
+                error: function() {}
+            }
+        });
 
-    $projectSwitcher.append($label, $projectSelect);
-    $projectSwitcher.insertBefore($header.find('.region-switcher'));
+        $projectSwitcher.append($label, $projectSelect);
+        $projectSwitcher.insertBefore($header.find('.region-switcher'));
 
-    // Change project event
-    $projectSelect.change(function() {
-      var projectID = $projectSelect.val();
+        // Change project event
+        $projectSelect.change(function() {
+            var projectID = $projectSelect.val();
 
-      if (projectID != -1) {
-        cloudStack.context.projects = [{
-          id: projectID
-        }];
+            if (projectID != -1) {
+                cloudStack.context.projects = [{
+                    id: projectID
+                }];
 
-        cloudStack.uiCustom.projects({ alreadySelected: true });
-      } else {
-        cloudStack.context.projects = null;
-        $('#cloudStack3-container').removeClass('project-view');
-        $('#navigation li.dashboard').click();
-      }
+                cloudStack.uiCustom.projects({
+                    alreadySelected: true
+                });
+            } else {
+                cloudStack.context.projects = null;
+                $('#cloudStack3-container').removeClass('project-view');
+                $('#navigation li.dashboard').click();
+            }
+        });
     });
-  });
-}(jQuery, cloudStack));      
-
+}(jQuery, cloudStack));


Mime
View raw message