Skip to content

Commit

Permalink
Merge pull request #694 from WeBankPartners/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
zgyzgyhero authored Jan 14, 2021
2 parents e386cbe + fbae890 commit 008d333
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 30 deletions.
32 changes: 4 additions & 28 deletions monitor-server/middleware/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ func SaveSession(session m.Session) (isOk bool,sId string) {
}

func GetOperateUser(c *gin.Context) string {
operator := c.GetString("operatorName")
if operator != "" {
return operator
}
if !m.Config().Http.Session.Enable {
coreToken := GetCoreToken(c)
return coreToken.User
Expand All @@ -98,34 +102,6 @@ func GetOperateUser(c *gin.Context) string {
}
}

//func GetCoreRequestRoleList(c *gin.Context) []string {
// var result []string
// authHeader := c.GetHeader("Authorization")
// if authHeader == "" {
// return result
// }
// authHeader = authHeader[strings.Index(authHeader, ".")+1:]
// authHeader = authHeader[:strings.LastIndex(authHeader, ".")]
// authHeader += "=="
// b,err := base64.StdEncoding.DecodeString(authHeader)
// if err != nil {
// log.Logger.Error("Decode core request base64 fail", log.Error(err))
// return result
// }
// var requestToke m.CoreRequestToken
// err = json.Unmarshal(b, &requestToke)
// if err != nil {
// log.Logger.Error("Get core token,json unmarchal fail", log.Error(err))
// return result
// }
// if requestToke.Authority != "" {
// requestToke.Authority = strings.Replace(requestToke.Authority, "[", "", -1)
// requestToke.Authority = strings.Replace(requestToke.Authority, "]", "", -1)
// result = strings.Split(requestToke.Authority, ",")
// }
// return result
//}

func GetSessionData(sId string) m.Session {
var result m.Session
localContain := false
Expand Down
2 changes: 1 addition & 1 deletion monitor-server/services/db/alarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ func QueryHistoryAlarm(param m.QueryHistoryAlarmParam) (err error, result m.Alar
whereSql += fmt.Sprintf(" AND s_metric='%s' ", param.Metric)
}
if param.Filter == "all" {
sql = "SELECT * FROM alarm WHERE start<='" + endString + "' OR end>='" + startString + "' " + whereSql + " ORDER BY id DESC"
sql = "SELECT * FROM alarm WHERE (start<='" + endString + "' OR end>='" + startString + "') " + whereSql + " ORDER BY id DESC"
}
if param.Filter == "start" {
sql = "SELECT * FROM alarm WHERE start>='" + startString + "' AND start<'" + endString + "' " + whereSql + " ORDER BY id DESC"
Expand Down
2 changes: 1 addition & 1 deletion monitor-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@types/js-cookie": "^2.2.6",
"@vue/cli-plugin-typescript": "^4.3.1",
"axios": "^0.19.0",
"axios": "^0.21.1",
"bootstrap": "^4.3.1",
"colresizable": "^1.6.0",
"core-js": "^2.6.5",
Expand Down

0 comments on commit 008d333

Please sign in to comment.