diff --git a/pkg/systemd/init.js b/pkg/systemd/init.js index 90aa7aa70a71..7bb085f7e3ef 100644 --- a/pkg/systemd/init.js +++ b/pkg/systemd/init.js @@ -205,10 +205,14 @@ $(function() { unit.CombinedState = active_state; unit.AutomaticStartup = _("Static"); - if (unit.UnitFileState && startsWith(unit.UnitFileState, 'enabled')) + unit.AutomaticStartupIndex = 3; + if (unit.UnitFileState && startsWith(unit.UnitFileState, 'enabled')) { unit.AutomaticStartup = _("Enabled"); - else if (unit.UnitFileState && startsWith(unit.UnitFileState, 'disabled')) + unit.AutomaticStartupIndex = 1; + } else if (unit.UnitFileState && startsWith(unit.UnitFileState, 'disabled')) { unit.AutomaticStartup = _("Disabled"); + unit.AutomaticStartupIndex = 2; + } if (unit.Id.slice(-5) == "timer") { unit.is_timer = true; @@ -266,6 +270,7 @@ $(function() { var pattern = $('#services-filter button.active').attr('data-pattern'); var current_text_filter = $('#services-text-filter').val() .toLowerCase(); + var current_type_filter = parseInt($('#current-service-type').attr("data-num")); function cmp_path(a, b) { return units_by_path[a].Id.localeCompare(units_by_path[b].Id) } var sorted_keys = Object.keys(units_by_path).sort(cmp_path); @@ -292,6 +297,8 @@ $(function() { if (current_text_filter && unit.Description.toLowerCase().indexOf(current_text_filter) == -1 && unit.Id.indexOf(current_text_filter) == -1) return; + if (current_type_filter !== 0 && current_type_filter !== unit.AutomaticStartupIndex) + return; units.push(unit); }); @@ -328,6 +335,8 @@ $(function() { function clear_filters() { $("#services-text-filter").val(""); + $('#current-service-type').attr("data-num", 0); + $('#current-service-type').text(_("All")); render(); } @@ -490,6 +499,13 @@ $(function() { render(); }); + $('#services-dropdown .dropdown-menu li').on('click', function() { + var selected = $(this).children(":first"); + $("#current-service-type").text(selected.text()); + $("#current-service-type").attr("data-num", selected.attr("data-num")); + render(); + }); + update_all(); } diff --git a/pkg/systemd/services.css b/pkg/systemd/services.css index ad704b423351..684220181562 100644 --- a/pkg/systemd/services.css +++ b/pkg/systemd/services.css @@ -33,3 +33,21 @@ table.systemd-unit-relationship-table td:first-child { background-color: initial; border: initial; } + +#services-dropdown { + display: inline; +} + +#service-type { + min-width: 10rem; +} + +#services-dropdown .dropdown-menu { + margin-top: 4px; + left: auto; + right: 0; +} + +.caret { + margin-top: 6px; +} diff --git a/pkg/systemd/services.html b/pkg/systemd/services.html index 327b4fdedbff..f891f2390dbf 100644 --- a/pkg/systemd/services.html +++ b/pkg/systemd/services.html @@ -62,6 +62,19 @@