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 2014/02/27 00:57:23 UTC

git commit: updated refs/heads/4.3-forward to 82121a2

Repository: cloudstack
Updated Branches:
  refs/heads/4.3-forward 94257c0fc -> 82121a214


BUG-ID: CLOUDSTACK-6162: UI > zone > physical network > service provider > add OVS.
Reviewed-by: Brian


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

Branch: refs/heads/4.3-forward
Commit: 82121a214926fe3ace33183da9e76e0c13c5e203
Parents: 94257c0
Author: Jessica Wang <je...@apache.org>
Authored: Wed Feb 26 15:56:30 2014 -0800
Committer: Jessica Wang <je...@apache.org>
Committed: Wed Feb 26 15:56:30 2014 -0800

----------------------------------------------------------------------
 ui/scripts/system.js | 133 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 133 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/82121a21/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index 500a339..9ba2597 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -192,6 +192,16 @@
         return allowedActions;
     };
 
+    function ovsProviderActionFilter(args) {
+        var allowedActions = [];
+        var jsonObj = args.context.item; //args.context.item == nspMap["virtualRouter"]
+        if (jsonObj.state == "Enabled")
+            allowedActions.push("disable");
+        else if (jsonObj.state == "Disabled")
+            allowedActions.push("enable");
+        return allowedActions;
+    };
+    
     cloudStack.sections.system = {
         title: 'label.menu.infrastructure',
         id: 'system',
@@ -3858,6 +3868,120 @@
                         }
                     },
 
+                    OVS: {
+                        id: "OVS",
+                        label: "OVS",
+                        isMaximized: true,
+                        type: 'detailView',
+                        fields: {
+                            name: {
+                                label: 'label.name'
+                            },                          
+                            state: {
+                                label: 'label.status',
+                                indicator: {
+                                    'Enabled': 'on'
+                                }
+                            }
+                        },
+                        tabs: {
+                            network: {
+                                title: 'label.network',
+                                fields: [{
+                                    name: {
+                                        label: 'label.name'
+                                    }
+                                }, {                                    
+                                    state: {
+                                        label: 'label.state'
+                                    },                                                                      
+                                    supportedServices: {
+                                        label: 'label.supported.services'
+                                    },
+                                    id: {
+                                        label: 'label.id'
+                                    },
+                                    physicalnetworkid: {
+                                        label: 'label.physical.network.ID'
+                                    }
+                                }],
+                                dataProvider: function(args) {
+                                    refreshNspData("OVS");
+                                    args.response.success({
+                                        actionFilter: ovsProviderActionFilter,
+                                        data: $.extend(nspMap["OVS"], {
+                                            supportedServices: nspMap["OVS"] == undefined? "": nspMap["OVS"].servicelist.join(', ')
+                                        })
+                                    });
+                                }
+                            },
+                        },
+                        actions: {
+                            enable: {
+                                label: 'label.enable.provider',
+                                action: function(args) {
+                                    $.ajax({
+                                        url: createURL("updateNetworkServiceProvider&id=" + nspMap["OVS"].id + "&state=Enabled"),
+                                        dataType: "json",
+                                        success: function(json) {
+                                            var jid = json.updatenetworkserviceproviderresponse.jobid;
+                                            args.response.success({
+                                                _custom: {
+                                                    jobId: jid,
+                                                    getUpdatedItem: function(json) {
+                                                        $(window).trigger('cloudStack.fullRefresh');
+                                                    }
+                                                }
+                                            });
+                                        }
+                                    });
+                                },
+                                messages: {
+                                    confirm: function(args) {
+                                        return 'message.confirm.enable.provider';
+                                    },
+                                    notification: function() {
+                                        return 'label.enable.provider';
+                                    }
+                                },
+                                notification: {
+                                    poll: pollAsyncJobResult
+                                }
+                            },
+                            disable: {
+                                label: 'label.disable.provider',
+                                action: function(args) {
+                                    $.ajax({
+                                        url: createURL("updateNetworkServiceProvider&id=" + nspMap["OVS"].id + "&state=Disabled"),
+                                        dataType: "json",
+                                        success: function(json) {
+                                            var jid = json.updatenetworkserviceproviderresponse.jobid;
+                                            args.response.success({
+                                                _custom: {
+                                                    jobId: jid,
+                                                    getUpdatedItem: function(json) {
+                                                        $(window).trigger('cloudStack.fullRefresh');
+                                                    }
+                                                }
+                                            });
+                                        }
+                                    });
+                                },
+                                messages: {
+                                    confirm: function(args) {
+                                        return 'message.confirm.disable.provider';
+                                    },
+                                    notification: function() {
+                                        return 'label.disable.provider';
+                                    }
+                                },
+                                notification: {
+                                    poll: pollAsyncJobResult
+                                }
+                            }
+                        }
+                    },                    
+                   
                     // NetScaler provider detail view
                     netscaler: {
                         type: 'detailView',
@@ -17999,6 +18123,9 @@
                             case "VpcVirtualRouter":
                                 nspMap["vpcVirtualRouter"] = items[i];
                                 break;
+                            case "OVS":
+                                nspMap["OVS"] = items[i];
+                                break;      
                             case "Netscaler":
                                 nspMap["netscaler"] = items[i];
                                 break;
@@ -18107,6 +18234,12 @@
                 state: nspMap.pa ? nspMap.pa.state : 'Disabled'
             });
         }
+        
+        nspHardcodingArray.push({
+            id: 'OVS',
+            name: 'OVS',
+            state: nspMap.OVS ? nspMap.OVS.state : 'Disabled'
+        });        
     };
 
     cloudStack.actionFilter.physicalNetwork = function(args) {