Skip to content

Commit 35164fd

Browse files
committed
Merge branch 'ui-cisco-asa1000v-support'
2 parents 7b46599 + 8811bcc commit 35164fd

5 files changed

Lines changed: 602 additions & 0 deletions

File tree

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
(function($, cloudStack) {
18+
cloudStack.modules.infrastructure = function(module) {
19+
module.pluginAPI.extend({
20+
networkServiceProvider: function(args) {
21+
var name = args.name;
22+
var id = args.id;
23+
var state = args.state;
24+
var detailView = args.detailView;
25+
var listView = args.listView;
26+
27+
cloudStack.sections.system.naas.networkProviders.types[id] = detailView;
28+
cloudStack.sections.system.subsections[listView.id] = {
29+
id: listView.id,
30+
title: name,
31+
listView: listView
32+
};
33+
34+
$(window).bind('cloudStack.system.serviceProviders.makeHarcodedArray', function(event, data) {
35+
var nspHardcodingArray = data.nspHardcodingArray;
36+
var selectedZoneObj = data.selectedZoneObj;
37+
var selectedPhysicalNetworkObj = data.selectedPhysicalNetworkObj;
38+
if(selectedZoneObj.networktype == "Advanced"){
39+
var selectedProviderObj = null;
40+
$.ajax({
41+
url: createURL('listNetworkServiceProviders'),
42+
data: {
43+
name: id, //e.g. 'CiscoVnmc'
44+
physicalnetworkid: selectedPhysicalNetworkObj.id
45+
},
46+
async: false,
47+
success: function(json){
48+
var items = json.listnetworkserviceprovidersresponse.networkserviceprovider;
49+
if(items != null && items.length > 0) {
50+
selectedProviderObj = items[0];
51+
}
52+
}
53+
});
54+
55+
nspHardcodingArray.push({
56+
id: id,
57+
name: name,
58+
state: selectedProviderObj? selectedProviderObj.state : 'Disabled'
59+
});
60+
}
61+
});
62+
},
63+
64+
resource: function(args) {
65+
var type = args.type;
66+
67+
if (type) {
68+
return cloudStack.sections.system.subsections[type];
69+
} else {
70+
return false;
71+
}
72+
}
73+
});
74+
};
75+
}(jQuery, cloudStack));

‎ui/modules/modules.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,8 @@
1616
// under the License.
1717
(function($, cloudStack) {
1818
cloudStack.modules = [
19+
'infrastructure',
20+
'vnmcNetworkProvider',
21+
'vnmcAsa1000v'
1922
];
2023
}(jQuery, cloudStack));
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
(function($, cloudStack) {
18+
cloudStack.modules.vnmcAsa1000v = function(module) {
19+
module.vnmcNetworkProvider.addDevice({
20+
id: 'asa1000v',
21+
title: 'ASA 1000v',
22+
listView: {
23+
id: 'asa1000vDevices',
24+
fields: {
25+
hostname: { label: 'label.host' },
26+
insideportprofile: { label: 'Inside Port Profile' }
27+
},
28+
dataProvider: function(args) {
29+
$.ajax({
30+
url: createURL('listCiscoAsa1000vResources'),
31+
data: {
32+
physicalnetworkid: args.context.physicalNetworks[0].id
33+
},
34+
success: function(json){
35+
var items = json.listCiscoAsa1000vResources.CiscoAsa1000vResource;
36+
args.response.success({ data: items });
37+
}
38+
});
39+
},
40+
41+
actions: {
42+
add: {
43+
label: 'Add CiscoASA1000v Resource',
44+
messages: {
45+
notification: function(args) {
46+
return 'Add CiscoASA1000v Resource';
47+
}
48+
},
49+
createForm: {
50+
title: 'Add CiscoASA1000v Resource',
51+
fields: {
52+
hostname: {
53+
label: 'label.host',
54+
validation: { required: true }
55+
},
56+
insideportprofile: {
57+
label: 'Inside Port Profile',
58+
validation: { required: true }
59+
},
60+
clusterid: {
61+
label: 'label.cluster',
62+
validation: { required: true },
63+
select: function(args){
64+
$.ajax({
65+
url: createURL('listClusters'),
66+
data: {
67+
zoneid: args.context.zones[0].id
68+
},
69+
success: function(json) {
70+
var objs = json.listclustersresponse.cluster;
71+
var items = [];
72+
if(objs != null) {
73+
for(var i = 0; i < objs.length; i++){
74+
items.push({id: objs[i].id, description: objs[i].name});
75+
}
76+
}
77+
args.response.success({data: items});
78+
}
79+
});
80+
}
81+
}
82+
}
83+
},
84+
action: function(args) {
85+
var data = {
86+
physicalnetworkid: args.context.physicalNetworks[0].id,
87+
hostname: args.data.hostname,
88+
insideportprofile: args.data.insideportprofile,
89+
clusterid: args.data.clusterid
90+
};
91+
92+
$.ajax({
93+
url: createURL('addCiscoAsa1000vResource'),
94+
data: data,
95+
success: function(json){
96+
var item = json.addCiscoAsa1000vResource.CiscoAsa1000vResource;
97+
args.response.success({data: item});
98+
},
99+
error: function(data) {
100+
args.response.error(parseXMLHttpResponse(data));
101+
}
102+
});
103+
104+
},
105+
notification: {
106+
poll: function(args) {
107+
args.complete();
108+
}
109+
}
110+
}
111+
},
112+
113+
detailView: {
114+
name: 'CiscoASA1000v details',
115+
actions: {
116+
remove: {
117+
label: 'delete CiscoASA1000v',
118+
messages: {
119+
confirm: function(args) {
120+
return 'Please confirm you want to delete CiscoASA1000v';
121+
},
122+
notification: function(args) {
123+
return 'delete CiscoASA1000v';
124+
}
125+
},
126+
action: function(args) {
127+
$.ajax({
128+
url: createURL('deleteCiscoAsa1000vResource'),
129+
data: {
130+
resourceid: args.context.asa1000vDevices[0].resourceid
131+
},
132+
success: function(json) {
133+
args.response.success();
134+
},
135+
error: function(data) {
136+
args.response.error(parseXMLHttpResponse(data));
137+
}
138+
});
139+
},
140+
notification: {
141+
poll: function(args) {
142+
args.complete();
143+
}
144+
}
145+
}
146+
},
147+
148+
tabs: {
149+
details: {
150+
title: 'label.details',
151+
152+
fields: [
153+
{
154+
hostname: {
155+
label: 'label.host'
156+
}
157+
},
158+
{
159+
insideportprofile: { label: 'Inside Port Profile' },
160+
RESOURCE_NAME: { label: 'Resource Name' },
161+
resourceid: { label: 'Resource ID' }
162+
}
163+
],
164+
165+
dataProvider: function(args) {
166+
$.ajax({
167+
url: createURL('listCiscoAsa1000vResources'),
168+
data: {
169+
resourceid: args.context.asa1000vDevices[0].resourceid
170+
},
171+
success: function(json) {
172+
var item = json.listCiscoAsa1000vResources.CiscoAsa1000vResource[0];
173+
args.response.success({ data: item });
174+
}
175+
});
176+
}
177+
}
178+
}
179+
}
180+
}
181+
});
182+
};
183+
}(jQuery, cloudStack));

0 commit comments

Comments
 (0)