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
39af588a
Commit
39af588a
authored
Sep 22, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(playlist): fixed sorting issue with playlist playback, fixes #5467
parent
598ac0e8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
24 deletions
+48
-24
CHANGELOG.md
+3
-0
pkg/api/dtos/playlist.go
+23
-0
pkg/api/playlist_play.go
+19
-10
pkg/models/playlist.go
+0
-11
public/app/features/playlist/partials/playlist.html
+2
-2
public/app/features/playlist/playlist_search.ts
+1
-1
No files found.
CHANGELOG.md
View file @
39af588a
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
*
**Influxdb**
: Add support for elapsed(), closes
[
#5827
](
https://github.com/grafana/grafana/pull/5827
)
*
**Influxdb**
: Add support for elapsed(), closes
[
#5827
](
https://github.com/grafana/grafana/pull/5827
)
*
**OAuth**
: Add support for generic oauth, closes
[
#4718
](
https://github.com/grafana/grafana/pull/4718
)
*
**OAuth**
: Add support for generic oauth, closes
[
#4718
](
https://github.com/grafana/grafana/pull/4718
)
*
**Cloudwatch**
: Add support to expand multi select template variable, closes
[
#5003
](
https://github.com/grafana/grafana/pull/5003
)
*
**Cloudwatch**
: Add support to expand multi select template variable, closes
[
#5003
](
https://github.com/grafana/grafana/pull/5003
)
*
**Graph Panel**
: Now supports flexible lower/upper bounds on Y-Max and Y-Min, PR
[
#5720
](
https://github.com/grafana/grafana/pull/5720
)
### Breaking changes
### Breaking changes
*
**SystemD**
: Change systemd description, closes
[
#5971
](
https://github.com/grafana/grafana/pull/5971
)
*
**SystemD**
: Change systemd description, closes
[
#5971
](
https://github.com/grafana/grafana/pull/5971
)
...
@@ -20,6 +21,8 @@
...
@@ -20,6 +21,8 @@
### Bugfixes
### Bugfixes
*
**Table Panel**
: Fixed problem when switching to Mixed datasource in metrics tab, fixes
[
#5999
](
https://github.com/grafana/grafana/pull/5999
)
*
**Table Panel**
: Fixed problem when switching to Mixed datasource in metrics tab, fixes
[
#5999
](
https://github.com/grafana/grafana/pull/5999
)
*
**Playlist**
: Fixed problem with play order not matching order defined in playlist, fixes
[
#5467
](
https://github.com/grafana/grafana/pull/5467
)
*
**Graph panel**
: Fixed problem with auto decimals on y axis when datamin=datamax, fixes
[
#6070
](
https://github.com/grafana/grafana/pull/6070
)
# 3.1.2 (unreleased)
# 3.1.2 (unreleased)
*
**Templating**
: Fixed issue when combining row & panel repeats, fixes
[
#5790
](
https://github.com/grafana/grafana/issues/5790
)
*
**Templating**
: Fixed issue when combining row & panel repeats, fixes
[
#5790
](
https://github.com/grafana/grafana/issues/5790
)
...
...
pkg/api/dtos/playlist.go
0 → 100644
View file @
39af588a
package
dtos
type
PlaylistDashboard
struct
{
Id
int64
`json:"id"`
Slug
string
`json:"slug"`
Title
string
`json:"title"`
Uri
string
`json:"uri"`
Order
int
`json:"order"`
}
type
PlaylistDashboardsSlice
[]
PlaylistDashboard
func
(
slice
PlaylistDashboardsSlice
)
Len
()
int
{
return
len
(
slice
)
}
func
(
slice
PlaylistDashboardsSlice
)
Less
(
i
,
j
int
)
bool
{
return
slice
[
i
]
.
Order
<
slice
[
j
]
.
Order
}
func
(
slice
PlaylistDashboardsSlice
)
Swap
(
i
,
j
int
)
{
slice
[
i
],
slice
[
j
]
=
slice
[
j
],
slice
[
i
]
}
pkg/api/playlist_play.go
View file @
39af588a
package
api
package
api
import
(
import
(
"sort"
"strconv"
"strconv"
"github.com/grafana/grafana/pkg/api/dtos"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/bus"
_
"github.com/grafana/grafana/pkg/log"
_
"github.com/grafana/grafana/pkg/log"
m
"github.com/grafana/grafana/pkg/models"
m
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/services/search"
"github.com/grafana/grafana/pkg/services/search"
)
)
func
populateDashboardsById
(
dashboardByIds
[]
int64
)
([]
m
.
PlaylistDashboardDto
,
error
)
{
func
populateDashboardsById
(
dashboardByIds
[]
int64
,
dashboardIdOrder
map
[
int64
]
int
)
(
dtos
.
PlaylistDashboardsSlice
,
error
)
{
result
:=
make
(
[]
m
.
PlaylistDashboardDto
,
0
)
result
:=
make
(
dtos
.
PlaylistDashboardsSlice
,
0
)
if
len
(
dashboardByIds
)
>
0
{
if
len
(
dashboardByIds
)
>
0
{
dashboardQuery
:=
m
.
GetDashboardsQuery
{
DashboardIds
:
dashboardByIds
}
dashboardQuery
:=
m
.
GetDashboardsQuery
{
DashboardIds
:
dashboardByIds
}
...
@@ -19,11 +21,12 @@ func populateDashboardsById(dashboardByIds []int64) ([]m.PlaylistDashboardDto, e
...
@@ -19,11 +21,12 @@ func populateDashboardsById(dashboardByIds []int64) ([]m.PlaylistDashboardDto, e
}
}
for
_
,
item
:=
range
dashboardQuery
.
Result
{
for
_
,
item
:=
range
dashboardQuery
.
Result
{
result
=
append
(
result
,
m
.
PlaylistDashboardDto
{
result
=
append
(
result
,
dtos
.
PlaylistDashboard
{
Id
:
item
.
Id
,
Id
:
item
.
Id
,
Slug
:
item
.
Slug
,
Slug
:
item
.
Slug
,
Title
:
item
.
Title
,
Title
:
item
.
Title
,
Uri
:
"db/"
+
item
.
Slug
,
Uri
:
"db/"
+
item
.
Slug
,
Order
:
dashboardIdOrder
[
item
.
Id
],
})
})
}
}
}
}
...
@@ -31,8 +34,8 @@ func populateDashboardsById(dashboardByIds []int64) ([]m.PlaylistDashboardDto, e
...
@@ -31,8 +34,8 @@ func populateDashboardsById(dashboardByIds []int64) ([]m.PlaylistDashboardDto, e
return
result
,
nil
return
result
,
nil
}
}
func
populateDashboardsByTag
(
orgId
,
userId
int64
,
dashboardByTag
[]
string
)
[]
m
.
PlaylistDashboardDto
{
func
populateDashboardsByTag
(
orgId
,
userId
int64
,
dashboardByTag
[]
string
,
dashboardTagOrder
map
[
string
]
int
)
dtos
.
PlaylistDashboardsSlice
{
result
:=
make
(
[]
m
.
PlaylistDashboardDto
,
0
)
result
:=
make
(
dtos
.
PlaylistDashboardsSlice
,
0
)
if
len
(
dashboardByTag
)
>
0
{
if
len
(
dashboardByTag
)
>
0
{
for
_
,
tag
:=
range
dashboardByTag
{
for
_
,
tag
:=
range
dashboardByTag
{
...
@@ -47,10 +50,11 @@ func populateDashboardsByTag(orgId, userId int64, dashboardByTag []string) []m.P
...
@@ -47,10 +50,11 @@ func populateDashboardsByTag(orgId, userId int64, dashboardByTag []string) []m.P
if
err
:=
bus
.
Dispatch
(
&
searchQuery
);
err
==
nil
{
if
err
:=
bus
.
Dispatch
(
&
searchQuery
);
err
==
nil
{
for
_
,
item
:=
range
searchQuery
.
Result
{
for
_
,
item
:=
range
searchQuery
.
Result
{
result
=
append
(
result
,
m
.
PlaylistDashboardDto
{
result
=
append
(
result
,
dtos
.
PlaylistDashboard
{
Id
:
item
.
Id
,
Id
:
item
.
Id
,
Title
:
item
.
Title
,
Title
:
item
.
Title
,
Uri
:
item
.
Uri
,
Uri
:
item
.
Uri
,
Order
:
dashboardTagOrder
[
tag
],
})
})
}
}
}
}
...
@@ -60,28 +64,33 @@ func populateDashboardsByTag(orgId, userId int64, dashboardByTag []string) []m.P
...
@@ -60,28 +64,33 @@ func populateDashboardsByTag(orgId, userId int64, dashboardByTag []string) []m.P
return
result
return
result
}
}
func
LoadPlaylistDashboards
(
orgId
,
userId
,
playlistId
int64
)
(
[]
m
.
PlaylistDashboardDto
,
error
)
{
func
LoadPlaylistDashboards
(
orgId
,
userId
,
playlistId
int64
)
(
dtos
.
PlaylistDashboardsSlice
,
error
)
{
playlistItems
,
_
:=
LoadPlaylistItems
(
playlistId
)
playlistItems
,
_
:=
LoadPlaylistItems
(
playlistId
)
dashboardByIds
:=
make
([]
int64
,
0
)
dashboardByIds
:=
make
([]
int64
,
0
)
dashboardByTag
:=
make
([]
string
,
0
)
dashboardByTag
:=
make
([]
string
,
0
)
dashboardIdOrder
:=
make
(
map
[
int64
]
int
)
dashboardTagOrder
:=
make
(
map
[
string
]
int
)
for
_
,
i
:=
range
playlistItems
{
for
_
,
i
:=
range
playlistItems
{
if
i
.
Type
==
"dashboard_by_id"
{
if
i
.
Type
==
"dashboard_by_id"
{
dashboardId
,
_
:=
strconv
.
ParseInt
(
i
.
Value
,
10
,
64
)
dashboardId
,
_
:=
strconv
.
ParseInt
(
i
.
Value
,
10
,
64
)
dashboardByIds
=
append
(
dashboardByIds
,
dashboardId
)
dashboardByIds
=
append
(
dashboardByIds
,
dashboardId
)
dashboardIdOrder
[
dashboardId
]
=
i
.
Order
}
}
if
i
.
Type
==
"dashboard_by_tag"
{
if
i
.
Type
==
"dashboard_by_tag"
{
dashboardByTag
=
append
(
dashboardByTag
,
i
.
Value
)
dashboardByTag
=
append
(
dashboardByTag
,
i
.
Value
)
dashboardTagOrder
[
i
.
Value
]
=
i
.
Order
}
}
}
}
result
:=
make
(
[]
m
.
PlaylistDashboardDto
,
0
)
result
:=
make
(
dtos
.
PlaylistDashboardsSlice
,
0
)
var
k
,
_
=
populateDashboardsById
(
dashboardByIds
)
var
k
,
_
=
populateDashboardsById
(
dashboardByIds
,
dashboardIdOrder
)
result
=
append
(
result
,
k
...
)
result
=
append
(
result
,
k
...
)
result
=
append
(
result
,
populateDashboardsByTag
(
orgId
,
userId
,
dashboardByTag
)
...
)
result
=
append
(
result
,
populateDashboardsByTag
(
orgId
,
userId
,
dashboardByTag
,
dashboardTagOrder
)
...
)
sort
.
Sort
(
sort
.
Reverse
(
result
))
return
result
,
nil
return
result
,
nil
}
}
pkg/models/playlist.go
View file @
39af588a
...
@@ -58,17 +58,6 @@ type Playlists []*Playlist
...
@@ -58,17 +58,6 @@ type Playlists []*Playlist
type
PlaylistDashboards
[]
*
PlaylistDashboard
type
PlaylistDashboards
[]
*
PlaylistDashboard
//
//
// DTOS
//
type
PlaylistDashboardDto
struct
{
Id
int64
`json:"id"`
Slug
string
`json:"slug"`
Title
string
`json:"title"`
Uri
string
`json:"uri"`
}
//
// COMMANDS
// COMMANDS
//
//
...
...
public/app/features/playlist/partials/playlist.html
View file @
39af588a
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
</div>
</div>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-
md
-6"
>
<div
class=
"col-
lg
-6"
>
<div
class=
"playlist-search-containerwrapper"
>
<div
class=
"playlist-search-containerwrapper"
>
<div
class=
"max-width-32"
>
<div
class=
"max-width-32"
>
<h5
class=
"page-headering playlist-column-header"
>
Available
</h5>
<h5
class=
"page-headering playlist-column-header"
>
Available
</h5>
...
@@ -72,7 +72,7 @@
...
@@ -72,7 +72,7 @@
</div>
</div>
</div>
</div>
<div
class=
"col-
md
-6"
>
<div
class=
"col-
lg
-6"
>
<h5
class=
"page headering playlist-column-header"
>
Selected
</h5>
<h5
class=
"page headering playlist-column-header"
>
Selected
</h5>
<table
class=
"grafana-options-table playlist-available-list"
>
<table
class=
"grafana-options-table playlist-available-list"
>
<tr
ng-repeat=
"playlistItem in ctrl.playlistItems"
>
<tr
ng-repeat=
"playlistItem in ctrl.playlistItems"
>
...
...
public/app/features/playlist/playlist_search.ts
View file @
39af588a
...
@@ -14,7 +14,7 @@ export class PlaylistSearchCtrl {
...
@@ -14,7 +14,7 @@ export class PlaylistSearchCtrl {
/** @ngInject */
/** @ngInject */
constructor
(
private
$scope
,
private
$location
,
private
$timeout
,
private
backendSrv
,
private
contextSrv
)
{
constructor
(
private
$scope
,
private
$location
,
private
$timeout
,
private
backendSrv
,
private
contextSrv
)
{
this
.
query
=
{
query
:
''
,
tag
:
[],
starred
:
false
};
this
.
query
=
{
query
:
''
,
tag
:
[],
starred
:
false
,
limit
:
30
};
$timeout
(()
=>
{
$timeout
(()
=>
{
this
.
query
.
query
=
''
;
this
.
query
.
query
=
''
;
...
...
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