You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by je...@apache.org on 2015/01/20 01:16:40 UTC

[3/3] git commit: updated refs/heads/volume-upload to cef4447

(1) Remove UploadFile button from Register Template dialog. (2) sync latest templates.js from master branch.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cef4447f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cef4447f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cef4447f

Branch: refs/heads/volume-upload
Commit: cef4447fd4c5b5a982098405721ac8e27c644859
Parents: aa9a7f5
Author: Jessica Wang <je...@apache.org>
Authored: Mon Jan 19 16:13:57 2015 -0800
Committer: Jessica Wang <je...@apache.org>
Committed: Mon Jan 19 16:13:57 2015 -0800

----------------------------------------------------------------------
 ui/scripts/templates.js | 241 ++++++++++++++++++++++---------------------
 1 file changed, 125 insertions(+), 116 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cef4447f/ui/scripts/templates.js
----------------------------------------------------------------------
diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js
index 1b6400a..86f9159 100644
--- a/ui/scripts/templates.js
+++ b/ui/scripts/templates.js
@@ -43,6 +43,9 @@
                         mine: {
                             label: 'ui.listView.filters.mine'
                         },
+                        shared: {
+                            label: 'Shared'
+                        },
                         featured: {
                             label: 'label.featured'
                         },
@@ -107,22 +110,6 @@
                                 title: 'label.action.register.template',
                                 docID: 'helpNetworkOfferingName',
                                 preFilter: cloudStack.preFilter.createTemplate,
-                                fileUpload: {
-                                    getURL: function(args) {
-                                        args.response.success({
-                                            url: 'http://10.223.183.3/test-upload.php'
-                                        });
-                                    },
-                                    postUpload: function(args) {
-                                        // Called when upload is done to do 
-                                        // verification checks;
-                                        // i.e., poll the server to verify successful upload
-                                        //
-                                        // success() will close the dialog and call standard action
-                                        // error() will keep dialog open if user wants to re-submit
-                                        args.response.success();
-                                    }
-                                },
                                 fields: {
                                     name: {
                                         label: 'label.name',
@@ -131,10 +118,6 @@
                                             required: true
                                         }
                                     },
