mirror of https://github.com/apache/cloudstack.git
CS-14559: cloudstack 3.0 UI - VM Wizard - last step - screen doesn't change, but user-entered VM name will be passed as hostname and displayname to deployVirtualMachine API.
This commit is contained in:
parent
3337f1488b
commit
b3df14da0c
|
|
@ -385,23 +385,14 @@
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
// Step 6: Review
|
||||
function(args) {
|
||||
return false;
|
||||
}
|
||||
],
|
||||
action: function(args) {
|
||||
/*
|
||||
var isValid = true;
|
||||
isValid &= validateString("Name", $thisPopup.find("#wizard_vm_name"), $thisPopup.find("#wizard_vm_name_errormsg"), true); //optional
|
||||
isValid &= validateString("Group", $thisPopup.find("#wizard_vm_group"), $thisPopup.find("#wizard_vm_group_errormsg"), true); //optional
|
||||
if (!isValid)
|
||||
return;
|
||||
*/
|
||||
|
||||
// Step 6: Review
|
||||
function(args) {
|
||||
return false;
|
||||
}
|
||||
],
|
||||
action: function(args) {
|
||||
// Create a new VM!!!!
|
||||
var array1 = [];
|
||||
|
||||
|
|
@ -496,8 +487,10 @@
|
|||
}
|
||||
|
||||
var displayname = args.data.displayname;
|
||||
if(displayname != null && displayname.length > 0)
|
||||
if(displayname != null && displayname.length > 0) {
|
||||
array1.push("&displayname="+todb(displayname));
|
||||
array1.push("&name="+todb(displayname));
|
||||
}
|
||||
|
||||
var group = args.data.groupname;
|
||||
if (group != null && group.length > 0)
|
||||
|
|
@ -514,7 +507,7 @@
|
|||
getUpdatedItem: function(json) {
|
||||
var item = json.queryasyncjobresultresponse.jobresult.virtualmachine;
|
||||
if (item.passwordenabled == true)
|
||||
alert("Password of new VM " + getVmName(item.name, item.displayname) + " is " + item.password);
|
||||
alert("Password of new VM " + item.displayname + " is " + item.password);
|
||||
return item;
|
||||
},
|
||||
getActionFilter: function() {
|
||||
|
|
|
|||
|
|
@ -197,6 +197,20 @@ function isValidJsonString(str) {
|
|||
return true;
|
||||
}
|
||||
|
||||
cloudStack.validate = {
|
||||
vmHostName: function(args) {
|
||||
// 1 ~ 63 characters long
|
||||
// ASCII letters 'a' through 'z' (case-insensitive), digits '0' through '9', hyphen ('-')
|
||||
// must start with a letter
|
||||
// must end with a letter or a digit (must not end with a hyphen)
|
||||
var regexp = /^[a-z]{1}[a-z0-9\-]{0,61}[a-z0-9]{0,1}$/;
|
||||
var b = regexp.test(args); //true or false
|
||||
if(b == false)
|
||||
cloudStack.dialog.notice({ message: 'Instance name can not be longer than 63 characters. Only ASCII letters a~z, digits 0~9, hyphen are allowed. Must start with a letter and end with a letter or a digit.' });
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
cloudStack.preFilter = {
|
||||
createTemplate: function(args) {
|
||||
if(isAdmin()) {
|
||||
|
|
|
|||
|
|
@ -641,6 +641,16 @@
|
|||
}
|
||||
}
|
||||
|
||||
//step 6 - review (spcifiy displyname, group as well)
|
||||
if ($activeStep.hasClass('review')) {
|
||||
if($activeStep.find('input[name=displayname]').size() > 0 && $activeStep.find('input[name=displayname]').val().length > 0) {
|
||||
//validate
|
||||
var b = cloudStack.validate.vmHostName($activeStep.find('input[name=displayname]').val());
|
||||
if(b == false)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$form.valid()) {
|
||||
if ($form.find('input.error:visible, select.error:visible').size()) {
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue