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
d081f852
Commit
d081f852
authored
May 31, 2017
by
Daniel Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: use metric-segment for folder picker
parent
6c736e00
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
6 deletions
+23
-6
public/app/features/dashboard/folder_picker/picker.html
+4
-2
public/app/features/dashboard/folder_picker/picker.ts
+19
-4
No files found.
public/app/features/dashboard/folder_picker/picker.html
View file @
d081f852
<div
class=
"gf-form"
>
<label
class=
"gf-form-label width-7"
>
Folder
</label>
<div
class=
"gf-form-select-wrapper"
>
<select
ng-model=
"ctrl.selectedFolder"
class=
'gf-form-input'
ng-options=
"f.id as f.title for f in ctrl.folders"
ng-change=
"ctrl.folderChanged()"
></select>
<div
class=
"dropdown"
>
<metric-segment
segment=
"ctrl.selectedFolderSegment"
get-options=
"ctrl.getOptions()"
on-change=
"ctrl.folderChanged()"
></metric-segment>
</div>
</div>
public/app/features/dashboard/folder_picker/picker.ts
View file @
d081f852
...
...
@@ -8,12 +8,14 @@ export class FolderPickerCtrl {
dashboard
:
any
;
folders
:
Folder
[];
selectedFolder
:
number
;
selectedFolderSegment
:
any
;
/** @ngInject */
constructor
(
private
backendSrv
,
private
$scope
,
$sce
)
{
this
.
get
(
this
.
dashboard
.
id
);
constructor
(
private
backendSrv
,
private
$scope
,
private
$sce
,
private
uiSegmentSrv
)
{
this
.
selectedFolderSegment
=
this
.
uiSegmentSrv
.
newSegment
({
value
:
'Root'
,
selectMode
:
true
});
this
.
selectedFolder
=
this
.
dashboard
.
meta
.
parentId
;
this
.
folders
=
[{
id
:
0
,
title
:
'Root'
,
type
:
'dash-folder'
}]
;
this
.
get
(
this
.
dashboard
.
id
)
;
}
get
(
dashboardId
:
number
)
{
...
...
@@ -22,12 +24,25 @@ export class FolderPickerCtrl {
};
return
this
.
backendSrv
.
search
(
params
).
then
(
result
=>
{
this
.
folders
=
[{
id
:
0
,
title
:
'Root'
,
type
:
'dash-folder'
}];
this
.
folders
.
push
(...
result
);
const
selected
=
_
.
find
(
this
.
folders
,
{
id
:
this
.
selectedFolder
});
this
.
selectedFolderSegment
.
value
=
selected
.
title
;
this
.
selectedFolderSegment
.
text
=
selected
.
title
;
this
.
selectedFolderSegment
.
html
=
this
.
$sce
.
trustAsHtml
(
selected
.
title
);
});
}
getOptions
()
{
return
Promise
.
resolve
(
this
.
folders
.
map
(
folder
=>
{
return
this
.
uiSegmentSrv
.
newSegment
(
folder
.
title
);
}));
}
folderChanged
()
{
this
.
dashboard
.
parentId
=
this
.
selectedFolder
;
const
selected
=
_
.
find
(
this
.
folders
,
{
title
:
this
.
selectedFolderSegment
.
value
});
this
.
dashboard
.
parentId
=
selected
.
id
;
}
}
...
...
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