1 | # -*- coding: utf-8 -*-
|
---|
2 | # $Id: wuiadminbuildcategory.py 62484 2016-07-22 18:35:33Z vboxsync $
|
---|
3 |
|
---|
4 | """
|
---|
5 | Test Manager WUI - Build categories.
|
---|
6 | """
|
---|
7 |
|
---|
8 | __copyright__ = \
|
---|
9 | """
|
---|
10 | Copyright (C) 2012-2016 Oracle Corporation
|
---|
11 |
|
---|
12 | This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
13 | available from http://www.virtualbox.org. This file is free software;
|
---|
14 | you can redistribute it and/or modify it under the terms of the GNU
|
---|
15 | General Public License (GPL) as published by the Free Software
|
---|
16 | Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
17 | VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
18 | hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
19 |
|
---|
20 | The contents of this file may alternatively be used under the terms
|
---|
21 | of the Common Development and Distribution License Version 1.0
|
---|
22 | (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
23 | VirtualBox OSE distribution, in which case the provisions of the
|
---|
24 | CDDL are applicable instead of those of the GPL.
|
---|
25 |
|
---|
26 | You may elect to license modified versions of this file under the
|
---|
27 | terms and conditions of either the GPL or the CDDL or both.
|
---|
28 | """
|
---|
29 | __version__ = "$Revision: 62484 $"
|
---|
30 |
|
---|
31 |
|
---|
32 | # Validation Kit imports.
|
---|
33 | from common import webutils;
|
---|
34 | from testmanager.webui.wuicontentbase import WuiListContentBase, WuiFormContentBase, WuiRawHtml, WuiTmLink;
|
---|
35 | from testmanager.core.build import BuildCategoryData
|
---|
36 | from testmanager.core import coreconsts;
|
---|
37 |
|
---|
38 |
|
---|
39 | class WuiAdminBuildCatList(WuiListContentBase):
|
---|
40 | """
|
---|
41 | WUI Build Category List Content Generator.
|
---|
42 | """
|
---|
43 |
|
---|
44 | def __init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, fnDPrint, oDisp):
|
---|
45 | WuiListContentBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffective,
|
---|
46 | sTitle = 'Build Categories', sId = 'buildcategories',
|
---|
47 | fnDPrint = fnDPrint, oDisp = oDisp);
|
---|
48 | self._asColumnHeaders = ([ 'ID', 'Product', 'Repository', 'Branch', 'Build Type', 'OS/Architectures', 'Actions' ]);
|
---|
49 | self._asColumnAttribs = (['align="right"', '', '', '', '', 'align="center"' ]);
|
---|
50 |
|
---|
51 | def _formatListEntry(self, iEntry):
|
---|
52 | from testmanager.webui.wuiadmin import WuiAdmin;
|
---|
53 | oEntry = self._aoEntries[iEntry];
|
---|
54 |
|
---|
55 | aoActions = [
|
---|
56 | WuiTmLink('Details', WuiAdmin.ksScriptName,
|
---|
57 | { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildCategoryDetails,
|
---|
58 | BuildCategoryData.ksParam_idBuildCategory: oEntry.idBuildCategory, }),
|
---|
59 | WuiTmLink('Clone', WuiAdmin.ksScriptName,
|
---|
60 | { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildCategoryClone,
|
---|
61 | BuildCategoryData.ksParam_idBuildCategory: oEntry.idBuildCategory, }),
|
---|
62 | WuiTmLink('Try Remove', WuiAdmin.ksScriptName,
|
---|
63 | { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildCategoryDoRemove,
|
---|
64 | BuildCategoryData.ksParam_idBuildCategory: oEntry.idBuildCategory, }),
|
---|
65 | ];
|
---|
66 |
|
---|
67 | sHtml = '<ul class="tmshowall">\n';
|
---|
68 | for sOsArch in oEntry.asOsArches:
|
---|
69 | sHtml += ' <li class="tmshowall">%s</li>\n' % (webutils.escapeElem(sOsArch),);
|
---|
70 | sHtml += '</ul>\n'
|
---|
71 |
|
---|
72 | return [ oEntry.idBuildCategory,
|
---|
73 | oEntry.sRepository,
|
---|
74 | oEntry.sProduct,
|
---|
75 | oEntry.sBranch,
|
---|
76 | oEntry.sType,
|
---|
77 | WuiRawHtml(sHtml),
|
---|
78 | aoActions,
|
---|
79 | ];
|
---|
80 |
|
---|
81 |
|
---|
82 | class WuiAdminBuildCat(WuiFormContentBase):
|
---|
83 | """
|
---|
84 | WUI Build Category Form Content Generator.
|
---|
85 | """
|
---|
86 | def __init__(self, oData, sMode, oDisp):
|
---|
87 | if sMode == WuiFormContentBase.ksMode_Add:
|
---|
88 | sTitle = 'Create Build Category';
|
---|
89 | elif sMode == WuiFormContentBase.ksMode_Edit:
|
---|
90 | assert False, 'not possible'
|
---|
91 | else:
|
---|
92 | assert sMode == WuiFormContentBase.ksMode_Show;
|
---|
93 | sTitle = 'Build Category- %s' % (oData.idBuildCategory,);
|
---|
94 | WuiFormContentBase.__init__(self, oData, sMode, 'BuildCategory', oDisp, sTitle, fEditable = False);
|
---|
95 |
|
---|
96 | def _populateForm(self, oForm, oData):
|
---|
97 | oForm.addIntRO( BuildCategoryData.ksParam_idBuildCategory, oData.idBuildCategory, 'Build Category ID')
|
---|
98 | oForm.addText( BuildCategoryData.ksParam_sRepository, oData.sRepository, 'VCS repository name');
|
---|
99 | oForm.addText( BuildCategoryData.ksParam_sProduct, oData.sProduct, 'Product name')
|
---|
100 | oForm.addText( BuildCategoryData.ksParam_sBranch, oData.sBranch, 'Branch name')
|
---|
101 | oForm.addText( BuildCategoryData.ksParam_sType, oData.sType, 'Build type')
|
---|
102 |
|
---|
103 | aoOsArches = [[sOsArch, sOsArch in oData.asOsArches, sOsArch] for sOsArch in coreconsts.g_kasOsDotCpusAll];
|
---|
104 | oForm.addListOfOsArches(BuildCategoryData.ksParam_asOsArches, aoOsArches, 'Target architectures');
|
---|
105 |
|
---|
106 | if self._sMode != WuiFormContentBase.ksMode_Show:
|
---|
107 | oForm.addSubmit();
|
---|
108 | return True;
|
---|
109 |
|
---|