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;
}
.task-description {
max-width: 220px;
}
.task-schedule {
font-family: monospace;
white-space: nowrap;
}
.mails-pending {
color: green;
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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