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
af371249
Commit
af371249
authored
Dec 18, 2015
by
utkarshcmu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Successfully displayed userdId in UI
parent
22fd2aed
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
32 deletions
+12
-32
pkg/api/dashboard.go
+3
-2
pkg/models/dashboards.go
+3
-7
pkg/services/sqlstore/migrations/dashboard_mig.go
+1
-6
pkg/services/sqlstore/migrations/dashboard_snapshot_mig.go
+0
-1
public/app/features/dashboard/partials/settings.html
+5
-16
No files found.
pkg/api/dashboard.go
View file @
af371249
...
...
@@ -4,6 +4,7 @@ import (
"encoding/json"
"os"
"path"
"strconv"
"strings"
"github.com/grafana/grafana/pkg/api/dtos"
...
...
@@ -59,8 +60,7 @@ func GetDashboard(c *middleware.Context) {
CanEdit
:
canEditDashboard
(
c
.
OrgRole
),
Created
:
dash
.
Created
,
Updated
:
dash
.
Updated
,
CreatedBy
:
dash
.
CreatedBy
,
UpdatedBy
:
dash
.
UpdatedBy
,
UpdatedBy
:
strconv
.
FormatInt
(
dash
.
UpdatedBy
,
10
),
},
}
...
...
@@ -89,6 +89,7 @@ func DeleteDashboard(c *middleware.Context) {
func
PostDashboard
(
c
*
middleware
.
Context
,
cmd
m
.
SaveDashboardCommand
)
{
cmd
.
OrgId
=
c
.
OrgId
cmd
.
UpdatedBy
=
c
.
UserId
dash
:=
cmd
.
GetDashboardModel
()
if
dash
.
Id
==
0
{
...
...
pkg/models/dashboards.go
View file @
af371249
...
...
@@ -33,8 +33,7 @@ type Dashboard struct {
Created
time
.
Time
Updated
time
.
Time
CreatedBy
string
UpdatedBy
string
UpdatedBy
int64
Title
string
Data
map
[
string
]
interface
{}
...
...
@@ -48,8 +47,6 @@ func NewDashboard(title string) *Dashboard {
dash
.
Title
=
title
dash
.
Created
=
time
.
Now
()
dash
.
Updated
=
time
.
Now
()
// TODO:dash.CreatedBy = "Creator"
// TODO:dash.UpdatedBy = "Creator"
dash
.
UpdateSlug
()
return
dash
}
...
...
@@ -81,14 +78,11 @@ func NewDashboardFromJson(data map[string]interface{}) *Dashboard {
if
dash
.
Data
[
"version"
]
!=
nil
{
dash
.
Version
=
int
(
dash
.
Data
[
"version"
]
.
(
float64
))
dash
.
Updated
=
time
.
Now
()
// TODO:dash.UpdatedBy = "Updater"
}
}
else
{
dash
.
Data
[
"version"
]
=
0
dash
.
Created
=
time
.
Now
()
dash
.
Updated
=
time
.
Now
()
// TODO:dash.CreatedBy = "Creator"
// TODO:dash.UpdatedBy = "Creator"
}
return
dash
...
...
@@ -98,6 +92,7 @@ func NewDashboardFromJson(data map[string]interface{}) *Dashboard {
func
(
cmd
*
SaveDashboardCommand
)
GetDashboardModel
()
*
Dashboard
{
dash
:=
NewDashboardFromJson
(
cmd
.
Dashboard
)
dash
.
OrgId
=
cmd
.
OrgId
dash
.
UpdatedBy
=
cmd
.
UpdatedBy
dash
.
UpdateSlug
()
return
dash
}
...
...
@@ -121,6 +116,7 @@ type SaveDashboardCommand struct {
Dashboard
map
[
string
]
interface
{}
`json:"dashboard" binding:"Required"`
Overwrite
bool
`json:"overwrite"`
OrgId
int64
`json:"-"`
UpdatedBy
int64
`json:"-"`
Result
*
Dashboard
}
...
...
pkg/services/sqlstore/migrations/dashboard_mig.go
View file @
af371249
...
...
@@ -93,13 +93,8 @@ func addDashboardMigration(mg *Migrator) {
Postgres
(
"SELECT 0;"
)
.
Mysql
(
"ALTER TABLE dashboard MODIFY data MEDIUMTEXT;"
))
// add column to store creator of a dashboard
mg
.
AddMigration
(
"Add column created_by in dashboard - v2"
,
NewAddColumnMigration
(
dashboardV2
,
&
Column
{
Name
:
"created_by"
,
Type
:
DB_NVarchar
,
Length
:
255
,
Nullable
:
false
,
Default
:
"Anonymous"
,
}))
// add column to store updater of a dashboard
mg
.
AddMigration
(
"Add column updated_by in dashboard - v2"
,
NewAddColumnMigration
(
dashboardV2
,
&
Column
{
Name
:
"updated_by"
,
Type
:
DB_
NVarchar
,
Length
:
255
,
Nullable
:
false
,
Default
:
"Anonymous"
,
Name
:
"updated_by"
,
Type
:
DB_
Int
,
Nullable
:
true
,
}))
}
pkg/services/sqlstore/migrations/dashboard_snapshot_mig.go
View file @
af371249
...
...
@@ -54,5 +54,4 @@ func addDashboardSnapshotMigrations(mg *Migrator) {
Sqlite
(
"SELECT 0 WHERE 0;"
)
.
Postgres
(
"SELECT 0;"
)
.
Mysql
(
"ALTER TABLE dashboard_snapshot MODIFY dashboard MEDIUMTEXT;"
))
}
public/app/features/dashboard/partials/settings.html
View file @
af371249
...
...
@@ -117,7 +117,7 @@
<div
ng-if=
"editor.index == 4"
>
<div
class=
"editor-row"
>
<div
class=
"tight-form-section"
>
<h5>
I
nfo
</h5>
<h5>
Dashboard i
nfo
</h5>
<div
class=
"tight-form"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
style=
"width: 120px"
>
...
...
@@ -129,17 +129,6 @@
</ul>
<div
class=
"clearfix"
></div>
</div>
<div
class=
"tight-form"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
style=
"width: 120px"
>
Last updated by:
</li>
<li
class=
"tight-form-item"
style=
"width: 180px"
>
{{dashboardMeta.updatedBy}}
</li>
</ul>
<div
class=
"clearfix"
></div>
</div>
<div
class=
"tight-form last"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
style=
"width: 120px"
>
...
...
@@ -151,14 +140,14 @@
</ul>
<div
class=
"clearfix"
></div>
</div>
<div
class=
"tight-form
last
"
>
<div
class=
"tight-form"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
style=
"width: 120px"
>
Cre
ated by:
Last upd
ated by:
</li>
<li
class=
"tight-form-item"
style=
"width: 180px"
>
{{dashboardMeta.
cre
atedBy}}
</li>
{{dashboardMeta.
upd
atedBy}}
</li>
</ul>
<div
class=
"clearfix"
></div>
</div>
...
...
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