VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/testmanager/webui/wuiadminbuild.py@ 65445

Last change on this file since 65445 was 65350, checked in by vboxsync, 8 years ago

TestManager/webui: Implemented simple column sorting direction toggle during the meeting. (Still testboxes only.)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.0 KB
Line 
1# -*- coding: utf-8 -*-
2# $Id: wuiadminbuild.py 65350 2017-01-17 15:35:59Z vboxsync $
3
4"""
5Test Manager WUI - Builds.
6"""
7
8__copyright__ = \
9"""
10Copyright (C) 2012-2016 Oracle Corporation
11
12This file is part of VirtualBox Open Source Edition (OSE), as
13available from http://www.virtualbox.org. This file is free software;
14you can redistribute it and/or modify it under the terms of the GNU
15General Public License (GPL) as published by the Free Software
16Foundation, in version 2 as it comes in the "COPYING" file of the
17VirtualBox OSE distribution. VirtualBox OSE is distributed in the
18hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
19
20The contents of this file may alternatively be used under the terms
21of the Common Development and Distribution License Version 1.0
22(CDDL) only, as it comes in the "COPYING.CDDL" file of the
23VirtualBox OSE distribution, in which case the provisions of the
24CDDL are applicable instead of those of the GPL.
25
26You may elect to license modified versions of this file under the
27terms and conditions of either the GPL or the CDDL or both.
28"""
29__version__ = "$Revision: 65350 $"
30
31
32# Validation Kit imports.
33from testmanager.webui.wuicontentbase import WuiFormContentBase, WuiListContentBase, WuiTmLink, WuiBuildLogLink, \
34 WuiSvnLinkWithTooltip;
35from testmanager.core.build import BuildData, BuildCategoryLogic;
36from testmanager.core.buildblacklist import BuildBlacklistData;
37from testmanager.core.db import isDbTimestampInfinity;
38
39
40class WuiAdminBuild(WuiFormContentBase):
41 """
42 WUI Build HTML content generator.
43 """
44
45 def __init__(self, oData, sMode, oDisp):
46 if sMode == WuiFormContentBase.ksMode_Add:
47 sTitle = 'Add Build'
48 elif sMode == WuiFormContentBase.ksMode_Edit:
49 sTitle = 'Modify Build - #%s' % (oData.idBuild,);
50 else:
51 assert sMode == WuiFormContentBase.ksMode_Show;
52 sTitle = 'Build - #%s' % (oData.idBuild,);
53 WuiFormContentBase.__init__(self, oData, sMode, 'Build', oDisp, sTitle);
54
55 def _populateForm(self, oForm, oData):
56 oForm.addIntRO (BuildData.ksParam_idBuild, oData.idBuild, 'Build ID')
57 oForm.addTimestampRO(BuildData.ksParam_tsCreated, oData.tsCreated, 'Created')
58 oForm.addTimestampRO(BuildData.ksParam_tsEffective, oData.tsEffective, 'Last changed')
59 oForm.addTimestampRO(BuildData.ksParam_tsExpire, oData.tsExpire, 'Expires (excl)')
60 oForm.addIntRO (BuildData.ksParam_uidAuthor, oData.uidAuthor, 'Changed by UID')
61
62 oForm.addComboBox (BuildData.ksParam_idBuildCategory, oData.idBuildCategory, 'Build category',
63 BuildCategoryLogic(self._oDisp.getDb()).fetchForCombo());
64
65 oForm.addInt (BuildData.ksParam_iRevision, oData.iRevision, 'Revision')
66 oForm.addText (BuildData.ksParam_sVersion, oData.sVersion, 'Version')
67 oForm.addWideText (BuildData.ksParam_sLogUrl, oData.sLogUrl, 'Log URL')
68 oForm.addWideText (BuildData.ksParam_sBinaries, oData.sBinaries, 'Binaries')
69 oForm.addCheckBox (BuildData.ksParam_fBinariesDeleted, oData.fBinariesDeleted, 'Binaries deleted')
70
71 oForm.addSubmit()
72 return True;
73
74
75class WuiAdminBuildList(WuiListContentBase):
76 """
77 WUI Admin Build List Content Generator.
78 """
79
80 def __init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, fnDPrint, oDisp, aiSelectedSortColumns = None):
81 WuiListContentBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffective,
82 sTitle = 'Builds', sId = 'builds', fnDPrint = fnDPrint, oDisp = oDisp,
83 aiSelectedSortColumns = aiSelectedSortColumns);
84
85 self._asColumnHeaders = ['ID', 'Product', 'Branch', 'Version',
86 'Type', 'OS(es)', 'Author', 'Added',
87 'Files', 'Action' ];
88 self._asColumnAttribs = ['align="right"', 'align="center"', 'align="center"', 'align="center"',
89 'align="center"', 'align="center"', 'align="center"', 'align="center"',
90 '', 'align="center"'];
91
92 def _formatListEntry(self, iEntry):
93 from testmanager.webui.wuiadmin import WuiAdmin
94 oEntry = self._aoEntries[iEntry];
95
96 aoActions = [];
97 if oEntry.sLogUrl is not None:
98 aoActions.append(WuiBuildLogLink(oEntry.sLogUrl, 'Build Log'));
99
100 dParams = { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildBlacklistAdd,
101 BuildBlacklistData.ksParam_sProduct: oEntry.oCat.sProduct,
102 BuildBlacklistData.ksParam_sBranch: oEntry.oCat.sBranch,
103 BuildBlacklistData.ksParam_asTypes: oEntry.oCat.sType,
104 BuildBlacklistData.ksParam_asOsArches: oEntry.oCat.asOsArches,
105 BuildBlacklistData.ksParam_iFirstRevision: oEntry.iRevision,
106 BuildBlacklistData.ksParam_iLastRevision: oEntry.iRevision }
107 aoActions += [
108 WuiTmLink('Blacklist', WuiAdmin.ksScriptName, dParams),
109 WuiTmLink('Details', WuiAdmin.ksScriptName,
110 { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildDetails,
111 BuildData.ksParam_idBuild: oEntry.idBuild,
112 WuiAdmin.ksParamEffectiveDate: self._tsEffectiveDate, }),
113 WuiTmLink('Clone', WuiAdmin.ksScriptName,
114 { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildClone,
115 BuildData.ksParam_idBuild: oEntry.idBuild,
116 WuiAdmin.ksParamEffectiveDate: self._tsEffectiveDate, }),
117 ];
118 if isDbTimestampInfinity(oEntry.tsExpire):
119 aoActions += [
120 WuiTmLink('Modify', WuiAdmin.ksScriptName,
121 { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildEdit,
122 BuildData.ksParam_idBuild: oEntry.idBuild }),
123 WuiTmLink('Remove', WuiAdmin.ksScriptName,
124 { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildDoRemove,
125 BuildData.ksParam_idBuild: oEntry.idBuild },
126 sConfirm = 'Are you sure you want to remove build #%d?' % (oEntry.idBuild,) ),
127 ];
128
129 return [ oEntry.idBuild,
130 oEntry.oCat.sProduct,
131 oEntry.oCat.sBranch,
132 WuiSvnLinkWithTooltip(oEntry.iRevision, oEntry.oCat.sRepository,
133 sName = '%s r%s' % (oEntry.sVersion, oEntry.iRevision,)),
134 oEntry.oCat.sType,
135 ' '.join(oEntry.oCat.asOsArches),
136 'batch' if oEntry.uidAuthor is None else oEntry.uidAuthor,
137 self.formatTsShort(oEntry.tsCreated),
138 oEntry.sBinaries if not oEntry.fBinariesDeleted else '<Deleted>',
139 aoActions,
140 ];
141
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette