← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16361: Dashboard. Remembering the current dashboard per-user basis.

 

------------------------------------------------------------
revno: 16361
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2014-08-09 16:36:38 +0200
message:
  Dashboard. Remembering the current dashboard per-user basis.
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/CurrentUserController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/webdomain/user/UserAccount.java
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/CurrentUserController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/CurrentUserController.java	2014-07-29 08:52:03 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/CurrentUserController.java	2014-08-09 14:36:38 +0000
@@ -193,6 +193,7 @@
         UserAccount userAccount = new UserAccount();
 
         // user account
+        userAccount.setUsername( currentUser.getUsername() );
         userAccount.setFirstName( currentUser.getFirstName() );
         userAccount.setSurname( currentUser.getSurname() );
         userAccount.setEmail( currentUser.getEmail() );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/webdomain/user/UserAccount.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/webdomain/user/UserAccount.java	2014-05-22 12:40:24 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/webdomain/user/UserAccount.java	2014-08-09 14:36:38 +0000
@@ -39,6 +39,8 @@
 public class UserAccount
 {
     // user account
+    private String username;
+    
     private String firstName;
 
     private String surname;
@@ -72,6 +74,17 @@
     {
     }
 
+    @JsonProperty
+    public String getUsername()
+    {
+        return username;
+    }
+    
+    public void setUsername( String username )
+    {
+        this.username = username;
+    }
+    
     @JsonProperty( required = true )
     public String getFirstName()
     {

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js	2014-07-25 09:36:28 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js	2014-08-09 14:36:38 +0000
@@ -1,7 +1,7 @@
 
 dhis2.util.namespace( 'dhis2.db' );
 
-dhis2.db.currentKey = "dhis2.dashboard.current";
+dhis2.db.currentKey = undefined;
 
 dhis2.db.current = function() 
 {
@@ -49,7 +49,10 @@
 	$( "#searchField" ).focus();
 	$( "#searchField" ).keyup( dhis2.db.search );
 	
-	dhis2.db.renderDashboardListLoadFirst();
+	$.getJSON( "../api/me/user-account.json", function( json ) {
+		dhis2.db.currentKey = "dhis2.dashboard.current." + json.username;
+		dhis2.db.renderDashboardListLoadFirst();
+	} );
 } );
 
 //------------------------------------------------------------------------------