You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/07/07 20:16:33 UTC
[16/50] [abbrv] git commit: implement new module tab on coordinator
web UI for better user exprerience
implement new module tab on coordinator web UI for better user exprerience
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/1d1eed1a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/1d1eed1a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/1d1eed1a
Branch: refs/heads/two-dot-o
Commit: 1d1eed1a1277fbe930e60da2a1b3ae7b2cfd6d1e
Parents: 97e5dfb
Author: Salih Kardan <ka...@gmail.com>
Authored: Fri Jun 27 20:51:48 2014 +0300
Committer: Salih Kardan <ka...@gmail.com>
Committed: Fri Jun 27 20:51:48 2014 +0300
----------------------------------------------------------------------
.../webapp/view/chart/layout/ChartLayout.java | 12 +++-
.../chop/webapp/view/main/MainView.java | 4 +-
.../chop/webapp/view/module/ModuleLayout.java | 73 ++++++++++++++++++++
3 files changed, 87 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1d1eed1a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/chart/layout/ChartLayout.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/chart/layout/ChartLayout.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/chart/layout/ChartLayout.java
index 514f902..e278dbe 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/chart/layout/ChartLayout.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/chart/layout/ChartLayout.java
@@ -21,6 +21,7 @@ package org.apache.usergrid.chop.webapp.view.chart.layout;
import java.util.Set;
+import com.vaadin.ui.Notification;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@@ -131,11 +132,14 @@ public class ChartLayout extends AbsoluteLayout implements JavaScriptFunction {
testNameCombo.setWidth( "155px" );
metricCombo = UIUtil.createCombo( "Metric:", Metric.values() );
+ metricCombo.setWidth( "155px" );
percentileCombo = UIUtil.createCombo( "Percentile:",
new String[] { "100", "90", "80", "70", "60", "50", "40", "30", "20", "10" } );
+ percentileCombo.setWidth( "155px" );
failureCombo = UIUtil.createCombo( "Points to Plot:", FailureType.values() );
+ failureCombo.setWidth( "155px" );
Button submitButton = new Button("Submit");
submitButton.addClickListener(new Button.ClickListener() {
@@ -181,6 +185,12 @@ public class ChartLayout extends AbsoluteLayout implements JavaScriptFunction {
public void loadChart() {
+ Params params = getParams();
+ if ( params.getTestName() == null ){
+ Notification.show( "Warning", "You don't have run results yet !!!", Notification.Type.WARNING_MESSAGE );
+ return;
+ }
+
// BUG: If common.js is loaded separately its content is not visible later
String chartContent = FileUtil.getContent( "js/common.js" ) + FileUtil.getContent( chartFile );
Chart chart = chartBuilder.getChart( getParams() );
@@ -207,4 +217,4 @@ public class ChartLayout extends AbsoluteLayout implements JavaScriptFunction {
detailsTable.setContent( json );
noteLayout.load( params.getCommitId(), params.getRunNumber() );
}
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1d1eed1a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/main/MainView.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/main/MainView.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/main/MainView.java
index db16360..0127093 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/main/MainView.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/main/MainView.java
@@ -28,6 +28,7 @@ import com.vaadin.ui.UI;
import com.vaadin.ui.TabSheet;
import org.apache.usergrid.chop.webapp.service.chart.Params;
import org.apache.usergrid.chop.webapp.service.shiro.ShiroRealm;
+import org.apache.usergrid.chop.webapp.view.module.ModuleLayout;
import org.apache.usergrid.chop.webapp.view.chart.layout.OverviewChartLayout;
import org.apache.usergrid.chop.webapp.view.log.LogLayout;
import org.apache.usergrid.chop.webapp.view.module.ModuleListWindow;
@@ -71,7 +72,8 @@ public class MainView extends VerticalLayout implements ModuleSelectListener {
modules.addClickListener( new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent clickEvent) {
- UI.getCurrent().addWindow( new ModuleListWindow( MainView.this ) );
+// UI.getCurrent().addWindow( new ModuleListWindow( MainView.this ) );
+ tabSheetManager.addTabWithVerticalLayout( new ModuleLayout( MainView.this ), "Modules" );
}
});
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1d1eed1a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleLayout.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleLayout.java b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleLayout.java
new file mode 100644
index 0000000..6c6d7d0
--- /dev/null
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/view/module/ModuleLayout.java
@@ -0,0 +1,73 @@
+package org.apache.usergrid.chop.webapp.view.module;
+
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
+import org.apache.usergrid.chop.api.Module;
+import org.apache.usergrid.chop.webapp.dao.ModuleDao;
+import org.apache.usergrid.chop.webapp.service.InjectorFactory;
+import org.apache.usergrid.chop.webapp.view.module.ModuleSelectListener;
+
+import java.util.List;
+
+
+public class ModuleLayout extends VerticalLayout{
+
+ private final ModuleSelectListener listener;
+
+ public ModuleLayout ( ModuleSelectListener listener ){
+ this.listener = listener;
+ Table userTable = addTable();
+ addComponent( userTable );
+ setComponentAlignment( userTable, Alignment.MIDDLE_CENTER );
+ }
+
+
+ public Table addTable( ){
+ Table table = new Table(" \n ");
+ table.setHeight( "500px" );
+ table.setWidth( "700px" );
+
+ table.addContainerProperty( "Group", Label.class, null );
+ table.addContainerProperty( "Artifact", Label.class, null );
+ table.addContainerProperty( "Version", Label.class, null );
+ table.addContainerProperty( "Results", Button.class, null );
+
+ loadData( table );
+ return table;
+ }
+
+ private void onItemClick( String id) {
+ listener.onModuleSelect( id );
+ }
+
+ public void loadData( Table userTable ){
+ ModuleDao moduleDao = InjectorFactory.getInstance( ModuleDao.class );
+ List<Module> modules = moduleDao.getAll();
+ for( final Module module : modules ) {
+ Label groupLabel = new Label( module.getGroupId( ) );
+ Label artifactLabel = new Label( module.getArtifactId( ) );
+ Label versionLabel = new Label( module.getVersion( ) );
+
+ // The Table item identifier for the row.
+ String itemId = new String( module.getId( ) );
+
+ // Create a button and handle its click. A Button does not
+ // know the item it is contained in, so we have to store the
+ // item ID as user-defined data.
+ Button detailsField = new Button( "show details" );
+ detailsField.setId( itemId );
+ detailsField.setData( itemId );
+ detailsField.addStyleName( "link" );
+ detailsField.addClickListener( new Button.ClickListener( ) {
+ @Override
+ public void buttonClick( Button.ClickEvent event ) {
+ onItemClick( module.getId() );
+ }
+ } );
+ userTable.addItem( new Object[]{ groupLabel, artifactLabel, versionLabel, detailsField }, module.getId( ) );
+ }
+ }
+}
\ No newline at end of file