From d7b715b83f968c2062dcee10112085e98ef37f73 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Thu, 18 Apr 2013 10:38:03 -0700 Subject: [PATCH 01/17] Rename widget 'plugins' to 'pluginListing' For better clarity on its function, rename the 'plugins' widget to 'pluginListing,' as it does not handle the actual plugin logic. --- ui/index.jsp | 2 +- ui/scripts/plugins.js | 4 +--- ui/scripts/ui-custom/{plugins.js => pluginListing.js} | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) rename ui/scripts/ui-custom/{plugins.js => pluginListing.js} (98%) diff --git a/ui/index.jsp b/ui/index.jsp index 46f49f00984..550661e546a 100644 --- a/ui/index.jsp +++ b/ui/index.jsp @@ -1681,7 +1681,7 @@ under the License. - + diff --git a/ui/scripts/plugins.js b/ui/scripts/plugins.js index 5a33d56ef9f..d3e07055299 100644 --- a/ui/scripts/plugins.js +++ b/ui/scripts/plugins.js @@ -51,7 +51,7 @@ cloudStack.sections.plugins = { title: 'label.plugins', - show: cloudStack.uiCustom.plugins + show: cloudStack.uiCustom.pluginListing }; // Load plugins @@ -70,7 +70,5 @@ ui: pluginAPI }); }); - - // Load CSS }); }(jQuery, cloudStack, require)); diff --git a/ui/scripts/ui-custom/plugins.js b/ui/scripts/ui-custom/pluginListing.js similarity index 98% rename from ui/scripts/ui-custom/plugins.js rename to ui/scripts/ui-custom/pluginListing.js index aaf95319da1..3dcce983943 100644 --- a/ui/scripts/ui-custom/plugins.js +++ b/ui/scripts/ui-custom/pluginListing.js @@ -95,7 +95,7 @@ } }; - cloudStack.uiCustom.plugins = function() { + cloudStack.uiCustom.pluginListing = function() { var plugins = cloudStack.plugins; return elems.pluginListing({ From 908115203e6997ad8bea6e273a10865e38726877 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Thu, 18 Apr 2013 15:13:14 -0700 Subject: [PATCH 02/17] WIP: Service provider module -Add 'add service provider' module to assist with creating a new service provider UI -Add required functionality to append service provider to hardcoded list -Add basic ASA 1000v provider to list (name, id, state) --- .../asa1000vNetworkProvider.js | 25 +++++++++++++ ui/modules/infrastructure/infrastructure.js | 37 +++++++++++++++++++ ui/modules/modules.js | 2 + ui/scripts/system.js | 4 ++ 4 files changed, 68 insertions(+) create mode 100644 ui/modules/asa1000vNetworkProvider/asa1000vNetworkProvider.js create mode 100644 ui/modules/infrastructure/infrastructure.js diff --git a/ui/modules/asa1000vNetworkProvider/asa1000vNetworkProvider.js b/ui/modules/asa1000vNetworkProvider/asa1000vNetworkProvider.js new file mode 100644 index 00000000000..3855daf6724 --- /dev/null +++ b/ui/modules/asa1000vNetworkProvider/asa1000vNetworkProvider.js @@ -0,0 +1,25 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +(function($, cloudStack) { + cloudStack.modules.asa1000vNetworkProvider = function(module) { + module.infrastructure.networkServiceProvider({ + id: 'ciscoAsa1000v', + name: 'Cisco ASA 1000v', + state: 'Disabled' + }); + }; +}(jQuery, cloudStack)); \ No newline at end of file diff --git a/ui/modules/infrastructure/infrastructure.js b/ui/modules/infrastructure/infrastructure.js new file mode 100644 index 00000000000..01cc4d7fe77 --- /dev/null +++ b/ui/modules/infrastructure/infrastructure.js @@ -0,0 +1,37 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +(function($, cloudStack) { + cloudStack.modules.infrastructure = function(module) { + module.pluginAPI.extend({ + networkServiceProvider: function(args) { + var name = args.name; + var id = args.id; + var state = args.state; + + $(window).bind('cloudStack.system.serviceProviders.makeHarcodedArray', function(event, data) { + var nspHardcodingArray = data.nspHardcodingArray; + + nspHardcodingArray.push({ + id: id, + name: name, + state: state + }); + }); + } + }); + }; +}(jQuery, cloudStack)); \ No newline at end of file diff --git a/ui/modules/modules.js b/ui/modules/modules.js index 490749ff085..f5dd62a0e9e 100644 --- a/ui/modules/modules.js +++ b/ui/modules/modules.js @@ -16,5 +16,7 @@ // under the License. (function($, cloudStack) { cloudStack.modules = [ + 'infrastructure', + 'asa1000vNetworkProvider' ]; }(jQuery, cloudStack)); diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 73bf3fd4160..f8881698de0 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -11666,6 +11666,10 @@ } ]; + $(window).trigger('cloudStack.system.serviceProviders.makeHarcodedArray', { + nspHardcodingArray: nspHardcodingArray + }); + if(selectedZoneObj.networktype == "Basic") { nspHardcodingArray.push( { From d53d06cc2f202d326740d01ffa29e626c9b735d2 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Thu, 18 Apr 2013 16:26:23 -0700 Subject: [PATCH 03/17] Add basic listView/detailView for network provider --- .../asa1000vNetworkProvider.js | 48 ++++++++++++++++++- ui/modules/infrastructure/infrastructure.js | 9 ++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/ui/modules/asa1000vNetworkProvider/asa1000vNetworkProvider.js b/ui/modules/asa1000vNetworkProvider/asa1000vNetworkProvider.js index 3855daf6724..8c83339c562 100644 --- a/ui/modules/asa1000vNetworkProvider/asa1000vNetworkProvider.js +++ b/ui/modules/asa1000vNetworkProvider/asa1000vNetworkProvider.js @@ -19,7 +19,53 @@ module.infrastructure.networkServiceProvider({ id: 'ciscoAsa1000v', name: 'Cisco ASA 1000v', - state: 'Disabled' + state: 'Disabled', + listView: { + id: 'asa1000vDevices', + fields: { + name: { label: 'label.name' }, + ipaddress: { label: 'label.ip.address' }, + state: { label: 'label.state', indicator: { + 'Enabled': 'on', + 'Disabled': 'off' + }} + }, + dataProvider: function(args) { + args.response.success({ + data: [ + { name: 'device1', ipaddress: '192.168.1.12', state: 'Enabled' }, + { name: 'device2', ipaddress: '192.168.1.13', state: 'Disabled' }, + { name: 'device3', ipaddress: '192.168.1.14', state: 'Enabled' } + ] + }); + } + }, + detailView: { + id: 'asa1000vProvider', + label: 'label.netScaler', + viewAll: { label: 'label.devices', path: '_zone.asa100vDevices' }, + tabs: { + details: { + title: 'label.details', + fields: [ + { + name: { label: 'label.name' } + }, + { + state: { label: 'label.state' } + } + ], + dataProvider: function(args) { + args.response.success({ + data: { + name: 'Cisco ASA 1000v', + state: 'Disabled' + } + }); + } + } + } + } }); }; }(jQuery, cloudStack)); \ No newline at end of file diff --git a/ui/modules/infrastructure/infrastructure.js b/ui/modules/infrastructure/infrastructure.js index 01cc4d7fe77..8292896f052 100644 --- a/ui/modules/infrastructure/infrastructure.js +++ b/ui/modules/infrastructure/infrastructure.js @@ -21,6 +21,15 @@ var name = args.name; var id = args.id; var state = args.state; + var detailView = args.detailView; + var listView = args.listView; + + cloudStack.sections.system.naas.networkProviders.types[id] = detailView; + cloudStack.sections.system.subsections[listView.id] = { + id: listView.id, + title: name, + listView: listView + }; $(window).bind('cloudStack.system.serviceProviders.makeHarcodedArray', function(event, data) { var nspHardcodingArray = data.nspHardcodingArray; From 1c482b5c3bc85e549b457070e5cd901bb181c3f9 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Tue, 23 Apr 2013 14:40:33 -0700 Subject: [PATCH 04/17] Infrastructure UI plugin API: Add 'resource' method Add new method 'infrastructure.resource' for retrieving resource objects from the infrastructure section. Specify the type as a string (i.e, 'pod' 'cluster' or 'host') and the entire resource object will be returned, including listView, actions, createForm, etc. Updating the data in this resource will automatically update the UI. --- ui/modules/infrastructure/infrastructure.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ui/modules/infrastructure/infrastructure.js b/ui/modules/infrastructure/infrastructure.js index 8292896f052..ad43108259b 100644 --- a/ui/modules/infrastructure/infrastructure.js +++ b/ui/modules/infrastructure/infrastructure.js @@ -40,7 +40,17 @@ state: state }); }); + }, + + resource: function(args) { + var type = args.type; + + if (type) { + return cloudStack.sections.system.subsections[type]; + } else { + return false; + } } }); }; -}(jQuery, cloudStack)); \ No newline at end of file +}(jQuery, cloudStack)); From a9b903d597614adcb8d2c783d718e23f9011767f Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Tue, 23 Apr 2013 14:42:16 -0700 Subject: [PATCH 05/17] Add pod action: Add custom 'appendData' to action For use with plugin API, if 'appendData' is passed in args, always append this data to the end of the API call. Used when plugin adds new attributes that need to be passed via the API. --- ui/scripts/system.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ui/scripts/system.js b/ui/scripts/system.js index f8881698de0..95690a9b7c7 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -7634,6 +7634,7 @@ action: function(args) { var array1 = []; + var appendData = args.data.append ? args.data.append : {}; array1.push("&zoneId=" + args.data.zoneid); array1.push("&name=" + todb(args.data.podname)); @@ -7647,6 +7648,7 @@ $.ajax({ url: createURL("createPod" + array1.join("")), + data: appendData, dataType: "json", success: function(json) { var item = json.createpodresponse.pod; From 06963409e78ad262868dab4eff6fc34ea79466f5 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Fri, 3 May 2013 14:07:12 -0700 Subject: [PATCH 06/17] Fix typo --- ui/modules/asa1000vNetworkProvider/asa1000vNetworkProvider.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/modules/asa1000vNetworkProvider/asa1000vNetworkProvider.js b/ui/modules/asa1000vNetworkProvider/asa1000vNetworkProvider.js index 8c83339c562..5818c5bed54 100644 --- a/ui/modules/asa1000vNetworkProvider/asa1000vNetworkProvider.js +++ b/ui/modules/asa1000vNetworkProvider/asa1000vNetworkProvider.js @@ -43,7 +43,7 @@ detailView: { id: 'asa1000vProvider', label: 'label.netScaler', - viewAll: { label: 'label.devices', path: '_zone.asa100vDevices' }, + viewAll: { label: 'label.devices', path: '_zone.asa1000vDevices' }, tabs: { details: { title: 'label.details', @@ -68,4 +68,4 @@ } }); }; -}(jQuery, cloudStack)); \ No newline at end of file +}(jQuery, cloudStack)); From ad8f10656c937f87ad858bbd712db5b5a4cc37d3 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Fri, 3 May 2013 14:12:26 -0700 Subject: [PATCH 07/17] Add sample detail view --- .../asa1000vNetworkProvider.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/ui/modules/asa1000vNetworkProvider/asa1000vNetworkProvider.js b/ui/modules/asa1000vNetworkProvider/asa1000vNetworkProvider.js index 5818c5bed54..cae30bfa05f 100644 --- a/ui/modules/asa1000vNetworkProvider/asa1000vNetworkProvider.js +++ b/ui/modules/asa1000vNetworkProvider/asa1000vNetworkProvider.js @@ -38,6 +38,28 @@ { name: 'device3', ipaddress: '192.168.1.14', state: 'Enabled' } ] }); + }, + + detailView: { + tabs: { + details: { + title: 'label.details', + fields: [ + { + name: { label: 'label.name' } + }, + { + ipaddress: { label: 'label.ip.address' }, + state: { label: 'label.state' } + } + ], + dataProvider: function(args) { + args.response.success({ + data: args.context.asa1000vDevices[0] + }); + } + } + } } }, detailView: { From 9a8bf4a66bd08f660eadf6d3707c46044fcac08c Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Mon, 6 May 2013 11:46:24 -0700 Subject: [PATCH 08/17] VNMC: Refactor ASA1000v as a VNMC subdevice -Make new provider 'VNMC' instead of 'ASA1000v' -Add helper function to add new VNMC managed devices to module -Make ASA1000v device listing as a view all link under VNMC --- .../asa1000vNetworkProvider.js | 93 --------------- ui/modules/modules.js | 3 +- ui/modules/vnmcAsa1000v/vnmcAsa1000v.js | 44 +++++++ .../vnmcNetworkProvider.js | 112 ++++++++++++++++++ 4 files changed, 158 insertions(+), 94 deletions(-) delete mode 100644 ui/modules/asa1000vNetworkProvider/asa1000vNetworkProvider.js create mode 100644 ui/modules/vnmcAsa1000v/vnmcAsa1000v.js create mode 100644 ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js diff --git a/ui/modules/asa1000vNetworkProvider/asa1000vNetworkProvider.js b/ui/modules/asa1000vNetworkProvider/asa1000vNetworkProvider.js deleted file mode 100644 index cae30bfa05f..00000000000 --- a/ui/modules/asa1000vNetworkProvider/asa1000vNetworkProvider.js +++ /dev/null @@ -1,93 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -(function($, cloudStack) { - cloudStack.modules.asa1000vNetworkProvider = function(module) { - module.infrastructure.networkServiceProvider({ - id: 'ciscoAsa1000v', - name: 'Cisco ASA 1000v', - state: 'Disabled', - listView: { - id: 'asa1000vDevices', - fields: { - name: { label: 'label.name' }, - ipaddress: { label: 'label.ip.address' }, - state: { label: 'label.state', indicator: { - 'Enabled': 'on', - 'Disabled': 'off' - }} - }, - dataProvider: function(args) { - args.response.success({ - data: [ - { name: 'device1', ipaddress: '192.168.1.12', state: 'Enabled' }, - { name: 'device2', ipaddress: '192.168.1.13', state: 'Disabled' }, - { name: 'device3', ipaddress: '192.168.1.14', state: 'Enabled' } - ] - }); - }, - - detailView: { - tabs: { - details: { - title: 'label.details', - fields: [ - { - name: { label: 'label.name' } - }, - { - ipaddress: { label: 'label.ip.address' }, - state: { label: 'label.state' } - } - ], - dataProvider: function(args) { - args.response.success({ - data: args.context.asa1000vDevices[0] - }); - } - } - } - } - }, - detailView: { - id: 'asa1000vProvider', - label: 'label.netScaler', - viewAll: { label: 'label.devices', path: '_zone.asa1000vDevices' }, - tabs: { - details: { - title: 'label.details', - fields: [ - { - name: { label: 'label.name' } - }, - { - state: { label: 'label.state' } - } - ], - dataProvider: function(args) { - args.response.success({ - data: { - name: 'Cisco ASA 1000v', - state: 'Disabled' - } - }); - } - } - } - } - }); - }; -}(jQuery, cloudStack)); diff --git a/ui/modules/modules.js b/ui/modules/modules.js index f5dd62a0e9e..d4502a195bc 100644 --- a/ui/modules/modules.js +++ b/ui/modules/modules.js @@ -17,6 +17,7 @@ (function($, cloudStack) { cloudStack.modules = [ 'infrastructure', - 'asa1000vNetworkProvider' + 'vnmcNetworkProvider', + 'vnmcAsa1000v' ]; }(jQuery, cloudStack)); diff --git a/ui/modules/vnmcAsa1000v/vnmcAsa1000v.js b/ui/modules/vnmcAsa1000v/vnmcAsa1000v.js new file mode 100644 index 00000000000..10fe3ef0712 --- /dev/null +++ b/ui/modules/vnmcAsa1000v/vnmcAsa1000v.js @@ -0,0 +1,44 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +(function($, cloudStack) { + cloudStack.modules.vnmcAsa1000v = function(module) { + module.vnmcNetworkProvider.addDevice({ + id: 'asa1000v', + title: 'ASA 1000v', + listView: { + id: 'asa1000vDevices', + fields: { + name: { label: 'label.name' }, + ipaddress: { label: 'label.ip.address' }, + state: { label: 'label.state', indicator: { + 'Enabled': 'on', + 'Disabled': 'off' + }} + }, + dataProvider: function(args) { + args.response.success({ + data: [ + { name: 'asadevice1', ipaddress: '192.168.1.12', state: 'Enabled' }, + { name: 'asadevice2', ipaddress: '192.168.1.13', state: 'Disabled' }, + { name: 'asadevice3', ipaddress: '192.168.1.14', state: 'Enabled' } + ] + }); + } + } + }); + }; +}(jQuery, cloudStack)); diff --git a/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js b/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js new file mode 100644 index 00000000000..6add2c59686 --- /dev/null +++ b/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js @@ -0,0 +1,112 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +(function($, cloudStack) { + cloudStack.modules.vnmcNetworkProvider = function(module) { + var vnmcDeviceViewAll = window._m = [ + { + label: 'VNMC Devices', + path: '_zone.vnmcDevices' + } + ]; + + var vnmcListView = { + id: 'vnmcDevices', + fields: { + name: { label: 'label.name' }, + ipaddress: { label: 'label.ip.address' }, + state: { label: 'label.state', indicator: { + 'Enabled': 'on', + 'Disabled': 'off' + }} + }, + dataProvider: function(args) { + args.response.success({ + data: [ + { name: 'device1', ipaddress: '192.168.1.12', state: 'Enabled' }, + { name: 'device2', ipaddress: '192.168.1.13', state: 'Disabled' }, + { name: 'device3', ipaddress: '192.168.1.14', state: 'Enabled' } + ] + }); + } + }; + + var vnmcProviderDetailView = vnmcListView.detailView = { + id: 'vnmcProvider', + label: 'VNMC', + viewAll: vnmcDeviceViewAll, + tabs: { + details: { + title: 'label.details', + fields: [ + { + name: { label: 'label.name' } + }, + { + state: { label: 'label.state' } + } + ], + dataProvider: function(args) { + args.response.success({ + data: { + name: 'VNMC Devices', + state: 'Disabled' + } + }); + } + } + } + }; + + var vnmcDeviceDetailView = { + tabs: { + details: { + title: 'label.details', + fields: [ + { + name: { label: 'label.name' } + }, + { + ipaddress: { label: 'label.ip.address' }, + state: { label: 'label.state' } + } + ], + dataProvider: function(args) { + args.response.success({ + data: args.context.vnmcDevices[0] + }); + } + } + } + }; + + module.pluginAPI.extend({ + addDevice: function(device) { + cloudStack.sections.system.subsections[device.id] = device; + vnmcDeviceViewAll.push({ label: device.title, path: '_zone.' + device.id }); + } + }); + + module.infrastructure.networkServiceProvider({ + id: 'vnmc', + name: 'Cisco VNMC', + state: 'Disabled', + listView: vnmcListView, + + detailView: vnmcProviderDetailView + }); + }; +}(jQuery, cloudStack)); From 6323b2e71b0d1295fb91ba8735130973b484cdbe Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Wed, 8 May 2013 12:02:30 -0700 Subject: [PATCH 09/17] CLOUDSTACK-1816: Cisco VNMC ASA1000v - UI - implement Add Cisco VNMC action. --- .../vnmcNetworkProvider.js | 190 +++++++++++++++++- 1 file changed, 182 insertions(+), 8 deletions(-) diff --git a/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js b/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js index 6add2c59686..220a0b9c746 100644 --- a/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js +++ b/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js @@ -33,14 +33,188 @@ 'Disabled': 'off' }} }, - dataProvider: function(args) { - args.response.success({ - data: [ - { name: 'device1', ipaddress: '192.168.1.12', state: 'Enabled' }, - { name: 'device2', ipaddress: '192.168.1.13', state: 'Disabled' }, - { name: 'device3', ipaddress: '192.168.1.14', state: 'Enabled' } - ] - }); + + actions: { + add: { + label: 'Add VNMC device', + + messages: { + /* + confirm: function(args) { + return 'Add VNMC device'; + }, + */ + notification: function(args) { + return 'Add VNMC device'; + } + }, + + createForm: { + title: 'Add VNMC device', + fields: { + hostname: { + label: 'label.host', + validation: { required: true } + }, + username: { + label: 'label.username', + validation: { required: true } + }, + password: { + label: 'label.password', + isPassword: true, + validation: { required: true } + } + } + }, + + action: function(args) { + //debugger; + $.ajax({ + url: createURL('listNetworkServiceProviders'), + data: { + name: 'CiscoVnmc', + physicalnetworkid: args.context.physicalNetworks[0].id + }, + success: function(json){ + //debugger; + var items = json.listnetworkserviceprovidersresponse.networkserviceprovider; + if(items != null && items.length > 0) { + var ciscoVnmcProvider = items[0]; + if(ciscoVnmcProvider.state == 'Enabled') { + addCiscoVnmcResourceFn(); + } + else { + enableCiscoVnmcProviderFn(ciscoVnmcProvider); + } + } + else { + $.ajax({ + url: createURL("addNetworkServiceProvider"), + data: { + name: 'CiscoVnmc', + physicalnetworkid: args.context.physicalNetworks[0].id + }, + success: function(json) { + var jobId = json.addnetworkserviceproviderresponse.jobid; + var addVnmcProviderIntervalID = setInterval(function() { + $.ajax({ + url: createURL("queryAsyncJobResult&jobId="+jobId), + dataType: "json", + success: function(json) { + var result = json.queryasyncjobresultresponse; + //debugger; + if (result.jobstatus == 0) { + return; //Job has not completed + } + else { + clearInterval(addVnmcProviderIntervalID ); + if (result.jobstatus == 1) { + //nspMap["CiscoVnmc"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; + var ciscoVnmcProvider = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; + enableCiscoVnmcProviderFn(ciscoVnmcProvider); + } + else if (result.jobstatus == 2) { + args.response.error(_s(result.jobresult.errortext)); + } + } + }, + error: function(XMLHttpResponse) { + args.response.error(parseXMLHttpResponse(data)); + } + }); + }, g_queryAsyncJobResultInterval); + } + }); + } + } + }); + //debugger; + + var enableCiscoVnmcProviderFn = function(ciscoVnmcProvider){ + $.ajax({ + url: createURL('updateNetworkServiceProvider'), + data: { + id: ciscoVnmcProvider.id, + state: 'Enabled' + }, + success: function(json) { + var jid = json.updatenetworkserviceproviderresponse.jobid; + var enableVnmcProviderIntervalID = setInterval(function(){ + $.ajax({ + url: createURL('queryAsyncJobResult'), + data: { + jobid: jid + }, + success: function(json){ + var result = json.queryasyncjobresultresponse; + if (result.jobstatus == 0) { + return; //Job has not completed + } + else { + clearInterval(enableVnmcProviderIntervalID); + if (result.jobstatus == 1) { + addCiscoVnmcResourceFn(); + } + else if (result.jobstatus == 2) { + args.response.error(_s(result.jobresult.errortext)); + } + } + } + }); + }, g_queryAsyncJobResultInterval); + } + }); + } + + var addCiscoVnmcResourceFn = function(){ + //debugger; + var data = { + physicalnetworkid: args.context.physicalNetworks[0].id, + hostname: args.data.hostname, + username: args.data.username, + password: args.data.password + }; + + $.ajax({ + url: createURL('addCiscoVnmcResource'), + data: data, + success: function(json) { + //debugger; + var item = json.addciscovnmcresourceresponse.ciscovnmcresource; + args.response.success({data: item}); + }, + error: function(data) { + args.response.error(parseXMLHttpResponse(data)); + } + }); + } + }, + + notification: { + poll: function(args) { + args.complete(); + } + } + } + }, + + dataProvider: function(args) { + $.ajax({ + url: createURL('listCiscoVnmcResources'), + data: { + physicalnetworkid: args.context.physicalNetworks[0].id + }, + success: function(json){ + args.response.success({ + data: [ + { name: 'device1', ipaddress: '192.168.1.12', state: 'Enabled' }, + { name: 'device2', ipaddress: '192.168.1.13', state: 'Disabled' }, + { name: 'device3', ipaddress: '192.168.1.14', state: 'Enabled' } + ] + }); + } + }); } }; From 99f0cdd0d9d8de8f82d8f7ce12f98bce2a8915d8 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Wed, 8 May 2013 14:50:15 -0700 Subject: [PATCH 10/17] CLOUDSTACK-1816: Cisco VNMC ASA1000v - UI - implement Add CiscoASA1000v action. --- ui/modules/vnmcAsa1000v/vnmcAsa1000v.js | 103 +++++++++++++++--- .../vnmcNetworkProvider.js | 7 +- 2 files changed, 89 insertions(+), 21 deletions(-) diff --git a/ui/modules/vnmcAsa1000v/vnmcAsa1000v.js b/ui/modules/vnmcAsa1000v/vnmcAsa1000v.js index 10fe3ef0712..3b92d2dfd0c 100644 --- a/ui/modules/vnmcAsa1000v/vnmcAsa1000v.js +++ b/ui/modules/vnmcAsa1000v/vnmcAsa1000v.js @@ -22,22 +22,95 @@ listView: { id: 'asa1000vDevices', fields: { - name: { label: 'label.name' }, - ipaddress: { label: 'label.ip.address' }, - state: { label: 'label.state', indicator: { - 'Enabled': 'on', - 'Disabled': 'off' - }} + hostname: { label: 'label.host' }, + insideportprofile: { label: 'Inside Port Profile' } }, - dataProvider: function(args) { - args.response.success({ - data: [ - { name: 'asadevice1', ipaddress: '192.168.1.12', state: 'Enabled' }, - { name: 'asadevice2', ipaddress: '192.168.1.13', state: 'Disabled' }, - { name: 'asadevice3', ipaddress: '192.168.1.14', state: 'Enabled' } - ] - }); - } + dataProvider: function(args) { + $.ajax({ + url: createURL('listCiscoAsa1000vResources'), + data: { + physicalnetworkid: args.context.physicalNetworks[0].id + }, + success: function(json){ + var items = json.listCiscoAsa1000vResources["null"]; //waiting for Koushik to fix object name to be "CiscoAsa1000vResource" instead of "null" + //var items = json.listCiscoAsa1000vResources.CiscoAsa1000vResource; + args.response.success({ data: items }); + } + }); + }, + + actions: { + add: { + label: 'Add CiscoASA1000v', + messages: { + notification: function(args) { + return 'Add CiscoASA1000v'; + } + }, + createForm: { + title: 'Add CiscoASA1000v', + fields: { + hostname: { + label: 'label.host', + validation: { required: true } + }, + insideportprofile: { + label: 'Inside Port Profile', + validation: { required: true }, + defaultValue: 'in-asa' + }, + clusterid: { + label: 'label.cluster', + validation: { required: true }, + select: function(args){ + $.ajax({ + url: createURL('listClusters'), + data: { + zoneid: args.context.zones[0].id + }, + success: function(json) { + var objs = json.listclustersresponse.cluster; + var items = []; + if(objs != null) { + for(var i = 0; i < objs.length; i++){ + items.push({id: objs[i].id, description: objs[i].name}); + } + } + args.response.success({data: items}); + } + }); + } + } + } + }, + action: function(args) { + var data = { + physicalnetworkid: args.context.physicalNetworks[0].id, + hostname: args.data.hostname, + insideportprofile: args.data.insideportprofile, + clusterid: args.data.clusterid + }; + + $.ajax({ + url: createURL('addCiscoAsa1000vResource'), + data: data, + success: function(json){ + var item = json.addCiscoAsa1000vResource.CiscoAsa1000vResource; + args.response.success({data: item}); + }, + error: function(data) { + args.response.error(parseXMLHttpResponse(data)); + } + }); + + }, + notification: { + poll: function(args) { + args.complete(); + } + } + } + } } }); }; diff --git a/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js b/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js index 220a0b9c746..135cefac62c 100644 --- a/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js +++ b/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js @@ -38,12 +38,7 @@ add: { label: 'Add VNMC device', - messages: { - /* - confirm: function(args) { - return 'Add VNMC device'; - }, - */ + messages: { notification: function(args) { return 'Add VNMC device'; } From 6dff20e2129fac2d7f370d9297821bbde32cc92d Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Wed, 8 May 2013 15:40:46 -0700 Subject: [PATCH 11/17] CLOUDSTACK-1816: Cisco VNMC ASA1000v - UI - implement Delete CiscoASA1000v action. --- ui/modules/vnmcAsa1000v/vnmcAsa1000v.js | 82 +++++++++++++++++++++++-- 1 file changed, 76 insertions(+), 6 deletions(-) diff --git a/ui/modules/vnmcAsa1000v/vnmcAsa1000v.js b/ui/modules/vnmcAsa1000v/vnmcAsa1000v.js index 3b92d2dfd0c..6a29c707551 100644 --- a/ui/modules/vnmcAsa1000v/vnmcAsa1000v.js +++ b/ui/modules/vnmcAsa1000v/vnmcAsa1000v.js @@ -41,14 +41,14 @@ actions: { add: { - label: 'Add CiscoASA1000v', + label: 'Add CiscoASA1000v Resource', messages: { notification: function(args) { - return 'Add CiscoASA1000v'; + return 'Add CiscoASA1000v Resource'; } }, createForm: { - title: 'Add CiscoASA1000v', + title: 'Add CiscoASA1000v Resource', fields: { hostname: { label: 'label.host', @@ -56,8 +56,7 @@ }, insideportprofile: { label: 'Inside Port Profile', - validation: { required: true }, - defaultValue: 'in-asa' + validation: { required: true } }, clusterid: { label: 'label.cluster', @@ -110,7 +109,78 @@ } } } - } + }, + + detailView: { + name: 'CiscoASA1000v details', + actions: { + remove: { + label: 'delete CiscoASA1000v', + messages: { + confirm: function(args) { + return 'Please confirm you want to delete CiscoASA1000v'; + }, + notification: function(args) { + return 'delete CiscoASA1000v'; + } + }, + action: function(args) { + debugger; + $.ajax({ + url: createURL('deleteCiscoAsa1000vResource'), + data: { + resourceid: args.context.asa1000vDevices[0].resourceid + }, + success: function(json) { + args.response.success(); + }, + error: function(data) { + args.response.error(parseXMLHttpResponse(data)); + } + }); + }, + notification: { + poll: function(args) { + args.complete(); + } + } + } + }, + + tabs: { + details: { + title: 'label.details', + + fields: [ + { + hostname: { + label: 'label.host' + } + }, + { + insideportprofile: { label: 'Inside Port Profile' }, + RESOURCE_NAME: { label: 'Resource Name' }, + resourceid: { label: 'Resource ID' } + } + ], + + dataProvider: function(args) { + debugger; + $.ajax({ + url: createURL('listCiscoAsa1000vResources'), + data: { + resourceid: args.context.asa1000vDevices[0].resourceid + }, + success: function(json) { + var item = json.listCiscoAsa1000vResources["null"][0]; //waiting for Koushik to fix object name to be "CiscoAsa1000vResource" instead of "null" + //var item = json.listCiscoAsa1000vResources.CiscoAsa1000vResource[0]; + args.response.success({ data: item }); + } + }); + } + } + } + } } }); }; From c9bb5356bde4dcd40ebaea0e6ed0b36560f86267 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Thu, 9 May 2013 11:37:30 -0700 Subject: [PATCH 12/17] CLOUDSTACK-1816: Cisco VNMC ASA1000v - UI - CiscoVNMC - populate listView. --- .../vnmcNetworkProvider.js | 35 ++++++------------- 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js b/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js index 135cefac62c..c4c371cbc4f 100644 --- a/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js +++ b/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js @@ -26,12 +26,8 @@ var vnmcListView = { id: 'vnmcDevices', fields: { - name: { label: 'label.name' }, - ipaddress: { label: 'label.ip.address' }, - state: { label: 'label.state', indicator: { - 'Enabled': 'on', - 'Disabled': 'off' - }} + resourcename: { label: 'Resource Name' }, + provider: { label: 'Provider' } }, actions: { @@ -63,16 +59,14 @@ } }, - action: function(args) { - //debugger; + action: function(args) { $.ajax({ url: createURL('listNetworkServiceProviders'), data: { name: 'CiscoVnmc', physicalnetworkid: args.context.physicalNetworks[0].id }, - success: function(json){ - //debugger; + success: function(json){ var items = json.listnetworkserviceprovidersresponse.networkserviceprovider; if(items != null && items.length > 0) { var ciscoVnmcProvider = items[0]; @@ -97,8 +91,7 @@ url: createURL("queryAsyncJobResult&jobId="+jobId), dataType: "json", success: function(json) { - var result = json.queryasyncjobresultresponse; - //debugger; + var result = json.queryasyncjobresultresponse; if (result.jobstatus == 0) { return; //Job has not completed } @@ -124,8 +117,7 @@ } } }); - //debugger; - + var enableCiscoVnmcProviderFn = function(ciscoVnmcProvider){ $.ajax({ url: createURL('updateNetworkServiceProvider'), @@ -162,8 +154,7 @@ }); } - var addCiscoVnmcResourceFn = function(){ - //debugger; + var addCiscoVnmcResourceFn = function(){ var data = { physicalnetworkid: args.context.physicalNetworks[0].id, hostname: args.data.hostname, @@ -174,9 +165,8 @@ $.ajax({ url: createURL('addCiscoVnmcResource'), data: data, - success: function(json) { - //debugger; - var item = json.addciscovnmcresourceresponse.ciscovnmcresource; + success: function(json) { + var item = json.addCiscoVnmcResource.CiscoVnmcResource; args.response.success({data: item}); }, error: function(data) { @@ -201,12 +191,9 @@ physicalnetworkid: args.context.physicalNetworks[0].id }, success: function(json){ + var items = json.listCiscoVnmcResources["null"]; //change it after API is fixed. args.response.success({ - data: [ - { name: 'device1', ipaddress: '192.168.1.12', state: 'Enabled' }, - { name: 'device2', ipaddress: '192.168.1.13', state: 'Disabled' }, - { name: 'device3', ipaddress: '192.168.1.14', state: 'Enabled' } - ] + data: items }); } }); From b73156a56ece6153bca6b9c5ce99a6200c1ad4e4 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Thu, 9 May 2013 12:51:40 -0700 Subject: [PATCH 13/17] CLOUDSTACK-1816: Cisco VNMC ASA1000v - object name in API response has been corrected. Here is related UI change. --- ui/modules/vnmcAsa1000v/vnmcAsa1000v.js | 12 ++-- .../vnmcNetworkProvider.js | 57 ++++++++++++------- 2 files changed, 39 insertions(+), 30 deletions(-) diff --git a/ui/modules/vnmcAsa1000v/vnmcAsa1000v.js b/ui/modules/vnmcAsa1000v/vnmcAsa1000v.js index 6a29c707551..621c52a3ddc 100644 --- a/ui/modules/vnmcAsa1000v/vnmcAsa1000v.js +++ b/ui/modules/vnmcAsa1000v/vnmcAsa1000v.js @@ -32,8 +32,7 @@ physicalnetworkid: args.context.physicalNetworks[0].id }, success: function(json){ - var items = json.listCiscoAsa1000vResources["null"]; //waiting for Koushik to fix object name to be "CiscoAsa1000vResource" instead of "null" - //var items = json.listCiscoAsa1000vResources.CiscoAsa1000vResource; + var items = json.listCiscoAsa1000vResources.CiscoAsa1000vResource; args.response.success({ data: items }); } }); @@ -124,8 +123,7 @@ return 'delete CiscoASA1000v'; } }, - action: function(args) { - debugger; + action: function(args) { $.ajax({ url: createURL('deleteCiscoAsa1000vResource'), data: { @@ -164,16 +162,14 @@ } ], - dataProvider: function(args) { - debugger; + dataProvider: function(args) { $.ajax({ url: createURL('listCiscoAsa1000vResources'), data: { resourceid: args.context.asa1000vDevices[0].resourceid }, success: function(json) { - var item = json.listCiscoAsa1000vResources["null"][0]; //waiting for Koushik to fix object name to be "CiscoAsa1000vResource" instead of "null" - //var item = json.listCiscoAsa1000vResources.CiscoAsa1000vResource[0]; + var item = json.listCiscoAsa1000vResources.CiscoAsa1000vResource[0]; args.response.success({ data: item }); } }); diff --git a/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js b/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js index c4c371cbc4f..82a5a3e454b 100644 --- a/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js +++ b/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js @@ -28,8 +28,21 @@ fields: { resourcename: { label: 'Resource Name' }, provider: { label: 'Provider' } - }, - + }, + dataProvider: function(args) { + $.ajax({ + url: createURL('listCiscoVnmcResources'), + data: { + physicalnetworkid: args.context.physicalNetworks[0].id + }, + success: function(json){ + var items = json.listCiscoVnmcResources.CiscoVnmcResource; + args.response.success({ + data: items + }); + } + }); + }, actions: { add: { label: 'Add VNMC device', @@ -182,21 +195,6 @@ } } } - }, - - dataProvider: function(args) { - $.ajax({ - url: createURL('listCiscoVnmcResources'), - data: { - physicalnetworkid: args.context.physicalNetworks[0].id - }, - success: function(json){ - var items = json.listCiscoVnmcResources["null"]; //change it after API is fixed. - args.response.success({ - data: items - }); - } - }); } }; @@ -233,14 +231,29 @@ title: 'label.details', fields: [ { - name: { label: 'label.name' } + resourcename: { label: 'Resource Name' } }, - { - ipaddress: { label: 'label.ip.address' }, - state: { label: 'label.state' } + { + resourceid: { label: 'Resource ID'}, + provider: { label: 'Provider' }, + RESOURCE_NAME: { label: 'Resource Name'} } ], - dataProvider: function(args) { + dataProvider: function(args) { + $.ajax({ + url: createURL('listCiscoVnmcResources'), + data: { + resourceid: args.context.vnmcDevices[0].id + }, + success: function(json){ + var item = json.listCiscoVnmcResources.CiscoVnmcResource[0]; + args.response.success({ + data: item + }); + } + }); + + args.response.success({ data: args.context.vnmcDevices[0] }); From ea4cb0e988bc09145cde9c5e6d62c84bb21e76da Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Thu, 9 May 2013 13:20:02 -0700 Subject: [PATCH 14/17] CLOUDSTACK-1816: Cisco VNMC ASA1000v - implement Delete VNMC Resource action. --- .../vnmcNetworkProvider.js | 107 +++++++++++------- 1 file changed, 67 insertions(+), 40 deletions(-) diff --git a/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js b/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js index 82a5a3e454b..acd00568589 100644 --- a/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js +++ b/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js @@ -195,10 +195,74 @@ } } } - } + }, + + detailView: { + name: 'CiscoVNMC resource details', + actions: { + remove: { + label: 'delete CiscoVNMC resource', + messages: { + confirm: function(args) { + return 'Please confirm you want to delete CiscoVNMC resource'; + }, + notification: function(args) { + return 'delete CiscoVNMC resource'; + } + }, + action: function(args) { + $.ajax({ + url: createURL('deleteCiscoVnmcResource'), + data: { + resourceid: args.context.vnmcDevices[0].resourceid + }, + success: function(json) { + args.response.success(); + }, + error: function(data) { + args.response.error(parseXMLHttpResponse(data)); + } + }); + }, + notification: { + poll: function(args) { + args.complete(); + } + } + } + }, + + tabs: { + details: { + title: 'label.details', + fields: [ + { + resourcename: { label: 'Resource Name' } + }, + { + resourceid: { label: 'Resource ID'}, + provider: { label: 'Provider' }, + RESOURCE_NAME: { label: 'Resource Name'} + } + ], + dataProvider: function(args) { + $.ajax({ + url: createURL('listCiscoVnmcResources'), + data: { + resourceid: args.context.vnmcDevices[0].resourceid + }, + success: function(json){ + var item = json.listCiscoVnmcResources.CiscoVnmcResource[0]; + args.response.success({ data: item }); + } + }); + } + } + } + } }; - var vnmcProviderDetailView = vnmcListView.detailView = { + var vnmcProviderDetailView = { id: 'vnmcProvider', label: 'VNMC', viewAll: vnmcDeviceViewAll, @@ -224,44 +288,7 @@ } } }; - - var vnmcDeviceDetailView = { - tabs: { - details: { - title: 'label.details', - fields: [ - { - resourcename: { label: 'Resource Name' } - }, - { - resourceid: { label: 'Resource ID'}, - provider: { label: 'Provider' }, - RESOURCE_NAME: { label: 'Resource Name'} - } - ], - dataProvider: function(args) { - $.ajax({ - url: createURL('listCiscoVnmcResources'), - data: { - resourceid: args.context.vnmcDevices[0].id - }, - success: function(json){ - var item = json.listCiscoVnmcResources.CiscoVnmcResource[0]; - args.response.success({ - data: item - }); - } - }); - - - args.response.success({ - data: args.context.vnmcDevices[0] - }); - } - } - } - }; - + module.pluginAPI.extend({ addDevice: function(device) { cloudStack.sections.system.subsections[device.id] = device; From 04be0cdec2ab37bd1975e85dc2c406a6d39b688c Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Thu, 9 May 2013 14:33:18 -0700 Subject: [PATCH 15/17] CLOUDSTACK-1816: Cisco VNMC ASA1000v - UI - Infrastructure menu - network service providers - show Cisco VNMC in Advanced zone, hide it in Basic zone. --- ui/modules/infrastructure/infrastructure.js | 14 ++++++++------ ui/scripts/system.js | 3 ++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ui/modules/infrastructure/infrastructure.js b/ui/modules/infrastructure/infrastructure.js index ad43108259b..dae797e39df 100644 --- a/ui/modules/infrastructure/infrastructure.js +++ b/ui/modules/infrastructure/infrastructure.js @@ -33,12 +33,14 @@ $(window).bind('cloudStack.system.serviceProviders.makeHarcodedArray', function(event, data) { var nspHardcodingArray = data.nspHardcodingArray; - - nspHardcodingArray.push({ - id: id, - name: name, - state: state - }); + var selectedZoneObj = data.selectedZoneObj; + if(selectedZoneObj.networktype == "Advanced"){ + nspHardcodingArray.push({ + id: id, + name: name, + state: state + }); + } }); }, diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 6f4e116b4e8..81fda3a71c3 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -12144,7 +12144,8 @@ ]; $(window).trigger('cloudStack.system.serviceProviders.makeHarcodedArray', { - nspHardcodingArray: nspHardcodingArray + nspHardcodingArray: nspHardcodingArray, + selectedZoneObj: selectedZoneObj }); if(selectedZoneObj.networktype == "Basic") { From b1f6d8914154114fe5c70618a7618d9dd0419df0 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Thu, 9 May 2013 15:31:25 -0700 Subject: [PATCH 16/17] CLOUDSTACK-1816: Cisco VNMC ASA1000v - UI - Infrastructure menu - network service providers - populate provider detailView. --- ui/modules/infrastructure/infrastructure.js | 23 ++++++++++++-- .../vnmcNetworkProvider.js | 30 ++++++++++++++----- ui/scripts/system.js | 3 +- 3 files changed, 44 insertions(+), 12 deletions(-) diff --git a/ui/modules/infrastructure/infrastructure.js b/ui/modules/infrastructure/infrastructure.js index dae797e39df..4111aa5af37 100644 --- a/ui/modules/infrastructure/infrastructure.js +++ b/ui/modules/infrastructure/infrastructure.js @@ -33,12 +33,29 @@ $(window).bind('cloudStack.system.serviceProviders.makeHarcodedArray', function(event, data) { var nspHardcodingArray = data.nspHardcodingArray; - var selectedZoneObj = data.selectedZoneObj; - if(selectedZoneObj.networktype == "Advanced"){ + var selectedZoneObj = data.selectedZoneObj; + var selectedPhysicalNetworkObj = data.selectedPhysicalNetworkObj; + if(selectedZoneObj.networktype == "Advanced"){ + var selectedProviderObj = {}; + $.ajax({ + url: createURL('listNetworkServiceProviders'), + data: { + name: id, //e.g. 'CiscoVnmc' + physicalnetworkid: selectedPhysicalNetworkObj.id + }, + async: false, + success: function(json){ + var items = json.listnetworkserviceprovidersresponse.networkserviceprovider; + if(items != null && items.length > 0) { + selectedProviderObj = items[0]; + } + } + }); + nspHardcodingArray.push({ id: id, name: name, - state: state + state: selectedProviderObj.state }); } }); diff --git a/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js b/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js index acd00568589..cecf56c79ea 100644 --- a/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js +++ b/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js @@ -274,16 +274,30 @@ name: { label: 'label.name' } }, { - state: { label: 'label.state' } + state: { label: 'label.state' }, + id: { label: 'label.id' }, + servicelist: { + label: 'Services', + converter: function(args){ + return args.join(', '); + } + } } ], - dataProvider: function(args) { - args.response.success({ + dataProvider: function(args) { + $.ajax({ + url: createURL('listNetworkServiceProviders'), data: { - name: 'VNMC Devices', - state: 'Disabled' + name: 'CiscoVnmc', + physicalnetworkid: args.context.physicalNetworks[0].id + }, + success: function(json){ + var items = json.listnetworkserviceprovidersresponse.networkserviceprovider; + if(items != null && items.length > 0) { + args.response.success({ data: items[0] }); + } } - }); + }); } } } @@ -297,9 +311,9 @@ }); module.infrastructure.networkServiceProvider({ - id: 'vnmc', + id: 'CiscoVnmc', name: 'Cisco VNMC', - state: 'Disabled', + //state: 'Disabled', //don't know state until log in and visit Infrastructure menu > zone detail > physical network > network service providers listView: vnmcListView, detailView: vnmcProviderDetailView diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 81fda3a71c3..0164e21cb68 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -12145,7 +12145,8 @@ $(window).trigger('cloudStack.system.serviceProviders.makeHarcodedArray', { nspHardcodingArray: nspHardcodingArray, - selectedZoneObj: selectedZoneObj + selectedZoneObj: selectedZoneObj, + selectedPhysicalNetworkObj: selectedPhysicalNetworkObj }); if(selectedZoneObj.networktype == "Basic") { From 1177589a6bb433577c557771ea905aab236bb21b Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Fri, 10 May 2013 11:54:17 -0700 Subject: [PATCH 17/17] CLOUDSTACK-1816: Cisco VNMC ASA1000v - UI - Infrastructure menu - physical network - network service providers - Cisco VNMC - fix a bug that detailView loads forever. --- ui/modules/infrastructure/infrastructure.js | 4 ++-- .../vnmcNetworkProvider/vnmcNetworkProvider.js | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ui/modules/infrastructure/infrastructure.js b/ui/modules/infrastructure/infrastructure.js index 4111aa5af37..55767d3137e 100644 --- a/ui/modules/infrastructure/infrastructure.js +++ b/ui/modules/infrastructure/infrastructure.js @@ -36,7 +36,7 @@ var selectedZoneObj = data.selectedZoneObj; var selectedPhysicalNetworkObj = data.selectedPhysicalNetworkObj; if(selectedZoneObj.networktype == "Advanced"){ - var selectedProviderObj = {}; + var selectedProviderObj = null; $.ajax({ url: createURL('listNetworkServiceProviders'), data: { @@ -55,7 +55,7 @@ nspHardcodingArray.push({ id: id, name: name, - state: selectedProviderObj.state + state: selectedProviderObj? selectedProviderObj.state : 'Disabled' }); } }); diff --git a/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js b/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js index cecf56c79ea..cad4a49a6a5 100644 --- a/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js +++ b/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js @@ -278,8 +278,11 @@ id: { label: 'label.id' }, servicelist: { label: 'Services', - converter: function(args){ - return args.join(', '); + converter: function(args){ + if(args) + return args.join(', '); + else + return ''; } } } @@ -296,6 +299,14 @@ if(items != null && items.length > 0) { args.response.success({ data: items[0] }); } + else { + args.response.success({ + data: { + name: 'CiscoVnmc', + state: 'Disabled' + } + }) + } } }); }