@@ -2841,6 +2841,7 @@ cloudStack.createTemplateMethod = function (isSnapshot){
28412841 isChecked : false
28422842 }
28432843 }
2844+
28442845 } ,
28452846 action : function ( args ) {
28462847 var data = {
@@ -2898,6 +2899,107 @@ cloudStack.createTemplateMethod = function (isSnapshot){
28982899 }
28992900 } ;
29002901} ;
2902+ cloudStack . createTemplateFromSnapshotMethod = function ( ) {
2903+ return {
2904+ label : 'label.create.template' ,
2905+ messages : {
2906+ confirm : function ( args ) {
2907+ return 'message.create.template' ;
2908+ } ,
2909+ notification : function ( args ) {
2910+ return 'label.create.template' ;
2911+ }
2912+ } ,
2913+ createForm : {
2914+ title : 'label.create.template' ,
2915+ desc : '' ,
2916+
2917+
2918+ fields : {
2919+ name : {
2920+ label : 'label.name' ,
2921+ validation : {
2922+ required : true
2923+ }
2924+ } ,
2925+ displayText : {
2926+ label : 'label.description' ,
2927+ validation : {
2928+ required : true
2929+ }
2930+ } ,
2931+ osTypeId : {
2932+ label : 'label.os.type' ,
2933+ select : function ( args ) {
2934+ $ . ajax ( {
2935+ url : createURL ( "listOsTypes" ) ,
2936+ dataType : "json" ,
2937+ async : true ,
2938+ success : function ( json ) {
2939+ var ostypes = json . listostypesresponse . ostype ;
2940+ var items = [ ] ;
2941+ $ ( ostypes ) . each ( function ( ) {
2942+ items . push ( {
2943+ id : this . id ,
2944+ description : this . description
2945+ } ) ;
2946+ } ) ;
2947+ args . response . success ( {
2948+ data : items
2949+ } ) ;
2950+ }
2951+ } ) ;
2952+ }
2953+ } ,
2954+ isPublic : {
2955+ label : 'label.public' ,
2956+ isBoolean : true
2957+ } ,
2958+ isPasswordEnabled : {
2959+ label : 'label.password.enabled' ,
2960+ isBoolean : true
2961+ } ,
2962+ isdynamicallyscalable : {
2963+ label : 'label.dynamically.scalable' ,
2964+ isBoolean : true
2965+ }
2966+ }
2967+ } ,
2968+ action : function ( args ) {
2969+ var data = {
2970+ snapshotid : args . context . snapshots [ 0 ] . id ,
2971+ name : args . data . name ,
2972+ displayText : args . data . displayText ,
2973+ osTypeId : args . data . osTypeId ,
2974+ isPublic : ( args . data . isPublic == "on" ) ,
2975+ passwordEnabled : ( args . data . isPasswordEnabled == "on" ) ,
2976+ isdynamicallyscalable : ( args . data . isdynamicallyscalable == "on" )
2977+ } ;
2978+
2979+ $ . ajax ( {
2980+ url : createURL ( 'createTemplate' ) ,
2981+ data : data ,
2982+ success : function ( json ) {
2983+ var jid = json . createtemplateresponse . jobid ;
2984+ args . response . success ( {
2985+ _custom : {
2986+ jobId : jid ,
2987+ getUpdatedItem : function ( json ) {
2988+ return { } ; //nothing in this snapshot needs to be updated
2989+ } ,
2990+ getActionFilter : function ( ) {
2991+ return snapshotActionfilter ;
2992+ }
2993+ }
2994+ } ) ;
2995+ }
2996+ } ) ;
2997+ } ,
2998+ notification : {
2999+ poll : pollAsyncJobResult
3000+ }
3001+ } ;
3002+ } ;
29013003
29023004cloudStack . addParameterToCommandUrlParameterArrayIfValueIsNotEmpty = function ( array , parameterName , value ) {
29033005 if ( value != null && value . length > 0 ) {
0 commit comments