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"
>
<div
class=
"gf-form"
>
<label
class=
"gf-form-label width-7"
>
Folder
</label>
<label
class=
"gf-form-label width-7"
>
Folder
</label>
<div
class=
"gf-form-select-wrapper"
>
<div
class=
"dropdown"
>
<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>
<metric-segment
segment=
"ctrl.selectedFolderSegment"
get-options=
"ctrl.getOptions()"
on-change=
"ctrl.folderChanged()"
></metric-segment>
</div>
</div>
</div>
</div>
public/app/features/dashboard/folder_picker/picker.ts
View file @
d081f852
...
@@ -8,12 +8,14 @@ export class FolderPickerCtrl {
...
@@ -8,12 +8,14 @@ export class FolderPickerCtrl {
dashboard
:
any
;
dashboard
:
any
;
folders
:
Folder
[];
folders
:
Folder
[];
selectedFolder
:
number
;
selectedFolder
:
number
;
selectedFolderSegment
:
any
;
/** @ngInject */
/** @ngInject */
constructor
(
private
backendSrv
,
private
$scope
,
$sce
)
{
constructor
(
private
backendSrv
,
private
$scope
,
private
$sce
,
private
uiSegmentSrv
)
{
this
.
get
(
this
.
dashboard
.
id
);
this
.
selectedFolderSegment
=
this
.
uiSegmentSrv
.
newSegment
({
value
:
'Root'
,
selectMode
:
true
});
this
.
selectedFolder
=
this
.
dashboard
.
meta
.
parentId
;
this
.
selectedFolder
=
this
.
dashboard
.
meta
.
parentId
;
this
.
folders
=
[{
id
:
0
,
title
:
'Root'
,
type
:
'dash-folder'
}]
;
this
.
get
(
this
.
dashboard
.
id
)
;
}
}
get
(
dashboardId
:
number
)
{
get
(
dashboardId
:
number
)
{
...
@@ -22,12 +24,25 @@ export class FolderPickerCtrl {
...
@@ -22,12 +24,25 @@ export class FolderPickerCtrl {
};
};
return
this
.
backendSrv
.
search
(
params
).
then
(
result
=>
{
return
this
.
backendSrv
.
search
(
params
).
then
(
result
=>
{
this
.
folders
=
[{
id
:
0
,
title
:
'Root'
,
type
:
'dash-folder'
}];
this
.
folders
.
push
(...
result
);
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
()
{
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