You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2013/08/26 20:56:00 UTC
git commit: updated refs/heads/master to 474b966
Updated Branches:
refs/heads/master b1ee33abc -> 474b966bc
CLOUDSTACK-4508 (WIP): Conditionally make VSM fields required
If VSM is active, and either traffic overrides are checked, make VSM
fields required.
** This creates new VSM fields, with '_req' appended to end of ID. API
calls need to be changes to account for this.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/474b966b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/474b966b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/474b966b
Branch: refs/heads/master
Commit: 474b966bc12afc753ff314eef9ef24600a22e8f9
Parents: b1ee33a
Author: Brian Federle <br...@citrix.com>
Authored: Mon Aug 26 11:53:04 2013 -0700
Committer: Brian Federle <br...@citrix.com>
Committed: Mon Aug 26 11:55:47 2013 -0700
----------------------------------------------------------------------
ui/scripts/system.js | 69 ++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 66 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/474b966b/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index 15b3ae2..e3f45c4 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -10284,6 +10284,47 @@
},
createForm: {
title: 'label.add.cluster',
+ preFilter: function(args) {
+ var $form = args.$form;
+
+ $form.click(function() {
+ // VSM fields need to be required if a traffic override is selected
+ //
+ // ** This is done by switching out optional fields for required fields;
+ // need to check for *either* vsm[...]_req or vsm[...]
+ var $overrideGuestTraffic = $form.find('.form-item[rel=overrideguesttraffic] input[type=checkbox]');
+ var $overridePublicTraffic = $form.find('.form-item[rel=overridepublictraffic] input[type=checkbox]');
+ var $vsmFields = $form.find('.form-item').filter(function() {
+ var vsmFields = [
+ 'vsmipaddress',
+ 'vsmusername',
+ 'vsmpassword'
+ ];
+
+ return $.inArray($(this).attr('rel'), vsmFields) > -1;
+ });
+ var $vsmReqFields = $form.find('.form-item').filter(function() {
+ var vsmFields = [
+ 'vsmipaddress_req',
+ 'vsmusername_req',
+ 'vsmpassword_req'
+ ];
+
+ return $.inArray($(this).attr('rel'), vsmFields) > -1;
+ });
+
+
+ if ($overridePublicTraffic.is(':checked') ||
+ $overrideGuestTraffic.is(':checked')) {
+ $vsmReqFields.css('display', 'inline-block');
+ $vsmFields.hide();
+ } else {
+ $vsmFields.css('display', 'inline-block');
+ $vsmReqFields.hide();
+ }
+
+ });
+ },
fields: {
zoneid: {
label: 'Zone Name',
@@ -10722,14 +10763,28 @@
validation: {
required: false
},
- isHidden: false
+ isHidden: true
+ },
+ vsmipaddress_req: {
+ label: 'Nexus 1000v IP Address',
+ validation: {
+ required: true
+ },
+ isHidden: true
},
vsmusername: {
label: 'Nexus 1000v Username',
validation: {
required: false
},
- isHidden: false
+ isHidden: true
+ },
+ vsmusername_req: {
+ label: 'Nexus 1000v Username',
+ validation: {
+ required: true
+ },
+ isHidden: true
},
vsmpassword: {
label: 'Nexus 1000v Password',
@@ -10737,7 +10792,15 @@
required: false
},
isPassword: true,
- isHidden: false
+ isHidden: true
+ },
+ vsmpassword_req: {
+ label: 'Nexus 1000v Password',
+ validation: {
+ required: true
+ },
+ isPassword: true,
+ isHidden: true
}
//hypervisor==VMWare ends here
}