🚸 SWU: Improve update & check buttons

* "Update all" will now only update *enabled* items
  * "Update all available" (dropdown) will update enabled *and* muted items
  * "Check for updates" does what it always did
  * "Force check for updates" (dropdown) bypasses the cache
  * Notification muting and logic is now also explained in a footer.
This commit is contained in:
Gina Häußge committed 2021-11-23 17:37:20 +01:00
1 parent 008d787e7f
commit 658c4233d4
2 files changed
+42 -13

No files matched your search

@@ -82,6 +82,10 @@ $(function () {
});
self.enableUpdateAll = ko.pureComputed(function () {
return self.enableUpdate() && self.availableAndPossible().length > 0;
});
self.enableUpdateEnabled = ko.pureComputed(function () {
return (
self.enableUpdate() && self.availableAndPossibleAndEnabled().length > 0
);
@@ -370,6 +374,17 @@ $(function () {
});
};
information.notificationIconTitle = function () {
var update = information.updateAvailable
? gettext("Update available")
: gettext("Up-to-date");
var notifications = information.disabled
? gettext("notifications are muted")
: gettext("notifications are enabled");
return update + " (" + notifications + ")";
};
return information;
};
@@ -85,28 +85,31 @@
<div class="tab-content">
<div class="tab-pane active" id="settings_plugin_softwareupdate_updates">
<div class="pull-right">
<button class="btn btn-primary" data-bind="click: function() { $root.updateAll(); }, enable: enableUpdateAll, css: {disabled: !enableUpdateAll}"><i class="fas fa-spinner fa-spin" data-bind="visible: updateInProgress"></i> {{ _('Update all') }}</button>
<button class="btn" data-bind="click: function() { $root.performCheck(true, false, true); }, enable: !checking(), css: {disabled: checking()}"><i class="fas fa-spinner fa-spin" data-bind="visible: checking"></i> {{ _('Check for updates') }}</button>
<div class="btn-group">
<button class="btn btn-primary" data-bind="click: function() { $root.updateEnabled(); }, enable: enableUpdateEnabled, css: {disabled: !enableUpdateEnabled}" title="{{ _('Update all enabled') | edq }}"><i class="fas fa-spinner fa-spin" data-bind="visible: updateInProgress"></i> {{ _('Update all') }}</button>
<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href="javascript:void(0)" data-bind="click: function() { $root.updateAll(); }, enable: enableUpdateAll, css: {disabled: !enableUpdateAll}" title="{{ _('Update all muted & enabled') | edq }}">{{ _('Update all available') }}</a></li>
</ul>
</div>
<div class="btn-group">
<button class="btn" data-bind="click: function() { $root.performCheck(true, false, true); }, enable: !checking(), css: {disabled: checking()}"><i class="fas fa-spinner fa-spin" data-bind="visible: checking"></i> {{ _('Check for updates') }}</button>
<button class="btn dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href="javascript:void(0)" data-bind="click: function() { $root.performCheck(true, true, true); }, enable: !checking(), css: {disabled: checking()}">{{ _('Force check for updates') }}</a></li>
</ul>
</div>
<button class="btn" data-bind="click: function() { $root.showPluginSettings(); }" title="{{ _('Plugin Configuration')|edq }}"><i class="fas fa-wrench"></i></button>
</div>
<h3>{{ _('Current versions') }}</h3>
<div class="swupdate-advanced">
<div><small><a href="javascript:void(0)" class="muted" onclick="$(this).children().toggleClass('fa-caret-right fa-caret-down').parent().parent().parent().next().slideToggle('fast')"><i class="fas fa-caret-right"></i> {{ _('Advanced options') }}</a></small></div>
<div class="hide">
<small class="muted" style="display: block">{{ _('Last cache refresh:') }} <span data-bind="text: cacheTimestampText"></span></small>
<button class="btn btn-block" data-bind="click: function() { $root.performCheck(true, true, true); }, enable: !checking(), css: {disabled: checking()}"><i class="fas fa-spinner fa-spin" data-bind="visible: checking"></i> {{ _('Force check for update (overrides cache used for update checks)') }}</button>
<button class="btn btn-block btn-danger" data-bind="visible: CONFIG_DEBUG, click: function() { $root.updateAll(true); }, enable: enableUpdate() && !checking(), css: {disabled: !enableUpdate() || checking()}"><i class="fas fa-spinner fa-spin" data-bind="visible: checking"></i> {{ _('Force update all (even if no new versions are available)') }}</button>
</div>
</div>
<div id="settings_plugin_softwareupdate_updatelist">
<table class="table table-striped table-hover table-condensed table-hover">
<tbody data-bind="foreach: versions.paginatedItems">
<tr data-bind="attr: {title: displayName}">
<tr>
<td class="settings_plugin_softwareupdate_column_update">
<a href="javascript:void(0)" data-bind="visible: compatible, click: toggleDisabled"><i class="far" data-bind="css: { muted: !updateAvailable, 'fa-bell': !disabled, 'fa-bell-slash': disabled }" title="{{ _('Update available')|edq }}"></i></a>
<a href="javascript:void(0)" data-bind="visible: compatible, click: toggleDisabled"><i class="far" data-bind="css: { muted: !updateAvailable, 'fa-bell': !disabled, 'fa-bell-slash': disabled }, attr: { title: notificationIconTitle() }"></i></a>
<span data-bind="visible: !compatible" class="muted"><i class="fas fa-power-off" title="{{ _('Not compatible') }}|edq"></i></span>
</td>
<td class="settings_plugin_softwareupdate_column_information">
@@ -126,6 +129,17 @@
</tr>
</tbody>
</table>
<small class="muted">
<i class="far fa-bell"></i> = {{ _('Update notifications enabled') }},
<i class="far fa-bell-slash"></i> = {{ _('Update notifications muted') }},
{{ _('click to toggle') }}.
{% trans %}
"Update all" will update all items for which updates are availalbe &
update notifications are enabled as well, "Update all available" will
update all items for which updates are available regardless of update
notifications being enabled or muted.
{% endtrans %}
</small>
</div>
</div>
<div class="tab-pane" id="settings_plugin_softwareupdate_updatelog">