Adding in Virtual Networks panel
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c7161556 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c7161556 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c7161556 Branch: refs/heads/sf-plugins Commit: c71615561571c12d81719f6a500a63fe2c5385ac Parents: f6f2ba6 Author: Mike Tutkowski <[email protected]> Authored: Sat Jul 18 23:33:57 2015 -0600 Committer: Mike Tutkowski <[email protected]> Committed: Fri Sep 18 19:28:22 2015 -0600 ---------------------------------------------------------------------- ui/plugins/sfAdministration/sfAdministration.js | 538 +++++++++++-------- 1 file changed, 300 insertions(+), 238 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c7161556/ui/plugins/sfAdministration/sfAdministration.js ---------------------------------------------------------------------- diff --git a/ui/plugins/sfAdministration/sfAdministration.js b/ui/plugins/sfAdministration/sfAdministration.js index bdb467b..be1be98 100644 --- a/ui/plugins/sfAdministration/sfAdministration.js +++ b/ui/plugins/sfAdministration/sfAdministration.js @@ -3,278 +3,340 @@ plugin.ui.addSection({ id: 'sfAdministration', title: 'SolidFire Administration', + sectionSelect: { + label: 'label.select-view', + preFilter: function() { + return ['sfAdministration']; + } + }, preFilter: function(args) { return isAdmin(); }, - listView: { - id: 'sfAdministration', - fields: { - name: { label: 'label.name' }, - mvip: { label: 'MVIP' }, - username: { label: 'Username' }, - zonename: { label: 'label.zone' } - }, - dataProvider: function(args) { - plugin.ui.apiCall('listSolidFireClusters', { - success: function(json) { - var sfclustersfiltered = []; - var sfclusters = json.listsolidfireclustersresponse.sfcluster; - var search = args.filterBy.search.value == null ? "" : args.filterBy.search.value.toLowerCase(); - - if (search == "") { - sfclustersfiltered = sfclusters; - } - else { - for (i = 0; i < sfclusters.length; i++) { - sfcluster = sfclusters[i]; + sections: { + sfAdministration: { + id: 'sfAdministration', + type: 'select', + title: 'SolidFire Clusters', + listView: { + section: 'sfAdministration', + id: 'sfAdministration', + fields: { + name: { label: 'label.name' }, + mvip: { label: 'MVIP' }, + username: { label: 'Username' }, + zonename: { label: 'label.zone' } + }, + dataProvider: function(args) { + plugin.ui.apiCall('listSolidFireClusters', { + success: function(json) { + var sfclustersfiltered = []; + var sfclusters = json.listsolidfireclustersresponse.sfcluster; + var search = args.filterBy.search.value == null ? "" : args.filterBy.search.value.toLowerCase(); - if (sfcluster.name.toLowerCase().indexOf(search) > -1 ) { - sfclustersfiltered.push(sfcluster); + if (search == "") { + sfclustersfiltered = sfclusters; } - } - } - - args.response.success({ data: sfclustersfiltered }); - }, - error: function(errorMessage) { - args.response.error(errorMessage); - } - }); - }, - actions: { - add: { - label: 'Add Reference to Cluster', - preFilter: function(args) { - return true; - }, - messages: { - confirm: function(args) { - return 'Please fill in the following data to add a new reference to a cluster.'; - }, - notification: function(args) { - return 'Add Reference to Cluster'; - } - }, - createForm: { - title: 'Add Reference to Cluster', - desc: 'Please fill in the following data to add a new reference to a cluster.', - fields: { - availabilityZone: { - label: 'label.availability.zone', - docID: 'helpVolumeAvailabilityZone', - validation: { - required: true - }, - select: function(args) { - $.ajax({ - url: createURL("listZones&available=true"), - dataType: "json", - async: true, - success: function(json) { - var zoneObjs = json.listzonesresponse.zone; + else { + for (i = 0; i < sfclusters.length; i++) { + sfcluster = sfclusters[i]; - args.response.success({ - descriptionField: 'name', - data: zoneObjs - }); + if (sfcluster.name.toLowerCase().indexOf(search) > -1 ) { + sfclustersfiltered.push(sfcluster); } - }); - } - }, - mvip: { - label: 'MVIP', - validation: { - required: true - } - }, - username: { - label: 'label.username', - docID: 'helpUserUsername', - validation: { - required: true - } - }, - password: { - label: 'label.password', - docID: 'helpUserPassword', - isPassword: true, - validation: { - required: true + } } + + args.response.success({ data: sfclustersfiltered }); }, - totalCapacity: { - label: 'Total Capacity', - validation: { - required: true, - number: true - } + error: function(errorMessage) { + args.response.error(errorMessage); + } + }); + }, + actions: { + add: { + label: 'Add Reference to Cluster', + preFilter: function(args) { + return true; }, - totalMinIops: { - label: 'Total Min IOPS', - validation: { - required: true, - number: true + messages: { + confirm: function(args) { + return 'Please fill in the following data to add a new reference to a cluster.'; + }, + notification: function(args) { + return 'Add Reference to Cluster'; } }, - totalMaxIops: { - label: 'Total Max IOPS', - validation: { - required: true, - number: true + createForm: { + title: 'Add Reference to Cluster', + desc: 'Please fill in the following data to add a new reference to a cluster.', + fields: { + availabilityZone: { + label: 'label.availability.zone', + docID: 'helpVolumeAvailabilityZone', + validation: { + required: true + }, + select: function(args) { + $.ajax({ + url: createURL("listZones&available=true"), + dataType: "json", + async: true, + success: function(json) { + var zoneObjs = json.listzonesresponse.zone; + + args.response.success({ + descriptionField: 'name', + data: zoneObjs + }); + } + }); + } + }, + mvip: { + label: 'MVIP', + validation: { + required: true + } + }, + username: { + label: 'label.username', + docID: 'helpUserUsername', + validation: { + required: true + } + }, + password: { + label: 'label.password', + docID: 'helpUserPassword', + isPassword: true, + validation: { + required: true + } + }, + totalCapacity: { + label: 'Total Capacity', + validation: { + required: true, + number: true + } + }, + totalMinIops: { + label: 'Total Min IOPS', + validation: { + required: true, + number: true + } + }, + totalMaxIops: { + label: 'Total Max IOPS', + validation: { + required: true, + number: true + } + }, + totalBurstIops: { + label: 'Total Burst IOPS', + validation: { + required: true, + number: true + } + } } }, - totalBurstIops: { - label: 'Total Burst IOPS', - validation: { - required: true, - number: true - } - } - } - }, - action: function(args) { - var data = { - zoneid: args.data.availabilityZone, - mvip: args.data.mvip, - username: args.data.username, - password: args.data.password, - totalcapacity: args.data.totalCapacity, - totalminiops: args.data.totalMinIops, - totalmaxiops: args.data.totalMaxIops, - totalburstiops: args.data.totalBurstIops - }; + action: function(args) { + var data = { + zoneid: args.data.availabilityZone, + mvip: args.data.mvip, + username: args.data.username, + password: args.data.password, + totalcapacity: args.data.totalCapacity, + totalminiops: args.data.totalMinIops, + totalmaxiops: args.data.totalMaxIops, + totalburstiops: args.data.totalBurstIops + }; - $.ajax({ - url: createURL('createReferenceToSolidFireCluster'), - data: data, - success: function(json) { - var sfclusterObj = json.createreferencetosolidfireclusterresponse.apicreatereferencetosolidfirecluster; + $.ajax({ + url: createURL('createReferenceToSolidFireCluster'), + data: data, + success: function(json) { + var sfclusterObj = json.createreferencetosolidfireclusterresponse.apicreatereferencetosolidfirecluster; - args.response.success({ - data: sfclusterObj + args.response.success({ + data: sfclusterObj + }); + }, + error: function(json) { + args.response.error(parseXMLHttpResponse(json)); + } }); - }, - error: function(json) { - args.response.error(parseXMLHttpResponse(json)); - } - }); - } - } - }, - detailView: { - name: 'label.details', - actions: { - edit: { - label: 'label.edit', - messages: { - notification: function(args) { - return 'Edit Cluster'; } + } + }, + detailView: { + name: 'label.details', + viewAll: { + path: 'sfAdministration.sfVirtualNetworks', + label: 'Virtual Networks' }, - action: function (args) { - var params = []; + actions: { + edit: { + label: 'label.edit', + messages: { + notification: function(args) { + return 'Edit Cluster'; + } + }, + action: function (args) { + var params = []; - params.push("&name=" + args.context.sfAdministration[0].name); - params.push("&totalcapacity=" + args.data.totalcapacity); - params.push("&totalminiops=" + args.data.totalminiops); - params.push("&totalmaxiops=" + args.data.totalmaxiops); - params.push("&totalburstiops=" + args.data.totalburstiops); + params.push("&name=" + args.context.sfAdministration[0].name); + params.push("&totalcapacity=" + args.data.totalcapacity); + params.push("&totalminiops=" + args.data.totalminiops); + params.push("&totalmaxiops=" + args.data.totalmaxiops); + params.push("&totalburstiops=" + args.data.totalburstiops); - $.ajax({ - url: createURL('updateReferenceToSolidFireCluster' + params.join("")), - success: function(json) { - var sfclusterObj = json.updatereferencetosolidfireclusterresponse.apiupdatereferencetosolidfirecluster; + $.ajax({ + url: createURL('updateReferenceToSolidFireCluster' + params.join("")), + success: function(json) { + var sfclusterObj = json.updatereferencetosolidfireclusterresponse.apiupdatereferencetosolidfirecluster; - args.response.success({ - data: sfclusterObj + args.response.success({ + data: sfclusterObj + }); + }, + error: function(json) { + args.response.error(parseXMLHttpResponse(json)); + } }); - }, - error: function(json) { - args.response.error(parseXMLHttpResponse(json)); } - }); - } - }, - remove: { - label: 'Delete Reference to Cluster', - messages: { - confirm: function(args) { - return 'Are you sure you would like to delete this reference to a SolidFire cluster?'; }, - notification: function(args) { - return 'Delete Reference to Cluster'; + remove: { + label: 'Delete Reference to Cluster', + messages: { + confirm: function(args) { + return 'Are you sure you would like to delete this reference to a SolidFire cluster?'; + }, + notification: function(args) { + return 'Delete Reference to Cluster'; + } + }, + action: function(args) { + $.ajax({ + url: createURL('deleteReferenceToSolidFireCluster&name=' + args.context.sfAdministration[0].name), + success: function(json) { + args.response.success(); + }, + error: function(json) { + args.response.error(parseXMLHttpResponse(json)); + } + }); + } } }, - action: function(args) { - $.ajax({ - url: createURL('deleteReferenceToSolidFireCluster&name=' + args.context.sfAdministration[0].name), - success: function(json) { - args.response.success(); + tabs: { + details: { + title: 'label.details', + preFilter: function(args) { + return []; }, - error: function(json) { - args.response.error(parseXMLHttpResponse(json)); + fields: [ + { + name: { + label: 'label.name' + } + }, + { + uuid: { + label: 'label.id' + }, + zonename: { + label: 'label.zone' + }, + mvip: { + label: 'MVIP' + }, + username: { + label: 'Username' + }, + totalcapacity: { + label: 'Total Capacity', + isEditable: true + }, + totalminiops: { + label: 'Total Min IOPS', + isEditable: true + }, + totalmaxiops: { + label: 'Total Max IOPS', + isEditable: true + }, + totalburstiops: { + label: 'Total Burst IOPS', + isEditable: true + } + } + ], + dataProvider: function(args) { + $.ajax({ + url: createURL("listSolidFireClusters&name=" + args.context.sfAdministration[0].name), + dataType: "json", + async: true, + success: function(json) { + var jsonObj = json.listsolidfireclustersresponse.sfcluster[0]; + + args.response.success({ + data: jsonObj + }); + } + }); } - }); + } } } - }, - tabs: { - details: { - title: 'label.details', - preFilter: function(args) { - return []; - }, - fields: [ - { - name: { - label: 'label.name' - } - }, - { - uuid: { - label: 'label.id' - }, - zonename: { - label: 'label.zone' - }, - mvip: { - label: 'MVIP' - }, - username: { - label: 'Username' - }, - totalcapacity: { - label: 'Total Capacity', - isEditable: true - }, - totalminiops: { - label: 'Total Min IOPS', - isEditable: true - }, - totalmaxiops: { - label: 'Total Max IOPS', - isEditable: true - }, - totalburstiops: { - label: 'Total Burst IOPS', - isEditable: true + } + }, + sfVirtualNetworks: { + id: 'sfVirtualNetworks', + type: 'select', + title: 'SolidFire Virtual Networks', + listView: { + section: 'sfVirtualNetworks', + id: 'sfVirtualNetworks', + fields: { + name: { label: 'label.name' }, + tag: { label: 'Tag' }, + svip: { label: 'SVIP' }, + account: { label: 'label.account' } + }, + dataProvider: function(args) { + var virtualnetworkid = args.context.virtualnetwork[0].id; + + plugin.ui.apiCall('listSolidFireVirtualNetworks&' + virtualnetworkid, { + success: function(json) { + var sfvirtualnetworksfiltered = []; + var sfvirtualnetworks = json.listsolidfirevirtualnetworksresponse.sfvirtualnetwork; + var search = args.filterBy.search.value == null ? "" : args.filterBy.search.value.toLowerCase(); + + if (search == "") { + sfvirtualnetworksfiltered = sfvirtualnetworks; } - } - ], - dataProvider: function(args) { - $.ajax({ - url: createURL("listSolidFireClusters&name=" + args.context.sfAdministration[0].name), - dataType: "json", - async: true, - success: function(json) { - var jsonObj = json.listsolidfireclustersresponse.sfcluster[0]; + else { + for (i = 0; i < sfvirtualnetworks.length; i++) { + sfvirtualnetwork = sfvirtualnetworks[i]; - args.response.success({ - data: jsonObj - }); + if (sfvirtualnetwork.name.toLowerCase().indexOf(search) > -1 ) { + sfvirtualnetworksfiltered.push(sfvirtualnetwork); + } + } } - }); - } + + args.response.success({ data: sfvirtualnetworksfiltered }); + }, + error: function(errorMessage) { + args.response.error(errorMessage); + } + }); } } }
