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
cacbcb9c
Commit
cacbcb9c
authored
Dec 13, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ux: added search box to ds list page, closes #10106
parent
22aa1f7e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
15 deletions
+17
-15
public/app/features/plugins/ds_list_ctrl.ts
+9
-13
public/app/features/plugins/partials/ds_list.html
+8
-2
No files found.
public/app/features/plugins/ds_list_ctrl.ts
View file @
cacbcb9c
///<reference path="../../headers/common.d.ts" />
import
coreModule
from
'../../core/core_module'
;
import
{
appEvents
}
from
'app/core/core
'
;
import
_
from
'lodash
'
;
export
class
DataSourcesCtrl
{
datasources
:
any
;
unfiltered
:
any
;
navModel
:
any
;
searchQuery
:
string
;
/** @ngInject */
constructor
(
private
$scope
,
private
backendSrv
,
private
datasourceSrv
,
private
$location
,
private
navModelSrv
)
{
this
.
navModel
=
this
.
navModelSrv
.
getNav
(
'cfg'
,
'datasources'
,
0
);
this
.
navigateToUrl
=
this
.
navigateToUrl
.
bind
(
this
);
backendSrv
.
get
(
'/api/datasources'
).
then
(
result
=>
{
this
.
datasources
=
result
;
});
appEvents
.
on
(
'location-change'
,
payload
=>
{
this
.
navigateToUrl
(
payload
.
href
);
this
.
unfiltered
=
result
;
});
}
navigateToUrl
(
url
)
{
// debugger;
this
.
$location
.
path
(
url
);
this
.
$location
.
replace
();
onQueryUpdated
()
{
let
regex
=
new
RegExp
(
this
.
searchQuery
,
'ig'
);
this
.
datasources
=
_
.
filter
(
this
.
unfiltered
,
item
=>
{
return
regex
.
test
(
item
.
name
)
||
regex
.
test
(
item
.
type
);
});
}
removeDataSourceConfirmed
(
ds
)
{
...
...
public/app/features/plugins/partials/ds_list.html
View file @
cacbcb9c
<page-header
model=
"ctrl.navModel"
></page-header>
<div
class=
"page-container page-body"
>
<div
ng-if=
"ctrl.
datasources
.length"
>
<div
ng-if=
"ctrl.
unfiltered
.length"
>
<div
class=
"page-action-bar"
>
<div
class=
"gf-form"
>
<label
class=
"gf-form-label"
>
Search
</label>
<input
type=
"text"
class=
"gf-form-input width-20"
ng-model=
"ctrl.searchQuery"
ng-change=
"ctrl.onQueryUpdated()"
give-focus=
"true"
placeholder=
"Filter by name or type"
/>
</div>
<div
class=
"page-action-bar__spacer"
></div>
<a
class=
"page-header__cta btn btn-success"
href=
"datasources/new"
>
<i
class=
"fa fa-plus"
></i>
Add data source
...
...
@@ -42,7 +48,7 @@
</section>
</div>
<div
ng-if=
"ctrl.
datasources
.length === 0"
>
<div
ng-if=
"ctrl.
unfiltered
.length === 0"
>
<empty-list-cta
model=
"{
title: 'There are no data sources defined yet',
buttonIcon: 'gicon gicon-dashboard-new',
...
...
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