diff --git a/src/js/client.js b/src/js/client.js index 08990f31d..114f6cce5 100644 --- a/src/js/client.js +++ b/src/js/client.js @@ -2754,6 +2754,17 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout }); }; + Client.prototype.remountVolume = function (volumeId, callback) { + var that = this; + + post('/api/v1/volumes/' + volumeId + '/remount', {}, null, function (error, data, status) { + if (error) return callback(error); + if (status !== 202) return callback(new ClientError(status, data)); + + callback(); + }); + }; + Client.prototype.removeVolume = function (volume, callback) { var config = { data: { diff --git a/src/translation/en.json b/src/translation/en.json index 29b5827dc..e5c9daf3f 100644 --- a/src/translation/en.json +++ b/src/translation/en.json @@ -1602,7 +1602,8 @@ "tooltipEdit": "Edit Volume", "mountStatus": "Mount Status", "type": "Type", - "localDirectory": "Local Directory" + "localDirectory": "Local Directory", + "remountActionTooltip": "Remount Volume" }, "storage": { "mounts": { diff --git a/src/views/volumes.html b/src/views/volumes.html index e0d200410..509100abb 100644 --- a/src/views/volumes.html +++ b/src/views/volumes.html @@ -149,6 +149,7 @@ {{ volume.hostPath }} + diff --git a/src/views/volumes.js b/src/views/volumes.js index 57b2b0815..165a51fe9 100644 --- a/src/views/volumes.js +++ b/src/views/volumes.js @@ -55,6 +55,25 @@ angular.module('Application').controller('VolumesController', ['$scope', '$locat }); } + // same as box/mounts.js + $scope.isMountProvider = function (provider) { + return provider === 'sshfs' || provider === 'cifs' || provider === 'nfs' || provider === 'ext4'; + }; + + $scope.remount = function (volume) { + volume.remounting = true; + + Client.remountVolume(volume.id, function (error) { + if (error) console.error(error); + + // give the backend some time + $timeout(function () { + volume.remounting = false; + refreshVolumes(function (error) { if (error) console.error('Failed to refresh volume states.', error); }); + }, 3000); + }); + }; + $scope.volumeAdd = { error: null, busy: false,