diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2015-07-29 16:41:22 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2015-07-30 09:57:08 +0200 |
commit | 5d15051da4a170b5c944ccffe372f1ebe2649924 (patch) | |
tree | ffef7fcc54656f74cdd9df24ba8df4e901451154 | |
parent | a07254856ce532bfe5c49c1b53247daf88dbdd4a (diff) | |
download | nextcloud-server-5d15051da4a170b5c944ccffe372f1ebe2649924.tar.gz nextcloud-server-5d15051da4a170b5c944ccffe372f1ebe2649924.zip |
Allow setupchecks to specify a warning level
-rw-r--r-- | core/js/setupchecks.js | 13 | ||||
-rw-r--r-- | core/js/tests/specs/setupchecksSpec.js | 16 | ||||
-rw-r--r-- | settings/js/admin.js | 37 | ||||
-rw-r--r-- | settings/templates/admin.php | 2 |
4 files changed, 56 insertions, 12 deletions
diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js index 35f24b188fa..bf8dba78c4b 100644 --- a/core/js/setupchecks.js +++ b/core/js/setupchecks.js @@ -10,6 +10,12 @@ (function() { OC.SetupChecks = { + + /* Message types */ + MESSAGE_TYPE_INFO:0, + MESSAGE_TYPE_WARNING:1, + MESSAGE_TYPE_ERROR:2, + /** * Check whether the WebDAV connection works. * @@ -60,9 +66,10 @@ ); } if(!data.isMemcacheConfigured) { - messages.push( - t('core', 'No memory cache has been configured. To enhance your performance please configure a memcache if available. Further information can be found in our <a href="{docLink}">documentation</a>.', {docLink: data.memcacheDocs}) - ); + messages.push({ + msg: t('core', 'No memory cache has been configured. To enhance your performance please configure a memcache if available. Further information can be found in our <a href="{docLink}">documentation</a>.', {docLink: data.memcacheDocs}), + type: OC.SetupChecks.MESSAGE_TYPE_TIP + }); } if(!data.isUrandomAvailable) { messages.push( diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js index ec8a732b4a1..2bf8129fd55 100644 --- a/core/js/tests/specs/setupchecksSpec.js +++ b/core/js/tests/specs/setupchecksSpec.js @@ -70,7 +70,13 @@ describe('OC.SetupChecks tests', function() { ); async.done(function( data, s, x ){ - expect(data).toEqual(['This server has no working Internet connection. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.', 'Your data directory and your files are probably accessible from the Internet. The .htaccess file is not working. We strongly suggest that you configure your web server in a way that the data directory is no longer accessible or you move the data directory outside the web server document root.', 'No memory cache has been configured. To enhance your performance please configure a memcache if available. Further information can be found in our <a href="https://doc.owncloud.org/server/go.php?to=admin-performance">documentation</a>.']); + expect(data).toEqual([ + 'This server has no working Internet connection. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.', + 'Your data directory and your files are probably accessible from the Internet. The .htaccess file is not working. We strongly suggest that you configure your web server in a way that the data directory is no longer accessible or you move the data directory outside the web server document root.', + { + msg: 'No memory cache has been configured. To enhance your performance please configure a memcache if available. Further information can be found in our <a href="https://doc.owncloud.org/server/go.php?to=admin-performance">documentation</a>.', + type: OC.SetupChecks.MESSAGE_TYPE_INFO + }]); done(); }); }); @@ -87,7 +93,13 @@ describe('OC.SetupChecks tests', function() { ); async.done(function( data, s, x ){ - expect(data).toEqual(['This server has no working Internet connection. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.', 'Your data directory and your files are probably accessible from the Internet. The .htaccess file is not working. We strongly suggest that you configure your web server in a way that the data directory is no longer accessible or you move the data directory outside the web server document root.', 'No memory cache has been configured. To enhance your performance please configure a memcache if available. Further information can be found in our <a href="https://doc.owncloud.org/server/go.php?to=admin-performance">documentation</a>.']); + expect(data).toEqual([ + 'This server has no working Internet connection. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.', + 'Your data directory and your files are probably accessible from the Internet. The .htaccess file is not working. We strongly suggest that you configure your web server in a way that the data directory is no longer accessible or you move the data directory outside the web server document root.', + { + msg: 'No memory cache has been configured. To enhance your performance please configure a memcache if available. Further information can be found in our <a href="https://doc.owncloud.org/server/go.php?to=admin-performance">documentation</a>.', + type: OC.SetupChecks.MESSAGE_TYPE_TIP + }]); done(); }); }); diff --git a/settings/js/admin.js b/settings/js/admin.js index 8f705b9048d..752ab44534d 100644 --- a/settings/js/admin.js +++ b/settings/js/admin.js @@ -166,17 +166,40 @@ $(document).ready(function(){ OC.SetupChecks.checkSetup(), OC.SetupChecks.checkGeneric() ).then(function(check1, check2, check3) { - var errors = [].concat(check1, check2, check3); + var messages = [].concat(check1, check2, check3); var $el = $('#postsetupchecks'); - var $errorsEl; $el.find('.loading').addClass('hidden'); - if (errors.length === 0) { + if (messages.length === 0) { } else { - $errorsEl = $el.find('.errors'); - for (var i = 0; i < errors.length; i++ ) { - $errorsEl.append('<li>' + errors[i] + '</li>'); + var $errorsEl = $el.find('.errors'); + var $warningsEl = $el.find('.warnings'); + var $infoEl = $el.find('.info'); + for (var i = 0; i < messages.length; i++ ) { + if ($.isPlainObject(messages[i])) { + switch(messages[i].type) { + case OC.SetupChecks.MESSAGE_TYPE_INFO: + $tipsEl.append('<li>' + messages[i].msg + '</li>'); + break; + case OC.SetupChecks.MESSAGE_TYPE_WARNING: + $warningsEl.append('<li>' + messages[i].msg + '</li>'); + break; + case OC.SetupChecks.MESSAGE_TYPE_ERROR: + default: + $errorsEl.append('<li>' + messages[i].msg + '</li>'); + } + } else { + $errorsEl.append('<li>' + messages[i] + '</li>'); + } + } + if ($errorsEl.find('li').length > 0) { + $errorsEl.removeClass('hidden'); + } + if ($warningsEl.find('li').length > 0) { + $warningsEl.removeClass('hidden'); + } + if ($infoEl.find('li').length > 0) { + $infoEl.removeClass('hidden'); } - $errorsEl.removeClass('hidden'); $el.find('.hint').removeClass('hidden'); } }); diff --git a/settings/templates/admin.php b/settings/templates/admin.php index a55071bdf84..1c5135c45b1 100644 --- a/settings/templates/admin.php +++ b/settings/templates/admin.php @@ -171,6 +171,8 @@ if ($_['cronErrors']) { <div id="postsetupchecks"> <div class="loading"></div> <ul class="errors hidden"></ul> + <ul class="warnings hidden"></ul> + <ul class="info hidden"></ul> <p class="hint hidden"> <?php print_unescaped($l->t('Please double check the <a target="_blank" href="%s">installation guides ↗</a>, and check for any errors or warnings in the <a href="#log-section">log</a>.', link_to_docs('admin-install'))); ?> </p> |