Add context for GetAlertNotificationUidQuery (#41633)

This commit is contained in:
idafurjes
2021-11-12 14:35:38 +01:00
committed by GitHub
parent 47aab9adfa
commit d72e389d3d
14 changed files with 69 additions and 66 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
package manager
import (
"context"
"io/ioutil"
"testing"
@@ -24,7 +25,7 @@ func TestDashboardImport(t *testing.T) {
mock := &dashboards.FakeDashboardService{}
dashboards.MockDashboardService(mock)
info, dash, err := pm.ImportDashboard("test-app", "dashboards/connections.json", 1, 0, nil, false,
info, dash, err := pm.ImportDashboard(context.Background(), "test-app", "dashboards/connections.json", 1, 0, nil, false,
[]plugins.ImportDashboardInput{
{Name: "*", Type: "datasource", Value: "graphite"},
}, &models.SignedInUser{UserId: 1, OrgRole: models.ROLE_ADMIN})
+3 -2
View File
@@ -1,6 +1,7 @@
package manager
import (
"context"
"os"
"path/filepath"
@@ -101,7 +102,7 @@ func (m *PluginManager) LoadPluginDashboard(pluginID, path string) (*models.Dash
return models.NewDashboardFromJson(data), nil
}
func (m *PluginManager) ImportDashboard(pluginID, path string, orgID, folderID int64, dashboardModel *simplejson.Json,
func (m *PluginManager) ImportDashboard(ctx context.Context, pluginID, path string, orgID, folderID int64, dashboardModel *simplejson.Json,
overwrite bool, inputs []plugins.ImportDashboardInput, user *models.SignedInUser) (plugins.PluginDashboardInfoDTO,
*models.Dashboard, error) {
var dashboard *models.Dashboard
@@ -140,7 +141,7 @@ func (m *PluginManager) ImportDashboard(pluginID, path string, orgID, folderID i
User: user,
}
savedDash, err := dashboards.NewService(m.sqlStore).ImportDashboard(dto)
savedDash, err := dashboards.NewService(m.sqlStore).ImportDashboard(ctx, dto)
if err != nil {
return plugins.PluginDashboardInfoDTO{}, &models.Dashboard{}, err
}