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
ca1f4298
Commit
ca1f4298
authored
Jun 21, 2017
by
Daniel Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: fix folder-picker for dashlist
parent
cb8b5c0d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
28 deletions
+24
-28
public/app/features/dashboard/folder_picker/picker.ts
+21
-20
public/app/plugins/panel/dashlist/editor.html
+2
-1
public/app/plugins/panel/dashlist/module.ts
+1
-7
No files found.
public/app/features/dashboard/folder_picker/picker.ts
View file @
ca1f4298
...
...
@@ -5,11 +5,13 @@ import appEvents from 'app/core/app_events';
import
_
from
'lodash'
;
export
class
FolderPickerCtrl
{
folders
:
Folder
[];
selectedOption
:
any
;
initialTitle
:
string
;
onChange
:
any
;
initialFolderId
:
number
;
labelClass
:
string
;
onChange
:
any
;
rootName
=
'Root'
;
private
folder
:
any
;
/** @ngInject */
constructor
(
private
backendSrv
,
private
$scope
,
private
$sce
)
{
...
...
@@ -17,7 +19,13 @@ export class FolderPickerCtrl {
this
.
labelClass
=
"width-7"
;
}
this
.
selectedOption
=
{
text
:
this
.
initialTitle
,
value
:
null
};
if
(
this
.
initialFolderId
>
0
)
{
this
.
getOptions
(
''
).
then
(
result
=>
{
this
.
folder
=
_
.
find
(
result
,
{
value
:
this
.
initialFolderId
});
});
}
else
{
this
.
folder
=
{
text
:
this
.
initialTitle
,
value
:
null
};
}
}
getOptions
(
query
)
{
...
...
@@ -28,37 +36,28 @@ export class FolderPickerCtrl {
return
this
.
backendSrv
.
search
(
params
).
then
(
result
=>
{
if
(
query
===
""
)
{
result
.
unshift
({
title
:
"Root"
,
value
:
0
});
result
.
unshift
({
title
:
this
.
rootName
,
value
:
0
});
}
return
_
.
map
(
result
,
item
=>
{
return
{
text
:
item
.
title
,
value
:
item
.
id
};
});
});
}
folderChanged
(
option
)
{
onFolderChange
(
option
)
{
this
.
onChange
({
$folder
:
{
id
:
option
.
value
,
title
:
option
.
text
}});
}
}
export
interface
Folder
{
id
:
number
;
title
:
string
;
uri
?:
string
;
type
:
string
;
tags
?:
string
[];
isStarred
?:
boolean
;
parentId
?:
number
;
dashboards
?:
any
;
}
const
template
=
`
<div class="gf-form">
<label class="gf-form-label {{ctrl.labelClass}}">Folder</label>
<div class="dropdown">
<gf-form-dropdown model="ctrl.
selectedOption
"
<gf-form-dropdown model="ctrl.
folder
"
get-options="ctrl.getOptions($query)"
on-change="ctrl.
folderChanged
($option)">
on-change="ctrl.
onFolderChange
($option)">
</gf-form-dropdown>
</div>
</div>
...
...
@@ -73,8 +72,10 @@ export function folderPicker() {
controllerAs
:
'ctrl'
,
scope
:
{
initialTitle
:
"<"
,
onChange
:
"&"
,
labelClass
:
"@"
,
initialFolderId
:
'<'
,
labelClass
:
'@'
,
rootName
:
'@'
,
onChange
:
'&'
}
};
}
...
...
public/app/plugins/panel/dashlist/editor.html
View file @
ca1f4298
...
...
@@ -23,7 +23,8 @@
</div>
<div
class=
"gf-form"
>
<folder-picker
initial-text=
"ctrl.folderTitle"
<folder-picker
root-name=
"All"
initial-folder-id=
"ctrl.panel.folderId"
on-change=
"ctrl.onFolderChange($folder)"
label-class=
"width-6"
>
</folder-picker>
...
...
public/app/plugins/panel/dashlist/module.ts
View file @
ca1f4298
...
...
@@ -10,7 +10,6 @@ class DashListCtrl extends PanelCtrl {
groups
:
any
[];
modes
:
any
[];
folderTitle
:
any
;
panelDefaults
=
{
query
:
''
,
...
...
@@ -66,10 +65,6 @@ class DashListCtrl extends PanelCtrl {
this
.
editorTabIndex
=
1
;
this
.
modes
=
[
'starred'
,
'search'
,
'recently viewed'
];
this
.
addEditorTab
(
'Options'
,
'public/app/plugins/panel/dashlist/editor.html'
);
if
(
!
this
.
panel
.
folderId
)
{
this
.
folderTitle
=
"All"
;
}
}
onRefresh
()
{
...
...
@@ -131,9 +126,8 @@ class DashListCtrl extends PanelCtrl {
});
}
onFolderChange
(
folder
)
{
onFolderChange
(
folder
:
any
)
{
this
.
panel
.
folderId
=
folder
.
id
;
this
.
panel
.
folderTitle
=
folder
.
title
;
this
.
refresh
();
}
}
...
...
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