@@ -55,29 +55,30 @@ function createTemplateURI(appId) {
5555// e.g. https://axonitered-jt1.red.ygrid.yahoo.com:50509/history/application_1502220952225_59143/stages/stage/?id=0&attempt=0
5656function StageEndPoint ( appId ) {
5757 var words = document . baseURI . split ( '/' ) ;
58+ var words2 = document . baseURI . split ( '?' ) ;
5859 var ind = words . indexOf ( "proxy" ) ;
5960 if ( ind > 0 ) {
6061 var appId = words [ ind + 1 ] ;
61- var stageIdLen = words [ ind + 3 ] . indexOf ( '&' ) ;
62- var stageId = words [ ind + 3 ] . substr ( 9 , stageIdLen - 9 ) ;
62+ var stageIdLen = words2 [ 1 ] . indexOf ( '&' ) ;
63+ var stageId = words2 [ 1 ] . substr ( 3 , stageIdLen - 3 ) ;
6364 var newBaseURI = words . slice ( 0 , ind + 2 ) . join ( '/' ) ;
6465 return newBaseURI + "/api/v1/applications/" + appId + "/stages/" + stageId ;
6566 }
6667 ind = words . indexOf ( "history" ) ;
6768 if ( ind > 0 ) {
6869 var appId = words [ ind + 1 ] ;
69- var attemptId = words [ ind + 5 ] . split ( "&attempt=" ) . pop ( ) ;
70- var stageIdLen = words [ ind + 5 ] . indexOf ( '&' ) ;
71- var stageId = words [ ind + 5 ] . substr ( 4 , stageIdLen - 4 ) ;
70+ var attemptId = words [ ind + 2 ] ;
71+ var stageIdLen = words2 [ 1 ] . indexOf ( '&' ) ;
72+ var stageId = words2 [ 1 ] . substr ( 3 , stageIdLen - 3 ) ;
7273 var newBaseURI = words . slice ( 0 , ind ) . join ( '/' ) ;
7374 if ( isNaN ( attemptId ) || attemptId == "0" ) {
74- return newBaseURI + "/api/v1/applications/" + appId + "/" + "1" + "/ stages/" + stageId ;
75+ return newBaseURI + "/api/v1/applications/" + appId + "/stages/" + stageId ;
7576 } else {
7677 return newBaseURI + "/api/v1/applications/" + appId + "/" + attemptId + "/stages/" + stageId ;
7778 }
7879 }
79- var stageIdLen = words [ ind + 3 ] . indexOf ( '&' ) ;
80- var stageId = words [ ind + 3 ] . substr ( 9 , stageIdLen - 9 ) ;
80+ var stageIdLen = words2 [ 1 ] . indexOf ( '&' ) ;
81+ var stageId = words2 [ 1 ] . substr ( 3 , stageIdLen - 3 ) ;
8182 return location . origin + "/api/v1/applications/" + appId + "/stages/" + stageId ;
8283}
8384
0 commit comments