mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Add exported constructor for panelKey (#71872)
Exported constructor for panelKey
This commit is contained in:
@@ -57,14 +57,19 @@ type PanelKey struct {
|
||||
panelID int64
|
||||
}
|
||||
|
||||
func NewPanelKey(orgID int64, dashUID string, panelID int64) PanelKey {
|
||||
return PanelKey{
|
||||
orgID: orgID,
|
||||
dashUID: dashUID,
|
||||
panelID: panelID,
|
||||
}
|
||||
}
|
||||
|
||||
// PanelKey attempts to get the key of the panel attached to the given rule. Returns nil if the rule is not attached to a panel.
|
||||
func parsePanelKey(rule history_model.RuleMeta, logger log.Logger) *PanelKey {
|
||||
if rule.DashboardUID != "" {
|
||||
return &PanelKey{
|
||||
orgID: rule.OrgID,
|
||||
dashUID: rule.DashboardUID,
|
||||
panelID: rule.PanelID,
|
||||
}
|
||||
key := NewPanelKey(rule.OrgID, rule.DashboardUID, rule.PanelID)
|
||||
return &key
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user