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 Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9a8bf4a6 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9a8bf4a6 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9a8bf4a6 Branch: refs/heads/ui-vpc-redesign Commit: 9a8bf4a66bd08f660eadf6d3707c46044fcac08c Parents: 2cd70d0 Author: Brian Federle <brian.fede...@citrix.com> Authored: Mon May 6 11:46:24 2013 -0700 Committer: Brian Federle <brian.fede...@citrix.com> Committed: Mon May 6 11:46:24 2013 -0700 ---------------------------------------------------------------------- .../asa1000vNetworkProvider.js | 93 ------------ ui/modules/modules.js | 3 +- ui/modules/vnmcAsa1000v/vnmcAsa1000v.js | 44 ++++++ .../vnmcNetworkProvider/vnmcNetworkProvider.js | 112 +++++++++++++++ 4 files changed, 158 insertions(+), 94 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a8bf4a6/ui/modules/asa1000vNetworkProvider/asa1000vNetworkProvider.js ---------------------------------------------------------------------- diff --git a/ui/modules/asa1000vNetworkProvider/asa1000vNetworkProvider.js b/ui/modules/asa1000vNetworkProvider/asa1000vNetworkProvider.js deleted file mode 100644 index cae30bf..0000000 --- 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)); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a8bf4a6/ui/modules/modules.js ---------------------------------------------------------------------- diff --git a/ui/modules/modules.js b/ui/modules/modules.js index f5dd62a..d4502a1 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)); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a8bf4a6/ui/modules/vnmcAsa1000v/vnmcAsa1000v.js ---------------------------------------------------------------------- diff --git a/ui/modules/vnmcAsa1000v/vnmcAsa1000v.js b/ui/modules/vnmcAsa1000v/vnmcAsa1000v.js new file mode 100644 index 0000000..10fe3ef --- /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)); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a8bf4a6/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js ---------------------------------------------------------------------- diff --git a/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js b/ui/modules/vnmcNetworkProvider/vnmcNetworkProvider.js new file mode 100644 index 0000000..6add2c5 --- /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));