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
8e1b7536
Commit
8e1b7536
authored
Feb 05, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added limit to dashboard list panel and search
parent
b6d5f49c
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
5 deletions
+34
-5
pkg/api/search.go
+6
-0
pkg/models/search.go
+1
-0
pkg/services/sqlstore/dashboard.go
+3
-0
src/app/features/account/partials/import.html
+4
-4
src/app/panels/dashlist/editor.html
+16
-0
src/app/panels/dashlist/module.js
+4
-1
No files found.
pkg/api/search.go
View file @
8e1b7536
...
@@ -33,6 +33,11 @@ func setIsStarredFlagOnSearchResults(c *middleware.Context, hits []*m.DashboardS
...
@@ -33,6 +33,11 @@ func setIsStarredFlagOnSearchResults(c *middleware.Context, hits []*m.DashboardS
func
Search
(
c
*
middleware
.
Context
)
{
func
Search
(
c
*
middleware
.
Context
)
{
queryText
:=
c
.
Query
(
"q"
)
queryText
:=
c
.
Query
(
"q"
)
starred
:=
c
.
Query
(
"starred"
)
starred
:=
c
.
Query
(
"starred"
)
limit
:=
c
.
QueryInt
(
"limit"
)
if
limit
==
0
{
limit
=
200
}
result
:=
m
.
SearchResult
{
result
:=
m
.
SearchResult
{
Dashboards
:
[]
*
m
.
DashboardSearchHit
{},
Dashboards
:
[]
*
m
.
DashboardSearchHit
{},
...
@@ -58,6 +63,7 @@ func Search(c *middleware.Context) {
...
@@ -58,6 +63,7 @@ func Search(c *middleware.Context) {
Title
:
matches
[
3
],
Title
:
matches
[
3
],
Tag
:
matches
[
2
],
Tag
:
matches
[
2
],
UserId
:
c
.
UserId
,
UserId
:
c
.
UserId
,
Limit
:
limit
,
IsStarred
:
starred
==
"1"
,
IsStarred
:
starred
==
"1"
,
AccountId
:
c
.
AccountId
,
AccountId
:
c
.
AccountId
,
}
}
...
...
pkg/models/search.go
View file @
8e1b7536
...
@@ -25,6 +25,7 @@ type SearchDashboardsQuery struct {
...
@@ -25,6 +25,7 @@ type SearchDashboardsQuery struct {
Tag
string
Tag
string
AccountId
int64
AccountId
int64
UserId
int64
UserId
int64
Limit
int
IsStarred
bool
IsStarred
bool
Result
[]
*
DashboardSearchHit
Result
[]
*
DashboardSearchHit
...
...
pkg/services/sqlstore/dashboard.go
View file @
8e1b7536
...
@@ -2,6 +2,7 @@ package sqlstore
...
@@ -2,6 +2,7 @@ package sqlstore
import
(
import
(
"bytes"
"bytes"
"fmt"
"github.com/go-xorm/xorm"
"github.com/go-xorm/xorm"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/bus"
...
@@ -116,6 +117,8 @@ func SearchDashboards(query *m.SearchDashboardsQuery) error {
...
@@ -116,6 +117,8 @@ func SearchDashboards(query *m.SearchDashboardsQuery) error {
params
=
append
(
params
,
query
.
Tag
)
params
=
append
(
params
,
query
.
Tag
)
}
}
sql
.
WriteString
(
fmt
.
Sprintf
(
" LIMIT %d"
,
query
.
Limit
))
var
res
[]
DashboardSearchProjection
var
res
[]
DashboardSearchProjection
err
:=
x
.
Sql
(
sql
.
String
(),
params
...
)
.
Find
(
&
res
)
err
:=
x
.
Sql
(
sql
.
String
(),
params
...
)
.
Find
(
&
res
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
src/app/features/account/partials/import.html
View file @
8e1b7536
...
@@ -19,18 +19,18 @@
...
@@ -19,18 +19,18 @@
<div
class=
"section"
>
<div
class=
"section"
>
<div
class=
"tight-form"
>
<div
class=
"tight-form"
>
<ul
class=
"tight-form-list"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
style=
"width: 1
6
0px"
>
<li
class=
"tight-form-item"
style=
"width: 1
5
0px"
>
<strong>
Dashboard source
</strong>
<strong>
Dashboard source
</strong>
</li>
</li>
<li>
<li>
<select
type=
"text"
ng-model=
"sourceName"
class=
"input-
small
tight-form-input"
ng-options=
"f for f in datasources"
>
<select
type=
"text"
ng-model=
"sourceName"
class=
"input-
medium
tight-form-input"
ng-options=
"f for f in datasources"
>
</select>
</select>
</li>
</li>
<li
class=
"tight-form-item"
style=
"width: 160px"
>
<li
class=
"tight-form-item"
>
<strong>
Destination
</strong>
<strong>
Destination
</strong>
</li>
</li>
<li>
<li>
<select
type=
"text"
ng-model=
"destName"
class=
"input-
small
tight-form-input"
ng-options=
"f for f in datasources"
>
<select
type=
"text"
ng-model=
"destName"
class=
"input-
medium
tight-form-input"
ng-options=
"f for f in datasources"
>
</select>
</select>
</li>
</li>
<li>
<li>
...
...
src/app/panels/dashlist/editor.html
View file @
8e1b7536
...
@@ -39,3 +39,19 @@
...
@@ -39,3 +39,19 @@
</div>
</div>
</div>
</div>
<div
class=
"editor-row"
>
<div
class=
"section"
style=
"margin-bottom: 20px"
>
<div
class=
"tight-form"
>
<ul
class=
"tight-form-list"
>
<li
class=
"tight-form-item"
style=
"width: 110px"
>
<strong>
Limit number to
</strong>
</li>
<li>
<input
class=
"input-small tight-form-input"
type=
"number"
ng-model=
"panel.limit"
ng-model-onblur
ng-change=
"get_data"
>
</li>
</ul>
<div
class=
"clearfix"
></div>
</div>
</div>
</div>
src/app/panels/dashlist/module.js
View file @
8e1b7536
...
@@ -31,6 +31,7 @@ function (angular, app, _, config, PanelMeta) {
...
@@ -31,6 +31,7 @@ function (angular, app, _, config, PanelMeta) {
var
defaults
=
{
var
defaults
=
{
mode
:
'starred'
,
mode
:
'starred'
,
query
:
''
,
query
:
''
,
limit
:
10
,
tag
:
''
,
tag
:
''
,
};
};
...
@@ -51,7 +52,9 @@ function (angular, app, _, config, PanelMeta) {
...
@@ -51,7 +52,9 @@ function (angular, app, _, config, PanelMeta) {
};
};
$scope
.
get_data
=
function
()
{
$scope
.
get_data
=
function
()
{
var
params
=
{};
var
params
=
{
limit
:
$scope
.
panel
.
limit
};
if
(
$scope
.
panel
.
mode
===
'starred'
)
{
if
(
$scope
.
panel
.
mode
===
'starred'
)
{
params
.
starred
=
1
;
params
.
starred
=
1
;
}
else
{
}
else
{
...
...
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