diff --git a/src/opnsense/www/js/widgets/Services.js b/src/opnsense/www/js/widgets/Services.js index 92ad0b83245..5c7d7bde1b0 100644 --- a/src/opnsense/www/js/widgets/Services.js +++ b/src/opnsense/www/js/widgets/Services.js @@ -38,17 +38,15 @@ export default class Services extends BaseTableWidget { } getMarkup() { - let $table = this.createTable('services-table', { - headerPosition: 'left', - headerBreakpoint: 270 - }); - return $(`
`).append($table); + return $(`
`); } serviceControl(actions) { return actions.map(({ action, id, title, icon }) => ` `).join(''); @@ -62,13 +60,14 @@ export default class Services extends BaseTableWidget { return; } - $('.service-status').tooltip('hide'); - $('.srv_status_act2').tooltip('hide'); + $('[data-toggle="tooltip"]').tooltip('hide'); - for (const service of data.rows) { - let name = service.name; - let $description = $(`
${service.description}
`); + const $container = $('#services-container'); + $container.empty(); + + data.rows.sort((a, b) => a.description.localeCompare(b.description)); + for (const service of data.rows) { let actions = []; if (service.locked) { actions.push({ action: 'restart', id: service.id, title: this.translations.restart, icon: 'refresh' }); @@ -79,25 +78,52 @@ export default class Services extends BaseTableWidget { actions.push({ action: 'start', id: service.id, title: this.translations.start, icon: 'play' }); } - let $buttonContainer = $(` -
- - - + let statusColor = service.running ? 'success' : 'danger'; + let statusIcon = service.running ? 'play' : 'stop'; + let statusTitle = service.running ? this.translations.running : this.translations.stopped; + + let $tile = $(` +
+
${service.description}
+
+
+ + + +
+
+
+ ${this.serviceControl(actions)} +
+
+
`); - $buttonContainer.append(this.serviceControl(actions)); - - super.updateTable('services-table', [[$description.prop('outerHTML'), $buttonContainer.prop('outerHTML')]], service.id); + $container.append($tile); } - $('.service-status').tooltip({container: 'body'}); - $('.srv_status_act2').tooltip({container: 'body'}); $('.srv_status_act2').on('click', async (event) => { this.locked = true; @@ -120,8 +146,7 @@ export default class Services extends BaseTableWidget { } displayError(message) { - const $error = $(`
${message}
`); - $('#services-table').empty().append($error); + const $error = $(`
${message}
`); + $('#services-container').empty().append($error); } - -} +} \ No newline at end of file