cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jessicaw...@apache.org
Subject [30/39] Format JS
Date Fri, 19 Jul 2013 17:01:43 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f766a9e5/ui/scripts/events.js
----------------------------------------------------------------------
diff --git a/ui/scripts/events.js b/ui/scripts/events.js
index bd50887..873998e 100644
--- a/ui/scripts/events.js
+++ b/ui/scripts/events.js
@@ -15,198 +15,241 @@
 // specific language governing permissions and limitations
 // under the License.
 (function(cloudStack) {
-  cloudStack.sections.events = {
-    title: 'label.menu.events',
-    id: 'events',
-    sectionSelect: {
-      preFilter: function(args) {
-        if(isAdmin())
-          return ["events", "alerts"];
-        else
-          return ["events"];
-      },
-      label: 'label.select-view'
-    },
-    sections: {
-      events: {
-        type: 'select',
+    cloudStack.sections.events = {
         title: 'label.menu.events',
-        listView: {
-          id: 'events',
-          label: 'label.menu.events',
-          fields: {            
-            description: { label: 'label.description' },
-	    level: { label: 'label.level' },
-            type: {label:'Type'},
-            domain: { label: 'label.domain' },
-	    account: { label: 'label.account' },
-            created: { label: 'label.date', converter: cloudStack.converters.toLocalDate }
-          },
-
-          actions: {
-            // Remove multiple events
-            remove: {
-              label: 'Delete Events',
-              isHeader: true,
-              addRow: false,
-              messages: {
-                notification: function(args) {
-                  return 'Events Deleted';
-                }
-              },
-              createForm: {
-                title:'Delete Events',
-                desc: '',
-                fields: {
-                  type: { label: 'By event type'  , docID:'helpEventsDeleteType'},
-                  date: {
-                    label: 'By date (older than)',
-                    docID:'helpEventsDeleteDate',
-                    isDatepicker: true
-                  }
-                }
-              },
-             action: function(args) {
-
-                var data={};
-
-                if(args.data.type != "")
-                  $.extend(data, { type:args.data.type });
-
-                if(args.data.date != "")
-                  $.extend(data, {olderthan:args.data.date });
-   
-                $.ajax({
-
-                     url:createURL("deleteEvents"),
-                     data:data,
-                     dataType:'json',
-                     async: false,
-
-                  success:function(data){
-
-                  args.response.success();
-               
-                    }  
-                   });
-                                  // Reloads window with events removed
-                $(window).trigger('cloudStack.fullRefresh');
-              }
+        id: 'events',
+        sectionSelect: {
+            preFilter: function(args) {
+                if (isAdmin())
+                    return ["events", "alerts"];
+                else
+                    return ["events"];
             },
-
-            // Archive multiple events
-            archive: {
-              label: 'Archive Events',
-              isHeader: true,
-              addRow: false,
-              messages: {
-                notification: function(args) {
-                  return 'Archive events';
-                }
-              },
-              createForm: {
-                title:'Archive Events',
-                desc: '',
-                fields: {
-                  type: { label: 'By event type' , docID:'helpEventsArchiveType'},
-                  date: { label: 'By date (older than)' , docID:'helpEventsArchiveDate', isDatepicker: true },
-                }
-              },
-              action: function(args) {
-                   var data={};
-
-                if(args.data.type != "")
-                  $.extend(data, { type:args.data.type });
-
-                if(args.data.date != "")
-                  $.extend(data, {olderthan:args.data.date });
-
-                $.ajax({
-
-                     url:createURL("archiveEvents"),
-                     data:data,
-                     dataType:'json',
-                     async: false,
-
-                  success:function(data){
-
-                  args.response.success();
-
-                    }
-                   });
-
-                // Reloads window with events removed
-                $(window).trigger('cloudStack.fullRefresh');
-              }
-            }
-
-          },
-
-
-										
-					advSearchFields: {	
-            level: {
-						  label: 'label.level',
-							select: function(args) {
-							  args.response.success({
-									data: [
-									  {id: '', description: ''}, 
-									  {id: 'INFO', description: 'INFO'}, 
-										{id: 'WARN', description: 'WARN'}, 
-										{id: 'ERROR', description: 'ERROR'}
-									]
-								});
-							}
-						},					
-						
-						domainid: {					
-							label: 'Domain',					
-							select: function(args) {
-								if(isAdmin() || isDomainAdmin()) {
-									$.ajax({
-										url: createURL('listDomains'),
-										data: { 
-											listAll: true,
-											details: 'min'
-										},
-										success: function(json) {
-											var array1 = [{id: '', description: ''}];
-											var domains = json.listdomainsresponse.domain;
-											if(domains != null && domains.length > 0) {
-												for(var i = 0; i < domains.length; i++) {
-													array1.push({id: domains[i].id, description: domains[i].path});
-												}
-											}
-											args.response.success({
-												data: array1
-											});
-										}
-									});
-								}
-								else {
-									args.response.success({
-										data: null
-									});
-								}
-							},
-							isHidden: function(args) {
-								if(isAdmin() || isDomainAdmin())
-									return false;
-								else
-									return true;
-							}
-						},		
-						
-						account: { 
-							label: 'Account',
-							isHidden: function(args) {
-								if(isAdmin() || isDomainAdmin())
-									return false;
-								else
-									return true;
-							}			
-						}
-            /*
+            label: 'label.select-view'
+        },
+        sections: {
+            events: {
+                type: 'select',
+                title: 'label.menu.events',
+                listView: {
+                    id: 'events',
+                    label: 'label.menu.events',
+                    fields: {
+                        description: {
+                            label: 'label.description'
+                        },
+                        level: {
+                            label: 'label.level'
+                        },
+                        type: {
+                            label: 'Type'
+                        },
+                        domain: {
+                            label: 'label.domain'
+                        },
+                        account: {
+                            label: 'label.account'
+                        },
+                        created: {
+                            label: 'label.date',
+                            converter: cloudStack.converters.toLocalDate
+                        }
+                    },
+
+                    actions: {
+                        // Remove multiple events
+                        remove: {
+                            label: 'Delete Events',
+                            isHeader: true,
+                            addRow: false,
+                            messages: {
+                                notification: function(args) {
+                                    return 'Events Deleted';
+                                }
+                            },
+                            createForm: {
+                                title: 'Delete Events',
+                                desc: '',
+                                fields: {
+                                    type: {
+                                        label: 'By event type',
+                                        docID: 'helpEventsDeleteType'
+                                    },
+                                    date: {
+                                        label: 'By date (older than)',
+                                        docID: 'helpEventsDeleteDate',
+                                        isDatepicker: true
+                                    }
+                                }
+                            },
+                            action: function(args) {
+
+                                var data = {};
+
+                                if (args.data.type != "")
+                                    $.extend(data, {
+                                        type: args.data.type
+                                    });
+
+                                if (args.data.date != "")
+                                    $.extend(data, {
+                                        olderthan: args.data.date
+                                    });
+
+                                $.ajax({
+
+                                    url: createURL("deleteEvents"),
+                                    data: data,
+                                    dataType: 'json',
+                                    async: false,
+
+                                    success: function(data) {
+
+                                        args.response.success();
+
+                                    }
+                                });
+                                // Reloads window with events removed
+                                $(window).trigger('cloudStack.fullRefresh');
+                            }
+                        },
+
+                        // Archive multiple events
+                        archive: {
+                            label: 'Archive Events',
+                            isHeader: true,
+                            addRow: false,
+                            messages: {
+                                notification: function(args) {
+                                    return 'Archive events';
+                                }
+                            },
+                            createForm: {
+                                title: 'Archive Events',
+                                desc: '',
+                                fields: {
+                                    type: {
+                                        label: 'By event type',
+                                        docID: 'helpEventsArchiveType'
+                                    },
+                                    date: {
+                                        label: 'By date (older than)',
+                                        docID: 'helpEventsArchiveDate',
+                                        isDatepicker: true
+                                    },
+                                }
+                            },
+                            action: function(args) {
+                                var data = {};
+
+                                if (args.data.type != "")
+                                    $.extend(data, {
+                                        type: args.data.type
+                                    });
+
+                                if (args.data.date != "")
+                                    $.extend(data, {
+                                        olderthan: args.data.date
+                                    });
+
+                                $.ajax({
+
+                                    url: createURL("archiveEvents"),
+                                    data: data,
+                                    dataType: 'json',
+                                    async: false,
+
+                                    success: function(data) {
+
+                                        args.response.success();
+
+                                    }
+                                });
+
+                                // Reloads window with events removed
+                                $(window).trigger('cloudStack.fullRefresh');
+                            }
+                        }
+
+                    },
+
+
+
+                    advSearchFields: {
+                        level: {
+                            label: 'label.level',
+                            select: function(args) {
+                                args.response.success({
+                                    data: [{
+                                        id: '',
+                                        description: ''
+                                    }, {
+                                        id: 'INFO',
+                                        description: 'INFO'
+                                    }, {
+                                        id: 'WARN',
+                                        description: 'WARN'
+                                    }, {
+                                        id: 'ERROR',
+                                        description: 'ERROR'
+                                    }]
+                                });
+                            }
+                        },
+
+                        domainid: {
+                            label: 'Domain',
+                            select: function(args) {
+                                if (isAdmin() || isDomainAdmin()) {
+                                    $.ajax({
+                                        url: createURL('listDomains'),
+                                        data: {
+                                            listAll: true,
+                                            details: 'min'
+                                        },
+                                        success: function(json) {
+                                            var array1 = [{
+                                                id: '',
+                                                description: ''
+                                            }];
+                                            var domains = json.listdomainsresponse.domain;
+                                            if (domains != null && domains.length > 0) {
+                                                for (var i = 0; i < domains.length; i++) {
+                                                    array1.push({
+                                                        id: domains[i].id,
+                                                        description: domains[i].path
+                                                    });
+                                                }
+                                            }
+                                            args.response.success({
+                                                data: array1
+                                            });
+                                        }
+                                    });
+                                } else {
+                                    args.response.success({
+                                        data: null
+                                    });
+                                }
+                            },
+                            isHidden: function(args) {
+                                if (isAdmin() || isDomainAdmin())
+                                    return false;
+                                else
+                                    return true;
+                            }
+                        },
+
+                        account: {
+                            label: 'Account',
+                            isHidden: function(args) {
+                                if (isAdmin() || isDomainAdmin())
+                                    return false;
+                                else
+                                    return true;
+                            }
+                        }
+                        /*
 						,
             startdate: {
               label: 'Start Date',
@@ -215,321 +258,380 @@
             enddate: {
               label: 'End Date',
 							isDatepicker: true
-            }				
-            */						
-					},						
-					
-          dataProvider: function(args) {					  
-						var data = {};
-						listViewDataProvider(args, data);						
-						
-            $.ajax({
-              url: createURL('listEvents'),
-              data: data,              
-              success: function(json) {
-                var items = json.listeventsresponse.event;
-                args.response.success({data:items});
-              }
-            });
-          },
-					detailView: {
-            name: 'label.details',
-              actions: {
-
-              // Remove single event
-              remove: {
-                label: 'Delete',
-                messages: {
-                  notification: function(args) {
-                    return 'Event Deleted';
-                  },
-                  confirm: function() {
-                    return 'Are you sure you want to remove this event?';
-                  }
-                },
-                action: function(args) {
-
-                  $.ajax({
-                       url:createURL("deleteEvents&ids=" +args.context.events[0].id),
-                       success:function(json){  
-
-                  args.response.success();
-                             
-                       }
-
-                       });
-                }
-              },
-
-              // Archive single event
-              archive: {
-                label: 'Archive',
-                messages: {
-                  notification: function(args) {
-                    return 'Event Archived';
-                  },
-                  confirm: function() {
-                    return 'Please confirm that you want to archive this event.';
-                  }
-                },
-                action: function(args) {
-                    
-                  $.ajax({
-                       url:createURL("archiveEvents&ids=" +args.context.events[0].id),
-                       success:function(json){
-
-                  args.response.success();        
-                             
-                       }
-
-                       });
-                  
-
-                  // Reloads window with item archived
-                  $(window).trigger('cloudStack.fullRefresh');
-                }
-              }
-           },
-            tabs: {
-              details: {
-                title: 'label.details',
-                fields: [
-                  {
-									  description: { label: 'label.description' },
-										state: { label: 'label.state' },
-									  level: { label: 'label.level' },
-                    type: { label: 'label.type' },										                
-										domain: { label: 'label.domain' },
-										account: { label: 'label.account' },
-										username: { label: 'label.initiated.by' },
-                    created: { label: 'label.date', converter: cloudStack.converters.toLocalDate },
-										id: { label: 'label.id' }
-                  }
-                ],
-                dataProvider: function(args) {								  
-									$.ajax({
-										url: createURL("listEvents&id=" + args.context.events[0].id),
-										dataType: "json",
-										async: true,
-										success: function(json) {
-											var item = json.listeventsresponse.event[0];
-											args.response.success({data: item});
-										}
-									});									
-								}
-              }
             }
-          }
-        }
-      },
-      alerts: {
-        type: 'select',
-        title: 'label.menu.alerts',
-        listView: {
-          id: 'alerts',
-          label: 'label.menu.alerts',
-          fields: {
-            description: { label: 'label.description' },
-            type: {label:'Type'},
-            sent: { label: 'label.date', converter: cloudStack.converters.toLocalDate }
-          },
-
-           actions: {
-            // Remove multiple Alerts
-            remove: {
-              label: 'Delete Alerts',
-              isHeader: true,
-              addRow: false,
-              messages: {
-                notification: function(args) {
-                  return 'Alerts Deleted';
-                }
-              },
-              createForm: {
-                title:'Delete Alerts',
-                desc: '',
-                fields: {
-                  type: { label: 'By Alert type' , docID:'helpAlertsDeleteType'},
-                  date: { label: 'By date (older than)' ,docID:'helpAlertsDeleteDate', isDatepicker: true }
-                }
-              },
-             action: function(args) {
-
-                var data={};
-
-                if(args.data.type != "")
-                  $.extend(data, { type:args.data.type });
-
-                if(args.data.date != "")
-                  $.extend(data, {olderthan:args.data.date });
-
-                $.ajax({
-
-                     url:createURL("deleteAlerts"),
-                     data:data,
-                     dataType:'json',
-                     async: false,
-
-                  success:function(data){
-
-                  args.response.success();
-
+            */
+                    },
+
+                    dataProvider: function(args) {
+                        var data = {};
+                        listViewDataProvider(args, data);
+
+                        $.ajax({
+                            url: createURL('listEvents'),
+                            data: data,
+                            success: function(json) {
+                                var items = json.listeventsresponse.event;
+                                args.response.success({
+                                    data: items
+                                });
+                            }
+                        });
+                    },
+                    detailView: {
+                        name: 'label.details',
+                        actions: {
+
+                            // Remove single event
+                            remove: {
+                                label: 'Delete',
+                                messages: {
+                                    notification: function(args) {
+                                        return 'Event Deleted';
+                                    },
+                                    confirm: function() {
+                                        return 'Are you sure you want to remove this event?';
+                                    }
+                                },
+                                action: function(args) {
+
+                                    $.ajax({
+                                        url: createURL("deleteEvents&ids=" + args.context.events[0].id),
+                                        success: function(json) {
+
+                                            args.response.success();
+
+                                        }
+
+                                    });
+                                }
+                            },
+
+                            // Archive single event
+                            archive: {
+                                label: 'Archive',
+                                messages: {
+                                    notification: function(args) {
+                                        return 'Event Archived';
+                                    },
+                                    confirm: function() {
+                                        return 'Please confirm that you want to archive this event.';
+                                    }
+                                },
+                                action: function(args) {
+
+                                    $.ajax({
+                                        url: createURL("archiveEvents&ids=" + args.context.events[0].id),
+                                        success: function(json) {
+
+                                            args.response.success();
+
+                                        }
+
+                                    });
+
+
+                                    // Reloads window with item archived
+                                    $(window).trigger('cloudStack.fullRefresh');
+                                }
+                            }
+                        },
+                        tabs: {
+                            details: {
+                                title: 'label.details',
+                                fields: [{
+                                    description: {
+                                        label: 'label.description'
+                                    },
+                                    state: {
+                                        label: 'label.state'
+                                    },
+                                    level: {
+                                        label: 'label.level'
+                                    },
+                                    type: {
+                                        label: 'label.type'
+                                    },
+                                    domain: {
+                                        label: 'label.domain'
+                                    },
+                                    account: {
+                                        label: 'label.account'
+                                    },
+                                    username: {
+                                        label: 'label.initiated.by'
+                                    },
+                                    created: {
+                                        label: 'label.date',
+                                        converter: cloudStack.converters.toLocalDate
+                                    },
+                                    id: {
+                                        label: 'label.id'
+                                    }
+                                }],
+                                dataProvider: function(args) {
+                                    $.ajax({
+                                        url: createURL("listEvents&id=" + args.context.events[0].id),
+                                        dataType: "json",
+                                        async: true,
+                                        success: function(json) {
+                                            var item = json.listeventsresponse.event[0];
+                                            args.response.success({
+                                                data: item
+                                            });
+                                        }
+                                    });
+                                }
+                            }
+                        }
                     }
-                   });
-                                  // Reloads window with events removed
-                $(window).trigger('cloudStack.fullRefresh');
-              }
-            },
-          
-           // Archive multiple Alerts
-            archive: {
-              label: 'Archive Alerts',
-              isHeader: true,
-              addRow: false,
-              messages: {
-                notification: function(args) {
-                  return 'Alerts Archived';
                 }
-              },
-              createForm: {
-                title:'Archive Alerts',
-                desc: '',
-                fields: {
-                  type: { label: 'By Alert type', docID:'helpAlertsArchiveType' },
-                  date: { label: 'By date (older than)' , docID:'helpAlertsArchiveDate', isDatepicker: true }
-                }
-              },
-              action: function(args) {
-                   var data={};
-
-                if(args.data.type != "")
-                  $.extend(data, { type:args.data.type });
-
-                if(args.data.date != "")
-                  $.extend(data, {olderthan:args.data.date });
-
-                $.ajax({
-
-                     url:createURL("archiveAlerts"),
-                     data:data,
-                     dataType:'json',
-                     async: false,
-
-                  success:function(data){
-
-                  args.response.success();
-
+            },
+            alerts: {
+                type: 'select',
+                title: 'label.menu.alerts',
+                listView: {
+                    id: 'alerts',
+                    label: 'label.menu.alerts',
+                    fields: {
+                        description: {
+                            label: 'label.description'
+                        },
+                        type: {
+                            label: 'Type'
+                        },
+                        sent: {
+                            label: 'label.date',
+                            converter: cloudStack.converters.toLocalDate
+                        }
+                    },
+
+                    actions: {
+                        // Remove multiple Alerts
+                        remove: {
+                            label: 'Delete Alerts',
+                            isHeader: true,
+                            addRow: false,
+                            messages: {
+                                notification: function(args) {
+                                    return 'Alerts Deleted';
+                                }
+                            },
+                            createForm: {
+                                title: 'Delete Alerts',
+                                desc: '',
+                                fields: {
+                                    type: {
+                                        label: 'By Alert type',
+                                        docID: 'helpAlertsDeleteType'
+                                    },
+                                    date: {
+                                        label: 'By date (older than)',
+                                        docID: 'helpAlertsDeleteDate',
+                                        isDatepicker: true
+                                    }
+                                }
+                            },
+                            action: function(args) {
+
+                                var data = {};
+
+                                if (args.data.type != "")
+                                    $.extend(data, {
+                                        type: args.data.type
+                                    });
+
+                                if (args.data.date != "")
+                                    $.extend(data, {
+                                        olderthan: args.data.date
+                                    });
+
+                                $.ajax({
+
+                                    url: createURL("deleteAlerts"),
+                                    data: data,
+                                    dataType: 'json',
+                                    async: false,
+
+                                    success: function(data) {
+
+                                        args.response.success();
+
+                                    }
+                                });
+                                // Reloads window with events removed
+                                $(window).trigger('cloudStack.fullRefresh');
+                            }
+                        },
+
+                        // Archive multiple Alerts
+                        archive: {
+                            label: 'Archive Alerts',
+                            isHeader: true,
+                            addRow: false,
+                            messages: {
+                                notification: function(args) {
+                                    return 'Alerts Archived';
+                                }
+                            },
+                            createForm: {
+                                title: 'Archive Alerts',
+                                desc: '',
+                                fields: {
+                                    type: {
+                                        label: 'By Alert type',
+                                        docID: 'helpAlertsArchiveType'
+                                    },
+                                    date: {
+                                        label: 'By date (older than)',
+                                        docID: 'helpAlertsArchiveDate',
+                                        isDatepicker: true
+                                    }
+                                }
+                            },
+                            action: function(args) {
+                                var data = {};
+
+                                if (args.data.type != "")
+                                    $.extend(data, {
+                                        type: args.data.type
+                                    });
+
+                                if (args.data.date != "")
+                                    $.extend(data, {
+                                        olderthan: args.data.date
+                                    });
+
+                                $.ajax({
+
+                                    url: createURL("archiveAlerts"),
+                                    data: data,
+                                    dataType: 'json',
+                                    async: false,
+
+                                    success: function(data) {
+
+                                        args.response.success();
+
+                                    }
+                                });
+
+                                // Reloads window with events removed
+                                $(window).trigger('cloudStack.fullRefresh');
+                            }
+                        }
+
+                    },
+
+                    dataProvider: function(args) {
+                        var data = {};
+                        listViewDataProvider(args, data);
+
+                        $.ajax({
+                            url: createURL('listAlerts'),
+                            data: data,
+                            async: true,
+                            success: function(json) {
+                                var items = json.listalertsresponse.alert;
+                                args.response.success({
+                                    data: items
+                                });
+                            }
+                        });
+                    },
+                    detailView: {
+                        name: 'Alert details',
+                        actions: {
+
+                            // Remove single Alert
+                            remove: {
+                                label: 'Delete',
+                                messages: {
+                                    notification: function(args) {
+                                        return 'Alert Deleted';
+                                    },
+                                    confirm: function() {
+                                        return 'Are you sure you want to delete this alert ?';
+                                    }
+                                },
+                                action: function(args) {
+
+                                    $.ajax({
+                                        url: createURL("deleteAlerts&ids=" + args.context.alerts[0].id),
+                                        success: function(json) {
+
+                                            args.response.success();
+
+                                        }
+
+                                    });
+                                    $(window).trigger('cloudStack.fullRefresh');
+
+                                }
+                            },
+
+                            archive: {
+                                label: 'Archive',
+                                messages: {
+                                    notification: function(args) {
+                                        return 'Alert Archived';
+                                    },
+                                    confirm: function() {
+                                        return 'Please confirm that you want to archive this alert.';
+                                    }
+                                },
+                                action: function(args) {
+
+                                    $.ajax({
+                                        url: createURL("archiveAlerts&ids=" + args.context.alerts[0].id),
+                                        success: function(json) {
+
+                                            args.response.success();
+
+                                        }
+
+                                    });
+
+
+                                    // Reloads window with item archived
+                                    $(window).trigger('cloudStack.fullRefresh');
+                                }
+                            }
+
+                        },
+
+                        tabs: {
+                            details: {
+                                title: 'label.details',
+                                fields: [{
+                                    id: {
+                                        label: 'ID'
+                                    },
+                                    description: {
+                                        label: 'label.description'
+                                    },
+                                    sent: {
+                                        label: 'label.date',
+                                        converter: cloudStack.converters.toLocalDate
+                                    }
+                                }],
+                                dataProvider: function(args) {
+                                    $.ajax({
+                                        url: createURL("listAlerts&id=" + args.context.alerts[0].id),
+                                        dataType: "json",
+                                        async: true,
+                                        success: function(json) {
+                                            var item = json.listalertsresponse.alert[0];
+                                            args.response.success({
+                                                data: item
+                                            });
+                                        }
+                                    });
+                                }
+                            }
+                        }
                     }
-                   });
-
-                // Reloads window with events removed
-                $(window).trigger('cloudStack.fullRefresh');
-              }
-            }
-
-          },
-
-          dataProvider: function(args) {
-					  var data = {};
-						listViewDataProvider(args, data);		
-					
-            $.ajax({
-              url: createURL('listAlerts'),
-              data: data,
-              async: true,
-              success: function(json) {
-                var items = json.listalertsresponse.alert;
-                args.response.success({data:items});
-              }
-            });
-          },
-          detailView: {
-            name: 'Alert details',
-              actions: {
-
-              // Remove single Alert
-              remove: {
-                label: 'Delete',
-                messages: {
-                  notification: function(args) {
-                    return 'Alert Deleted';
-                  },
-                  confirm: function() {
-                    return 'Are you sure you want to delete this alert ?';
-                  }
-                },
-                action: function(args) {
-
-                  $.ajax({
-                       url:createURL("deleteAlerts&ids=" +args.context.alerts[0].id),
-                       success:function(json){
-
-                  args.response.success();
-
-                       }
-
-                       });
-                    $(window).trigger('cloudStack.fullRefresh');
-
-                }
-              },
-
-               archive: {
-                label: 'Archive',
-                messages: {
-                  notification: function(args) {
-                    return 'Alert Archived';
-                  },
-                  confirm: function() {
-                    return 'Please confirm that you want to archive this alert.';
-                  }
-                },
-                action: function(args) {
-
-                  $.ajax({
-                       url:createURL("archiveAlerts&ids=" +args.context.alerts[0].id),
-                       success:function(json){
-
-                  args.response.success();
-
-                       }
-
-                       });
-
-
-                  // Reloads window with item archived
-                  $(window).trigger('cloudStack.fullRefresh');
                 }
-              }
-
-            },  
-
-            tabs: {
-              details: {
-                title: 'label.details',
-                fields: [
-                  {
-                    id: { label: 'ID' },
-                    description: { label: 'label.description' },
-                    sent: { label: 'label.date', converter: cloudStack.converters.toLocalDate }
-                  }
-                ],
-                dataProvider: function(args) {								  
-									$.ajax({
-										url: createURL("listAlerts&id=" + args.context.alerts[0].id),
-										dataType: "json",
-										async: true,
-										success: function(json) {
-											var item = json.listalertsresponse.alert[0];
-											args.response.success({data: item});
-										}
-									});															 
-								}
-              }
             }
-          }
         }
-      }
-    }
-  };
+    };
 })(cloudStack);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f766a9e5/ui/scripts/globalSettings.js
----------------------------------------------------------------------
diff --git a/ui/scripts/globalSettings.js b/ui/scripts/globalSettings.js
index 1ae73b7..973f07a 100644
--- a/ui/scripts/globalSettings.js
+++ b/ui/scripts/globalSettings.js
@@ -16,341 +16,428 @@
 // under the License.
 
 (function(cloudStack) {
-  cloudStack.sections['global-settings'] = {
-    title: 'label.menu.global.settings',
-    id: 'global-settings',
-    sectionSelect: {
-      label: 'label.select-view'
-    },
-    sections: {
-      globalSettings: {
-        type: 'select',
+    cloudStack.sections['global-settings'] = {
         title: 'label.menu.global.settings',
-        listView: {
-          label: 'label.menu.global.settings',
-          actions: {
-            edit: {
-              label: 'label.change.value',
-              action: function(args) {    
-								var data = {
-								  name: args.data.jsonObj.name,
-									value: args.data.value
-								};								
-                $.ajax({
-                  url: createURL('updateConfiguration'),
-                  data: data,                  
-                  success: function(json) {                
-                    var item = json.updateconfigurationresponse.configuration;
-                    if(item.category == "Usage")
-                      cloudStack.dialog.notice({ message: _l('message.restart.mgmt.usage.server') });
-                    else
-                      cloudStack.dialog.notice({ message: _l('message.restart.mgmt.server') });	
-                    args.response.success({data: item});
-                  },
-                  error: function(json) {                
-                    args.response.error(parseXMLHttpResponse(json));
-                  }
-                });
-              }
-            }
-          },
-          fields: {
-            name: { label: 'label.name', id: true },
-            description: { label: 'label.description' },
-            value: { label: 'label.value', editable: true, truncate: true }
-          },
-          dataProvider: function(args) {
-            var data = {
-              page: args.page,
-              pagesize: pageSize
-            };
-
-            if (args.filterBy.search.value) {
-              data.name = args.filterBy.search.value;
-            }
-
-            $.ajax({
-              url: createURL('listConfigurations'),
-              data: data,
-              dataType: "json",
-              async: true,
-              success: function(json) {
-                var items = json.listconfigurationsresponse.configuration;
-                args.response.success({ data: items });
-              }
-            });
-          }
-        }
-      },
-
-      ldapConfiguration:{
-         type:'select',
-         title:'LDAP Configuration',
-         listView:{
-            id:'ldap',
-            label:'LDAP Configuration', 
-            fields:{
-                hostname: {label: 'Hostname'},
-                queryfilter: {label: 'Query Filter'},
-                searchbase: {label: 'Search Base'},
-                port: {label: 'LDAP Port'},
-                ssl: {
-                  label: 'SSL'
-
-                  }
-
-             },
-              dataProvider:function(args){
-                   var data = {};
-                   listViewDataProvider(args, data);
-                    $.ajax({
-              url: createURL('ldapConfig&listall=true'),   //Need a list LDAP configuration API call which needs to be implemented
-              data: data,
-                success: function(json) {
-                var items = json.ldapconfigresponse.ldapconfig;
-                args.response.success({data:items});
-                   },
-                   error: function(data) {
-                args.response.error(parseXMLHttpResponse(data));
-                  }
-               });
-           },
-
-          detailView: {
-            name: 'label.details',
-              actions: {
-
-              // Remove LDAP
-              remove: {
-                label: 'Remove LDAP',
-                messages: {
-                  notification: function(args) {
-                    return 'LDAP Configuration Deleted';
-                  },
-                  confirm: function() {
-                    return 'Are you sure you want to delete the LDAP configuration?';
-                  }
-                },
-                action: function(args) {
-
-                  $.ajax({
-                       url:createURL("ldapRemove"),
-                       success:function(json){
-
-                  args.response.success();
-
-                       }
-
-                       });
-                    $(window).trigger('cloudStack.fullRefresh');
+        id: 'global-settings',
+        sectionSelect: {
+            label: 'label.select-view'
+        },
+        sections: {
+            globalSettings: {
+                type: 'select',
+                title: 'label.menu.global.settings',
+                listView: {
+                    label: 'label.menu.global.settings',
+                    actions: {
+                        edit: {
+                            label: 'label.change.value',
+                            action: function(args) {
+                                var data = {
+                                    name: args.data.jsonObj.name,
+                                    value: args.data.value
+                                };
+                                $.ajax({
+                                    url: createURL('updateConfiguration'),
+                                    data: data,
+                                    success: function(json) {
+                                        var item = json.updateconfigurationresponse.configuration;
+                                        if (item.category == "Usage")
+                                            cloudStack.dialog.notice({
+                                                message: _l('message.restart.mgmt.usage.server')
+                                            });
+                                        else
+                                            cloudStack.dialog.notice({
+                                                message: _l('message.restart.mgmt.server')
+                                            });
+                                        args.response.success({
+                                            data: item
+                                        });
+                                    },
+                                    error: function(json) {
+                                        args.response.error(parseXMLHttpResponse(json));
+                                    }
+                                });
+                            }
+                        }
+                    },
+                    fields: {
+                        name: {
+                            label: 'label.name',
+                            id: true
+                        },
+                        description: {
+                            label: 'label.description'
+                        },
+                        value: {
+                            label: 'label.value',
+                            editable: true,
+                            truncate: true
+                        }
+                    },
+                    dataProvider: function(args) {
+                        var data = {
+                            page: args.page,
+                            pagesize: pageSize
+                        };
+
+                        if (args.filterBy.search.value) {
+                            data.name = args.filterBy.search.value;
+                        }
 
+                        $.ajax({
+                            url: createURL('listConfigurations'),
+                            data: data,
+                            dataType: "json",
+                            async: true,
+                            success: function(json) {
+                                var items = json.listconfigurationsresponse.configuration;
+                                args.response.success({
+                                    data: items
+                                });
+                            }
+                        });
+                    }
                 }
-              }
-          },
-
-           tabs:{
-
-               details: {
-                title: 'LDAP Configuration Details',
-                fields: [
-                  {
-                    hostname: { label: 'Hostname' },
-                    description: { label: 'label.description' },
-                    ssl : { label: 'SSL'}
-                  }
-                ],
-                dataProvider: function(args) {
-                                                                        $.ajax({
-                                                                                url: createURL("ldapConfig&listAll=true" ),
-                                                                                dataType: "json",
-                                                                                async: true,
-                                                                                success: function(json) {
-                                                                                        var item = json.ldapconfigresponse.ldapconfig;
-                                                                                        args.response.success({data: item});
-                                                                                }
-                                                                        });                                                                                                       
-                                                                }
-             
-                                                        }
+            },
 
-            }
-       }, 
-
-          actions: {
-               add:{
-
-               label: 'Configure LDAP',
- 
-               messages: {
-                confirm: function(args) {
-                  return 'Do you really want to configure LDAP ? ';
-                },
-                notification: function(args) {
-                  return 'LDAP configured';
-                }
-              },
-         
-              createForm: {
-                    
-                    title: 'Configure LDAP',
-                    fields:{
-                        name:{label: 'Bind DN' , validation: {required:true} },
-                        password: {label: 'Bind Password', validation: {required: true },isPassword:true },
-                        hostname: {label:'Hostname' , validation:{required:true}},
-                        queryfilter: {label:'Query Filter' , validation: {required:true} , docID:'helpLdapQueryFilter'},
-                        searchbase: {label:'SearchBase',validation:{required:true}},
-                        ssl:  {
-                               label:'SSL' ,
-                               isBoolean:true,
-                               isChecked:false
-                                
+            ldapConfiguration: {
+                type: 'select',
+                title: 'LDAP Configuration',
+                listView: {
+                    id: 'ldap',
+                    label: 'LDAP Configuration',
+                    fields: {
+                        hostname: {
+                            label: 'Hostname'
+                        },
+                        queryfilter: {
+                            label: 'Query Filter'
+                        },
+                        searchbase: {
+                            label: 'Search Base'
+                        },
+                        port: {
+                            label: 'LDAP Port'
+                        },
+                        ssl: {
+                            label: 'SSL'
+
+                        }
+
+                    },
+                    dataProvider: function(args) {
+                        var data = {};
+                        listViewDataProvider(args, data);
+                        $.ajax({
+                            url: createURL('ldapConfig&listall=true'), //Need a list LDAP configuration API call which needs to be implemented
+                            data: data,
+                            success: function(json) {
+                                var items = json.ldapconfigresponse.ldapconfig;
+                                args.response.success({
+                                    data: items
+                                });
                             },
-                        port: {  label: 'Port' , defaultValue: '389' },
-                        truststore:{ label:'Trust Store' , isHidden:true , dependsOn:'ssl',validation:{required:true} },
-                        truststorepassword:{ label:'Trust Store Password' ,isHidden:true , dependsOn:'ssl', validation:{required:true}}
-                        
-                     }
- 
-
-              },
-            
-
-                action:function(args) {
-                     var array = [];
-                      array.push("&binddn=" + todb(args.data.name));
-                      array.push("&bindpass=" + todb(args.data.password));
-                      array.push("&hostname=" + todb(args.data.hostname));
-                      array.push("&searchbase=" +todb(args.data.searchbase));
-                      array.push("&queryfilter=" +todb(args.data.queryfilter));
-                      array.push("&port=" +todb(args.data.port));
-
-                      if(args.$form.find('.form-item[rel=ssl]').find('input[type=checkbox]').is(':Checked')== true)  {
-
-                            array.push("&ssl=true");
-                            if(args.data.truststore != "")
-                            array.push("&truststore=" +todb(args.data.truststore));
-
-                            if(args.data.truststorepassword !="")
-                            array.push("&truststorepass=" +todb(args.data.truststorepassword));
+                            error: function(data) {
+                                args.response.error(parseXMLHttpResponse(data));
+                            }
+                        });
+                    },
+
+                    detailView: {
+                        name: 'label.details',
+                        actions: {
+
+                            // Remove LDAP
+                            remove: {
+                                label: 'Remove LDAP',
+                                messages: {
+                                    notification: function(args) {
+                                        return 'LDAP Configuration Deleted';
+                                    },
+                                    confirm: function() {
+                                        return 'Are you sure you want to delete the LDAP configuration?';
+                                    }
+                                },
+                                action: function(args) {
+
+                                    $.ajax({
+                                        url: createURL("ldapRemove"),
+                                        success: function(json) {
+
+                                            args.response.success();
+
+                                        }
+
+                                    });
+                                    $(window).trigger('cloudStack.fullRefresh');
+
+                                }
+                            }
+                        },
+
+                        tabs: {
+
+                            details: {
+                                title: 'LDAP Configuration Details',
+                                fields: [{
+                                    hostname: {
+                                        label: 'Hostname'
+                                    },
+                                    description: {
+                                        label: 'label.description'
+                                    },
+                                    ssl: {
+                                        label: 'SSL'
+                                    }
+                                }],
+                                dataProvider: function(args) {
+                                    $.ajax({
+                                        url: createURL("ldapConfig&listAll=true"),
+                                        dataType: "json",
+                                        async: true,
+                                        success: function(json) {
+                                            var item = json.ldapconfigresponse.ldapconfig;
+                                            args.response.success({
+                                                data: item
+                                            });
+                                        }
+                                    });
+                                }
+
+                            }
 
                         }
+                    },
+
+                    actions: {
+                        add: {
 
-                      else
-                        array.push("&ssl=false");
+                            label: 'Configure LDAP',
 
-                  $.ajax({
-                    url: createURL("ldapConfig" + array.join("")),
-                    dataType: "json",
-                    async: true,
-                    success: function(json) {
-                       var items = json.ldapconfigresponse.ldapconfig;
-                       args.response.success({
-                                   data: items
-                             });
+                            messages: {
+                                confirm: function(args) {
+                                    return 'Do you really want to configure LDAP ? ';
+                                },
+                                notification: function(args) {
+                                    return 'LDAP configured';
+                                }
+                            },
 
-                      },
+                            createForm: {
+
+                                title: 'Configure LDAP',
+                                fields: {
+                                    name: {
+                                        label: 'Bind DN',
+                                        validation: {
+                                            required: true
+                                        }
+                                    },
+                                    password: {
+                                        label: 'Bind Password',
+                                        validation: {
+                                            required: true
+                                        },
+                                        isPassword: true
+                                    },
+                                    hostname: {
+                                        label: 'Hostname',
+                                        validation: {
+                                            required: true
+                                        }
+                                    },
+                                    queryfilter: {
+                                        label: 'Query Filter',
+                                        validation: {
+                                            required: true
+                                        },
+                                        docID: 'helpLdapQueryFilter'
+                                    },
+                                    searchbase: {
+                                        label: 'SearchBase',
+                                        validation: {
+                                            required: true
+                                        }
+                                    },
+                                    ssl: {
+                                        label: 'SSL',
+                                        isBoolean: true,
+                                        isChecked: false
+
+                                    },
+                                    port: {
+                                        label: 'Port',
+                                        defaultValue: '389'
+                                    },
+                                    truststore: {
+                                        label: 'Trust Store',
+                                        isHidden: true,
+                                        dependsOn: 'ssl',
+                                        validation: {
+                                            required: true
+                                        }
+                                    },
+                                    truststorepassword: {
+                                        label: 'Trust Store Password',
+                                        isHidden: true,
+                                        dependsOn: 'ssl',
+                                        validation: {
+                                            required: true
+                                        }
+                                    }
+
+                                }
 
-                   error:function(json){
-                      args.response.error(parseXMLHttpResponse(json));
 
-                     }
+                            },
 
 
-                     });
+                            action: function(args) {
+                                var array = [];
+                                array.push("&binddn=" + todb(args.data.name));
+                                array.push("&bindpass=" + todb(args.data.password));
+                                array.push("&hostname=" + todb(args.data.hostname));
+                                array.push("&searchbase=" + todb(args.data.searchbase));
+                                array.push("&queryfilter=" + todb(args.data.queryfilter));
+                                array.push("&port=" + todb(args.data.port));
 
+                                if (args.$form.find('.form-item[rel=ssl]').find('input[type=checkbox]').is(':Checked') == true) {
+
+                                    array.push("&ssl=true");
+                                    if (args.data.truststore != "")
+                                        array.push("&truststore=" + todb(args.data.truststore));
+
+                                    if (args.data.truststorepassword != "")
+                                        array.push("&truststorepass=" + todb(args.data.truststorepassword));
+
+                                } else
+                                    array.push("&ssl=false");
+
+                                $.ajax({
+                                    url: createURL("ldapConfig" + array.join("")),
+                                    dataType: "json",
+                                    async: true,
+                                    success: function(json) {
+                                        var items = json.ldapconfigresponse.ldapconfig;
+                                        args.response.success({
+                                            data: items
+                                        });
+
+                                    },
+
+                                    error: function(json) {
+                                        args.response.error(parseXMLHttpResponse(json));
+
+                                    }
+
+
+                                });
+
+
+                            }
+                        }
 
-                }
-             }
-
-           }
-
- 
-
-          }
-
-
-
-       },
-      hypervisorCapabilities: {
-        type: 'select',
-        title: 'label.hypervisor.capabilities',
-        listView: {
-          id: 'hypervisorCapabilities',
-          label: 'label.hypervisor.capabilities',
-          fields: {
-            hypervisor: { label: 'label.hypervisor' },
-            hypervisorversion: { label: 'label.hypervisor.version' },
-            maxguestslimit: { label: 'label.max.guest.limit' }
-          },
-          dataProvider: function(args) {					  
-						var data = {};
-						listViewDataProvider(args, data);					
-										  
-            $.ajax({
-              url: createURL('listHypervisorCapabilities'),
-              data: data,              
-              success: function(json) {
-                var items = json.listhypervisorcapabilitiesresponse.hypervisorCapabilities;
-                args.response.success({data:items});
-              },
-              error: function(data) {
-                args.response.error(parseXMLHttpResponse(data));
-              }
-            });
-          },
-
-          detailView: {
-            name: 'label.details',
-            actions: {
-              edit: {
-                label: 'label.edit',
-                action: function(args) {
-                  var data = {
-									  id: args.context.hypervisorCapabilities[0].id,
-										maxguestslimit: args.data.maxguestslimit
-									};
-                  
-                  $.ajax({
-                    url: createURL('updateHypervisorCapabilities'),
-                    data: data,
-                    success: function(json) {
-                      var item = json.updatehypervisorcapabilitiesresponse['null'];
-                      args.response.success({data: item});
-                    },
-                    error: function(data) {
-                      args.response.error(parseXMLHttpResponse(data));
                     }
-                  });
+
+
+
                 }
-              }
+
+
+
             },
+            hypervisorCapabilities: {
+                type: 'select',
+                title: 'label.hypervisor.capabilities',
+                listView: {
+                    id: 'hypervisorCapabilities',
+                    label: 'label.hypervisor.capabilities',
+                    fields: {
+                        hypervisor: {
+                            label: 'label.hypervisor'
+                        },
+                        hypervisorversion: {
+                            label: 'label.hypervisor.version'
+                        },
+                        maxguestslimit: {
+                            label: 'label.max.guest.limit'
+                        }
+                    },
+                    dataProvider: function(args) {
+                        var data = {};
+                        listViewDataProvider(args, data);
+
+                        $.ajax({
+                            url: createURL('listHypervisorCapabilities'),
+                            data: data,
+                            success: function(json) {
+                                var items = json.listhypervisorcapabilitiesresponse.hypervisorCapabilities;
+                                args.response.success({
+                                    data: items
+                                });
+                            },
+                            error: function(data) {
+                                args.response.error(parseXMLHttpResponse(data));
+                            }
+                        });
+                    },
 
-            tabs: {
-              details: {
-                title: 'label.details',
-                fields: [
-                  {
-                    id: { label: 'label.id' },
-                    hypervisor: { label: 'label.hypervisor' },
-                    hypervisorversion: { label: 'label.hypervisor.version' },
-                    maxguestslimit: {
-                      label: 'label.max.guest.limit',
-                      isEditable: true
-                    }
-                  }
-                ],
-                dataProvider: function(args) {
-                  args.response.success(
-                    {
-                      data:args.context.hypervisorCapabilities[0]
+                    detailView: {
+                        name: 'label.details',
+                        actions: {
+                            edit: {
+                                label: 'label.edit',
+                                action: function(args) {
+                                    var data = {
+                                        id: args.context.hypervisorCapabilities[0].id,
+                                        maxguestslimit: args.data.maxguestslimit
+                                    };
+
+                                    $.ajax({
+                                        url: createURL('updateHypervisorCapabilities'),
+                                        data: data,
+                                        success: function(json) {
+                                            var item = json.updatehypervisorcapabilitiesresponse['null'];
+                                            args.response.success({
+                                                data: item
+                                            });
+                                        },
+                                        error: function(data) {
+                                            args.response.error(parseXMLHttpResponse(data));
+                                        }
+                                    });
+                                }
+                            }
+                        },
+
+                        tabs: {
+                            details: {
+                                title: 'label.details',
+                                fields: [{
+                                    id: {
+                                        label: 'label.id'
+                                    },
+                                    hypervisor: {
+                                        label: 'label.hypervisor'
+                                    },
+                                    hypervisorversion: {
+                                        label: 'label.hypervisor.version'
+                                    },
+                                    maxguestslimit: {
+                                        label: 'label.max.guest.limit',
+                                        isEditable: true
+                                    }
+                                }],
+                                dataProvider: function(args) {
+                                    args.response.success({
+                                        data: args.context.hypervisorCapabilities[0]
+                                    });
+                                }
+                            }
+                        }
                     }
-                  );
                 }
-              }
             }
-          }
         }
-      }
-    }
-  };
+    };
 })(cloudStack);


Mime
View raw message