• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package autotest.afe.create;
2 
3 import autotest.afe.CheckBoxPanel;
4 import autotest.afe.CheckBoxPanelDisplay;
5 import autotest.afe.ControlTypeSelect;
6 import autotest.afe.ControlTypeSelectDisplay;
7 import autotest.afe.HostSelector;
8 import autotest.afe.HostSelectorDisplay;
9 import autotest.afe.IButton;
10 import autotest.afe.IButton.ButtonImpl;
11 import autotest.afe.ICheckBox;
12 import autotest.afe.ICheckBox.CheckBoxImpl;
13 import autotest.afe.ITextArea;
14 import autotest.afe.ITextArea.TextAreaImpl;
15 import autotest.afe.ITextBox;
16 import autotest.afe.ITextBox.TextBoxImpl;
17 import autotest.afe.RadioChooser;
18 import autotest.afe.RadioChooserDisplay;
19 import autotest.afe.TestSelector;
20 import autotest.afe.TestSelectorDisplay;
21 import autotest.common.ui.ExtendedListBox;
22 import autotest.common.ui.SimplifiedList;
23 import autotest.common.ui.ToolTip;
24 
25 import com.google.gwt.event.dom.client.HasClickHandlers;
26 import com.google.gwt.event.logical.shared.HasCloseHandlers;
27 import com.google.gwt.event.logical.shared.HasOpenHandlers;
28 import com.google.gwt.user.client.ui.Anchor;
29 import com.google.gwt.user.client.ui.Button;
30 import com.google.gwt.user.client.ui.CheckBox;
31 import com.google.gwt.user.client.ui.DisclosurePanel;
32 import com.google.gwt.user.client.ui.FlexTable;
33 import com.google.gwt.user.client.ui.HTMLPanel;
34 import com.google.gwt.user.client.ui.HTMLTable;
35 import com.google.gwt.user.client.ui.HasText;
36 import com.google.gwt.user.client.ui.HasValue;
37 import com.google.gwt.user.client.ui.HorizontalPanel;
38 import com.google.gwt.user.client.ui.Label;
39 import com.google.gwt.user.client.ui.Panel;
40 import com.google.gwt.user.client.ui.TextBox;
41 import com.google.gwt.user.client.ui.VerticalPanel;
42 
43 public class CreateJobViewDisplay implements CreateJobViewPresenter.Display {
44     public static final int CHECKBOX_PANEL_COLUMNS = 5;
45 
46     private TextBox jobName = new TextBox();
47     private ToolTip jobNameToolTip = new ToolTip(
48         "?",
49         "Name for the job. The string should be meaningful when viewing a list of jobs.");
50     private ExtendedListBox priorityList = new ExtendedListBox();
51     private ToolTip priorityListToolTip = new ToolTip(
52         "?",
53         "Lowest to highest: Weekly, Daily, PostBuild, Default.");
54     private TextBoxImpl image_url = new TextBoxImpl();
55     private ToolTip image_urlToolTip = new ToolTip(
56         "?",
57         "Name of the test image to use. Example: \"x86-alex-release/R27-3837.0.0\". " +
58         "If no image is specified, regular tests will use current image on the Host. " +
59         "Please note that an image is required to run a test suite.");
60     /**
61      * - When the fetch tests from build checkbox is unchecked (by default), the tests
62      * selection dropdown list is filled up by using the build on Moblab device.
63      * - You can only check the checkbox if a build is selected in the test source build
64      * dropdown list
65      * - Whenever the source build dropdown selection changes, automatically switch back
66      * to fetch tests from Moblab device.
67      */
68     private CheckBoxImpl fetchTestsCheckBox = new CheckBoxImpl("Fetch Tests from Build");
69     private TextBox timeout = new TextBox();
70     private ToolTip timeoutToolTip = new ToolTip(
71         "?",
72         "The number of minutes after the job creation before the scheduler " +
73         "automatically aborts an incomplete job.");
74     private TextBox maxRuntime = new TextBox();
75     private ToolTip maxRuntimeToolTip = new ToolTip(
76         "?",
77         "The number of minutes after the job starts running before the scheduler " +
78         "automatically aborts an incomplete job.");
79     private TextBox testRetry = new TextBox();
80     private ToolTip testRetryToolTip = new ToolTip(
81         "?",
82         "Number of times to retry test if the test did not complete successfully.");
83     private TextBox emailList = new TextBox();
84     private ToolTip emailListToolTip = new ToolTip(
85         "?",
86         "Email addresses to notify when this job completes. " +
87         "Use a comma or space to separate multiple addresses.");
88     private CheckBoxImpl skipVerify = new CheckBoxImpl();
89     private ToolTip skipVerifyToolTip = new ToolTip(
90         "?",
91         "Skips the host verification step before running the job. " +
92         "This is useful for machine reinstalls, for example.");
93     private CheckBoxImpl skipReset = new CheckBoxImpl();
94     private ToolTip skipResetToolTip = new ToolTip(
95         "?",
96         "Skips the host reset step before running the job.");
97     private RadioChooserDisplay rebootBefore = new RadioChooserDisplay();
98     private ToolTip rebootBeforeToolTip = new ToolTip(
99         "?",
100         "Reboots all assigned hosts before the job runs. " +
101         "Click If dirty to reboot the host only if it hasn’t been rebooted " +
102         "since it was added, locked, or after running the last job.");
103     private RadioChooserDisplay rebootAfter = new RadioChooserDisplay();
104     private ToolTip rebootAfterToolTip = new ToolTip(
105         "?",
106         "Reboots all assigned hosts after the job runs. Click If all tests passed " +
107         "to skip rebooting the host if any test in the job fails.");
108     private CheckBox parseFailedRepair = new CheckBox();
109     private ToolTip parseFailedRepairToolTip = new ToolTip(
110         "?",
111         "When a host fails repair, displays repair and verify test entries in " +
112         "the results database along with a SERVER_JOB entry. " +
113         "Otherwise, no information is displayed in TKO (Result Database).");
114     private CheckBoxImpl hostless = new CheckBoxImpl();
115     private ToolTip hostlessToolTip = new ToolTip(
116         "?",
117         "Check to run a suite of tests, and select Server from the Test type dropdown list.");
118     private CheckBoxImpl require_ssp = new CheckBoxImpl();
119     private ToolTip require_sspToolTip = new ToolTip(
120         "?",
121         "Check to force a server side test to use server-side packaging. This " +
122         "option has no effect on suite job. Test jobs created by a suite job " +
123         "will use SSP if enable_ssp_container is set to True in global config " +
124         "and there exists a drone supporting SSP.");
125     private TextBox pool = new TextBox();
126     private ToolTip poolToolTip = new ToolTip(
127         "?",
128         "Specify the pool of machines to use for suite job.");
129     private TextBoxImpl args = new TextBoxImpl();
130     private ToolTip argsToolTip = new ToolTip(
131         "?",
132         "Example: \"device_addrs=00:1F:20:33:6A:1E, arg2=value2, arg3=value3\". " +
133         "Separate multiple args with commas.");
134     private TextBoxImpl firmwareRWBuild = new TextBoxImpl();
135     private ToolTip firmwareRWBuildToolTip = new ToolTip(
136         "?",
137         "Name of the firmware build to update RW firmware of the DUT. Example: " +
138         "\"x86-alex-firmware/R41-6588.9.0\". If no firmware build is specified, " +
139         "the RW firmware of the DUT will not be updated.");
140     private TextBoxImpl firmwareROBuild = new TextBoxImpl();
141     private ToolTip firmwareROBuildToolTip = new ToolTip(
142         "?",
143         "Name of the firmware build to update RO firmware of the DUT. Example: " +
144         "\"x86-alex-firmware/R41-6588.9.0\". If no firmware RO build is specified, " +
145         "the RO firmware of the DUT will not be updated.");
146     private ExtendedListBox testSourceBuildList = new ExtendedListBox();
147     private ToolTip testSourceBuildListToolTip = new ToolTip(
148         "?",
149         "The image/build from which the tests will be fetched and ran from. It can " +
150         "be one of the specified Build Image, Firmware RW Build or the Firmware RO Build.");
151     private TestSelectorDisplay testSelector = new TestSelectorDisplay();
152     private CheckBoxPanelDisplay profilersPanel = new CheckBoxPanelDisplay(CHECKBOX_PANEL_COLUMNS);
153     private CheckBoxImpl runNonProfiledIteration =
154         new CheckBoxImpl("Run each test without profilers first");
155     private ExtendedListBox droneSet = new ExtendedListBox();
156     private TextAreaImpl controlFile = new TextAreaImpl();
157     private DisclosurePanel controlFilePanel = new DisclosurePanel("");
158     private ControlTypeSelectDisplay controlTypeSelect = new ControlTypeSelectDisplay();
159     private TextBoxImpl synchCountInput = new TextBoxImpl();
160     private ButtonImpl editControlButton = new ButtonImpl();
161     private HostSelectorDisplay hostSelector = new HostSelectorDisplay();
162     private ButtonImpl submitJobButton = new ButtonImpl("Submit Job");
163     private Button createTemplateJobButton = new Button("Create Template Job");
164     private Button resetButton = new Button("Reset");
165     private Label viewLink = new Label("");
166     private DisclosurePanel advancedOptionsPanel = new DisclosurePanel("");
167     private DisclosurePanel firmwareBuildOptionsPanel = new DisclosurePanel("");
168 
initialize(HTMLPanel panel)169     public void initialize(HTMLPanel panel) {
170         jobName.addStyleName("jobname-image-boundedwidth");
171         image_url.addStyleName("jobname-image-boundedwidth");
172 
173         Panel profilerControls = new VerticalPanel();
174         profilerControls.add(profilersPanel);
175         profilerControls.add(runNonProfiledIteration);
176 
177         controlFile.setSize("100%", "30em");
178 
179         HorizontalPanel controlOptionsPanel = new HorizontalPanel();
180         controlOptionsPanel.setVerticalAlignment(HorizontalPanel.ALIGN_BOTTOM);
181         controlOptionsPanel.add(controlTypeSelect);
182         Label useLabel = new Label("Use");
183         useLabel.getElement().getStyle().setProperty("marginLeft", "1em");
184         synchCountInput.setSize("3em", ""); // set width only
185         synchCountInput.getElement().getStyle().setProperty("margin", "0 0.5em 0 0.5em");
186         controlOptionsPanel.add(useLabel);
187         controlOptionsPanel.add(synchCountInput);
188         controlOptionsPanel.add(new Label("host(s) per execution"));
189         Panel controlEditPanel = new VerticalPanel();
190         controlEditPanel.add(controlOptionsPanel);
191         controlEditPanel.add(controlFile);
192         controlEditPanel.setWidth("100%");
193 
194         Panel controlHeaderPanel = new HorizontalPanel();
195         controlHeaderPanel.add(controlFilePanel.getHeader());
196         controlHeaderPanel.add(viewLink);
197         controlHeaderPanel.add(editControlButton);
198 
199         controlFilePanel.setHeader(controlHeaderPanel);
200         controlFilePanel.add(controlEditPanel);
201         controlFilePanel.addStyleName("panel-boundedwidth");
202 
203         // Setup the Advanced options panel
204         advancedOptionsPanel.getHeaderTextAccessor().setText("Advanced Options");
205 
206         FlexTable advancedOptionsLayout = new FlexTable();
207 
208         Panel priorityPanel = new HorizontalPanel();
209         priorityPanel.add(priorityList);
210         priorityPanel.add(priorityListToolTip);
211         advancedOptionsLayout.setWidget(0, 0, new Label("Priority:"));
212         advancedOptionsLayout.setWidget(0, 1, priorityPanel);
213 
214         Panel timeoutPanel = new HorizontalPanel();
215         timeoutPanel.add(timeout);
216         timeoutPanel.add(timeoutToolTip);
217         advancedOptionsLayout.setWidget(3, 0, new Label("Timeout (minutes):"));
218         advancedOptionsLayout.setWidget(3, 1, timeoutPanel);
219 
220         Panel maxRuntimePanel = new HorizontalPanel();
221         maxRuntimePanel.add(maxRuntime);
222         maxRuntimePanel.add(maxRuntimeToolTip);
223         advancedOptionsLayout.setWidget(4, 0, new Label("Max runtime (minutes):"));
224         advancedOptionsLayout.setWidget(4, 1, maxRuntimePanel);
225 
226         Panel testRetryPanel = new HorizontalPanel();
227         testRetryPanel.add(testRetry);
228         testRetryPanel.add(testRetryToolTip);
229         advancedOptionsLayout.setWidget(5, 0, new Label("Test Retries: (optional)"));
230         advancedOptionsLayout.setWidget(5, 1, testRetryPanel);
231 
232         Panel emailListPanel = new HorizontalPanel();
233         emailListPanel.add(emailList);
234         emailListPanel.add(emailListToolTip);
235         advancedOptionsLayout.setWidget(6, 0, new Label("Email List: (optional)"));
236         advancedOptionsLayout.setWidget(6, 1, emailListPanel);
237 
238         Panel skipVerifyPanel = new HorizontalPanel();
239         skipVerifyPanel.add(skipVerify);
240         skipVerifyPanel.add(skipVerifyToolTip);
241         advancedOptionsLayout.setWidget(7, 0, new Label("Skip verify:"));
242         advancedOptionsLayout.setWidget(7, 1, skipVerifyPanel);
243 
244         Panel skipResetPanel = new HorizontalPanel();
245         skipResetPanel.add(skipReset);
246         skipResetPanel.add(skipResetToolTip);
247         advancedOptionsLayout.setWidget(8, 0, new Label("Skip reset:"));
248         advancedOptionsLayout.setWidget(8, 1, skipResetPanel);
249 
250         Panel rebootBeforePanel = new HorizontalPanel();
251         rebootBeforePanel.add(rebootBefore);
252         rebootBeforePanel.add(rebootBeforeToolTip);
253         advancedOptionsLayout.setWidget(9, 0, new Label("Reboot before:"));
254         advancedOptionsLayout.setWidget(9, 1, rebootBeforePanel);
255 
256         Panel rebootAfterPanel = new HorizontalPanel();
257         rebootAfterPanel.add(rebootAfter);
258         rebootAfterPanel.add(rebootAfterToolTip);
259         advancedOptionsLayout.setWidget(10, 0, new Label("Reboot after:"));
260         advancedOptionsLayout.setWidget(10, 1, rebootAfterPanel);
261 
262         Panel parseFailedRepairPanel = new HorizontalPanel();
263         parseFailedRepairPanel.add(parseFailedRepair);
264         parseFailedRepairPanel.add(parseFailedRepairToolTip);
265         advancedOptionsLayout.setWidget(11, 0, new Label("Include failed repair results:"));
266         advancedOptionsLayout.setWidget(11, 1, parseFailedRepairPanel);
267 
268         Panel hostlessPanel = new HorizontalPanel();
269         hostlessPanel.add(hostless);
270         hostlessPanel.add(hostlessToolTip);
271         advancedOptionsLayout.setWidget(12, 0, new Label("Hostless (Suite Job):"));
272         advancedOptionsLayout.setWidget(12, 1, hostlessPanel);
273 
274         Panel require_sspPanel = new HorizontalPanel();
275         require_sspPanel.add(require_ssp);
276         require_sspPanel.add(require_sspToolTip);
277         advancedOptionsLayout.setWidget(13, 0, new Label("Require server-side packaging:"));
278         advancedOptionsLayout.setWidget(13, 1, require_sspPanel);
279 
280         Panel poolPanel = new HorizontalPanel();
281         poolPanel.add(pool);
282         poolPanel.add(poolToolTip);
283         advancedOptionsLayout.setWidget(14, 0, new Label("Pool: (optional)"));
284         advancedOptionsLayout.setWidget(14, 1, poolPanel);
285 
286         Panel argsPanel = new HorizontalPanel();
287         argsPanel.add(args);
288         argsPanel.add(argsToolTip);
289         advancedOptionsLayout.setWidget(15, 0, new Label("Args: (optional)"));
290         advancedOptionsLayout.setWidget(15, 1, argsPanel);
291 
292         advancedOptionsLayout.setWidget(16, 0, new Label("Profilers: (optional)"));
293         advancedOptionsLayout.setWidget(16, 1, profilerControls);
294 
295         HTMLTable.RowFormatter advOptLayoutFormatter = advancedOptionsLayout.getRowFormatter();
296         for (int row = 0; row < advancedOptionsLayout.getRowCount(); ++row)
297         {
298           if (row % 2 == 0) {
299               advOptLayoutFormatter.addStyleName(row, "data-row");
300           }
301           else {
302               advOptLayoutFormatter.addStyleName(row, "data-row-alternate");
303           }
304 
305         }
306         advancedOptionsLayout.setWidth("100%");
307         advancedOptionsPanel.addStyleName("panel-boundedwidth");
308         advancedOptionsPanel.add(advancedOptionsLayout);
309 
310         // Setup the Firmware Build options panel
311         firmwareBuildOptionsPanel.getHeaderTextAccessor().setText("Firmware Build Options (optional)");
312         FlexTable firmwareBuildOptionsLayout = new FlexTable();
313 
314         firmwareBuildOptionsLayout.getFlexCellFormatter().setColSpan(0, 0, 2);
315         firmwareBuildOptionsLayout.setWidget(0, 0, new Label("Image URL/Build must be specified for " +
316             "updating the firmware of the test device with given firmware build. A servo may be " +
317             "required to be attached to the test device in order to have firmware updated."));
318 
319         Panel firmwareRWBuildPanel = new HorizontalPanel();
320         firmwareRWBuild.addStyleName("jobname-image-boundedwidth");
321         firmwareRWBuildPanel.add(firmwareRWBuild);
322         firmwareRWBuildPanel.add(firmwareRWBuildToolTip);
323         firmwareBuildOptionsLayout.setWidget(1, 0, new Label("Firmware RW build:"));
324         firmwareBuildOptionsLayout.setWidget(1, 1, firmwareRWBuildPanel);
325 
326         Panel firmwareROBuildPanel = new HorizontalPanel();
327         firmwareROBuild.addStyleName("jobname-image-boundedwidth");
328         firmwareROBuildPanel.add(firmwareROBuild);
329         firmwareROBuildPanel.add(firmwareROBuildToolTip);
330         firmwareBuildOptionsLayout.setWidget(2, 0, new Label("Firmware RO build:"));
331         firmwareBuildOptionsLayout.setWidget(2, 1, firmwareROBuildPanel);
332 
333         firmwareBuildOptionsLayout.setWidth("100%");
334         firmwareBuildOptionsPanel.addStyleName("panel-boundedwidth");
335         firmwareBuildOptionsPanel.add(firmwareBuildOptionsLayout);
336         firmwareRWBuild.setEnabled(false);
337         firmwareROBuild.setEnabled(false);
338 
339         testSourceBuildList.getElement().getStyle().setProperty("minWidth", "15em");
340 
341         fetchTestsCheckBox.setEnabled(false);
342         // Add the remaining widgets to the main panel
343         panel.add(jobName, "create_job_name");
344         panel.add(jobNameToolTip, "create_job_name");
345         panel.add(image_url, "create_image_url");
346         panel.add(image_urlToolTip, "create_image_url");
347         panel.add(testSourceBuildList, "create_test_source_build");
348         panel.add(testSourceBuildListToolTip, "create_test_source_build");
349         panel.add(fetchTestsCheckBox, "fetch_tests_from_build");
350         panel.add(testSelector, "create_tests");
351         panel.add(controlFilePanel, "create_edit_control");
352         panel.add(hostSelector, "create_host_selector");
353         panel.add(submitJobButton, "create_submit");
354         panel.add(createTemplateJobButton, "create_template_job");
355         panel.add(resetButton, "create_reset");
356         panel.add(droneSet, "create_drone_set");
357 
358         panel.add(advancedOptionsPanel, "create_advanced_options");
359         panel.add(firmwareBuildOptionsPanel, "create_firmware_build_options");
360     }
361 
getCheckBoxPanelDisplay()362     public CheckBoxPanel.Display getCheckBoxPanelDisplay() {
363         return profilersPanel;
364     }
365 
getControlTypeSelectDisplay()366     public ControlTypeSelect.Display getControlTypeSelectDisplay() {
367         return controlTypeSelect;
368     }
369 
getControlFile()370     public ITextArea getControlFile() {
371         return controlFile;
372     }
373 
getControlFilePanelClose()374     public HasCloseHandlers<DisclosurePanel> getControlFilePanelClose() {
375         return controlFilePanel;
376     }
377 
getControlFilePanelOpen()378     public HasOpenHandlers<DisclosurePanel> getControlFilePanelOpen() {
379         return controlFilePanel;
380     }
381 
getCreateTemplateJobButton()382     public HasClickHandlers getCreateTemplateJobButton() {
383         return createTemplateJobButton;
384     }
385 
getDroneSet()386     public SimplifiedList getDroneSet() {
387         return droneSet;
388     }
389 
getEditControlButton()390     public IButton getEditControlButton() {
391         return editControlButton;
392     }
393 
getEmailList()394     public HasText getEmailList() {
395         return emailList;
396     }
397 
getHostSelectorDisplay()398     public HostSelector.Display getHostSelectorDisplay() {
399         return hostSelector;
400     }
401 
getHostless()402     public ICheckBox getHostless() {
403         return hostless;
404     }
405 
getRequireSSP()406     public ICheckBox getRequireSSP() {
407       return require_ssp;
408     }
409 
getPool()410     public HasText getPool() {
411         return pool;
412     }
413 
getArgs()414     public ITextBox getArgs() {
415         return args;
416     }
417 
getJobName()418     public HasText getJobName() {
419         return jobName;
420     }
421 
getImageUrl()422     public ITextBox getImageUrl() {
423         return image_url;
424     }
425 
getMaxRuntime()426     public HasText getMaxRuntime() {
427         return maxRuntime;
428     }
429 
getTestRetry()430     public HasText getTestRetry() {
431         return testRetry;
432     }
433 
getParseFailedRepair()434     public HasValue<Boolean> getParseFailedRepair() {
435         return parseFailedRepair;
436     }
437 
getPriorityList()438     public ExtendedListBox getPriorityList() {
439         return priorityList;
440     }
441 
getRebootAfter()442     public RadioChooser.Display getRebootAfter() {
443         return rebootAfter;
444     }
445 
getRebootBefore()446     public RadioChooser.Display getRebootBefore() {
447         return rebootBefore;
448     }
449 
getResetButton()450     public HasClickHandlers getResetButton() {
451         return resetButton;
452     }
453 
getRunNonProfiledIteration()454     public ICheckBox getRunNonProfiledIteration() {
455         return runNonProfiledIteration;
456     }
457 
getSkipVerify()458     public ICheckBox getSkipVerify() {
459         return skipVerify;
460     }
461 
getSkipReset()462     public ICheckBox getSkipReset() {
463       return skipReset;
464     }
465 
getSubmitJobButton()466     public IButton getSubmitJobButton() {
467         return submitJobButton;
468     }
469 
getSynchCountInput()470     public ITextBox getSynchCountInput() {
471         return synchCountInput;
472     }
473 
getTestSelectorDisplay()474     public TestSelector.Display getTestSelectorDisplay() {
475         return testSelector;
476     }
477 
getTimeout()478     public HasText getTimeout() {
479         return timeout;
480     }
481 
getViewLink()482     public HasText getViewLink() {
483         return viewLink;
484     }
485 
setControlFilePanelOpen(boolean isOpen)486     public void setControlFilePanelOpen(boolean isOpen) {
487         controlFilePanel.setOpen(isOpen);
488     }
489 
getFetchTestsFromBuildCheckBox()490     public ICheckBox getFetchTestsFromBuildCheckBox() {
491       return fetchTestsCheckBox;
492     }
493 
getFirmwareRWBuild()494     public ITextBox getFirmwareRWBuild() {
495       return firmwareRWBuild;
496     }
497 
getFirmwareROBuild()498     public ITextBox getFirmwareROBuild() {
499       return firmwareROBuild;
500     }
501 
getTestSourceBuildList()502     public ExtendedListBox getTestSourceBuildList() {
503       return testSourceBuildList;
504     }
505 }
506