@Override public void onSelectionChange(SelectionChangeEvent event) { // Currently selection model for sessions is a single selection model Set<SessionDataDto> selected = ((MultiSelectionModel<SessionDataDto>) event.getSource()).getSelectedSet(); // Refresh summary chosenMetrics.clear(); chosenPlots.clear(); summaryPanel.updateSessions(selected); // Clear plots display plotPanel.clear(); plotTrendsPanel.clear(); // Clear markings dto map markingsMap.clear(); testDataGrid.setRowData(Collections.EMPTY_LIST); chosenSessions.clear(); sessionPlotPanel.clearPlots(); if (selected.isEmpty()) { ((MultiSelectionModel) testDataGrid.getSelectionModel()).clear(); return; } final Set<String> sessionIds = new HashSet<String>(); for (SessionDataDto sessionDataDto : selected) { sessionIds.add(sessionDataDto.getSessionId()); chosenSessions.add(sessionDataDto.getSessionId()); } Collections.sort( chosenSessions, new Comparator<String>() { @Override public int compare(String o1, String o2) { return (Long.parseLong(o2) - Long.parseLong(o1)) > 0 ? 0 : 1; } }); TaskDataService.Async.getInstance() .getTaskDataForSessions( sessionIds, new AsyncCallback<List<TaskDataDto>>() { @Override public void onFailure(Throwable caught) { caught.printStackTrace(); } @Override public void onSuccess(List<TaskDataDto> result) { updateTests(result); } }); }
private void initData(SessionDataDto sessionData) { Label name = new Label("Session #" + sessionData.getSessionId()); name.setStyleName(JaggerResources.INSTANCE.css().sessionNameHeader()); add(name); Grid summaryGrid = new Grid(6, 2); summaryGrid.getElement().getStyle().setProperty("margin", "40px"); Label sessionLabel = new Label("Session id"); sessionLabel.getElement().getStyle().setFontWeight(Style.FontWeight.BOLD); summaryGrid.setWidget(0, 0, sessionLabel); summaryGrid.setWidget(0, 1, new Label(sessionData.getSessionId())); Label startTimeLabel = new Label("Session start time"); startTimeLabel.getElement().getStyle().setFontWeight(Style.FontWeight.BOLD); summaryGrid.setWidget(1, 0, startTimeLabel); summaryGrid.setWidget(1, 1, new Label(sessionData.getStartDate())); Label endTimeLabel = new Label("Session end time"); endTimeLabel.getElement().getStyle().setFontWeight(Style.FontWeight.BOLD); summaryGrid.setWidget(2, 0, endTimeLabel); summaryGrid.setWidget(2, 1, new Label(sessionData.getEndDate())); Label numberTasksLabel = new Label("Number of tasks"); numberTasksLabel.getElement().getStyle().setFontWeight(Style.FontWeight.BOLD); summaryGrid.setWidget(3, 0, numberTasksLabel); summaryGrid.setWidget(3, 1, new Label(Integer.toString(sessionData.getTasksExecuted()))); Label failuresLabel = new Label("Number of task failures"); failuresLabel.getElement().getStyle().setFontWeight(Style.FontWeight.BOLD); summaryGrid.setWidget(4, 0, failuresLabel); summaryGrid.setWidget(4, 1, new Label(Integer.toString(sessionData.getTasksFailed()))); Label activeKernels = new Label("Number of active kernels"); activeKernels.getElement().getStyle().setFontWeight(Style.FontWeight.BOLD); summaryGrid.setWidget(5, 0, activeKernels); summaryGrid.setWidget(5, 1, new Label(Integer.toString(sessionData.getActiveKernelsCount()))); add(summaryGrid); Label testPanelName = new Label("Tests"); testPanelName.addStyleName(JaggerResources.INSTANCE.css().testNameHeader()); add(testPanelName); add(testPanel); }
public void addTest(TaskDataDto test) { WorkloadTaskDataService.Async.getInstance() .getWorkloadTaskData( session.getSessionId(), test.getId(), new AsyncCallback<WorkloadTaskDataDto>() { @Override public void onFailure(Throwable caught) { caught.printStackTrace(); } @Override public void onSuccess(WorkloadTaskDataDto result) { TestPanel test = new TestPanel(result); testPanel.add(test); testPanels.put(result.getName(), test); } }); }
private void filterSessions(Set<SessionDataDto> sessionDataDtoSet) { if (sessionDataDtoSet == null || sessionDataDtoSet.isEmpty()) { sessionIdsTextBox.setText(null); stopTypingSessionIdsTimer.schedule(10); return; } final StringBuilder builder = new StringBuilder(); boolean first = true; for (SessionDataDto sessionDataDto : sessionDataDtoSet) { if (!first) { builder.append("/"); } builder.append(sessionDataDto.getSessionId()); first = false; } sessionIdsTextBox.setText(builder.toString()); stopTypingSessionIdsTimer.schedule(10); }
@UiHandler("getHyperlink") void getHyperlink(ClickEvent event) { MultiSelectionModel<SessionDataDto> sessionModel = (MultiSelectionModel) sessionsDataGrid.getSelectionModel(); MultiSelectionModel<TaskDataDto> testModel = (MultiSelectionModel) testDataGrid.getSelectionModel(); Set<SessionDataDto> sessions = sessionModel.getSelectedSet(); Set<TaskDataDto> tests = testModel.getSelectedSet(); Set<MetricNameDto> metrics = metricPanel.getSelected(); TaskDataTreeViewModel taskDataTreeViewModel = (TaskDataTreeViewModel) taskDetailsTree.getTreeViewModel(); Set<PlotNameDto> trends = taskDataTreeViewModel.getSelectionModel().getSelectedSet(); HashSet<String> sessionsIds = new HashSet<String>(); HashSet<TestsMetrics> testsMetricses = new HashSet<TestsMetrics>(tests.size()); HashMap<String, TestsMetrics> map = new HashMap<String, TestsMetrics>(tests.size()); for (SessionDataDto session : sessions) { sessionsIds.add(session.getSessionId()); } for (TaskDataDto taskDataDto : tests) { TestsMetrics testsMetrics = new TestsMetrics(taskDataDto.getTaskName(), new HashSet<String>(), new HashSet<String>()); testsMetricses.add(testsMetrics); map.put(taskDataDto.getTaskName(), testsMetrics); } for (MetricNameDto metricNameDto : metrics) { map.get(metricNameDto.getTests().getTaskName()).getMetrics().add(metricNameDto.getName()); } for (PlotNameDto plotNameDto : trends) { map.get(plotNameDto.getTest().getTaskName()).getTrends().add(plotNameDto.getPlotName()); } TrendsPlace newPlace = new TrendsPlace( mainTabPanel.getSelectedIndex() == 0 ? NameTokens.SUMMARY : mainTabPanel.getSelectedIndex() == 1 ? NameTokens.TRENDS : NameTokens.METRICS); newPlace.setSelectedSessionIds(sessionsIds); newPlace.setSelectedTestsMetrics(testsMetricses); newPlace.setSessionTrends(sessionPlotPanel.getSelected()); String linkText = Window.Location.getHost() + Window.Location.getPath() + Window.Location.getQueryString() + "#" + new JaggerPlaceHistoryMapper().getToken(newPlace); linkText = URL.encode(linkText); // create a dialog for copy link final DialogBox dialog = new DialogBox(false, true); dialog.setText("Share link"); dialog.setModal(true); dialog.setAutoHideEnabled(true); dialog.setPopupPosition(event.getClientX(), event.getClientY()); final TextArea textArea = new TextArea(); textArea.setText(linkText); textArea.setWidth("300px"); textArea.setHeight("40px"); // select text Scheduler.get() .scheduleDeferred( new Scheduler.ScheduledCommand() { @Override public void execute() { textArea.setVisible(true); textArea.setFocus(true); textArea.selectAll(); } }); dialog.add(textArea); dialog.show(); }