Skip to content

Commit 80738cc

Browse files
author
Jessica Wang
committed
BUG-ID: CLOUDSTACK-6162: UI > zone > physical network > service provider > add OVS.
Reviewed-by: Brian
1 parent ef54710 commit 80738cc

1 file changed

Lines changed: 133 additions & 0 deletions

File tree

‎ui/scripts/system.js‎

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,16 @@
199199
return allowedActions;
200200
};
201201

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+
202212
cloudStack.sections.system = {
203213
title: 'label.menu.infrastructure',
204214
id: 'system',
@@ -3908,6 +3918,120 @@
39083918
}
39093919
},
39103920

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+
39114035
// NetScaler provider detail view
39124036
netscaler: {
39134037
type: 'detailView',
@@ -19002,6 +19126,9 @@
1900219126
case "VpcVirtualRouter":
1900319127
nspMap[ "vpcVirtualRouter"] = items[i];
1900419128
break;
19129+
case "OVS":
19130+
nspMap["OVS"] = items[i];
19131+
break;
1900519132
case "Netscaler":
1900619133
nspMap[ "netscaler"] = items[i];
1900719134
break;
@@ -19131,6 +19258,12 @@
1913119258
state: nspMap.pa ? nspMap.pa.state: 'Disabled'
1913219259
});
1913319260
}
19261+
19262+
nspHardcodingArray.push({
19263+
id: 'OVS',
19264+
name: 'OVS',
19265+
state: nspMap.OVS ? nspMap.OVS.state : 'Disabled'
19266+
});
1913419267
};
1913519268

1913619269
cloudStack.actionFilter.physicalNetwork = function (args) {

0 commit comments

Comments
 (0)