-
Notifications
You must be signed in to change notification settings - Fork 323
/
routing.go
52 lines (38 loc) · 2.06 KB
/
routing.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package alerts
import (
"fmt"
"os"
"github.com/highlight-run/highlight/backend/model"
)
func getErrorURL(errorAlert *model.ErrorAlert, errorGroup *model.ErrorGroup, errorObject *model.ErrorObject) string {
projectId := errorAlert.ProjectID
frontendURL := os.Getenv("REACT_APP_FRONTEND_URI")
return fmt.Sprintf("%s/%d/errors/%s/instances/%d", frontendURL, projectId, errorGroup.SecureID, errorObject.ID)
}
func getErrorResolveURL(errorAlert *model.ErrorAlert, errorGroup *model.ErrorGroup, errorObject *model.ErrorObject) string {
projectId := errorAlert.ProjectID
frontendURL := os.Getenv("REACT_APP_FRONTEND_URI")
return fmt.Sprintf("%s/%d/errors/%s/instances/%d?action=resolved", frontendURL, projectId, errorGroup.SecureID, errorObject.ID)
}
func getErrorIgnoreURL(errorAlert *model.ErrorAlert, errorGroup *model.ErrorGroup, errorObject *model.ErrorObject) string {
projectId := errorAlert.ProjectID
frontendURL := os.Getenv("REACT_APP_FRONTEND_URI")
return fmt.Sprintf("%s/%d/errors/%s/instances/%d?action=ignored", frontendURL, projectId, errorGroup.SecureID, errorObject.ID)
}
func getErrorSnoozeURL(errorAlert *model.ErrorAlert, errorGroup *model.ErrorGroup, errorObject *model.ErrorObject) string {
projectId := errorAlert.ProjectID
frontendURL := os.Getenv("REACT_APP_FRONTEND_URI")
return fmt.Sprintf("%s/%d/errors/%s/instances/%d?action=snooze", frontendURL, projectId, errorGroup.SecureID, errorObject.ID)
}
func getSessionURL(projectID int, session *model.Session) string {
frontendURL := os.Getenv("REACT_APP_FRONTEND_URI")
return fmt.Sprintf("%s/%d/sessions/%s", frontendURL, projectID, session.SecureID)
}
func getSessionCommentURL(projectID int, session *model.Session, sessionComment *model.SessionComment) string {
sessionURL := getSessionURL(projectID, session)
return fmt.Sprintf("%s/commentId=%d", sessionURL, sessionComment.ID)
}
func getMonitorURL(metricMonitor *model.MetricMonitor) string {
frontendURL := os.Getenv("REACT_APP_FRONTEND_URI")
return fmt.Sprintf("%s/%d/alerts/monitors/%d", frontendURL, metricMonitor.ProjectID, metricMonitor.ID)
}