Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix GetAllActiveUsers #1046

Merged
merged 2 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -4419,9 +4419,9 @@ func GetAllActiveUsers(tenantName string) ([]models.FilteredUser, error) {
defer conn.Release()
query := `
SELECT DISTINCT u.username
FROM users u
JOIN stations s ON u.id = s.created_by
WHERE tenant_name=$1
FROM users AS u
JOIN stations AS s ON u.id = s.created_by
WHERE s.tenant_name=$1
`
stmt, err := conn.Conn().Prepare(ctx, "get_all_active_users", query)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion models/monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ type GetStationOverviewDataSchema struct {

type SystemLogsRequest struct {
LogType string `form:"log_type" json:"log_type" binding:"required"`
StartIdx int `form:"start_index" json:"start_index" binding:"required"`
LogSource string `form:"log_source" json:"log_source"`
StartIdx int `form:"start_index" json:"start_index" binding:"required"`
}

type Log struct {
Expand Down
6 changes: 3 additions & 3 deletions server/memphis_cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -872,12 +872,12 @@ func (mh MonitoringHandler) GetSystemLogs(c *gin.Context) {

logSource := request.LogSource
if filterSubjectSuffix != _EMPTY_ {
if request.LogSource != "empty" && request.LogType != "external" {
if request.LogSource == "empty" || request.LogSource == "" {
filterSubject = fmt.Sprintf("%s.%s.%s", syslogsStreamName, "*", filterSubjectSuffix)
} else if request.LogSource != "empty" && request.LogType != "external" {
filterSubject = fmt.Sprintf("%s.%s.%s", syslogsStreamName, logSource, filterSubjectSuffix)
} else if request.LogSource != "empty" && request.LogType == "external" {
filterSubject = fmt.Sprintf("%s.%s.%s.%s", syslogsStreamName, logSource, "extern", ">")
} else {
filterSubject = fmt.Sprintf("%s.%s.%s", syslogsStreamName, "*", filterSubjectSuffix)
}
}

Expand Down