|
199 | 199 | return allowedActions; |
200 | 200 | }; |
201 | 201 |
|
| 202 | + function ovsProviderActionFilter(args) { |
| 203 | + var allowedActions = []; |
| 204 | + var jsonObj = args.context.item; //args.context.item == nspMap["virtualRouter"] |
| 205 | + if (jsonObj.state == "Enabled") |
| 206 | + allowedActions.push("disable"); |
| 207 | + else if (jsonObj.state == "Disabled") |
| 208 | + allowedActions.push("enable"); |
| 209 | + return allowedActions; |
| 210 | + }; |
| 211 | + |
202 | 212 | cloudStack.sections.system = { |
203 | 213 | title: 'label.menu.infrastructure', |
204 | 214 | id: 'system', |
|
3908 | 3918 | } |
3909 | 3919 | }, |
3910 | 3920 |
|
| 3921 | + OVS: { |
| 3922 | + id: "OVS", |
| 3923 | + label: "OVS", |
| 3924 | + isMaximized: true, |
| 3925 | + type: 'detailView', |
| 3926 | + fields: { |
| 3927 | + name: { |
| 3928 | + label: 'label.name' |
| 3929 | + }, |
| 3930 | + state: { |
| 3931 | + label: 'label.status', |
| 3932 | + indicator: { |
| 3933 | + 'Enabled': 'on' |
| 3934 | + } |
| 3935 | + } |
| 3936 | + }, |
| 3937 | + tabs: { |
| 3938 | + network: { |
| 3939 | + title: 'label.network', |
| 3940 | + fields: [{ |
| 3941 | + name: { |
| 3942 | + label: 'label.name' |
| 3943 | + } |
| 3944 | + }, { |
| 3945 | + state: { |
| 3946 | + label: 'label.state' |
| 3947 | + }, |
| 3948 | + supportedServices: { |
| 3949 | + label: 'label.supported.services' |
| 3950 | + }, |
| 3951 | + id: { |
| 3952 | + label: 'label.id' |
| 3953 | + }, |
| 3954 | + physicalnetworkid: { |
| 3955 | + label: 'label.physical.network.ID' |
| 3956 | + } |
| 3957 | + }], |
| 3958 | + dataProvider: function(args) { |
| 3959 | + refreshNspData("OVS"); |
| 3960 | + args.response.success({ |
| 3961 | + actionFilter: ovsProviderActionFilter, |
| 3962 | + data: $.extend(nspMap["OVS"], { |
| 3963 | + supportedServices: nspMap["OVS"] == undefined? "": nspMap["OVS"].servicelist.join(', ') |
| 3964 | + }) |
| 3965 | + }); |
| 3966 | + } |
| 3967 | + }, |
| 3968 | + }, |
| 3969 | + actions: { |
| 3970 | + enable: { |
| 3971 | + label: 'label.enable.provider', |
| 3972 | + action: function(args) { |
| 3973 | + $.ajax({ |
| 3974 | + url: createURL("updateNetworkServiceProvider&id=" + nspMap["OVS"].id + "&state=Enabled"), |
| 3975 | + dataType: "json", |
| 3976 | + success: function(json) { |
| 3977 | + var jid = json.updatenetworkserviceproviderresponse.jobid; |
| 3978 | + args.response.success({ |
| 3979 | + _custom: { |
| 3980 | + jobId: jid, |
| 3981 | + getUpdatedItem: function(json) { |
| 3982 | + $(window).trigger('cloudStack.fullRefresh'); |
| 3983 | + } |
| 3984 | + } |
| 3985 | + }); |
| 3986 | + } |
| 3987 | + }); |
| 3988 | + }, |
| 3989 | + messages: { |
| 3990 | + confirm: function(args) { |
| 3991 | + return 'message.confirm.enable.provider'; |
| 3992 | + }, |
| 3993 | + notification: function() { |
| 3994 | + return 'label.enable.provider'; |
| 3995 | + } |
| 3996 | + }, |
| 3997 | + notification: { |
| 3998 | + poll: pollAsyncJobResult |
| 3999 | + } |
| 4000 | + }, |
| 4001 | + disable: { |
| 4002 | + label: 'label.disable.provider', |
| 4003 | + action: function(args) { |
| 4004 | + $.ajax({ |
| 4005 | + url: createURL("updateNetworkServiceProvider&id=" + nspMap["OVS"].id + "&state=Disabled"), |
| 4006 | + dataType: "json", |
| 4007 | + success: function(json) { |
| 4008 | + var jid = json.updatenetworkserviceproviderresponse.jobid; |
| 4009 | + args.response.success({ |
| 4010 | + _custom: { |
| 4011 | + jobId: jid, |
| 4012 | + getUpdatedItem: function(json) { |
| 4013 | + $(window).trigger('cloudStack.fullRefresh'); |
| 4014 | + } |
| 4015 | + } |
| 4016 | + }); |
| 4017 | + } |
| 4018 | + }); |
| 4019 | + }, |
| 4020 | + messages: { |
| 4021 | + confirm: function(args) { |
| 4022 | + return 'message.confirm.disable.provider'; |
| 4023 | + }, |
| 4024 | + notification: function() { |
| 4025 | + return 'label.disable.provider'; |
| 4026 | + } |
| 4027 | + }, |
| 4028 | + notification: { |
| 4029 | + poll: pollAsyncJobResult |
| 4030 | + } |
| 4031 | + } |
| 4032 | + } |
| 4033 | + }, |
| 4034 | + |
3911 | 4035 | // NetScaler provider detail view |
3912 | 4036 | netscaler: { |
3913 | 4037 | type: 'detailView', |
|
19002 | 19126 | case "VpcVirtualRouter": |
19003 | 19127 | nspMap[ "vpcVirtualRouter"] = items[i]; |
19004 | 19128 | break; |
| 19129 | + case "OVS": |
| 19130 | + nspMap["OVS"] = items[i]; |
| 19131 | + break; |
19005 | 19132 | case "Netscaler": |
19006 | 19133 | nspMap[ "netscaler"] = items[i]; |
19007 | 19134 | break; |
|
19131 | 19258 | state: nspMap.pa ? nspMap.pa.state: 'Disabled' |
19132 | 19259 | }); |
19133 | 19260 | } |
| 19261 | + |
| 19262 | + nspHardcodingArray.push({ |
| 19263 | + id: 'OVS', |
| 19264 | + name: 'OVS', |
| 19265 | + state: nspMap.OVS ? nspMap.OVS.state : 'Disabled' |
| 19266 | + }); |
19134 | 19267 | }; |
19135 | 19268 |
|
19136 | 19269 | cloudStack.actionFilter.physicalNetwork = function (args) { |
|
0 commit comments