pkg: fix deadcode issues

This commit is contained in:
Mario Trangoni
2018-04-24 18:52:57 +02:00
parent 7aaa188471
commit 97fd66db2e
3 changed files with 32 additions and 49 deletions

View File

@ -294,19 +294,3 @@ func canSave(c *m.ReqContext, repo annotations.Repository, annotationID int64) R
return nil return nil
} }
func canSaveByRegionID(c *m.ReqContext, repo annotations.Repository, regionID int64) Response {
items, err := repo.Find(&annotations.ItemQuery{RegionId: regionID, OrgId: c.OrgId})
if err != nil || len(items) == 0 {
return Error(500, "Could not find annotation to update", err)
}
dashboardID := items[0].DashboardId
if canSave, err := canSaveByDashboardID(c, dashboardID); err != nil || !canSave {
return dashboardGuardianResponse(err)
}
return nil
}

View File

@ -31,8 +31,6 @@ func initContextWithRenderAuth(ctx *m.ReqContext) bool {
return true return true
} }
type renderContextFunc func(key string) (string, error)
func AddRenderAuthKey(orgId int64, userId int64, orgRole m.RoleType) string { func AddRenderAuthKey(orgId int64, userId int64, orgRole m.RoleType) string {
renderKeysLock.Lock() renderKeysLock.Lock()

View File

@ -2,37 +2,38 @@ package migrations
import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator" import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
func addStatsMigrations(mg *Migrator) { // commented out because of the deadcode CI check
statTable := Table{ //func addStatsMigrations(mg *Migrator) {
Name: "stat", // statTable := Table{
Columns: []*Column{ // Name: "stat",
{Name: "id", Type: DB_Int, IsPrimaryKey: true, IsAutoIncrement: true}, // Columns: []*Column{
{Name: "metric", Type: DB_Varchar, Length: 20, Nullable: false}, // {Name: "id", Type: DB_Int, IsPrimaryKey: true, IsAutoIncrement: true},
{Name: "type", Type: DB_Int, Nullable: false}, // {Name: "metric", Type: DB_Varchar, Length: 20, Nullable: false},
}, // {Name: "type", Type: DB_Int, Nullable: false},
Indices: []*Index{ // },
{Cols: []string{"metric"}, Type: UniqueIndex}, // Indices: []*Index{
}, // {Cols: []string{"metric"}, Type: UniqueIndex},
} // },
// }
// create table //
mg.AddMigration("create stat table", NewAddTableMigration(statTable)) // // create table
// mg.AddMigration("create stat table", NewAddTableMigration(statTable))
// create indices //
mg.AddMigration("add index stat.metric", NewAddIndexMigration(statTable, statTable.Indices[0])) // // create indices
// mg.AddMigration("add index stat.metric", NewAddIndexMigration(statTable, statTable.Indices[0]))
statValue := Table{ //
Name: "stat_value", // statValue := Table{
Columns: []*Column{ // Name: "stat_value",
{Name: "id", Type: DB_Int, IsPrimaryKey: true, IsAutoIncrement: true}, // Columns: []*Column{
{Name: "value", Type: DB_Double, Nullable: false}, // {Name: "id", Type: DB_Int, IsPrimaryKey: true, IsAutoIncrement: true},
{Name: "time", Type: DB_DateTime, Nullable: false}, // {Name: "value", Type: DB_Double, Nullable: false},
}, // {Name: "time", Type: DB_DateTime, Nullable: false},
} // },
// }
// create table //
mg.AddMigration("create stat_value table", NewAddTableMigration(statValue)) // // create table
} // mg.AddMigration("create stat_value table", NewAddTableMigration(statValue))
//}
func addTestDataMigrations(mg *Migrator) { func addTestDataMigrations(mg *Migrator) {
testData := Table{ testData := Table{