VirtualBox

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

Last change on this file since 65132 was 62484, checked in by vboxsync, 8 years ago

(C) 2016

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.9 KB
Line 
1# -*- coding: utf-8 -*-
2# $Id: wuiadminbuild.py 62484 2016-07-22 18:35:33Z 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: 62484 $"
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):
81 WuiListContentBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffective,
82 sTitle = 'Builds', sId = 'builds', fnDPrint = fnDPrint, oDisp = oDisp);
83
84 self._asColumnHeaders = ['ID', 'Product', 'Branch', 'Version',
85 'Type', 'OS(es)', 'Author', 'Added',
86 'Files', 'Action' ];
87 self._asColumnAttribs = ['align="right"', 'align="center"', 'align="center"', 'align="center"',
88 'align="center"', 'align="center"', 'align="center"', 'align="center"',
89 '', 'align="center"'];
90
91 def _formatListEntry(self, iEntry):
92 from testmanager.webui.wuiadmin import WuiAdmin
93 oEntry = self._aoEntries[iEntry];
94
95 aoActions = [];
96 if oEntry.sLogUrl is not None:
97 aoActions.append(WuiBuildLogLink(oEntry.sLogUrl, 'Build Log'));
98
99 dParams = { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildBlacklistAdd,
100 BuildBlacklistData.ksParam_sProduct: oEntry.oCat.sProduct,
101 BuildBlacklistData.ksParam_sBranch: oEntry.oCat.sBranch,
102 BuildBlacklistData.ksParam_asTypes: oEntry.oCat.sType,
103 BuildBlacklistData.ksParam_asOsArches: oEntry.oCat.asOsArches,
104 BuildBlacklistData.ksParam_iFirstRevision: oEntry.iRevision,
105 BuildBlacklistData.ksParam_iLastRevision: oEntry.iRevision }
106 aoActions += [
107 WuiTmLink('Blacklist', WuiAdmin.ksScriptName, dParams),
108 WuiTmLink('Details', WuiAdmin.ksScriptName,
109 { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildDetails,
110 BuildData.ksParam_idBuild: oEntry.idBuild,
111 WuiAdmin.ksParamEffectiveDate: self._tsEffectiveDate, }),
112 WuiTmLink('Clone', WuiAdmin.ksScriptName,
113 { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildClone,
114 BuildData.ksParam_idBuild: oEntry.idBuild,
115 WuiAdmin.ksParamEffectiveDate: self._tsEffectiveDate, }),
116 ];
117 if isDbTimestampInfinity(oEntry.tsExpire):
118 aoActions += [
119 WuiTmLink('Modify', WuiAdmin.ksScriptName,
120 { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildEdit,
121 BuildData.ksParam_idBuild: oEntry.idBuild }),
122 WuiTmLink('Remove', WuiAdmin.ksScriptName,
123 { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildDoRemove,
124 BuildData.ksParam_idBuild: oEntry.idBuild },
125 sConfirm = 'Are you sure you want to remove build #%d?' % (oEntry.idBuild,) ),
126 ];
127
128 return [ oEntry.idBuild,
129 oEntry.oCat.sProduct,
130 oEntry.oCat.sBranch,
131 WuiSvnLinkWithTooltip(oEntry.iRevision, oEntry.oCat.sRepository,
132 sName = '%s r%s' % (oEntry.sVersion, oEntry.iRevision,)),
133 oEntry.oCat.sType,
134 ' '.join(oEntry.oCat.asOsArches),
135 'batch' if oEntry.uidAuthor is None else oEntry.uidAuthor,
136 self.formatTsShort(oEntry.tsCreated),
137 oEntry.sBinaries if not oEntry.fBinariesDeleted else '<Deleted>',
138 aoActions,
139 ];
140
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