Skip to content

Commit b79aa32

Browse files
author
Jessica Wang
committed
cloudStack 3.0 new UI - NaaS - implement Add F5 Load Balancer.
1 parent 593803c commit b79aa32

1 file changed

Lines changed: 54 additions & 18 deletions

File tree

‎ui/scripts/system.js‎

Lines changed: 54 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@
595595

596596
detailView: {
597597
name: 'Guest network details',
598-
viewAll: { path: '_zone.guestIpRanges', label: 'IP ranges' }, //jessica
598+
viewAll: { path: '_zone.guestIpRanges', label: 'IP ranges' },
599599
actions: {
600600
edit: {
601601
label: 'Edit',
@@ -928,35 +928,71 @@
928928
createForm: {
929929
title: 'Add F5',
930930
fields: {
931-
name: {
932-
label: 'Name',
933-
validation: { required: true }
931+
url: {
932+
label: 'URL'
934933
},
935-
ipaddress: {
936-
label: 'IP Address',
937-
validation: { required: true }
934+
username: {
935+
label: 'Username'
938936
},
939-
supportedServices: {
940-
label: 'Supported Services',
941-
isBoolean: true,
942-
multiArray: {
943-
serviceA: { label: 'Service A' },
944-
serviceB: { label: 'Service B' },
945-
serviceC: { label: 'Service C' }
937+
password: {
938+
label: 'Password',
939+
isPassword: true
940+
},
941+
networkdevicetype: {
942+
label: 'Network device type',
943+
select: function(args) {
944+
var items = [];
945+
items.push({id: "F5BigIpLoadBalancer", description: "F5 Big Ip Load Balancer"});
946+
args.response.success({data: items});
946947
}
947-
}
948+
}
948949
}
949950
},
950-
action: function(args) {
951-
args.response.success();
951+
action: function(args) {
952+
var zoneObj = args.context.zones[0];
953+
var physicalNetworkObj;
954+
$.ajax({
955+
url: createURL("listPhysicalNetworks&zoneId=" + zoneObj.id),
956+
dataType: "json",
957+
async: false,
958+
success: function(json) {
959+
var items = json.listphysicalnetworksresponse.physicalnetwork;
960+
physicalNetworkObj = items[0];
961+
}
962+
});
963+
964+
var array1 = [];
965+
array1.push("&physicalnetworkid=" + physicalNetworkObj.id)
966+
array1.push("&url=" + todb(args.data.url));
967+
array1.push("&username=" + todb(args.data.username));
968+
array1.push("&password=" + todb(args.data.password));
969+
array1.push("&networkdevicetype=" + todb(args.data.networkdevicetype));
970+
$.ajax({
971+
url: createURL("addF5LoadBalancer" + array1.join("")),
972+
dataType: "json",
973+
success: function(json) {
974+
//jessica
975+
var jid = json.addf5bigiploadbalancerresponse.jobid;
976+
args.response.success(
977+
{_custom:
978+
{jobId: jid,
979+
getUpdatedItem: function(json) {
980+
var item = json.queryasyncjobresultresponse.jobresult.loadbalancer;
981+
return {data: item};
982+
}
983+
}
984+
}
985+
);
986+
}
987+
});
952988
},
953989
messages: {
954990
notification: function(args) {
955991
return 'Added new F5';
956992
}
957993
},
958994
notification: {
959-
poll: testData.notifications.testPoll
995+
poll: pollAsyncJobResult
960996
}
961997
}
962998
},

0 commit comments

Comments
 (0)