VirtualBox

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

Last change on this file since 98103 was 98103, checked in by vboxsync, 2 years ago

Copyright year updates by scm.

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