cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtutkow...@apache.org
Subject [1/5] git commit: updated refs/heads/sf-plugins-a to cb53d9f
Date Thu, 01 Oct 2015 02:23:20 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/sf-plugins-a [created] cb53d9f15


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a33835d/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFireSharedPrimaryDataStoreDriver.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFireSharedPrimaryDataStoreDriver.java
b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFireSharedPrimaryDataStoreDriver.java
index a16408e..365533c 100644
--- a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFireSharedPrimaryDataStoreDriver.java
+++ b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidFireSharedPrimaryDataStoreDriver.java
@@ -16,50 +16,5 @@
 // under the License.
 package org.apache.cloudstack.storage.datastore.driver;
 
-import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult;
-import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
-import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
-import org.apache.cloudstack.storage.command.CommandResult;
-
-import com.cloud.agent.api.to.DataStoreTO;
-import com.cloud.agent.api.to.DataTO;
-
 public class SolidFireSharedPrimaryDataStoreDriver extends CloudStackPrimaryDataStoreDriverImpl
{
-    @Override
-    public DataTO getTO(DataObject data) {
-        return null;
-    }
-
-    @Override
-    public DataStoreTO getStoreTO(DataStore store) {
-        return null;
-    }
-
-    @Override
-    public boolean canCopy(DataObject srcData, DataObject destData) {
-        return false;
-    }
-
-    @Override
-    public void copyAsync(DataObject srcdata, DataObject destData, AsyncCompletionCallback<CopyCommandResult>
callback) {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void resize(DataObject data, AsyncCompletionCallback<CreateCmdResult> callback)
{
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void takeSnapshot(SnapshotInfo snapshot, AsyncCompletionCallback<CreateCmdResult>
callback) {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void revertSnapshot(SnapshotInfo snapshot, AsyncCompletionCallback<CommandResult>
callback) {
-        throw new UnsupportedOperationException();
-    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a33835d/ui/plugins/plugins.js
----------------------------------------------------------------------
diff --git a/ui/plugins/plugins.js b/ui/plugins/plugins.js
index 386ec06..d115eef 100644
--- a/ui/plugins/plugins.js
+++ b/ui/plugins/plugins.js
@@ -16,6 +16,8 @@
 // under the License.
 (function($, cloudStack) {
   cloudStack.plugins = [
-    // 'testPlugin'
+    // 'testPlugin',
+    // 'sfSharedVolume',
+    // 'sfAdministration'
   ];
 }(jQuery, cloudStack));

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a33835d/ui/plugins/sfAdministration/config.js
----------------------------------------------------------------------
diff --git a/ui/plugins/sfAdministration/config.js b/ui/plugins/sfAdministration/config.js
new file mode 100644
index 0000000..376ae56
--- /dev/null
+++ b/ui/plugins/sfAdministration/config.js
@@ -0,0 +1,9 @@
+(function (cloudStack) {
+  cloudStack.plugins.sfAdministration.config = {
+    title: 'SolidFire Administration',
+    desc: 'SolidFire Administration',
+    externalLink: 'http://www.solidfire.com/',
+    authorName: 'Mike Tutkowski',
+    authorEmail: 'mike.tutkowski@solidfire.com'
+  };
+}(cloudStack));
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a33835d/ui/plugins/sfAdministration/icon.png
----------------------------------------------------------------------
diff --git a/ui/plugins/sfAdministration/icon.png b/ui/plugins/sfAdministration/icon.png
new file mode 100644
index 0000000..a313d35
Binary files /dev/null and b/ui/plugins/sfAdministration/icon.png differ

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a33835d/ui/plugins/sfAdministration/sfAdministration.js
----------------------------------------------------------------------
diff --git a/ui/plugins/sfAdministration/sfAdministration.js b/ui/plugins/sfAdministration/sfAdministration.js
new file mode 100644
index 0000000..ca07318
--- /dev/null
+++ b/ui/plugins/sfAdministration/sfAdministration.js
@@ -0,0 +1,566 @@
+(function (cloudStack) {
+  cloudStack.plugins.sfAdministration = function(plugin) {
+    plugin.ui.addSection({
+      id: 'sfAdministration',
+      title: 'SolidFire Administration',
+      sectionSelect: {
+        label: 'label.select-view',
+        preFilter: function() {
+          return ['sfAdministration'];
+        }
+      },
+      preFilter: function(args) {
+        return isAdmin();
+      },
+      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 (search == "") {
+                    sfclustersfiltered = sfclusters;
+                  }
+                  else {
+                    for (i = 0; i < sfclusters.length; i++) {
+                      sfcluster = sfclusters[i];
+
+                      if (sfcluster.name.toLowerCase().indexOf(search) > -1 ) {
+                        sfclustersfiltered.push(sfcluster);
+                      }
+                    }
+                  }
+
+                  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 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 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',
+                      validation: {
+                        required: true
+                      }
+                    },
+                    password: {
+                      label: 'label.password',
+                      isPassword: true,
+                      validation: {
+                        required: true
+                      }
+                    },
+                    totalCapacity: {
+                      label: 'Total Capacity (in GB)',
+                      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
+                      }
+                    }
+                  }
+                },
+                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;
+
+                      args.response.success({
+                        data: sfclusterObj
+                      });
+                    },
+                    error: function(json) {
+                      args.response.error(parseXMLHttpResponse(json));
+                    }
+                  });
+                }
+              }
+            },
+            detailView: {
+              name: 'label.details',
+              viewAll: {
+                path: 'sfAdministration.sfVirtualNetworks',
+                label: 'Virtual Networks'
+              },
+              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);
+
+                    $.ajax({
+                      url: createURL('updateReferenceToSolidFireCluster' + params.join("")),
+                      success: function(json) {
+                        var sfclusterObj = json.updatereferencetosolidfireclusterresponse.apiupdatereferencetosolidfirecluster;
+
+                        args.response.success({
+                          data: sfclusterObj
+                        });
+                      },
+                      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';
+                    }
+                  },
+                  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));
+                      }
+                    });
+                  }
+                }
+              },
+              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 (in GB)',
+                        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
+                        });
+                      }
+                    });
+                  }
+                }
+              }
+            }
+          }
+        },
+        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' },
+              accountname: { label: 'label.account' }
+            },
+            dataProvider: function(args) {
+              var clustername = args.context.sfAdministration[0].name;
+
+              plugin.ui.apiCall('listSolidFireVirtualNetworks&clustername=' + clustername,
{
+                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;
+                  }
+                  else {
+                    for (i = 0; i < sfvirtualnetworks.length; i++) {
+                      sfvirtualnetwork = sfvirtualnetworks[i];
+
+                      if (sfvirtualnetwork.name.toLowerCase().indexOf(search) > -1 ) {
+                        sfvirtualnetworksfiltered.push(sfvirtualnetwork);
+                      }
+                    }
+                  }
+
+                  args.response.success({ data: sfvirtualnetworksfiltered });
+                },
+                error: function(errorMessage) {
+                  args.response.error(errorMessage);
+                }
+              });
+            },
+            actions: {
+              add: {
+                label: 'Add Virtual Network',
+                preFilter: function(args) {
+                  return true;
+                },
+                messages: {
+                  confirm: function(args) {
+                    return 'Please fill in the following data to add a virtual network.';
+                  },
+                  notification: function(args) {
+                    return 'Add Virtual Network';
+                  }
+                },
+                createForm: {
+                  title: 'Add Virtual Network',
+                  desc: 'Please fill in the following data to add a virtual network.',
+                  fields: {
+                    account: {
+                      label: 'Account',
+                      validation: {
+                        required: true
+                      },
+                      select: function(args) {
+                        $.ajax({
+                          url: createURL("listAccounts&listAll=true"),
+                          dataType: "json",
+                          async: true,
+                          success: function(json) {
+                            var accountObjs = json.listaccountsresponse.account;
+
+                            args.response.success({
+                              descriptionField: 'name',
+                              data: accountObjs
+                            });
+                          }
+                        });
+                      }
+                    },
+                    name: {
+                      label: 'Name',
+                      validation: {
+                        required: true
+                      }
+                    },
+                    tag: {
+                      label: 'Tag',
+                      validation: {
+                        required: true
+                      }
+                    },
+                    netmask: {
+                      label: 'Netmask',
+                      validation: {
+                        required: true
+                      }
+                    },
+                    startip: {
+                      label: 'Start IP',
+                      validation: {
+                        required: true
+                      }
+                    },
+                    size: {
+                      label: 'Size',
+                      validation: {
+                        required: true,
+                        number: true
+                      }
+                    },
+                    svip: {
+                      label: 'SVIP',
+                      validation: {
+                        required: true
+                      }
+                    }
+                  }
+                },
+                action: function(args) {
+                  var data = {
+                    clustername: args.context.sfAdministration[0].name,
+                    accountid: args.data.account,
+                    name: args.data.name,
+                    tag: args.data.tag,
+                    netmask: args.data.netmask,
+                    startip: args.data.startip,
+                    size: args.data.size,
+                    svip: args.data.svip
+                  };
+
+                  $.ajax({
+                    url: createURL('createSolidFireVirtualNetwork'),
+                    data: data,
+                    success: function(json) {
+                      var sfVirtualNetworkObj = json.createsolidfirevirtualnetworkresponse.apicreatesolidfirevirtualnetwork;
+
+                      args.response.success({
+                        data: sfVirtualNetworkObj
+                      });
+                    },
+                    error: function(json) {
+                      args.response.error(parseXMLHttpResponse(json));
+                    }
+                  });
+                }
+              }
+            },
+            detailView: {
+              name: 'label.details',
+              actions: {
+                edit: {
+                  label: 'label.edit',
+                  messages: {
+                    notification: function(args) {
+                      return 'Edit Virtual Network';
+                    }
+                  },
+                  action: function (args) {
+                    var params = [];
+
+                    params.push("&id=" + args.context.sfVirtualNetworks[0].id);
+                    params.push("&name=" + args.data.name);
+                    params.push("&netmask=" + args.data.netmask);
+                    params.push("&startip=" + args.data.startip);
+                    params.push("&size=" + args.data.size);
+
+                    $.ajax({
+                      url: createURL('updateSolidFireVirtualNetwork' + params.join("")),
+                      success: function(json) {
+                        var sfVirtualNetworkObj = json.updatesolidfirevirtualnetworkresponse.apiupdatesolidfirevirtualnetwork;
+
+                        args.response.success({
+                          data: sfVirtualNetworkObj
+                        });
+                      },
+                      error: function(json) {
+                        args.response.error(parseXMLHttpResponse(json));
+                      }
+                    });
+                  }
+                },
+                remove: {
+                  label: 'Delete Virtual Network',
+                  messages: {
+                    confirm: function(args) {
+                      return 'Are you sure you would like to delete this virtual network?';
+                    },
+                    notification: function(args) {
+                      return 'Delete Virtual Network';
+                    }
+                  },
+                  action: function(args) {
+                    $.ajax({
+                      url: createURL('deleteSolidFireVirtualNetwork&id=' + args.context.sfVirtualNetworks[0].id),
+                      success: function(json) {
+                        args.response.success();
+                      },
+                      error: function(json) {
+                        args.response.error(parseXMLHttpResponse(json));
+                      }
+                    });
+                  }
+                }
+              },
+              tabs: {
+                details: {
+                  title: 'label.details',
+                  preFilter: function(args) {
+                    return [];
+                  },
+                  fields: [
+                    {
+                      name: {
+                        label: 'label.name',
+                        isEditable: true
+                      }
+                    },
+                    {
+                      uuid: {
+                        label: 'label.id'
+                      },
+                      accountname: {
+                        label: 'label.account'
+                      },
+                      tag: {
+                        label: 'Tag'
+                      },
+                      netmask: {
+                        label: 'Netmask',
+                        isEditable: true
+                      },
+                      startip: {
+                        label: 'Start IP',
+                        isEditable: true
+                      },
+                      size: {
+                        label: 'Size',
+                        number: true,
+                        isEditable: true
+                      },
+                      svip: {
+                        label: 'SVIP'
+                      }
+                    }
+                  ],
+                  dataProvider: function(args) {
+                    $.ajax({
+                      url: createURL("listSolidFireVirtualNetworks&id=" + args.context.sfVirtualNetworks[0].id),
+                      dataType: "json",
+                      async: true,
+                      success: function(json) {
+                        var jsonObj = json.listsolidfirevirtualnetworksresponse.sfvirtualnetwork[0];
+
+                        args.response.success({
+                          data: jsonObj
+                        });
+                      }
+                    });
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    });
+  };
+}(cloudStack));
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a33835d/ui/plugins/sfSharedVolume/config.js
----------------------------------------------------------------------
diff --git a/ui/plugins/sfSharedVolume/config.js b/ui/plugins/sfSharedVolume/config.js
new file mode 100644
index 0000000..3784be6
--- /dev/null
+++ b/ui/plugins/sfSharedVolume/config.js
@@ -0,0 +1,9 @@
+(function (cloudStack) {
+  cloudStack.plugins.sfSharedVolume.config = {
+    title: 'Shared Volume',
+    desc: 'Shared Volume',
+    externalLink: 'http://www.solidfire.com/',
+    authorName: 'Mike Tutkowski',
+    authorEmail: 'mike.tutkowski@solidfire.com'
+  };
+}(cloudStack));
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a33835d/ui/plugins/sfSharedVolume/icon.png
----------------------------------------------------------------------
diff --git a/ui/plugins/sfSharedVolume/icon.png b/ui/plugins/sfSharedVolume/icon.png
new file mode 100644
index 0000000..a313d35
Binary files /dev/null and b/ui/plugins/sfSharedVolume/icon.png differ

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a33835d/ui/plugins/sfSharedVolume/sfSharedVolume.js
----------------------------------------------------------------------
diff --git a/ui/plugins/sfSharedVolume/sfSharedVolume.js b/ui/plugins/sfSharedVolume/sfSharedVolume.js
new file mode 100644
index 0000000..6d4c791
--- /dev/null
+++ b/ui/plugins/sfSharedVolume/sfSharedVolume.js
@@ -0,0 +1,377 @@
+(function (cloudStack) {
+  cloudStack.plugins.sfSharedVolume = function(plugin) {
+    plugin.ui.addSection({
+      id: 'sfSharedVolume',
+      title: 'Shared Volume',
+      preFilter: function(args) {
+        return true;
+      },
+      listView: {
+        id: 'sfSharedVolumes',
+        fields: {
+          name: { label: 'label.name' },
+          iqn: { label: 'IQN' },
+          size: { label: 'Size (GB)' },
+          miniops: { label: 'Min IOPS' },
+          maxiops: { label: 'Max IOPS' },
+          burstiops: { label: 'Burst IOPS' }
+        },
+        dataProvider: function(args) {
+          plugin.ui.apiCall('listSolidFireVolumes', {
+            success: function(json) {
+              var sfvolumesfiltered = [];
+              var sfvolumes = json.listsolidfirevolumesresponse.sfvolume;
+              var search = args.filterBy.search.value == null ? "" : args.filterBy.search.value.toLowerCase();
+
+              if (search == "") {
+                sfvolumesfiltered = sfvolumes;
+              }
+              else {
+                for (i = 0; i < sfvolumes.length; i++) {
+                  sfvolume = sfvolumes[i];
+
+                  if (sfvolume.name.toLowerCase().indexOf(search) > -1 ) {
+                    sfvolumesfiltered.push(sfvolume);
+                  }
+                }
+              }
+
+              args.response.success({ data: sfvolumesfiltered });
+            },
+            error: function(errorMessage) {
+              args.response.error(errorMessage);
+            }
+          });
+        },
+        actions: {
+          add: {
+            label: 'Add Shared Volume',
+            preFilter: function(args) {
+              return true;
+            },
+            messages: {
+              confirm: function(args) {
+                return 'Please fill in the following data to add a new shared volume.';
+              },
+              notification: function(args) {
+                return 'Add Shared Volume';
+              }
+            },
+            createForm: {
+              title: 'Add Shared Volume',
+              desc: 'Please fill in the following data to add a new shared volume.',
+              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
+                        });
+                      }
+                    });
+                  }
+                },
+                name: {
+                  label: 'label.name',
+                  docID: 'helpVolumeName',
+                  validation: {
+                    required: true
+                  }
+                },
+                diskSize: {
+                  label: 'label.disk.size.gb',
+                  validation: {
+                    required: true,
+                    number: true
+                  }
+                },
+                minIops: {
+                  label: 'label.disk.iops.min',
+                  validation: {
+                    required: true,
+                    number: true
+                  }
+                },
+                maxIops: {
+                  label: 'label.disk.iops.max',
+                  validation: {
+                    required: true,
+                    number: true
+                  }
+                },
+                burstIops: {
+                  label: 'Burst IOPS',
+                  validation: {
+                    required: true,
+                    number: true
+                  }
+                },
+                account: {
+                  label: 'Account',
+                  validation: {
+                    required: true
+                  },
+                  isHidden: true,
+                  select: function(args) {
+                    var accountNameParam = "";
+
+                    if (isAdmin()) {
+                      args.$form.find('.form-item[rel=account]').show();
+                    }
+                    else {
+                      accountNameParam = "&name=" + g_account;
+                    }
+
+                    $.ajax({
+                      url: createURL("listAccounts&listAll=true" + accountNameParam),
+                      dataType: "json",
+                      async: true,
+                      success: function(json) {
+                        var accountObjs = json.listaccountsresponse.account;
+                        var filteredAccountObjs = [];
+
+                        if (isAdmin()) {
+                          filteredAccountObjs = accountObjs;
+                        }
+                        else {
+                          for (i = 0; i < accountObjs.length; i++) {
+                            var accountObj = accountObjs[i];
+
+                            if (accountObj.domainid == g_domainid) {
+                              filteredAccountObjs.push(accountObj);
+
+                              break; // there should only be one account with a particular
name in a domain
+                            }
+                          }
+                        }
+
+                        args.response.success({
+                          descriptionField: 'name',
+                          data: filteredAccountObjs
+                        });
+                      }
+                    });
+                  }
+                },
+                vlan: {
+                  label: 'VLAN',
+                  validation: {
+                    required: true
+                  },
+                  dependsOn: ['availabilityZone', 'account'],
+                  select: function(args) {
+                    if (args.data.availabilityZone == null || args.data.availabilityZone
== "" ||
+                        args.data.account == null || args.data.account == "") {
+                      return;
+                    }
+
+                    var params = [];
+
+                    params.push("&zoneid=" + args.data.availabilityZone);
+                    params.push("&accountid=" + args.data.account);
+
+                    $.ajax({
+                      url: createURL("listSolidFireVirtualNetworks" + params.join("")),
+                      dataType: "json",
+                      async: true,
+                      success: function(json) {
+                        var virtualNetworkObjs = json.listsolidfirevirtualnetworksresponse.sfvirtualnetwork;
+
+                        args.response.success({
+                          descriptionField: 'name',
+                          data: virtualNetworkObjs
+                        });
+                      }
+                    });
+                  }
+                }
+              }
+            },
+            action: function(args) {
+              var data = {
+                name: args.data.name,
+                size: args.data.diskSize,
+                miniops: args.data.minIops,
+                maxiops: args.data.maxIops,
+                burstiops: args.data.burstIops,
+                accountid: args.data.account,
+                sfvirtualnetworkid: args.data.vlan
+              };
+
+              $.ajax({
+                url: createURL('createSolidFireVolume'),
+                data: data,
+                success: function(json) {
+                  var sfvolumeObj = json.createsolidfirevolumeresponse.apicreatesolidfirevolume;
+
+                  args.response.success({
+                    data: sfvolumeObj
+                  });
+                },
+                error: function(json) {
+                  args.response.error(parseXMLHttpResponse(json));
+                }
+              });
+            }
+          }
+        },
+        detailView: {
+          name: 'label.volume.details',
+          actions: {
+            edit: {
+              label: 'label.edit',
+              messages: {
+                notification: function(args) {
+                  return 'Edit Shared Volume';
+                }
+              },
+              action: function (args) {
+                var params = [];
+
+                params.push("&id=" + args.context.sfSharedVolumes[0].id);
+                params.push("&size=" + args.data.size);
+                params.push("&miniops=" + args.data.miniops);
+                params.push("&maxiops=" + args.data.maxiops);
+                params.push("&burstiops=" + args.data.burstiops);
+
+                $.ajax({
+                  url: createURL('updateSolidFireVolume' + params.join("")),
+                  success: function(json) {
+                    var sfvolumeObj = json.updatesolidfirevolumeresponse.apiupdatesolidfirevolume;
+
+                    args.response.success({
+                      data: sfvolumeObj
+                    });
+                  },
+                  error: function(json) {
+                    args.response.error(parseXMLHttpResponse(json));
+                  }
+                });
+              }
+            },
+            remove: {
+              label: 'label.delete',
+              messages: {
+                confirm: function(args) {
+                  return 'Are you sure you would like to delete this shared volume?';
+                },
+                notification: function(args) {
+                  return 'Delete Shared Volume';
+                }
+              },
+              action: function(args) {
+                $.ajax({
+                  url: createURL('deleteSolidFireVolume&id=' + args.context.sfSharedVolumes[0].id),
+                  success: function(json) {
+                    args.response.success();
+                  },
+                  error: function(json) {
+                    args.response.error(parseXMLHttpResponse(json));
+                  }
+                });
+              }
+            }
+          },
+          tabs: {
+            details: {
+              title: 'label.details',
+              preFilter: function(args) {
+                var hiddenFields;
+
+                if (isAdmin()) {
+                  hiddenFields = [];
+                } else {
+                  hiddenFields = ['clustername', 'accountname'];
+                }
+
+                return hiddenFields;
+              },
+              fields: [
+                {
+                  name: {
+                    label: 'label.name'
+                  }
+                },
+                {
+                  uuid: {
+                    label: 'label.id'
+                  },
+                  clustername: {
+                    label: 'Cluster'
+                  },
+                  zonename: {
+                    label: 'label.zone'
+                  },
+                  accountname: {
+                    label: 'label.account'
+                  },
+                  vlanname: {
+                    label: 'VLAN'
+                  },
+                  size: {
+                    label: 'label.disk.size.gb',
+                    isEditable: true
+                  },
+                  miniops: {
+                    label: 'label.disk.iops.min',
+                    isEditable: true
+                  },
+                  maxiops: {
+                    label: 'label.disk.iops.max',
+                    isEditable: true
+                  },
+                  burstiops: {
+                    label: 'Burst IOPS',
+                    isEditable: true
+                  },
+                  targetportal: {
+                    label: 'Target Portal'
+                  },
+                  iqn: {
+                    label: 'IQN'
+                  },
+                  chapinitiatorusername: {
+                    label: 'Initiator Username'
+                  },
+                  chapinitiatorsecret: {
+                    label: 'Initiator Secret'
+                  },
+                  created: {
+                    label: 'label.created',
+                    converter: cloudStack.converters.toLocalDate
+                  }
+                }
+              ],
+              dataProvider: function(args) {
+                $.ajax({
+                  url: createURL("listSolidFireVolumes&id=" + args.context.sfSharedVolumes[0].id),
+                  dataType: "json",
+                  async: true,
+                  success: function(json) {
+                    var jsonObj = json.listsolidfirevolumesresponse.sfvolume[0];
+
+                    args.response.success({
+                      data: jsonObj
+                    });
+                  }
+                });
+              }
+            }
+          }
+        }
+      }
+    });
+  };
+}(cloudStack));
\ No newline at end of file


Mime
View raw message