VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/testmanager/webui/wuifailurecategory.py@ 61220

最後變更 在這個檔案從61220是 61220,由 vboxsync 提交於 9 年 前

testmanager: failiure reason fixes, some exception throwing cleanups, delinting with pylint 1.5.5.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 4.5 KB
 
1# -*- coding: utf-8 -*-
2# $Id: wuifailurecategory.py 61220 2016-05-27 01:16:02Z vboxsync $
3
4"""
5Test Manager WUI - Failure Categories Web content generator.
6"""
7
8__copyright__ = \
9"""
10Copyright (C) 2012-2015 Oracle Corporation
11
12This file is part of VirtualBox Open Source Edition (OSE), as
13available from http://www.alldomusa.eu.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: 61220 $"
30
31
32# Validation Kit imports.
33from testmanager.webui.wuicontentbase import WuiFormContentBase, WuiListContentBase, WuiTmLink
34from testmanager.core.failurecategory import FailureCategoryData
35
36
37class WuiFailureCategory(WuiFormContentBase):
38 """
39 WUI Failure Category HTML content generator.
40 """
41
42 def __init__(self, oData, sMode, oDisp):
43 """
44 Prepare & initialize parent
45 """
46
47 sTitle = 'Failure Category';
48 if sMode == WuiFormContentBase.ksMode_Add:
49 sTitle = 'Add ' + sTitle;
50 elif sMode == WuiFormContentBase.ksMode_Edit:
51 sTitle = 'Edit ' + sTitle;
52 else:
53 assert sMode == WuiFormContentBase.ksMode_Show;
54
55 WuiFormContentBase.__init__(self, oData, sMode, 'FailureCategory', oDisp, sTitle);
56
57 def _populateForm(self, oForm, oData):
58 """
59 Construct an HTML form
60 """
61
62 oForm.addIntRO (FailureCategoryData.ksParam_idFailureCategory, oData.idFailureCategory, 'Failure Category ID')
63 oForm.addTimestampRO(FailureCategoryData.ksParam_tsEffective, oData.tsEffective, 'Last changed')
64 oForm.addTimestampRO(FailureCategoryData.ksParam_tsExpire, oData.tsExpire, 'Expires (excl)')
65 oForm.addIntRO (FailureCategoryData.ksParam_uidAuthor, oData.uidAuthor, 'Changed by UID')
66 oForm.addText (FailureCategoryData.ksParam_sShort, oData.sShort, 'Short Description')
67 oForm.addText (FailureCategoryData.ksParam_sFull, oData.sFull, 'Full Description')
68
69 oForm.addSubmit()
70
71 return True
72
73
74class WuiFailureCategoryList(WuiListContentBase):
75 """
76 WUI Admin Failure Category Content Generator.
77 """
78
79 def __init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, fnDPrint, oDisp):
80 WuiListContentBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffective,
81 sTitle = 'Failure Categories', sId = 'failureCategories',
82 fnDPrint = fnDPrint, oDisp = oDisp);
83
84 self._asColumnHeaders = ['ID', 'Short Description', 'Full Description', 'Actions' ]
85 self._asColumnAttribs = ['align="right"', 'align="center"', 'align="center"', 'align="center"']
86
87 def _formatListEntry(self, iEntry):
88 from testmanager.webui.wuiadmin import WuiAdmin
89 oEntry = self._aoEntries[iEntry]
90
91 return [ oEntry.idFailureCategory,
92 oEntry.sShort,
93 oEntry.sFull,
94 [ WuiTmLink('Details', WuiAdmin.ksScriptName,
95 { WuiAdmin.ksParamAction: WuiAdmin.ksActionFailureCategoryDetails,
96 FailureCategoryData.ksParam_idFailureCategory: oEntry.idFailureCategory }),
97 WuiTmLink('Modify', WuiAdmin.ksScriptName,
98 { WuiAdmin.ksParamAction: WuiAdmin.ksActionFailureCategoryEdit,
99 FailureCategoryData.ksParam_idFailureCategory: oEntry.idFailureCategory }),
100 WuiTmLink('Remove', WuiAdmin.ksScriptName,
101 { WuiAdmin.ksParamAction: WuiAdmin.ksActionFailureCategoryDoRemove,
102 FailureCategoryData.ksParam_idFailureCategory: oEntry.idFailureCategory },
103 sConfirm = 'Do you really want to remove failure cateogry #%d?' % (oEntry.idFailureCategory,)),
104 ] ];
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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