-                                    templateFileUpload: {
-                                        label: 'Select a file',
-                                        isFileUpload: true
-                                    },
                                     description: {
                                         label: 'label.description',
                                         docID: 'helpRegisterTemplateDescription',
@@ -342,11 +325,19 @@
                                             });
                                             items.push({
                                                 id: "us",
-                                                description: "US"
+                                                description: "US Keboard"
+                                            });
+                                            items.push({
+                                                id: "uk",
+                                                description: "UK Keyboard"
                                             });
                                             items.push({
                                                 id: "jp",
-                                                description: "Japanese"
+                                                description: "Japanese Keyboard"
+                                            });
+                                            items.push({
+                                                id: "sc",
+                                                description: "Simplified Chinese"
                                             });
                                             args.response.success({
                                                 data: items
@@ -428,20 +419,18 @@
                                     osTypeId: {
                                         label: 'label.os.type',
                                         docID: 'helpRegisterTemplateOSType',
-                                        select: function(args) {                                        	
-                                        	if (ostypeObjs == undefined) {
-	                                            $.ajax({
-	                                                url: createURL("listOsTypes"),
-	                                                dataType: "json",
-	                                                async: false,
-	                                                success: function(json) {	                                                	
-	                                                	ostypeObjs = json.listostypesresponse.ostype;	                                                    
-	                                                }
-	                                            });
-                                        	}                                        	
-                                        	args.response.success({
-                                                data: ostypeObjs
-                                            });
+                                        select: function(args) {    
+                                            $.ajax({
+                                                url: createURL("listOsTypes"),
+                                                dataType: "json",
+                                                async: true,
+                                                success: function(json) {	                                                	
+                                                	var ostypeObjs = json.listostypesresponse.ostype;
+                                                	args.response.success({
+                                                        data: ostypeObjs
+                                                    });
+                                                }
+                                            });                                        	    
                                         }
                                     },
 
@@ -611,6 +600,11 @@
                                             templatefilter: 'self'
                                         });
                                         break;
+                                    case "shared":
+                                        $.extend(data, {
+                                            templatefilter: 'shared'
+                                        });
+                                        break;
                                     case "featured":
                                         ignoreProject = true;
                                         $.extend(data, {
@@ -663,6 +657,10 @@
 
                     detailView: {
                         name: 'Template details',
+                        viewAll: {
+                            label: 'label.instances',
+                            path: 'instances'
+                        },
                         actions: {
                             edit: {
                                 label: 'label.edit',
@@ -865,16 +863,16 @@
                                     }
                                                                       
                                     if ('templates' in args.context && args.context.templates[0].ostypeid != undefined) {
-                                    	if (ostypeObjs == undefined) {
-        	                            	$.ajax({
-        	                                    url: createURL("listOsTypes"),
-        	                                    dataType: "json",
-        	                                    async: false,
-        	                                    success: function(json) {	                                    	
-        	                                    	ostypeObjs = json.listostypesresponse.ostype;		                                    	
-        	                                    }
-        	                                });
-                                    	}                            	
+                                    	var ostypeObjs;
+    	                            	$.ajax({
+    	                                    url: createURL("listOsTypes"),
+    	                                    dataType: "json",
+    	                                    async: false,
+    	                                    success: function(json) {	                                    	
+    	                                    	var ostypeObjs = json.listostypesresponse.ostype;		                                    	
+    	                                    }
+    	                                });
+                                    	                           	
                                     	if (ostypeObjs != undefined) {
                                     		var ostypeName;
                                     		for (var i = 0; i < ostypeObjs.length; i++) {
@@ -926,7 +924,7 @@
                                         }
                                     },
                                     isextractable: {
-                                        label: 'label.extractable',
+                                        label: 'label.extractable.lower',
                                         isBoolean: true,
                                         isEditable: function() {
                                             if (isAdmin())
@@ -979,16 +977,16 @@
                                         label: 'label.os.type',
                                         isEditable: true,
                                         select: function(args) {
-                                        	if (ostypeObjs == undefined) {
-	                                            $.ajax({
-	                                                url: createURL("listOsTypes"),
-	                                                dataType: "json",
-	                                                async: false,
-	                                                success: function(json) {	                                                	
-	                                                	ostypeObjs = json.listostypesresponse.ostype;	                                                   
-	                                                }
-	                                            });
-                                        	}                                        	
+                                        	var ostypeObjs;
+                                            $.ajax({
+                                                url: createURL("listOsTypes"),
+                                                dataType: "json",
+                                                async: false,
+                                                success: function(json) {	                                                	
+                                                	ostypeObjs = json.listostypesresponse.ostype;	                                                   
+                                                }
+                                            });
+                                        	                                        	
                                         	var items = [];
                                             $(ostypeObjs).each(function() {
                                                 items.push({
@@ -1078,7 +1076,7 @@
                                             label: 'label.status'
                                         },
                                         isready: {
-                                            label: 'state.ready',
+                                            label: 'state.Ready',
                                             converter: cloudStack.converters.toBooleanText
                                         }
                                     },
@@ -1116,6 +1114,7 @@
                                     },
                                     
                                     detailView: {
+                                        noCompact: true,
                                         actions: {
                                              remove: {
                                                  label: 'label.action.delete.template',
@@ -1246,16 +1245,16 @@
                                                 }
                                                                                                
                                                 if ('templates' in args.context && args.context.templates[0].ostypeid != undefined) {
-                                                	if (ostypeObjs == undefined) {
-                    	                            	$.ajax({
-                    	                                    url: createURL("listOsTypes"),
-                    	                                    dataType: "json",
-                    	                                    async: false,
-                    	                                    success: function(json) {	                                    	
-                    	                                    	ostypeObjs = json.listostypesresponse.ostype;		                                    	
-                    	                                    }
-                    	                                });
-                                                	}                            	
+                                                	var ostypeObjs;
+                	                            	$.ajax({
+                	                                    url: createURL("listOsTypes"),
+                	                                    dataType: "json",
+                	                                    async: false,
+                	                                    success: function(json) {	                                    	
+                	                                    	ostypeObjs = json.listostypesresponse.ostype;		                                    	
+                	                                    }
+                	                                });
+                                                	                           	
                                                 	if (ostypeObjs != undefined) {
                                                 		var ostypeName;
                                                 		for (var i = 0; i < ostypeObjs.length; i++) {
@@ -1292,7 +1291,7 @@
                                                     label: 'label.zone.id'
                                                 },
                                             	isready: {
-                                                    label: 'state.ready',
+                                                    label: 'state.Ready',
                                                     converter: cloudStack.converters.toBooleanText
                                                 },
                                                 status: {
@@ -1324,7 +1323,7 @@
                                                     }
                                                 },
                                                 isextractable: {
-                                                    label: 'extractable',
+                                                    label: 'label.extractable.lower',
                                                     isBoolean: true,
                                                     isEditable: function() {
                                                         if (isAdmin())
@@ -1341,7 +1340,7 @@
                                                     converter: cloudStack.converters.toBooleanText
                                                 },
                                                 isdynamicallyscalable: {
-                                                    label: 'Dynamically Scalable',
+                                                    label: 'label.dynamically.scalable',
                                                     isBoolean: true,
                                                     isEditable: true,
                                                     converter: cloudStack.converters.toBooleanText
@@ -1377,16 +1376,16 @@
                                                     label: 'label.os.type',
                                                     isEditable: true,
                                                     select: function(args) {                                                    
-                                                    	if (ostypeObjs == undefined) {      
-	                                                        $.ajax({
-	                                                            url: createURL("listOsTypes"),
-	                                                            dataType: "json",
-	                                                            async: false,
-	                                                            success: function(json) {
-	                                                            	ostypeObjs = json.listostypesresponse.ostype;	                                                                
-	                                                            }
-	                                                        });
-                                                    	}                                                    
+                                                    	var ostypeObjs;
+                                                        $.ajax({
+                                                            url: createURL("listOsTypes"),
+                                                            dataType: "json",
+                                                            async: false,
+                                                            success: function(json) {
+                                                            	ostypeObjs = json.listostypesresponse.ostype;	                                                                
+                                                            }
+                                                        });
+                                                    	                                                    
                                                     	var items = [];
                                                         $(ostypeObjs).each(function() {
                                                             items.push({
@@ -1474,6 +1473,9 @@
                         mine: {
                             label: 'ui.listView.filters.mine'
                         },
+                        shared: {
+                            label: 'Shared'
+                        },
                         featured: {
                             label: 'label.featured'
                         },
@@ -1580,27 +1582,25 @@
                                             required: true
                                         },
                                         select: function(args) {
-                                        	if (ostypeObjs == undefined) {   
-	                                            $.ajax({
-	                                                url: createURL("listOsTypes"),
-	                                                dataType: "json",
-	                                                async: false,
-	                                                success: function(json) {
-	                                                    osTypeObjs = json.listostypesresponse.ostype;	                                                    
-	                                                }
-	                                            });
-                                        	}
-                                        	var items = [];
-                                            //items.push({id: "", description: "None"}); //shouldn't have None option when bootable is checked
-                                            $(osTypeObjs).each(function() {
-                                                items.push({
-                                                    id: this.id,
-                                                    description: this.description
-                                                });
-                                            });
-                                            args.response.success({
-                                                data: items
-                                            });
+                                        	$.ajax({
+                                                url: createURL("listOsTypes"),
+                                                dataType: "json",
+                                                async: true,
+                                                success: function(json) {
+                                                    var ostypeObjs = json.listostypesresponse.ostype;	
+                                                    var items = [];
+                                                    //items.push({id: "", description: "None"}); //shouldn't have None option when bootable is checked
+                                                    $(ostypeObjs).each(function() {
+                                                        items.push({
+                                                            id: this.id,
+                                                            description: this.description
+                                                        });
+                                                    });
+                                                    args.response.success({
+                                                        data: items
+                                                    });
+                                                }
+                                            });                                        	                                        	
                                         }
                                     },
 
@@ -1741,6 +1741,11 @@
                                             isofilter: 'self'
                                         });
                                         break;
+                                    case "shared":
+                                        $.extend(data, {
+                                        	isofilter: 'shared'
+                                        });
+                                        break;
                                     case "featured":
                                         ignoreProject = true;
                                         $.extend(data, {
@@ -1796,6 +1801,10 @@
 
                     detailView: {
                         name: 'label.details',
+                        viewAll: {
+                            label: 'label.instances',
+                            path: 'instances'
+                        },
                         actions: {
                             edit: {
                                 label: 'label.edit',
@@ -1963,7 +1972,7 @@
                                         }
                                     },
                                     isextractable: {
-                                        label: 'label.extractable',
+                                        label: 'label.extractable.lower',
                                         isBoolean: true,
                                         isEditable: function() {
                                             if (isAdmin())
@@ -2074,7 +2083,7 @@
                                             label: 'label.status'
                                         },
                                         isready: {
-                                            label: 'state.ready',
+                                            label: 'state.Ready',
                                             converter: cloudStack.converters.toBooleanText
                                         }
                                     },
@@ -2228,7 +2237,7 @@
                                                 }
                                             }, {
                                                 id: {
-                                                    label: 'ID'
+                                                    label: 'label.id'
                                                 },
                                                 zonename: {
                                                     label: 'label.zone.name'
@@ -2261,7 +2270,7 @@
                                                     }
                                                 },
                                                 isextractable: {
-                                                    label: 'extractable',
+                                                    label: 'label.extractable.lower',
                                                     isBoolean: true,
                                                     isEditable: function() {
                                                         if (isAdmin())
@@ -2297,16 +2306,16 @@
                                                     label: 'label.os.type',
                                                     isEditable: true,
                                                     select: function(args) {
-                                                    	if (ostypeObjs == undefined) {  
-	                                                        $.ajax({
-	                                                            url: createURL("listOsTypes"),
-	                                                            dataType: "json",
-	                                                            async: false,
-	                                                            success: function(json) {
-	                                                            	ostypeObjs = json.listostypesresponse.ostype;	                                                                
-	                                                            }
-	                                                        });
-                                                    	}
+                                                    	var ostypeObjs;
+                                                        $.ajax({
+                                                            url: createURL("listOsTypes"),
+                                                            dataType: "json",
+                                                            async: false,
+                                                            success: function(json) {
+                                                            	ostypeObjs = json.listostypesresponse.ostype;	                                                                
+                                                            }
+                                                        });
+                                                	
                                                     	var items = [];
                                                         $(ostypeObjs).each(function() {
                                                             items.push({