修复没有登录也可以搜索viewpoint的bug,以及在重启机器情况下,再次点击搜索页面没有跳转到登录页面
This commit is contained in:
parent
76d5baabc4
commit
4b2fb51f63
|
|
@ -1,5 +1,7 @@
|
|||
package com.ai.cloud.skywalking.web.common;
|
||||
|
||||
import com.ai.cloud.skywalking.web.exception.UserInvalidateException;
|
||||
import com.ai.cloud.skywalking.web.exception.UserNotLoginException;
|
||||
import com.ai.cloud.skywalking.web.util.Constants;
|
||||
import com.ai.cloud.skywalking.web.dto.LoginUserInfo;
|
||||
import org.springframework.ui.ModelMap;
|
||||
|
|
@ -29,11 +31,11 @@ public class BaseController {
|
|||
LoginUserInfo loginUserInfo = (LoginUserInfo) request.getSession().
|
||||
getAttribute(Constants.SESSION_LOGIN_INFO_KEY);
|
||||
if (loginUserInfo == null) {
|
||||
throw new RuntimeException("Failed to find login user info");
|
||||
throw new UserNotLoginException("Failed to find login user info");
|
||||
}
|
||||
|
||||
if (loginUserInfo.getUid() == null) {
|
||||
throw new RuntimeException("Login user Id is null");
|
||||
throw new UserInvalidateException("Login user Id is null");
|
||||
}
|
||||
|
||||
return loginUserInfo;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.ai.cloud.skywalking.web.entity.BreviaryChainNode;
|
|||
import com.ai.cloud.skywalking.web.dto.LoginUserInfo;
|
||||
import com.ai.cloud.skywalking.web.dto.TraceTreeInfo;
|
||||
import com.ai.cloud.skywalking.web.entity.BreviaryChainTree;
|
||||
import com.ai.cloud.skywalking.web.exception.UserNotLoginException;
|
||||
import com.ai.cloud.skywalking.web.service.inter.ICallChainTreeService;
|
||||
import com.ai.cloud.skywalking.web.service.inter.ITraceTreeService;
|
||||
import com.ai.cloud.skywalking.web.util.Constants;
|
||||
|
|
@ -115,7 +116,11 @@ public class SearchController extends BaseController {
|
|||
result.add("children", jsonElements);
|
||||
jsonObject.put("code", "200");
|
||||
jsonObject.put("result", result.toString());
|
||||
} catch (Exception e) {
|
||||
}catch (UserNotLoginException e){
|
||||
logger.error("Failed to search chain tree:{}", key, e);
|
||||
jsonObject.put("code", "505");
|
||||
jsonObject.put("result", "User is not login.");
|
||||
}catch (Exception e) {
|
||||
logger.error("Failed to search chain tree:{}", key, e);
|
||||
jsonObject.put("code", "500");
|
||||
jsonObject.put("result", "Fatal error");
|
||||
|
|
|
|||
|
|
@ -6,9 +6,10 @@ import com.ai.cloud.skywalking.web.util.ViewPointBeautiUtil;
|
|||
* Created by xin on 16-4-14.
|
||||
*/
|
||||
public class BreviaryChainNode {
|
||||
private String traceLevelId="";
|
||||
private String traceLevelId = "";
|
||||
private String viewPoint;
|
||||
private boolean isGuess;
|
||||
|
||||
public BreviaryChainNode(String traceLevelId, String viewPoint, boolean isGuess) {
|
||||
this.traceLevelId = traceLevelId;
|
||||
this.viewPoint = viewPoint;
|
||||
|
|
@ -32,9 +33,7 @@ public class BreviaryChainNode {
|
|||
}
|
||||
|
||||
public void beautiViewPointString(String searchKey) {
|
||||
if (viewPoint.length() > 100) {
|
||||
viewPoint = ViewPointBeautiUtil.beautifulViewPoint(viewPoint, searchKey);
|
||||
}
|
||||
viewPoint = ViewPointBeautiUtil.beautifulViewPoint(viewPoint, searchKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
package com.ai.cloud.skywalking.web.exception;
|
||||
|
||||
public class UserInvalidateException extends RuntimeException {
|
||||
|
||||
public UserInvalidateException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.ai.cloud.skywalking.web.exception;
|
||||
|
||||
public class UserNotLoginException extends RuntimeException {
|
||||
|
||||
public UserNotLoginException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
@ -24,7 +24,8 @@ public class AccessControllerFilter implements Filter {
|
|||
contained.add("addApplication");
|
||||
contained.add("createGlobalApplication");
|
||||
contained.add("modifyApplication");
|
||||
contained.add("showAnlyResult");
|
||||
contained.add("showAnlySearchResult");
|
||||
contained.add("showAnalysisResult");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
package com.ai.cloud.skywalking.web.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by xin on 16-4-19.
|
||||
*/
|
||||
|
|
@ -10,7 +7,10 @@ public class ViewPointBeautiUtil {
|
|||
|
||||
|
||||
public static String beautifulViewPoint(String viewPoint, String searchKey) {
|
||||
String highLightViewPoint = ViewPointBeautiUtil.addViewPoint(viewPoint, searchKey);
|
||||
String highLightViewPoint = viewPoint;
|
||||
if (viewPoint.length() > 100) {
|
||||
highLightViewPoint = ViewPointBeautiUtil.addViewPoint(viewPoint, searchKey);
|
||||
}
|
||||
return ViewPointBeautiUtil.highLightViewPoint(highLightViewPoint, searchKey);
|
||||
}
|
||||
|
||||
|
|
@ -27,7 +27,9 @@ public class ViewPointBeautiUtil {
|
|||
result.append("<span class='highlight-viewpoint'>");
|
||||
result.append(searchKey);
|
||||
result.append("</span>");
|
||||
result.append(viewPoint.substring(index + searchKey.length() + 1));
|
||||
if (viewPoint.length() > index + searchKey.length() + 1) {
|
||||
result.append(viewPoint.substring(index + searchKey.length() + 1));
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -89,6 +89,8 @@ function loadAnalyResult(searchKey, pageSize) {
|
|||
$("#anlyResultmPanel").append(htmlOutput);
|
||||
bindPagerBtn();
|
||||
}
|
||||
}else if (data.code == '505'){
|
||||
window.location.href = baseUrl + "/usr/login";
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
|
|
|
|||
Loading…
Reference in New Issue