@@ -390,6 +390,7 @@ $("#create-vm").click(function(){
390390 const cores = document . getElementById ( 'cores' ) . value ;
391391 const mem = document . getElementById ( 'mem' ) . value ;
392392 const template = document . getElementById ( 'template' ) . value ;
393+ const ssh_key = document . getElementById ( 'ssh-key' ) . value ;
393394 const iso = document . getElementById ( 'iso' ) . value ;
394395 const user = document . getElementById ( 'user' ) ;
395396 const max_cpu = $ ( this ) . data ( 'max_cpu' ) ;
@@ -451,6 +452,7 @@ $("#create-vm").click(function(){
451452 data . append ( 'template' , template ) ;
452453 data . append ( 'disk' , disk ) ;
453454 data . append ( 'iso' , iso ) ;
455+ data . append ( 'ssh_key' , ssh_key ) ;
454456 if ( user ) {
455457 data . append ( 'user' , user . value ) ;
456458 }
@@ -459,12 +461,10 @@ $("#create-vm").click(function(){
459461 method : 'post' ,
460462 body : data
461463 } ) . then ( ( response ) => {
462- return response . text ( )
463- } ) . then ( ( password ) => {
464464 if ( template == 'none' ) {
465465 var swal_text = `${ name } is now being created. Check back soon and it should be good to go.`
466466 } else {
467- var swal_text = `${ name } is now being created. Check back soon and it should be good to go. The SSH credentials are your CSH username for the user and ${ password } for the password. Save this password because you will not be able to retrieve it again! `
467+ var swal_text = `${ name } is now being created. Check back soon and it should be good to go. The SSH credentials are your CSH username for the user and the SSH key you provided. `
468468 }
469469 return swal ( `${ swal_text } ` , {
470470 icon : "success" ,
@@ -753,16 +753,19 @@ $(".add-ignored-pool").click(function(){
753753 } ) ;
754754} ) ;
755755
756- function hide_for_template ( obj ) {
756+ function change_for_template ( obj ) {
757757 var template_element = obj ;
758758 var selected = template_element . options [ template_element . selectedIndex ] . value ;
759759 var hide_area = document . getElementById ( 'hide-for-template' ) ;
760+ var show_area = document . getElementById ( 'show-for-template' ) ;
760761
761- if ( selected === 'none' ) {
762+ if ( selected === 'none' ) {
762763 hide_area . style . display = 'block' ;
764+ show_area . style . display = 'none' ;
763765 }
764- else {
766+ else {
765767 hide_area . style . display = 'none' ;
768+ show_area . style . display = 'block' ;
766769 }
767770}
768771
@@ -869,7 +872,6 @@ $(".resize-disk").click(function(){
869872$ ( ".edit-template" ) . click ( function ( ) {
870873 const template_id = $ ( this ) . data ( 'template_id' ) ;
871874 const template_name = $ ( this ) . data ( 'template_name' ) ;
872- const template_username = $ ( this ) . data ( 'template_username' ) ;
873875 const template_disk = $ ( this ) . data ( 'template_disk' ) ;
874876 var options = document . createElement ( 'div' ) ;
875877 name_text = document . createElement ( 'p' ) ;
@@ -878,18 +880,6 @@ $(".edit-template").click(function(){
878880 var name = document . createElement ( 'input' ) ;
879881 name . defaultValue = template_name ;
880882 options . append ( name ) ;
881- username_text = document . createElement ( 'p' ) ;
882- username_text . innerHTML = 'Username' ;
883- options . append ( username_text ) ;
884- var username = document . createElement ( 'input' ) ;
885- username . defaultValue = template_username ;
886- options . append ( username ) ;
887- password_text = document . createElement ( 'p' ) ;
888- password_text . innerHTML = 'Password' ;
889- options . append ( password_text ) ;
890- var password = document . createElement ( 'input' ) ;
891- password . type = 'password' ;
892- options . append ( password ) ;
893883 disk_text = document . createElement ( 'p' ) ;
894884 disk_text . innerHTML = 'Disk Size (GB)' ;
895885 options . append ( disk_text ) ;
@@ -917,8 +907,6 @@ $(".edit-template").click(function(){
917907 if ( willChange ) {
918908 var data = new FormData ( ) ;
919909 data . append ( 'name' , $ ( name ) . val ( ) ) ;
920- data . append ( 'username' , $ ( username ) . val ( ) ) ;
921- data . append ( 'password' , $ ( password ) . val ( ) ) ;
922910 data . append ( 'disk' , $ ( disk ) . val ( ) ) ;
923911 fetch ( `/template/${ template_id } /edit` , {
924912 credentials : 'same-origin' ,
0 commit comments