Allow setupchecks to specify a warning level

This commit is contained in:
Roeland Jago Douma 2015-07-29 16:41:22 +02:00
parent a07254856c
commit 5d15051da4
4 changed files with 56 additions and 12 deletions

View file

@ -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(

View file

@ -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();
});
});

View file

@ -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');
}
});

View file

@ -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>