Skip to content

Commit 987be62

Browse files
committed
Merge pull request apache#1926 from jayantpatil1234/CS-50157
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>
2 parents 1d1b503 + b468fde commit 987be62

4 files changed

Lines changed: 20 additions & 0 deletions

File tree

api/src/org/apache/cloudstack/api/ApiConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ public class ApiConstants {
263263
public static final String ISO_ID = "isoid";
264264
public static final String TIMEOUT = "timeout";
265265
public static final String TIMEZONE = "timezone";
266+
public static final String TIMEZONEOFFSET = "timezoneoffset";
266267
public static final String TYPE = "type";
267268
public static final String TRUST_STORE = "truststore";
268269
public static final String TRUST_STORE_PASSWORD = "truststorepass";

api/src/org/apache/cloudstack/api/response/LoginCmdResponse.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ public class LoginCmdResponse extends AuthenticationCmdResponse {
5858
@Param(description = "user time zone")
5959
private String timeZone;
6060

61+
@SerializedName(value = ApiConstants.TIMEZONEOFFSET)
62+
@Param(description = "user time zoneoffset")
63+
private String timeZoneOffset;
64+
6165
@SerializedName(value = ApiConstants.REGISTERED)
6266
@Param(description = "Is user registered")
6367
private String registered;
@@ -138,6 +142,12 @@ public void setTimeZone(String timeZone) {
138142
this.timeZone = timeZone;
139143
}
140144

145+
public String getTimeZoneOffset() {
146+
return timeZoneOffset;
147+
}
148+
149+
public void setTimeZoneOffset(String timeZoneOffset) { this.timeZoneOffset = timeZoneOffset; }
150+
141151
public String getRegistered() {
142152
return registered;
143153
}

server/src/com/cloud/api/ApiServer.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,9 @@ private ResponseObject createLoginResponse(HttpSession session) {
987987
if (ApiConstants.TIMEZONE.equalsIgnoreCase(attrName)) {
988988
response.setTimeZone(attrObj.toString());
989989
}
990+
if (ApiConstants.TIMEZONEOFFSET.equalsIgnoreCase(attrName)) {
991+
response.setTimeZoneOffset(attrObj.toString());
992+
}
990993
if (ApiConstants.REGISTERED.equalsIgnoreCase(attrName)) {
991994
response.setRegistered(attrObj.toString());
992995
}

ui/scripts/cloudStack.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
g_username = unBoxCookieValue('username');
121121
g_userfullname = unBoxCookieValue('userfullname');
122122
g_timezone = unBoxCookieValue('timezone');
123+
g_timezoneoffset = unBoxCookieValue('timezoneoffset');
123124
} else { //single-sign-on (bypass login screen)
124125
g_sessionKey = encodeURIComponent(g_loginResponse.sessionkey);
125126
g_role = g_loginResponse.type;
@@ -129,6 +130,7 @@
129130
g_domainid = g_loginResponse.domainid;
130131
g_userfullname = g_loginResponse.firstname + ' ' + g_loginResponse.lastname;
131132
g_timezone = g_loginResponse.timezone;
133+
g_timezoneoffset = g_loginResponse.timezoneoffset;
132134
}
133135

134136
var userValid = false;
@@ -258,6 +260,7 @@
258260
g_account = loginresponse.account;
259261
g_domainid = loginresponse.domainid;
260262
g_timezone = loginresponse.timezone;
263+
g_timezoneoffset = loginresponse.timezoneoffset;
261264
g_userfullname = loginresponse.firstname + ' ' + loginresponse.lastname;
262265

263266
$.cookie('username', g_username, {
@@ -275,6 +278,9 @@
275278
$.cookie('timezone', g_timezone, {
276279
expires: 1
277280
});
281+
$.cookie('timezoneoffset', g_timezoneoffset, {
282+
expires: 1
283+
});
278284
$.cookie('userfullname', g_userfullname, {
279285
expires: 1
280286
});

0 commit comments

Comments
 (0)