Skip to content

Commit

Permalink
Merge pull request #1926 from jayantpatil1234/CS-50157
Browse files Browse the repository at this point in the history
CLOUDSTACK-9768: Time displayed for events in UI is incorrectTime displayed for events in UI is incorrect. Let's say, when we login using Japanese language the time displayed in the events is GMT instead of JST. However with English language the time is JST, as expected.
Example:
Time is displayed in the event is 10:40, if you are logged in using English language.
Whereas, time in the event shows 19:40 If you login with Japanese language.

* pr/1926:
  CLOUDSTACK-9768: Time displayed for events in UI is incorrect

Signed-off-by: Rajani Karuturi <rajani.karuturi@accelerite.com>
  • Loading branch information
karuturi committed Feb 21, 2017
2 parents 1d1b503 + b468fde commit 987be62
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/src/org/apache/cloudstack/api/ApiConstants.java
Expand Up @@ -263,6 +263,7 @@ public class ApiConstants {
public static final String ISO_ID = "isoid";
public static final String TIMEOUT = "timeout";
public static final String TIMEZONE = "timezone";
public static final String TIMEZONEOFFSET = "timezoneoffset";
public static final String TYPE = "type";
public static final String TRUST_STORE = "truststore";
public static final String TRUST_STORE_PASSWORD = "truststorepass";
Expand Down
10 changes: 10 additions & 0 deletions api/src/org/apache/cloudstack/api/response/LoginCmdResponse.java
Expand Up @@ -58,6 +58,10 @@ public class LoginCmdResponse extends AuthenticationCmdResponse {
@Param(description = "user time zone")
private String timeZone;

@SerializedName(value = ApiConstants.TIMEZONEOFFSET)
@Param(description = "user time zoneoffset")
private String timeZoneOffset;

@SerializedName(value = ApiConstants.REGISTERED)
@Param(description = "Is user registered")
private String registered;
Expand Down Expand Up @@ -138,6 +142,12 @@ public void setTimeZone(String timeZone) {
this.timeZone = timeZone;
}

public String getTimeZoneOffset() {
return timeZoneOffset;
}

public void setTimeZoneOffset(String timeZoneOffset) { this.timeZoneOffset = timeZoneOffset; }

public String getRegistered() {
return registered;
}
Expand Down
3 changes: 3 additions & 0 deletions server/src/com/cloud/api/ApiServer.java
Expand Up @@ -987,6 +987,9 @@ private ResponseObject createLoginResponse(HttpSession session) {
if (ApiConstants.TIMEZONE.equalsIgnoreCase(attrName)) {
response.setTimeZone(attrObj.toString());
}
if (ApiConstants.TIMEZONEOFFSET.equalsIgnoreCase(attrName)) {
response.setTimeZoneOffset(attrObj.toString());
}
if (ApiConstants.REGISTERED.equalsIgnoreCase(attrName)) {
response.setRegistered(attrObj.toString());
}
Expand Down
6 changes: 6 additions & 0 deletions ui/scripts/cloudStack.js
Expand Up @@ -120,6 +120,7 @@
g_username = unBoxCookieValue('username');
g_userfullname = unBoxCookieValue('userfullname');
g_timezone = unBoxCookieValue('timezone');
g_timezoneoffset = unBoxCookieValue('timezoneoffset');
} else { //single-sign-on (bypass login screen)
g_sessionKey = encodeURIComponent(g_loginResponse.sessionkey);
g_role = g_loginResponse.type;
Expand All @@ -129,6 +130,7 @@
g_domainid = g_loginResponse.domainid;
g_userfullname = g_loginResponse.firstname + ' ' + g_loginResponse.lastname;
g_timezone = g_loginResponse.timezone;
g_timezoneoffset = g_loginResponse.timezoneoffset;
}

var userValid = false;
Expand Down Expand Up @@ -258,6 +260,7 @@
g_account = loginresponse.account;
g_domainid = loginresponse.domainid;
g_timezone = loginresponse.timezone;
g_timezoneoffset = loginresponse.timezoneoffset;
g_userfullname = loginresponse.firstname + ' ' + loginresponse.lastname;

$.cookie('username', g_username, {
Expand All @@ -275,6 +278,9 @@
$.cookie('timezone', g_timezone, {
expires: 1
});
$.cookie('timezoneoffset', g_timezoneoffset, {
expires: 1
});
$.cookie('userfullname', g_userfullname, {
expires: 1
});
Expand Down

0 comments on commit 987be62

Please sign in to comment.