VirtualBox

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

Last change on this file since 77807 was 76553, checked in by vboxsync, 6 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.2 KB
Line 
1# -*- coding: utf-8 -*-
2# $Id: wuiadminbuild.py 76553 2019-01-01 01:45:53Z vboxsync $
3
4"""
5Test Manager WUI - Builds.
6"""
7
8__copyright__ = \
9"""
10Copyright (C) 2012-2019 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: 76553 $"
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
108 if self._oDisp is None or not self._oDisp.isReadOnlyUser():
109 aoActions += [
110 WuiTmLink('Blacklist', WuiAdmin.ksScriptName, dParams),
111 WuiTmLink('Details', WuiAdmin.ksScriptName,
112 { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildDetails,
113 BuildData.ksParam_idBuild: oEntry.idBuild,
114 WuiAdmin.ksParamEffectiveDate: self._tsEffectiveDate, }),
115 WuiTmLink('Clone', WuiAdmin.ksScriptName,
116 { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildClone,
117 BuildData.ksParam_idBuild: oEntry.idBuild,
118 WuiAdmin.ksParamEffectiveDate: self._tsEffectiveDate, }),
119 ];
120 if isDbTimestampInfinity(oEntry.tsExpire):
121 aoActions += [
122 WuiTmLink('Modify', WuiAdmin.ksScriptName,
123 { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildEdit,
124 BuildData.ksParam_idBuild: oEntry.idBuild }),
125 WuiTmLink('Remove', WuiAdmin.ksScriptName,
126 { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildDoRemove,
127 BuildData.ksParam_idBuild: oEntry.idBuild },
128 sConfirm = 'Are you sure you want to remove build #%d?' % (oEntry.idBuild,) ),
129 ];
130
131 return [ oEntry.idBuild,
132 oEntry.oCat.sProduct,
133 oEntry.oCat.sBranch,
134 WuiSvnLinkWithTooltip(oEntry.iRevision, oEntry.oCat.sRepository,
135 sName = '%s r%s' % (oEntry.sVersion, oEntry.iRevision,)),
136 oEntry.oCat.sType,
137 ' '.join(oEntry.oCat.asOsArches),
138 'batch' if oEntry.uidAuthor is None else oEntry.uidAuthor,
139 self.formatTsShort(oEntry.tsCreated),
140 oEntry.sBinaries if not oEntry.fBinariesDeleted else '<Deleted>',
141 aoActions,
142 ];
143
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