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
5b35c694
Commit
5b35c694
authored
Jan 29, 2018
by
Marcus Efraimsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: generate and include uid in dashboard model. #7883
parent
025a14ec
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
1 deletions
+45
-1
Gopkg.lock
+7
-1
Gopkg.toml
+4
-0
pkg/models/dashboards.go
+15
-0
pkg/services/sqlstore/dashboard.go
+1
-0
vendor/github.com/teris-io/shortid/LICENSE
+18
-0
vendor/github.com/teris-io/shortid/shortid.go
+0
-0
No files found.
Gopkg.lock
View file @
5b35c694
...
...
@@ -413,6 +413,12 @@
version = "1.6.3"
[[projects]]
branch = "master"
name = "github.com/teris-io/shortid"
packages = ["."]
revision = "771a37caa5cf0c81f585d7b6df4dfc77e0615b5c"
[[projects]]
name = "github.com/uber/jaeger-client-go"
packages = [
".",
...
...
@@ -625,6 +631,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "
98e8d8f5fb21fe448aeb3db41c9fed85fe3bf80400e553211cf39a9c05720e01
"
inputs-digest = "
4de68f1342ba98a637ec8ca7496aeeae2021bf9e4c7c80db7924e14709151a62
"
solver-name = "gps-cdcl"
solver-version = 1
Gopkg.toml
View file @
5b35c694
...
...
@@ -193,3 +193,7 @@ ignored = [
non-go
=
true
go-tests
=
true
unused-packages
=
true
[[constraint]]
branch
=
"master"
name
=
"github.com/teris-io/shortid"
pkg/models/dashboards.go
View file @
5b35c694
...
...
@@ -7,6 +7,7 @@ import (
"github.com/gosimple/slug"
"github.com/grafana/grafana/pkg/components/simplejson"
"github.com/teris-io/shortid"
)
// Typed errors
...
...
@@ -39,6 +40,7 @@ var (
// Dashboard model
type
Dashboard
struct
{
Id
int64
Uid
string
Slug
string
OrgId
int64
GnetId
int64
...
...
@@ -61,6 +63,7 @@ type Dashboard struct {
// NewDashboard creates a new dashboard
func
NewDashboard
(
title
string
)
*
Dashboard
{
dash
:=
&
Dashboard
{}
dash
.
Uid
=
DashboardUid
()
dash
.
Data
=
simplejson
.
New
()
dash
.
Data
.
Set
(
"title"
,
title
)
dash
.
Title
=
title
...
...
@@ -107,9 +110,21 @@ func NewDashboardFromJson(data *simplejson.Json) *Dashboard {
dash
.
GnetId
=
int64
(
gnetId
)
}
if
uid
,
err
:=
dash
.
Data
.
Get
(
"uid"
)
.
String
();
err
==
nil
{
dash
.
Uid
=
uid
}
else
{
dash
.
Uid
=
DashboardUid
()
}
return
dash
}
func
DashboardUid
()
string
{
gen
,
_
:=
shortid
.
New
(
1
,
shortid
.
DefaultABC
,
1
)
uid
,
_
:=
gen
.
Generate
()
return
uid
}
// GetDashboardModel turns the command into the savable model
func
(
cmd
*
SaveDashboardCommand
)
GetDashboardModel
()
*
Dashboard
{
dash
:=
NewDashboardFromJson
(
cmd
.
Dashboard
)
...
...
pkg/services/sqlstore/dashboard.go
View file @
5b35c694
...
...
@@ -175,6 +175,7 @@ func GetDashboard(query *m.GetDashboardQuery) error {
}
dashboard
.
Data
.
Set
(
"id"
,
dashboard
.
Id
)
dashboard
.
Data
.
Set
(
"uid"
,
dashboard
.
Uid
)
query
.
Result
=
&
dashboard
return
nil
}
...
...
vendor/github.com/teris-io/shortid/LICENSE
0 → 100644
View file @
5b35c694
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
vendor/github.com/teris-io/shortid/shortid.go
0 → 100644
View file @
5b35c694
This diff is collapsed.
Click to expand it.
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