diff --git a/src/js/client.js b/src/js/client.js
index e1e92f823..4653d1b59 100644
--- a/src/js/client.js
+++ b/src/js/client.js
@@ -2665,10 +2665,12 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
});
};
- Client.prototype.addVolume = function (name, hostPath, callback) {
+ Client.prototype.addVolume = function (name, hostPath, mountType, mountOptions, callback) {
var data = {
name: name,
- hostPath: hostPath
+ hostPath: hostPath,
+ mountType: mountType,
+ mountOptions: mountOptions
};
var that = this;
@@ -2676,6 +2678,17 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
if (error) return callback(error);
if (status !== 201) return callback(new ClientError(status, data));
+ callback(null, data.id);
+ });
+ };
+
+ Client.prototype.mountVolume = function (volumeId, data, callback) {
+ var that = this;
+
+ post('/api/v1/volumes/' + volumeId + '/mount_config', data, null, function (error, data, status) {
+ if (error) return callback(error);
+ if (status !== 201) return callback(new ClientError(status, data));
+
callback();
});
};
diff --git a/src/views/volumes.html b/src/views/volumes.html
index 11107a316..3aea1ab7d 100644
--- a/src/views/volumes.html
+++ b/src/views/volumes.html
@@ -21,6 +21,38 @@
+
+
+
+
+
+
+
diff --git a/src/views/volumes.js b/src/views/volumes.js
index 03b991a7a..dc014c1b3 100644
--- a/src/views/volumes.js
+++ b/src/views/volumes.js
@@ -10,6 +10,14 @@ angular.module('Application').controller('VolumesController', ['$scope', '$locat
$scope.volumes = [];
$scope.ready = false;
+ $scope.mountTypes = [
+ { name: 'CIFS', value: 'cifs' },
+ { name: 'EXT4', value: 'ext4' },
+ { name: 'NFS', value: 'nfs' },
+ { name: 'SSHFS', value: 'sshfs' },
+ { name: 'No-op', value: 'noop' }
+ ];
+
function refreshVolumes(callback) {
Client.getVolumes(function (error, results) {
if (error) return console.error(error);
@@ -26,12 +34,24 @@ angular.module('Application').controller('VolumesController', ['$scope', '$locat
name: '',
hostPath: '',
+ mountType: 'noop',
+ host: '',
+ remoteDir: '',
+ username: '',
+ password: '',
+ diskPath: '',
reset: function () {
$scope.volumeAdd.busy = false;
$scope.volumeAdd.error = null;
$scope.volumeAdd.name = '';
$scope.volumeAdd.hostPath = '';
+ $scope.volumeAdd.mountType = 'noop';
+ $scope.volumeAdd.host = '';
+ $scope.volumeAdd.remoteDir = '';
+ $scope.volumeAdd.username = '';
+ $scope.volumeAdd.password = '';
+ $scope.volumeAdd.diskPath = '';
$scope.volumeAddForm.$setPristine();
$scope.volumeAddForm.$setUntouched();
@@ -47,7 +67,27 @@ angular.module('Application').controller('VolumesController', ['$scope', '$locat
$scope.volumeAdd.busy = true;
$scope.volumeAdd.error = null;
- Client.addVolume($scope.volumeAdd.name, $scope.volumeAdd.hostPath, function (error) {
+ var mountOptions = null;
+
+ if ($scope.volumeAdd.mountType === 'cifs') {
+ mountOptions = {
+ host: $scope.volumeAdd.host,
+ remoteDir: $scope.volumeAdd.remoteDir,
+ username: $scope.volumeAdd.username,
+ password: $scope.volumeAdd.password
+ };
+ } else if ($scope.volumeAdd.mountType === 'nfs') {
+ mountOptions = {
+ host: $scope.volumeAdd.host,
+ remoteDir: $scope.volumeAdd.remoteDir,
+ };
+ } else {
+ mountOptions = {
+ diskPath: $scope.volumeAdd.diskPath
+ };
+ }
+
+ Client.addVolume($scope.volumeAdd.name, $scope.volumeAdd.hostPath, $scope.volumeAdd.mountType, mountOptions, function (error) {
$scope.volumeAdd.busy = false;
if (error) {
$scope.volumeAdd.error = error.message;