Improve update notification layout and show non-default update server
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
parent
a96c651935
commit
9391d8fc60
|
@ -0,0 +1,3 @@
|
||||||
|
#oca_updatenotification_section p {
|
||||||
|
margin: 25px 0;
|
||||||
|
}
|
|
@ -105,6 +105,9 @@ class AdminController extends Controller implements ISettings {
|
||||||
|
|
||||||
$notifyGroups = json_decode($this->config->getAppValue('updatenotification', 'notify_groups', '["admin"]'), true);
|
$notifyGroups = json_decode($this->config->getAppValue('updatenotification', 'notify_groups', '["admin"]'), true);
|
||||||
|
|
||||||
|
$defaultUpdateServerURL = 'https://updates.nextcloud.com/server/';
|
||||||
|
$updateServerURL = $this->config->getSystemValue('updater.server.url', $defaultUpdateServerURL);
|
||||||
|
|
||||||
$params = [
|
$params = [
|
||||||
'isNewVersionAvailable' => !empty($updateState['updateAvailable']),
|
'isNewVersionAvailable' => !empty($updateState['updateAvailable']),
|
||||||
'isUpdateChecked' => $lastUpdateCheckTimestamp > 0,
|
'isUpdateChecked' => $lastUpdateCheckTimestamp > 0,
|
||||||
|
@ -114,7 +117,8 @@ class AdminController extends Controller implements ISettings {
|
||||||
'newVersionString' => (empty($updateState['updateVersion'])) ? '' : $updateState['updateVersion'],
|
'newVersionString' => (empty($updateState['updateVersion'])) ? '' : $updateState['updateVersion'],
|
||||||
'downloadLink' => (empty($updateState['downloadLink'])) ? '' : $updateState['downloadLink'],
|
'downloadLink' => (empty($updateState['downloadLink'])) ? '' : $updateState['downloadLink'],
|
||||||
'updaterEnabled' => (empty($updateState['updaterEnabled'])) ? false : $updateState['updaterEnabled'],
|
'updaterEnabled' => (empty($updateState['updaterEnabled'])) ? false : $updateState['updaterEnabled'],
|
||||||
|
'isDefaultUpdateServerURL' => $updateServerURL === $defaultUpdateServerURL,
|
||||||
|
'updateServerURL' => $updateServerURL,
|
||||||
'notify_groups' => implode('|', $notifyGroups),
|
'notify_groups' => implode('|', $notifyGroups),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
script('updatenotification', 'admin');
|
script('updatenotification', 'admin');
|
||||||
|
style('updatenotification', 'admin');
|
||||||
|
|
||||||
/** @var array $_ */
|
/** @var array $_ */
|
||||||
/** @var bool $isNewVersionAvailable */
|
/** @var bool $isNewVersionAvailable */
|
||||||
|
@ -14,8 +15,13 @@
|
||||||
$channels = $_['channels'];
|
$channels = $_['channels'];
|
||||||
/** @var string $currentChannel */
|
/** @var string $currentChannel */
|
||||||
$currentChannel = $_['currentChannel'];
|
$currentChannel = $_['currentChannel'];
|
||||||
|
/** @var string $updateServerURL */
|
||||||
|
$updateServerURL = $_['updateServerURL'];
|
||||||
|
/** @var bool $isDefaultUpdateServerURL */
|
||||||
|
$isDefaultUpdateServerURL = $_['isDefaultUpdateServerURL'];
|
||||||
?>
|
?>
|
||||||
<form id="oca_updatenotification_section" class="followupsection">
|
<form id="oca_updatenotification_section" class="followupsection">
|
||||||
|
<p>
|
||||||
<?php if ($isNewVersionAvailable === true) { ?>
|
<?php if ($isNewVersionAvailable === true) { ?>
|
||||||
<strong><?php p($l->t('A new version is available: %s', [$newVersionString])); ?></strong>
|
<strong><?php p($l->t('A new version is available: %s', [$newVersionString])); ?></strong>
|
||||||
<?php if ($_['updaterEnabled']) { ?>
|
<?php if ($_['updaterEnabled']) { ?>
|
||||||
|
@ -31,6 +37,15 @@
|
||||||
<span class="icon-info svg" title="<?php p($l->t('Checked on %s', [$lastCheckedDate])) ?>"></span>
|
<span class="icon-info svg" title="<?php p($l->t('Checked on %s', [$lastCheckedDate])) ?>"></span>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if (!$isDefaultUpdateServerURL) { ?>
|
||||||
|
<br />
|
||||||
|
<em>
|
||||||
|
<?php p($l->t("A non-default update server is in use to be checked for updates:")); ?>
|
||||||
|
<code><?php p($updateServerURL); ?></code>
|
||||||
|
</em>
|
||||||
|
<?php } ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<label for="release-channel"><?php p($l->t('Update channel:')) ?></label>
|
<label for="release-channel"><?php p($l->t('Update channel:')) ?></label>
|
||||||
<select id="release-channel">
|
<select id="release-channel">
|
||||||
|
@ -41,20 +56,16 @@
|
||||||
</option>
|
</option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
<span id="channel_save_msg" class="msg"></span>
|
<span id="channel_save_msg" class="msg"></span><br />
|
||||||
</p>
|
<em><?php p($l->t('You can always update to a newer version / experimental channel. But you can never downgrade to a more stable channel.')); ?></em><br />
|
||||||
<p>
|
|
||||||
<em><?php p($l->t('You can always update to a newer version / experimental channel. But you can never downgrade to a more stable channel.')); ?></em>
|
|
||||||
<em><?php p($l->t('Note that after a new release it can take some time before it shows up here. We roll out new versions spread out over time to our users and sometimes skip a version when issues are found.')); ?></em>
|
<em><?php p($l->t('Note that after a new release it can take some time before it shows up here. We roll out new versions spread out over time to our users and sometimes skip a version when issues are found.')); ?></em>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<p id="oca_updatenotification_groups">
|
<p id="oca_updatenotification_groups">
|
||||||
<br />
|
|
||||||
<?php p($l->t('Notify members of the following groups about available updates:')); ?>
|
<?php p($l->t('Notify members of the following groups about available updates:')); ?>
|
||||||
<input name="oca_updatenotification_groups_list" type="hidden" id="oca_updatenotification_groups_list" value="<?php p($_['notify_groups']) ?>" style="width: 400px">
|
<input name="oca_updatenotification_groups_list" type="hidden" id="oca_updatenotification_groups_list" value="<?php p($_['notify_groups']) ?>" style="width: 400px"><br />
|
||||||
<em class="<?php if (!in_array($currentChannel, ['daily', 'git'])) p('hidden'); ?>">
|
<em class="<?php if (!in_array($currentChannel, ['daily', 'git'])) p('hidden'); ?>">
|
||||||
<br />
|
|
||||||
<?php p($l->t('Only notification for app updates are available.')); ?>
|
<?php p($l->t('Only notification for app updates are available.')); ?>
|
||||||
<?php if ($currentChannel === 'daily') p($l->t('The selected update channel makes dedicated notifications for the server obsolete.')); ?>
|
<?php if ($currentChannel === 'daily') p($l->t('The selected update channel makes dedicated notifications for the server obsolete.')); ?>
|
||||||
<?php if ($currentChannel === 'git') p($l->t('The selected update channel does not support updates of the server.')); ?>
|
<?php if ($currentChannel === 'git') p($l->t('The selected update channel does not support updates of the server.')); ?>
|
||||||
|
|
|
@ -103,6 +103,11 @@ class AdminControllerTest extends TestCase {
|
||||||
['core', 'lastupdatedat', '', '12345'],
|
['core', 'lastupdatedat', '', '12345'],
|
||||||
['updatenotification', 'notify_groups', '["admin"]', '["admin"]'],
|
['updatenotification', 'notify_groups', '["admin"]', '["admin"]'],
|
||||||
]);
|
]);
|
||||||
|
$this->config
|
||||||
|
->expects($this->once())
|
||||||
|
->method('getSystemValue')
|
||||||
|
->with('updater.server.url', 'https://updates.nextcloud.com/server/')
|
||||||
|
->willReturn('https://updates.nextcloud.com/server/');
|
||||||
$this->dateTimeFormatter
|
$this->dateTimeFormatter
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('formatDateTime')
|
->method('formatDateTime')
|
||||||
|
@ -127,6 +132,8 @@ class AdminControllerTest extends TestCase {
|
||||||
'newVersionString' => '8.1.2',
|
'newVersionString' => '8.1.2',
|
||||||
'downloadLink' => 'https://downloads.nextcloud.org/server',
|
'downloadLink' => 'https://downloads.nextcloud.org/server',
|
||||||
'updaterEnabled' => true,
|
'updaterEnabled' => true,
|
||||||
|
'isDefaultUpdateServerURL' => true,
|
||||||
|
'updateServerURL' => 'https://updates.nextcloud.com/server/',
|
||||||
'notify_groups' => 'admin',
|
'notify_groups' => 'admin',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -155,6 +162,11 @@ class AdminControllerTest extends TestCase {
|
||||||
['core', 'lastupdatedat', '', '12345'],
|
['core', 'lastupdatedat', '', '12345'],
|
||||||
['updatenotification', 'notify_groups', '["admin"]', '["admin"]'],
|
['updatenotification', 'notify_groups', '["admin"]', '["admin"]'],
|
||||||
]);
|
]);
|
||||||
|
$this->config
|
||||||
|
->expects($this->once())
|
||||||
|
->method('getSystemValue')
|
||||||
|
->with('updater.server.url', 'https://updates.nextcloud.com/server/')
|
||||||
|
->willReturn('https://updates.nextcloud.com/server/');
|
||||||
$this->dateTimeFormatter
|
$this->dateTimeFormatter
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('formatDateTime')
|
->method('formatDateTime')
|
||||||
|
@ -174,6 +186,8 @@ class AdminControllerTest extends TestCase {
|
||||||
'newVersionString' => '',
|
'newVersionString' => '',
|
||||||
'downloadLink' => '',
|
'downloadLink' => '',
|
||||||
'updaterEnabled' => 0,
|
'updaterEnabled' => 0,
|
||||||
|
'isDefaultUpdateServerURL' => true,
|
||||||
|
'updateServerURL' => 'https://updates.nextcloud.com/server/',
|
||||||
'notify_groups' => 'admin',
|
'notify_groups' => 'admin',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue