| |
@@ -384,7 +384,9 @@
|
| |
values['user'] = user
|
| |
values['welcomeMessage'] = environ['koji.options']['KojiGreeting']
|
| |
|
| |
- return _genHTML(environ, 'index.chtml')
|
| |
+ values['koji'] = koji
|
| |
+
|
| |
+ return _genHTML(environ, 'index.html.j2')
|
| |
|
| |
|
| |
def notificationedit(environ, notificationID):
|
| |
@@ -430,7 +432,7 @@
|
| |
tags = server.listTags(queryOpts={'order': 'name'})
|
| |
values['tags'] = tags
|
| |
|
| |
- return _genHTML(environ, 'notificationedit.chtml')
|
| |
+ return _genHTML(environ, 'notificationedit.html.j2')
|
| |
|
| |
|
| |
def notificationcreate(environ):
|
| |
@@ -475,7 +477,7 @@
|
| |
tags = server.listTags(queryOpts={'order': 'name'})
|
| |
values['tags'] = tags
|
| |
|
| |
- return _genHTML(environ, 'notificationedit.chtml')
|
| |
+ return _genHTML(environ, 'notificationedit.html.j2')
|
| |
|
| |
|
| |
def notificationdelete(environ, notificationID):
|
| |
@@ -635,7 +637,10 @@
|
| |
for task, [descendents] in zip(tasks, descendentList):
|
| |
task['descendents'] = descendents
|
| |
|
| |
- return _genHTML(environ, 'tasks.chtml')
|
| |
+ values['S'] = SafeValue
|
| |
+ values['koji'] = koji
|
| |
+
|
| |
+ return _genHTML(environ, 'tasks.html.j2')
|
| |
|
| |
|
| |
def taskinfo(environ, taskID):
|
| |
@@ -792,7 +797,10 @@
|
| |
else:
|
| |
values['perms'] = []
|
| |
|
| |
- return _genHTML(environ, 'taskinfo.chtml')
|
| |
+ values['koji'] = koji
|
| |
+ values['S'] = SafeValue
|
| |
+
|
| |
+ return _genHTML(environ, 'taskinfo.html.j2')
|
| |
|
| |
|
| |
def taskstatus(environ, taskID):
|
| |
@@ -929,7 +937,7 @@
|
| |
else:
|
| |
values['childID'] = int(childID)
|
| |
|
| |
- return _genHTML(environ, 'tags.chtml')
|
| |
+ return _genHTML(environ, 'tags.html.j2')
|
| |
|
| |
|
| |
_PREFIX_CHARS = [chr(char) for char in list(range(48, 58)) + list(range(97, 123))]
|
| |
@@ -972,7 +980,7 @@
|
| |
|
| |
values['chars'] = _PREFIX_CHARS
|
| |
|
| |
- return _genHTML(environ, 'packages.chtml')
|
| |
+ return _genHTML(environ, 'packages.html.j2')
|
| |
|
| |
|
| |
def packageinfo(environ, packageID, tagOrder='name', tagStart=None, buildOrder='-completion_time',
|
| |
@@ -996,7 +1004,7 @@
|
| |
start=buildStart, dataName='builds', prefix='build',
|
| |
order=buildOrder)
|
| |
|
| |
- return _genHTML(environ, 'packageinfo.chtml')
|
| |
+ return _genHTML(environ, 'packageinfo.html.j2')
|
| |
|
| |
|
| |
def taginfo(environ, tagID, all='0', packageOrder='package_name', packageStart=None,
|
| |
@@ -1012,7 +1020,7 @@
|
| |
values['tagID'] = tag['id']
|
| |
if 'revoke_event' in tag:
|
| |
values['delete_ts'] = server.getEvent(tag['revoke_event'])['ts']
|
| |
- return _genHTML(environ, 'taginfo_deleted.chtml')
|
| |
+ return _genHTML(environ, 'taginfo_deleted.html.j2')
|
| |
|
| |
all = int(all)
|
| |
|
| |
@@ -1060,7 +1068,7 @@
|
| |
allPerms = dict([(perm['id'], perm['name']) for perm in permList])
|
| |
values['allPerms'] = allPerms
|
| |
|
| |
- return _genHTML(environ, 'taginfo.chtml')
|
| |
+ return _genHTML(environ, 'taginfo.html.j2')
|
| |
|
| |
|
| |
def tagcreate(environ):
|
| |
@@ -1096,7 +1104,7 @@
|
| |
values['tag'] = None
|
| |
values['permissions'] = server.getAllPerms()
|
| |
|
| |
- return _genHTML(environ, 'tagedit.chtml')
|
| |
+ return _genHTML(environ, 'tagedit.html.j2')
|
| |
|
| |
|
| |
def tagedit(environ, tagID):
|
| |
@@ -1139,7 +1147,7 @@
|
| |
values['tag'] = tag
|
| |
values['permissions'] = server.getAllPerms()
|
| |
|
| |
- return _genHTML(environ, 'tagedit.chtml')
|
| |
+ return _genHTML(environ, 'tagedit.html.j2')
|
| |
|
| |
|
| |
def tagdelete(environ, tagID):
|
| |
@@ -1205,7 +1213,7 @@
|
| |
'tag %i has tag %i listed as a parent more than once' %
|
| |
(tag['id'], parent['id']))
|
| |
|
| |
- return _genHTML(environ, 'tagparent.chtml')
|
| |
+ return _genHTML(environ, 'tagparent.html.j2')
|
| |
elif action == 'remove':
|
| |
data = server.getInheritanceData(tag['id'])
|
| |
for datum in data:
|
| |
@@ -1234,7 +1242,7 @@
|
| |
values['extRepo'] = extRepo
|
| |
values['repoTags'] = repoTags
|
| |
|
| |
- return _genHTML(environ, 'externalrepoinfo.chtml')
|
| |
+ return _genHTML(environ, 'externalrepoinfo.html.j2')
|
| |
|
| |
|
| |
def buildinfo(environ, buildID):
|
| |
@@ -1381,7 +1389,8 @@
|
| |
values['estCompletion'] = None
|
| |
|
| |
values['pathinfo'] = pathinfo
|
| |
- return _genHTML(environ, 'buildinfo.chtml')
|
| |
+ values['koji'] = koji
|
| |
+ return _genHTML(environ, 'buildinfo.html.j2')
|
| |
|
| |
|
| |
def builds(environ, userID=None, tagID=None, packageID=None, state=None, order='-build_id',
|
| |
@@ -1467,8 +1476,9 @@
|
| |
start=start, dataName='builds', prefix='build', order=order)
|
| |
|
| |
values['chars'] = _PREFIX_CHARS
|
| |
+ values['koji'] = koji
|
| |
|
| |
- return _genHTML(environ, 'builds.chtml')
|
| |
+ return _genHTML(environ, 'builds.html.j2')
|
| |
|
| |
|
| |
def users(environ, order='name', start=None, prefix=None):
|
| |
@@ -1488,7 +1498,7 @@
|
| |
|
| |
values['chars'] = _PREFIX_CHARS
|
| |
|
| |
- return _genHTML(environ, 'users.chtml')
|
| |
+ return _genHTML(environ, 'users.html.j2')
|
| |
|
| |
|
| |
def userinfo(environ, userID, packageOrder='package_name', packageStart=None,
|
| |
@@ -1516,7 +1526,7 @@
|
| |
start=buildStart, dataName='builds', prefix='build',
|
| |
order=buildOrder, pageSize=10)
|
| |
|
| |
- return _genHTML(environ, 'userinfo.chtml')
|
| |
+ return _genHTML(environ, 'userinfo.html.j2')
|
| |
|
| |
|
| |
# headers shown in rpminfo and buildinfo pages
|
| |
@@ -1576,7 +1586,10 @@
|
| |
kojiweb.util.paginateMethod(server, values, 'listRPMFiles', args=[rpm['id']],
|
| |
start=fileStart, dataName='files', prefix='file', order=fileOrder)
|
| |
|
| |
- return _genHTML(environ, 'rpminfo.chtml')
|
| |
+ values['koji'] = koji
|
| |
+ values['time'] = time # TODO rework template so it doesn't need this
|
| |
+
|
| |
+ return _genHTML(environ, 'rpminfo.html.j2')
|
| |
|
| |
|
| |
def archiveinfo(environ, archiveID, fileOrder='name', fileStart=None, buildrootOrder='-id',
|
| |
@@ -1620,7 +1633,9 @@
|
| |
values['show_archive_components'] = server.listArchives(imageID=archive['id'],
|
| |
queryOpts={'limit': 1})
|
| |
|
| |
- return _genHTML(environ, 'archiveinfo.chtml')
|
| |
+ values['koji'] = koji
|
| |
+
|
| |
+ return _genHTML(environ, 'archiveinfo.html.j2')
|
| |
|
| |
|
| |
def fileinfo(environ, filename, rpmID=None, archiveID=None):
|
| |
@@ -1655,7 +1670,7 @@
|
| |
|
| |
values['file'] = file
|
| |
|
| |
- return _genHTML(environ, 'fileinfo.chtml')
|
| |
+ return _genHTML(environ, 'fileinfo.html.j2')
|
| |
|
| |
|
| |
def cancelbuild(environ, buildID):
|
| |
@@ -1737,7 +1752,9 @@
|
| |
# Paginate after retrieving last update info so we can sort on it
|
| |
kojiweb.util.paginateList(values, hosts, start, 'hosts', 'host', order)
|
| |
|
| |
- return _genHTML(environ, 'hosts.chtml')
|
| |
+ values['zip'] = zip # TODO avoid passing this in
|
| |
+
|
| |
+ return _genHTML(environ, 'hosts.html.j2')
|
| |
|
| |
|
| |
def hostinfo(environ, hostID=None, userID=None):
|
| |
@@ -1783,7 +1800,7 @@
|
| |
else:
|
| |
values['perms'] = []
|
| |
|
| |
- return _genHTML(environ, 'hostinfo.chtml')
|
| |
+ return _genHTML(environ, 'hostinfo.html.j2')
|
| |
|
| |
|
| |
def hostedit(environ, hostID):
|
| |
@@ -1833,7 +1850,7 @@
|
| |
values['allChannels'] = allChannels
|
| |
values['hostChannels'] = server.listChannels(hostID=host['id'])
|
| |
|
| |
- return _genHTML(environ, 'hostedit.chtml')
|
| |
+ return _genHTML(environ, 'hostedit.html.j2')
|
| |
|
| |
|
| |
def disablehost(environ, hostID):
|
| |
@@ -1883,7 +1900,7 @@
|
| |
values['enabled_hosts'] = len([h for h in hosts if h['enabled']])
|
| |
values['ready_hosts'] = len([h for h in hosts if h['ready']])
|
| |
|
| |
- return _genHTML(environ, 'channelinfo.chtml')
|
| |
+ return _genHTML(environ, 'channelinfo.html.j2')
|
| |
|
| |
|
| |
def buildrootinfo(environ, buildrootID):
|
| |
@@ -1897,15 +1914,16 @@
|
| |
raise koji.GenericError('unknown buildroot ID: %i' % buildrootID)
|
| |
|
| |
elif buildroot['br_type'] == koji.BR_TYPES['STANDARD']:
|
| |
- template = 'buildrootinfo.chtml'
|
| |
+ template = 'buildrootinfo.html.j2'
|
| |
values['task'] = server.getTaskInfo(buildroot['task_id'], request=True)
|
| |
|
| |
else:
|
| |
- template = 'buildrootinfo_cg.chtml'
|
| |
+ template = 'buildrootinfo_cg.html.j2'
|
| |
# TODO - fetch tools and extras info
|
| |
|
| |
values['title'] = '%s | Buildroot Info' % kojiweb.util.brLabel(buildroot)
|
| |
values['buildroot'] = buildroot
|
| |
+ values['koji'] = koji
|
| |
|
| |
return _genHTML(environ, template)
|
| |
|
| |
@@ -1962,7 +1980,7 @@
|
| |
values['type'] = type
|
| |
values['order'] = order
|
| |
|
| |
- return _genHTML(environ, 'rpmlist.chtml')
|
| |
+ return _genHTML(environ, 'rpmlist.html.j2')
|
| |
|
| |
|
| |
def archivelist(environ, type, buildrootID=None, imageID=None, start=None, order='filename'):
|
| |
@@ -2009,7 +2027,7 @@
|
| |
values['type'] = type
|
| |
values['order'] = order
|
| |
|
| |
- return _genHTML(environ, 'archivelist.chtml')
|
| |
+ return _genHTML(environ, 'archivelist.html.j2')
|
| |
|
| |
|
| |
def buildtargets(environ, start=None, order='name'):
|
| |
@@ -2025,7 +2043,7 @@
|
| |
else:
|
| |
values['perms'] = []
|
| |
|
| |
- return _genHTML(environ, 'buildtargets.chtml')
|
| |
+ return _genHTML(environ, 'buildtargets.html.j2')
|
| |
|
| |
|
| |
def buildtargetinfo(environ, targetID=None, name=None):
|
| |
@@ -2055,7 +2073,7 @@
|
| |
else:
|
| |
values['perms'] = []
|
| |
|
| |
- return _genHTML(environ, 'buildtargetinfo.chtml')
|
| |
+ return _genHTML(environ, 'buildtargetinfo.html.j2')
|
| |
|
| |
|
| |
def buildtargetedit(environ, targetID):
|
| |
@@ -2095,7 +2113,7 @@
|
| |
values['target'] = target
|
| |
values['tags'] = tags
|
| |
|
| |
- return _genHTML(environ, 'buildtargetedit.chtml')
|
| |
+ return _genHTML(environ, 'buildtargetedit.html.j2')
|
| |
|
| |
|
| |
def buildtargetcreate(environ):
|
| |
@@ -2130,7 +2148,7 @@
|
| |
values['target'] = None
|
| |
values['tags'] = tags
|
| |
|
| |
- return _genHTML(environ, 'buildtargetedit.chtml')
|
| |
+ return _genHTML(environ, 'buildtargetedit.html.j2')
|
| |
|
| |
|
| |
def buildtargetdelete(environ, targetID):
|
| |
@@ -2155,7 +2173,7 @@
|
| |
values['loggedInUser'] = True
|
| |
else:
|
| |
values['loggedInUser'] = False
|
| |
- return _genHTML(environ, 'reports.chtml')
|
| |
+ return _genHTML(environ, 'reports.html.j2')
|
| |
|
| |
|
| |
def buildsbyuser(environ, start=None, order='-builds'):
|
| |
@@ -2183,7 +2201,7 @@
|
| |
values['increment'] = graphWidth / maxBuilds
|
| |
kojiweb.util.paginateList(values, users, start, 'userBuilds', 'userBuild', order)
|
| |
|
| |
- return _genHTML(environ, 'buildsbyuser.chtml')
|
| |
+ return _genHTML(environ, 'buildsbyuser.html.j2')
|
| |
|
| |
|
| |
def rpmsbyhost(environ, start=None, order=None, hostArch=None, rpmArch=None):
|
| |
@@ -2228,7 +2246,7 @@
|
| |
values['increment'] = graphWidth / maxRPMs
|
| |
kojiweb.util.paginateList(values, hosts, start, 'hosts', 'host', order)
|
| |
|
| |
- return _genHTML(environ, 'rpmsbyhost.chtml')
|
| |
+ return _genHTML(environ, 'rpmsbyhost.html.j2')
|
| |
|
| |
|
| |
def packagesbyuser(environ, start=None, order=None):
|
| |
@@ -2258,7 +2276,7 @@
|
| |
values['increment'] = graphWidth / maxPackages
|
| |
kojiweb.util.paginateList(values, users, start, 'users', 'user', order)
|
| |
|
| |
- return _genHTML(environ, 'packagesbyuser.chtml')
|
| |
+ return _genHTML(environ, 'packagesbyuser.html.j2')
|
| |
|
| |
|
| |
def tasksbyhost(environ, start=None, order='-tasks', hostArch=None):
|
| |
@@ -2296,7 +2314,7 @@
|
| |
values['increment'] = graphWidth / maxTasks
|
| |
kojiweb.util.paginateList(values, hosts, start, 'hosts', 'host', order)
|
| |
|
| |
- return _genHTML(environ, 'tasksbyhost.chtml')
|
| |
+ return _genHTML(environ, 'tasksbyhost.html.j2')
|
| |
|
| |
|
| |
def tasksbyuser(environ, start=None, order='-tasks'):
|
| |
@@ -2325,7 +2343,7 @@
|
| |
values['increment'] = graphWidth / maxTasks
|
| |
kojiweb.util.paginateList(values, users, start, 'users', 'user', order)
|
| |
|
| |
- return _genHTML(environ, 'tasksbyuser.chtml')
|
| |
+ return _genHTML(environ, 'tasksbyuser.html.j2')
|
| |
|
| |
|
| |
def buildsbystatus(environ, days='7'):
|
| |
@@ -2364,7 +2382,7 @@
|
| |
values['maxBuilds'] = maxBuilds
|
| |
values['increment'] = graphWidth / maxBuilds
|
| |
|
| |
- return _genHTML(environ, 'buildsbystatus.chtml')
|
| |
+ return _genHTML(environ, 'buildsbystatus.html.j2')
|
| |
|
| |
|
| |
def buildsbytarget(environ, days='7', start=None, order='-builds'):
|
| |
@@ -2404,7 +2422,7 @@
|
| |
values['maxBuilds'] = maxBuilds
|
| |
values['increment'] = graphWidth / maxBuilds
|
| |
|
| |
- return _genHTML(environ, 'buildsbytarget.chtml')
|
| |
+ return _genHTML(environ, 'buildsbytarget.html.j2')
|
| |
|
| |
|
| |
def _filter_hosts_by_arch(hosts, arch):
|
| |
@@ -2464,7 +2482,7 @@
|
| |
values['arches'] = sorted(arches)
|
| |
values['graphWidth'] = graphWidth
|
| |
values['channels'] = sorted(channels, key=lambda x: x['name'])
|
| |
- return _genHTML(environ, 'clusterhealth.chtml')
|
| |
+ return _genHTML(environ, 'clusterhealth.html.j2')
|
| |
|
| |
|
| |
def recentbuilds(environ, user=None, tag=None, package=None):
|
| |
@@ -2532,8 +2550,10 @@
|
| |
values['builds'] = builds
|
| |
values['weburl'] = _getBaseURL(environ)
|
| |
|
| |
+ values['koji'] = koji
|
| |
+
|
| |
environ['koji.headers'].append(['Content-Type', 'text/xml'])
|
| |
- return _genHTML(environ, 'recentbuilds.chtml')
|
| |
+ return _genHTML(environ, 'recentbuilds.html.j2')
|
| |
|
| |
|
| |
_infoURLs = {'package': 'packageinfo?packageID=%(id)i',
|
| |
@@ -2586,7 +2606,7 @@
|
| |
except Exception:
|
| |
values['error'] = 'Invalid regular expression'
|
| |
values['terms'] = ''
|
| |
- return _genHTML(environ, 'search.chtml')
|
| |
+ return _genHTML(environ, 'search.html.j2')
|
| |
|
| |
infoURL = _infoURLs.get(type)
|
| |
if not infoURL:
|
| |
@@ -2610,9 +2630,9 @@
|
| |
else:
|
| |
typeLabel = '%ss' % type
|
| |
values['typeLabel'] = typeLabel
|
| |
- return _genHTML(environ, 'search.chtml')
|
| |
+ return _genHTML(environ, 'search.html.j2')
|
| |
else:
|
| |
- return _genHTML(environ, 'search.chtml')
|
| |
+ return _genHTML(environ, 'search.html.j2')
|
| |
|
| |
|
| |
def api(environ):
|
| |
@@ -2621,12 +2641,13 @@
|
| |
|
| |
values['koji_hub_url'] = environ['koji.options']['KojiHubURL']
|
| |
values['methods'] = sorted(server._listapi(), key=lambda x: x['name'])
|
| |
+ values['web_version'] = koji.__version__
|
| |
try:
|
| |
values['koji_version'] = server.getKojiVersion()
|
| |
except koji.GenericError:
|
| |
values['koji_version'] = "Can't determine (older then 1.23)"
|
| |
|
| |
- return _genHTML(environ, 'api.chtml')
|
| |
+ return _genHTML(environ, 'api.html.j2')
|
| |
|
| |
|
| |
def watchlogs(environ, taskID):
|
| |
@@ -2677,7 +2698,9 @@
|
| |
pathinfo.repo(repo_info['id'], repo_info['tag_name']), 'repo.json')
|
| |
num_buildroots = len(server.listBuildroots(repoID=repoID)) or 0
|
| |
values['numBuildroots'] = num_buildroots
|
| |
- return _genHTML(environ, 'repoinfo.chtml')
|
| |
+ values['state_name'] = kojiweb.util.repoState(repo_info['state'])
|
| |
+ values['create_time'] = kojiweb.util.formatTimeLong(repo_info['create_ts'])
|
| |
+ return _genHTML(environ, 'repoinfo.html.j2')
|
| |
|
| |
|
| |
def activesession(environ, start=None, order=None):
|
| |
@@ -2687,18 +2710,20 @@
|
| |
values['loggedInUser'] = environ['koji.currentUser']
|
| |
|
| |
values['order'] = order
|
| |
- activesess = server.getSessionInfo(details=True, user_id=values['loggedInUser']['id'])
|
| |
- if not activesess:
|
| |
- activesess = []
|
| |
- else:
|
| |
+ activesess = []
|
| |
+ if environ['koji.currentUser']:
|
| |
+ activesess = server.getSessionInfo(details=True, user_id=values['loggedInUser']['id'])
|
| |
+ if activesess:
|
| |
current_timestamp = datetime.datetime.utcnow().timestamp()
|
| |
for a in activesess:
|
| |
a['lengthSession'] = kojiweb.util.formatTimestampDifference(
|
| |
a['start_time'], current_timestamp, in_days=True)
|
| |
+ else:
|
| |
+ activesess = []
|
| |
|
| |
kojiweb.util.paginateList(values, activesess, start, 'activesess', order=order)
|
| |
|
| |
- return _genHTML(environ, 'activesession.chtml')
|
| |
+ return _genHTML(environ, 'activesession.html.j2')
|
| |
|
| |
|
| |
def activesessiondelete(environ, sessionID):
|
| |
@@ -2727,4 +2752,6 @@
|
| |
kw={'repoID': repoID, 'state': state}, start=start,
|
| |
dataName='buildroots', prefix='buildroot', order=order)
|
| |
|
| |
- return _genHTML(environ, 'buildroots.chtml')
|
| |
+ values['koji'] = koji
|
| |
+
|
| |
+ return _genHTML(environ, 'buildroots.html.j2')
|
| |