Show task description in admin panel.

This commit is contained in:
baldo 2016-06-21 14:55:02 +02:00
parent 57c6d5d40f
commit ce155951bf
8 changed files with 33 additions and 11 deletions

View file

@ -14,6 +14,15 @@
text-decoration: line-through; text-decoration: line-through;
} }
.task-description {
max-width: 220px;
}
.task-schedule {
font-family: monospace;
white-space: nowrap;
}
.mails-pending { .mails-pending {
color: green; color: green;
} }

View file

@ -238,11 +238,13 @@ angular.module('ffffngAdmin').config(function(NgAdminConfigurationProvider, Rest
admin.addEntity(mails); admin.addEntity(mails);
function taskClasses(task) { function taskClasses(field) {
return function(task) {
if (!task) { if (!task) {
return; return;
} }
return task.values.enabled ? 'task-enabled' : 'task-disabled'; return 'task-' + field + ' ' + (task.values.enabled ? 'task-enabled' : 'task-disabled');
};
} }
var tasks = nga.entity('tasks').label('Background-Jobs'); var tasks = nga.entity('tasks').label('Background-Jobs');
@ -256,12 +258,13 @@ angular.module('ffffngAdmin').config(function(NgAdminConfigurationProvider, Rest
.batchActions([]) .batchActions([])
.exportFields([]) .exportFields([])
.fields([ .fields([
nga.field('id').cssClasses(taskClasses), nga.field('id').cssClasses(taskClasses('id')),
nga.field('name').cssClasses(taskClasses), nga.field('name').cssClasses(taskClasses('name')),
nga.field('schedule').cssClasses(taskClasses), nga.field('description').cssClasses(taskClasses('description')),
nga.field('state').cssClasses(taskClasses), nga.field('schedule').cssClasses(taskClasses('schedule')),
nga.field('runningSince').map(formatMoment).cssClasses(taskClasses), nga.field('state').cssClasses(taskClasses('state')),
nga.field('lastRunStarted').map(formatMoment).cssClasses(taskClasses) nga.field('runningSince').map(formatMoment).cssClasses(taskClasses('runningSince')),
nga.field('lastRunStarted').map(formatMoment).cssClasses(taskClasses('lastRunStarted'))
]) ])
.filters([ .filters([
nga.field('q') nga.field('q')

View file

@ -2,6 +2,8 @@
angular.module('ffffng').factory('MailQueueJob', function (MailService, Logger) { angular.module('ffffng').factory('MailQueueJob', function (MailService, Logger) {
return { return {
description: 'Send pending emails (up to 5 attempts in case of failures).',
run: function (callback) { run: function (callback) {
MailService.sendPendingMails(function (err) { MailService.sendPendingMails(function (err) {
if (err) { if (err) {

View file

@ -2,6 +2,8 @@
angular.module('ffffng').factory('MonitoringMailsSendingJob', function (MonitoringService, Logger) { angular.module('ffffng').factory('MonitoringMailsSendingJob', function (MonitoringService, Logger) {
return { return {
description: 'Sends monitoring emails depending on the monitoring state of nodes retrieved by the NodeInformationRetrievalJob.',
run: function (callback) { run: function (callback) {
MonitoringService.sendMonitoringMails(function (err) { MonitoringService.sendMonitoringMails(function (err) {
if (err) { if (err) {

View file

@ -2,6 +2,8 @@
angular.module('ffffng').factory('NodeInformationCleanupJob', function (MonitoringService, Logger) { angular.module('ffffng').factory('NodeInformationCleanupJob', function (MonitoringService, Logger) {
return { return {
description: 'Cleanup monitoring status entries for nodes no longer having monitoring enabled.',
run: function (callback) { run: function (callback) {
MonitoringService.cleanupNodeInformation(function (err) { MonitoringService.cleanupNodeInformation(function (err) {
if (err) { if (err) {

View file

@ -2,6 +2,8 @@
angular.module('ffffng').factory('NodeInformationRetrievalJob', function (MonitoringService, Logger) { angular.module('ffffng').factory('NodeInformationRetrievalJob', function (MonitoringService, Logger) {
return { return {
description: 'Fetches the nodes.json and calculates and stores the monitoring status for nodes with active monitoring.',
run: function (callback) { run: function (callback) {
MonitoringService.retrieveNodeInformation(function (err) { MonitoringService.retrieveNodeInformation(function (err) {
if (err) { if (err) {

View file

@ -33,6 +33,7 @@ angular.module('ffffng').factory('Scheduler', function ($injector, Logger, confi
var task = { var task = {
id: id, id: id,
name: jobName, name: jobName,
description: job.description,
schedule: expr, schedule: expr,
job: job, job: job,
runningSince: false, runningSince: false,

View file

@ -15,6 +15,7 @@ angular.module('ffffng').factory('TaskResource', function (
return { return {
id: task.id, id: task.id,
name: task.name, name: task.name,
description: task.description,
schedule: task.schedule, schedule: task.schedule,
runningSince: task.runningSince && task.runningSince.unix(), runningSince: task.runningSince && task.runningSince.unix(),
lastRunStarted: task.lastRunStarted && task.lastRunStarted.unix(), lastRunStarted: task.lastRunStarted && task.lastRunStarted.unix(),