summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin McCorkell <rmccorkell@owncloud.com>2015-09-16 16:58:26 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-10-23 15:25:07 +0200
commit9a4d37f626dca4663ea7d25f78f7c1f174306ab5 (patch)
tree2e8a4dee7c55253946adffe53adb0c58723c4e00
parent4ac33ab26bc75cde5277f59b3a0f0b3713c05dab (diff)
downloadnextcloud-server-9a4d37f626dca4663ea7d25f78f7c1f174306ab5.tar.gz
nextcloud-server-9a4d37f626dca4663ea7d25f78f7c1f174306ab5.zip
Display storage status as tooltip
-rw-r--r--apps/files_external/controller/storagescontroller.php16
-rw-r--r--apps/files_external/js/settings.js12
-rw-r--r--apps/files_external/lib/config.php1
-rw-r--r--apps/files_external/lib/storageconfig.php25
4 files changed, 47 insertions, 7 deletions
diff --git a/apps/files_external/controller/storagescontroller.php b/apps/files_external/controller/storagescontroller.php
index f754565f628..048f3588ed7 100644
--- a/apps/files_external/controller/storagescontroller.php
+++ b/apps/files_external/controller/storagescontroller.php
@@ -237,9 +237,21 @@ abstract class StoragesController extends Controller {
)
);
} catch (InsufficientDataForMeaningfulAnswerException $e) {
- $storage->setStatus(\OC_Mount_Config::STATUS_INDETERMINATE);
+ $storage->setStatus(
+ \OC_Mount_Config::STATUS_INDETERMINATE,
+ $this->l10n->t('Insufficient data: %s', [$e->getMessage()])
+ );
} catch (StorageNotAvailableException $e) {
- $storage->setStatus(\OC_Mount_Config::STATUS_ERROR);
+ $storage->setStatus(
+ \OC_Mount_Config::STATUS_ERROR,
+ $e->getMessage()
+ );
+ } catch (\Exception $e) {
+ // FIXME: convert storage exceptions to StorageNotAvailableException
+ $storage->setStatus(
+ \OC_Mount_Config::STATUS_ERROR,
+ get_class($e).': '.$e->getMessage()
+ );
}
}
diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js
index c4646d429f8..a839f396b9b 100644
--- a/apps/files_external/js/settings.js
+++ b/apps/files_external/js/settings.js
@@ -643,6 +643,10 @@ MountConfigListView.prototype = _.extend({
});
addSelect2(this.$el.find('tr:not(#addMountPoint) .applicableUsers'), this._userListLimit);
+ this.$el.tooltip({
+ selector: '.status span',
+ container: 'body'
+ });
this._initEvents();
@@ -947,7 +951,7 @@ MountConfigListView.prototype = _.extend({
if (concurrentTimer === undefined
|| $tr.data('save-timer') === concurrentTimer
) {
- self.updateStatus($tr, result.status);
+ self.updateStatus($tr, result.status, result.statusMessage);
$tr.attr('data-id', result.id);
if (_.isFunction(callback)) {
@@ -981,7 +985,7 @@ MountConfigListView.prototype = _.extend({
this.updateStatus($tr, StorageConfig.Status.IN_PROGRESS);
storage.recheck({
success: function(result) {
- self.updateStatus($tr, result.status);
+ self.updateStatus($tr, result.status, result.statusMessage);
},
error: function() {
self.updateStatus($tr, StorageConfig.Status.ERROR);
@@ -994,8 +998,9 @@ MountConfigListView.prototype = _.extend({
*
* @param {jQuery} $tr
* @param {int} status
+ * @param {string} message
*/
- updateStatus: function($tr, status) {
+ updateStatus: function($tr, status, message) {
var $statusSpan = $tr.find('.status span');
$statusSpan.removeClass('loading-small success indeterminate error');
switch (status) {
@@ -1014,6 +1019,7 @@ MountConfigListView.prototype = _.extend({
default:
$statusSpan.addClass('error');
}
+ $statusSpan.attr('data-original-title', (typeof message === 'string') ? message : '');
},
/**
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php
index d9fdb748fcd..56a7e547ec6 100644
--- a/apps/files_external/lib/config.php
+++ b/apps/files_external/lib/config.php
@@ -269,6 +269,7 @@ class OC_Mount_Config {
}
} catch (Exception $exception) {
\OCP\Util::logException('files_external', $exception);
+ throw $e;
}
}
return self::STATUS_ERROR;
diff --git a/apps/files_external/lib/storageconfig.php b/apps/files_external/lib/storageconfig.php
index 70aaa186783..86a7e6ffa12 100644
--- a/apps/files_external/lib/storageconfig.php
+++ b/apps/files_external/lib/storageconfig.php
@@ -73,6 +73,13 @@ class StorageConfig implements \JsonSerializable {
private $status;
/**
+ * Status message
+ *
+ * @var string
+ */
+ private $statusMessage;
+
+ /**
* Priority
*
* @var int
@@ -295,7 +302,7 @@ class StorageConfig implements \JsonSerializable {
}
/**
- * Sets the storage status, whether the config worked last time
+ * Gets the storage status, whether the config worked last time
*
* @return int $status status
*/
@@ -304,12 +311,23 @@ class StorageConfig implements \JsonSerializable {
}
/**
+ * Gets the message describing the storage status
+ *
+ * @return string|null
+ */
+ public function getStatusMessage() {
+ return $this->statusMessage;
+ }
+
+ /**
* Sets the storage status, whether the config worked last time
*
* @param int $status status
+ * @param string|null $message optional message
*/
- public function setStatus($status) {
+ public function setStatus($status, $message = null) {
$this->status = $status;
+ $this->statusMessage = $message;
}
/**
@@ -341,6 +359,9 @@ class StorageConfig implements \JsonSerializable {
if (!is_null($this->status)) {
$result['status'] = $this->status;
}
+ if (!is_null($this->statusMessage)) {
+ $result['statusMessage'] = $this->statusMessage;
+ }
return $result;
}
}