[CalendarServer-changes] [12842] CalendarServer/trunk/calendarserver/webadmin
source_changes at macosforge.org
source_changes at macosforge.org
Fri Mar 7 12:24:03 PST 2014
Revision: 12842
http://trac.calendarserver.org//changeset/12842
Author: wsanchez at apple.com
Date: 2014-03-07 12:24:02 -0800 (Fri, 07 Mar 2014)
Log Message:
-----------
Show additional attributes on items.
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/webadmin/work.py
CalendarServer/trunk/calendarserver/webadmin/work.xhtml
Modified: CalendarServer/trunk/calendarserver/webadmin/work.py
===================================================================
--- CalendarServer/trunk/calendarserver/webadmin/work.py 2014-03-07 20:23:39 UTC (rev 12841)
+++ CalendarServer/trunk/calendarserver/webadmin/work.py 2014-03-07 20:24:02 UTC (rev 12842)
@@ -33,16 +33,17 @@
from twisted.internet.defer import inlineCallbacks, returnValue
# from twisted.web.template import tags as html, renderer
-# from txdav.caldav.datastore.scheduling.imip.inbound import (
-# IMIPPollingWork, IMIPReplyWork
-# )
+from txdav.caldav.datastore.scheduling.imip.inbound import (
+ IMIPPollingWork, IMIPReplyWork
+)
-# from twistedcaldav.directory.directory import GroupCacherPollingWork
-# from calendarserver.push.notifier import PushNotificationWork
+from txdav.who.groups import GroupCacherPollingWork
+from calendarserver.push.notifier import PushNotificationWork
-# from txdav.caldav.datastore.scheduling.work import (
-# ScheduleOrganizerWork, ScheduleReplyWork, ScheduleRefreshWork
-# )
+from txdav.caldav.datastore.scheduling.work import (
+ ScheduleOrganizerWork, ScheduleRefreshWork,
+ ScheduleReplyWork, ScheduleAutoReplyWork,
+)
from twext.enterprise.jobqueue import JobItem
@@ -110,32 +111,60 @@
events = []
- itemsByTypeName = {}
+ jobsByTypeName = {}
- for item in (yield JobItem.all(txn)):
- itemsByTypeName.setdefault(item.workType, []).append(item)
+ for job in (yield JobItem.all(txn)):
+ jobsByTypeName.setdefault(job.workType, []).append(job)
totalsByTypeName = {}
for workType in JobItem.workTypes():
typeName = workType.table.model.name
- items = itemsByTypeName.get(typeName, [])
- totalsByTypeName[typeName] = len(items)
- itemData = []
+ jobs = jobsByTypeName.get(typeName, [])
+ totalsByTypeName[typeName] = len(jobs)
- for item in items:
- itemData.append(dict(
- jobID=item.jobID,
- priority=item.priority,
- notBefore=item.notBefore.ctime(), # FIXME: Use HTTP format
- notAfter=item.notAfter,
- ))
+ jobDicts = []
- if itemData:
+ for job in jobs:
+ jobDict = dict(
+ jobID=job.jobID,
+ priority=job.priority,
+ notBefore=job.notBefore.ctime(), # FIXME: Use HTTP format
+ notAfter=job.notAfter,
+ )
+
+ work = yield job.workItem()
+
+ if work is not None:
+ if workType == PushNotificationWork:
+ attrs = ("pushID", "priority")
+ elif workType == ScheduleOrganizerWork:
+ attrs = ("icalendarUid", "attendeeCount")
+ elif workType == ScheduleRefreshWork:
+ attrs = ("icalendarUid", "attendeeCount")
+ elif workType == ScheduleReplyWork:
+ attrs = ("icalendarUid",)
+ elif workType == ScheduleAutoReplyWork:
+ attrs = ("icalendarUid",)
+ elif workType == GroupCacherPollingWork:
+ attrs = ()
+ elif workType == IMIPPollingWork:
+ attrs = ()
+ elif workType == IMIPReplyWork:
+ attrs = ("organizer", "attendee")
+ else:
+ attrs = ()
+
+ for attr in attrs:
+ jobDict["work_{}".format(attr)] = getattr(work, attr)
+
+ jobDicts.append(jobDict)
+
+ if jobDicts:
events.append(dict(
eventClass=typeName,
eventID=time(),
- eventText=asJSON(itemData),
+ eventText=asJSON(jobDicts),
))
events.append(dict(
Modified: CalendarServer/trunk/calendarserver/webadmin/work.xhtml
===================================================================
--- CalendarServer/trunk/calendarserver/webadmin/work.xhtml 2014-03-07 20:23:39 UTC (rev 12841)
+++ CalendarServer/trunk/calendarserver/webadmin/work.xhtml 2014-03-07 20:24:02 UTC (rev 12842)
@@ -92,9 +92,19 @@
var jobItemAttributeDescriptions = {
"jobID": "Job ID",
- "priority": "Priority",
+ "priority": "Job Priority",
"notBefore": "Not Before",
"notAfter": "Not After",
+
+ // Push
+ "work_pushID": "Push ID",
+ "work_priority": "Priority",
+
+ // Scheduling
+ "work_icalendarUid": "iCalendar UID",
+ "work_attendeeCount": "Attendee Count",
+ "work_organizer": "Organizer",
+ "work_attendee": "Attendee",
}
// Function to return keys from an object in order, followed by keys
@@ -104,7 +114,7 @@
// will be in whatever order they came in over the wire.
function keysInKindOfKnownOrder(obj1, obj2) {
var keys = [];
- for (var key in obj1) { keys.push(key); }
+ for (var key in obj1) { if (key in obj2) { keys.push(key); } }
for (var key in obj2) { if (! key in obj1) { keys.push(key); } }
return keys;
}
@@ -396,8 +406,12 @@
for (var i in attributes) {
var attribute = attributes[i]; // OMG JavaScript the lameness
+ var content = jobItem[attribute]
+ if (content === null) { content = ""; }
+
var cell = document.createElement("td");
- var text = document.createTextNode(jobItem[attribute]);
+ var text = document.createTextNode(content);
+
cell.appendChild(text);
row.appendChild(cell);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140307/d223fb6f/attachment-0001.html>
More information about the calendarserver-changes
mailing list