Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
97fd66db
Commit
97fd66db
authored
Apr 24, 2018
by
Mario Trangoni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pkg: fix deadcode issues
parent
7aaa1884
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
49 deletions
+32
-49
pkg/api/annotations.go
+0
-16
pkg/middleware/render_auth.go
+0
-2
pkg/services/sqlstore/migrations/stats_mig.go
+32
-31
No files found.
pkg/api/annotations.go
View file @
97fd66db
...
...
@@ -294,19 +294,3 @@ func canSave(c *m.ReqContext, repo annotations.Repository, annotationID int64) R
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
}
pkg/middleware/render_auth.go
View file @
97fd66db
...
...
@@ -31,8 +31,6 @@ func initContextWithRenderAuth(ctx *m.ReqContext) bool {
return
true
}
type
renderContextFunc
func
(
key
string
)
(
string
,
error
)
func
AddRenderAuthKey
(
orgId
int64
,
userId
int64
,
orgRole
m
.
RoleType
)
string
{
renderKeysLock
.
Lock
()
...
...
pkg/services/sqlstore/migrations/stats_mig.go
View file @
97fd66db
...
...
@@ -2,37 +2,38 @@ package migrations
import
.
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
func
addStatsMigrations
(
mg
*
Migrator
)
{
statTable
:=
Table
{
Name
:
"stat"
,
Columns
:
[]
*
Column
{
{
Name
:
"id"
,
Type
:
DB_Int
,
IsPrimaryKey
:
true
,
IsAutoIncrement
:
true
},
{
Name
:
"metric"
,
Type
:
DB_Varchar
,
Length
:
20
,
Nullable
:
false
},
{
Name
:
"type"
,
Type
:
DB_Int
,
Nullable
:
false
},
},
Indices
:
[]
*
Index
{
{
Cols
:
[]
string
{
"metric"
},
Type
:
UniqueIndex
},
},
}
// create table
mg
.
AddMigration
(
"create stat table"
,
NewAddTableMigration
(
statTable
))
// create indices
mg
.
AddMigration
(
"add index stat.metric"
,
NewAddIndexMigration
(
statTable
,
statTable
.
Indices
[
0
]))
statValue
:=
Table
{
Name
:
"stat_value"
,
Columns
:
[]
*
Column
{
{
Name
:
"id"
,
Type
:
DB_Int
,
IsPrimaryKey
:
true
,
IsAutoIncrement
:
true
},
{
Name
:
"value"
,
Type
:
DB_Double
,
Nullable
:
false
},
{
Name
:
"time"
,
Type
:
DB_DateTime
,
Nullable
:
false
},
},
}
// create table
mg
.
AddMigration
(
"create stat_value table"
,
NewAddTableMigration
(
statValue
))
}
// commented out because of the deadcode CI check
//func addStatsMigrations(mg *Migrator) {
// statTable := Table{
// Name: "stat",
// Columns: []*Column{
// {Name: "id", Type: DB_Int, IsPrimaryKey: true, IsAutoIncrement: true},
// {Name: "metric", Type: DB_Varchar, Length: 20, Nullable: false},
// {Name: "type", Type: DB_Int, Nullable: false},
// },
// Indices: []*Index{
// {Cols: []string{"metric"}, Type: UniqueIndex},
// },
// }
//
// // create table
// mg.AddMigration("create stat table", NewAddTableMigration(statTable))
//
// // create indices
// mg.AddMigration("add index stat.metric", NewAddIndexMigration(statTable, statTable.Indices[0]))
//
// statValue := Table{
// Name: "stat_value",
// Columns: []*Column{
// {Name: "id", Type: DB_Int, IsPrimaryKey: true, IsAutoIncrement: true},
// {Name: "value", Type: DB_Double, Nullable: false},
// {Name: "time", Type: DB_DateTime, Nullable: false},
// },
// }
//
// // create table
// mg.AddMigration("create stat_value table", NewAddTableMigration(statValue))
//}
func
addTestDataMigrations
(
mg
*
Migrator
)
{
testData
:=
Table
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment