YARN-8961. [UI2] Flow Run End Time shows 'Invalid date'. Contributed by Akhil PB

(cherry picked from commit c726445990)
This commit is contained in:
Sunil G 2019-01-24 15:01:43 +05:30
parent 2471d8a6e7
commit 45c4df152f
2 changed files with 18 additions and 4 deletions

View File

@ -37,9 +37,9 @@ export default DS.JSONAPISerializer.extend({
runid: payload.info.SYSTEM_INFO_FLOW_RUN_ID,
shownid: payload.id,
type: payload.type,
createTime: Converter.timeStampToDate(payload.createdtime),
createTime: this.checkDateValidity(payload.createdtime),
createTimeRaw: payload.createdtime,
endTime: Converter.timeStampToDate(payload.info.SYSTEM_INFO_FLOW_RUN_END_TIME),
endTime: this.checkDateValidity(payload.info.SYSTEM_INFO_FLOW_RUN_END_TIME),
endTimeRaw: payload.info.SYSTEM_INFO_FLOW_RUN_END_TIME || 0,
user: payload.info.SYSTEM_INFO_USER,
uid: payload.info.UID,
@ -51,6 +51,13 @@ export default DS.JSONAPISerializer.extend({
return this._super(store, primaryModelClass, fixedPayload, id, requestType);
},
checkDateValidity(timestamp) {
if (timestamp && timestamp > 0) {
return Converter.timeStampToDate(timestamp);
}
return 'N/A';
},
normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) {
var normalizedArrayResponse = {data: []};

View File

@ -34,8 +34,8 @@ export default DS.JSONAPISerializer.extend({
runid: payload.info.SYSTEM_INFO_FLOW_RUN_ID,
shownid: payload.id,
type: payload.type,
createTime: Converter.timeStampToDate(payload.createdtime),
endTime: Converter.timeStampToDate(payload.info.SYSTEM_INFO_FLOW_RUN_END_TIME),
createTime: this.checkDateValidity(payload.createdtime),
endTime: this.checkDateValidity(payload.info.SYSTEM_INFO_FLOW_RUN_END_TIME),
user: payload.info.SYSTEM_INFO_USER,
metrics: payload.metrics,
}
@ -44,6 +44,13 @@ export default DS.JSONAPISerializer.extend({
return fixedPayload;
},
checkDateValidity(timestamp) {
if (timestamp && timestamp > 0) {
return Converter.timeStampToDate(timestamp);
}
return 'N/A';
},
normalizeSingleResponse(store, primaryModelClass, payload, id/*, requestType*/) {
var p = this.internalNormalizeSingleResponse(store,
primaryModelClass, payload, id);