X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=src%2Ftemplate%2Ftemplate-helper.js;h=23b0f12b37f84c6700fe9edd9f9b5851c014a225;hb=43898cdd317a127bc45e8b3cb2f160df386760a1;hp=3fd371035d0ab4989bcfbf771839f5d6431a5f11;hpb=8f63eeebd08491cdc82e12f178dc500f6d19d65c;p=websub-hub
diff --git a/src/template/template-helper.js b/src/template/template-helper.js
index 3fd3710..23b0f12 100644
--- a/src/template/template-helper.js
+++ b/src/template/template-helper.js
@@ -1,6 +1,7 @@
'use strict';
const { TemplateHelper } = require('@squeep/html-template-helper');
+const { Message } = require('../enum');
/**
* Render a topic as a row of details.
@@ -18,17 +19,17 @@ function renderTopicRow(topic, subscribers, detailsLink = true) {
return `
${detailsLink ? '' : ''}${topic.url}${detailsLink ? '' : ''} |
${subscribers.length} |
- ${TemplateHelper.dateFormat(topic.created, 'End of Time', 'Beginning of Time', 'Unknown')} |
+ ${TemplateHelper.dateFormat(topic.created, Message.EndOfTime, Message.BeginningOfTime, Message.Unknown)} |
${TemplateHelper.secondsToPeriod(topic.leaseSecondsPreferred)} |
${TemplateHelper.secondsToPeriod(topic.leaseSecondsMin)} |
${TemplateHelper.secondsToPeriod(topic.leaseSecondsMax)} |
${topic.publisherValidationUrl ? topic.publisherValidationUrl : 'None'} |
${topic.isActive} |
${topic.isDeleted} |
- ${TemplateHelper.dateFormat(topic.lastPublish, 'End of Time', 'Never', 'Never')} |
- ${TemplateHelper.dateFormat(topic.contentFetchNextAttempt, 'Next Publish', 'Pending', 'Next Publish')} |
+ ${TemplateHelper.dateFormat(topic.lastPublish, Message.EndOfTime, Message.Never, Message.Never)} |
+ ${TemplateHelper.dateFormat(topic.contentFetchNextAttempt, Message.NextPublish, Message.Pending, Message.NextPublish)} |
${topic.contentFetchAttemptsSinceSuccess} |
- ${TemplateHelper.dateFormat(topic.contentUpdated, 'End of Time', 'Never', 'Never')} |
+ ${TemplateHelper.dateFormat(topic.contentUpdated, Message.EndOfTime, Message.Never, Message.Never)} |
${topic.contentType} |
${topic.id} |
`;
@@ -73,16 +74,16 @@ function renderSubscriptionRow(subscription) {
}
return `
${subscription.callback} |
- ${TemplateHelper.dateFormat(subscription.created, 'End of Time', 'Beginning of Time', 'Unknown')} |
- ${TemplateHelper.dateFormat(subscription.verified, 'End of Time', 'Never', 'Never')} |
- ${TemplateHelper.dateFormat(subscription.expires, 'Never', 'Beginning of Time', 'Never')} |
+ ${TemplateHelper.dateFormat(subscription.created, Message.EndOfTime, Message.BeginningOfTime, Message.Unknown)} |
+ ${TemplateHelper.dateFormat(subscription.verified, Message.EndOfTime, Message.Never, Message.Never)} |
+ ${TemplateHelper.dateFormat(subscription.expires, Message.Never, Message.BeginningOfTime, Message.Never)} |
${!!subscription.secret} |
${subscription.signatureAlgorithm} |
${subscription.httpRemoteAddr} |
${subscription.httpFrom} |
- ${TemplateHelper.dateFormat(subscription.contentDelivered, 'End of Time', 'Never', 'Never')} |
+ ${TemplateHelper.dateFormat(subscription.contentDelivered, Message.EndOfTime, Message.Never, Message.Never)} |
${subscription.deliveryAttemptsSinceSuccess} |
- ${TemplateHelper.dateFormat(subscription.deliveryNextAttempt, 'End of Time', 'Next Publish', 'Next Publish')} |
+ ${TemplateHelper.dateFormat(subscription.deliveryNextAttempt, Message.EndOfTime, Message.NextPublish, Message.NextPublish)} |
${subscription.id} |
`;
}