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
533f2d3d
Commit
533f2d3d
authored
Jun 01, 2017
by
Daniel Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: refactor folder-picker for dashlist
parent
c602afb9
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
42 additions
and
15 deletions
+42
-15
public/app/core/components/search/search.ts
+1
-1
public/app/features/dashboard/dashnav/dashnav.ts
+4
-0
public/app/features/dashboard/folder_picker/picker.ts
+19
-13
public/app/features/dashboard/partials/settings.html
+1
-1
public/app/features/dashboard/save_as_modal.ts
+4
-0
public/app/plugins/panel/dashlist/editor.html
+5
-0
public/app/plugins/panel/dashlist/module.ts
+8
-0
No files found.
public/app/core/components/search/search.ts
View file @
533f2d3d
...
@@ -42,7 +42,7 @@ export class SearchCtrl {
...
@@ -42,7 +42,7 @@ export class SearchCtrl {
this
.
giveSearchFocus
=
0
;
this
.
giveSearchFocus
=
0
;
this
.
selectedIndex
=
-
1
;
this
.
selectedIndex
=
-
1
;
this
.
results
=
[];
this
.
results
=
[];
this
.
query
=
{
query
:
''
,
tag
:
[],
starred
:
false
};
this
.
query
=
{
query
:
''
,
tag
:
[],
starred
:
false
,
mode
:
'tree'
};
this
.
currentSearchId
=
0
;
this
.
currentSearchId
=
0
;
this
.
ignoreClose
=
true
;
this
.
ignoreClose
=
true
;
...
...
public/app/features/dashboard/dashnav/dashnav.ts
View file @
533f2d3d
...
@@ -135,6 +135,10 @@ export class DashNavCtrl {
...
@@ -135,6 +135,10 @@ export class DashNavCtrl {
var
uri
=
"data:application/json;charset=utf-8,"
+
encodeURIComponent
(
html
);
var
uri
=
"data:application/json;charset=utf-8,"
+
encodeURIComponent
(
html
);
var
newWindow
=
window
.
open
(
uri
);
var
newWindow
=
window
.
open
(
uri
);
}
}
onFolderChange
(
parentId
)
{
this
.
dashboard
.
parentId
=
parentId
;
}
}
}
export
function
dashNavDirective
()
{
export
function
dashNavDirective
()
{
...
...
public/app/features/dashboard/folder_picker/picker.ts
View file @
533f2d3d
...
@@ -5,32 +5,34 @@ import appEvents from 'app/core/app_events';
...
@@ -5,32 +5,34 @@ import appEvents from 'app/core/app_events';
import
_
from
'lodash'
;
import
_
from
'lodash'
;
export
class
FolderPickerCtrl
{
export
class
FolderPickerCtrl
{
dashboard
:
any
;
folders
:
Folder
[];
folders
:
Folder
[];
selectedFolder
:
number
;
selectedFolder
:
number
;
selectedFolderSegment
:
any
;
selectedFolderSegment
:
any
;
onChange
:
any
;
rootFolderName
:
string
;
/** @ngInject */
/** @ngInject */
constructor
(
private
backendSrv
,
private
$scope
,
private
$sce
,
private
uiSegmentSrv
)
{
constructor
(
private
backendSrv
,
private
$scope
,
private
$sce
,
private
uiSegmentSrv
)
{
this
.
selectedFolderSegment
=
this
.
uiSegmentSrv
.
newSegment
({
value
:
'Root'
,
selectMode
:
true
});
this
.
selectedFolderSegment
=
this
.
uiSegmentSrv
.
newSegment
({
value
:
this
.
rootFolderName
||
'Root'
,
selectMode
:
true
});
this
.
get
();
this
.
selectedFolder
=
this
.
dashboard
.
meta
.
parentId
;
this
.
get
(
this
.
dashboard
.
id
);
}
}
get
(
dashboardId
:
number
)
{
get
()
{
var
params
=
{
var
params
=
{
type
:
'dash-folder'
,
type
:
'dash-folder'
,
};
};
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
=
[{
id
:
0
,
title
:
this
.
rootFolderName
||
'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
;
if
(
this
.
selectedFolder
)
{
this
.
selectedFolderSegment
.
text
=
selected
.
title
;
const
selected
=
_
.
find
(
this
.
folders
,
{
id
:
this
.
selectedFolder
});
this
.
selectedFolderSegment
.
html
=
this
.
$sce
.
trustAsHtml
(
selected
.
title
);
this
.
selectedFolderSegment
.
value
=
selected
.
title
;
this
.
selectedFolderSegment
.
text
=
selected
.
title
;
this
.
selectedFolderSegment
.
html
=
this
.
$sce
.
trustAsHtml
(
selected
.
title
);
}
});
});
}
}
...
@@ -43,7 +45,7 @@ export class FolderPickerCtrl {
...
@@ -43,7 +45,7 @@ export class FolderPickerCtrl {
folderChanged
()
{
folderChanged
()
{
const
selected
=
_
.
find
(
this
.
folders
,
{
title
:
this
.
selectedFolderSegment
.
value
});
const
selected
=
_
.
find
(
this
.
folders
,
{
title
:
this
.
selectedFolderSegment
.
value
});
if
(
selected
)
{
if
(
selected
)
{
this
.
dashboard
.
parentId
=
selected
.
id
;
this
.
onChange
(
selected
.
id
)
;
}
}
}
}
}
}
...
@@ -66,7 +68,11 @@ export function folderPicker() {
...
@@ -66,7 +68,11 @@ export function folderPicker() {
controller
:
FolderPickerCtrl
,
controller
:
FolderPickerCtrl
,
bindToController
:
true
,
bindToController
:
true
,
controllerAs
:
'ctrl'
,
controllerAs
:
'ctrl'
,
scope
:
{
dashboard
:
"="
}
scope
:
{
selectedFolder
:
"<"
,
onChange
:
"<"
,
rootFolderName
:
"@"
}
};
};
}
}
...
...
public/app/features/dashboard/partials/settings.html
View file @
533f2d3d
...
@@ -45,7 +45,7 @@
...
@@ -45,7 +45,7 @@
</div>
</div>
</div>
</div>
<folder-picker
ng-if=
"!dashboardMeta.isFolder"
dashboard=
"dashboard
"
></folder-picker>
<folder-picker
ng-if=
"!dashboardMeta.isFolder"
selected-folder=
"dashboard.meta.parentId"
on-change=
"onFolderChange
"
></folder-picker>
</div>
</div>
<div
class=
"section"
>
<div
class=
"section"
>
...
...
public/app/features/dashboard/save_as_modal.ts
View file @
533f2d3d
...
@@ -66,6 +66,10 @@ export class SaveDashboardAsModalCtrl {
...
@@ -66,6 +66,10 @@ export class SaveDashboardAsModalCtrl {
this
.
save
();
this
.
save
();
}
}
}
}
onFolderChange
(
parentId
)
{
this
.
clone
.
parentId
=
parentId
;
}
}
}
export
function
saveDashboardAsDirective
()
{
export
function
saveDashboardAsDirective
()
{
...
...
public/app/plugins/panel/dashlist/editor.html
View file @
533f2d3d
...
@@ -23,6 +23,11 @@
...
@@ -23,6 +23,11 @@
</div>
</div>
<div
class=
"gf-form"
>
<div
class=
"gf-form"
>
<span
class=
"gf-form-label width-6"
>
Folder
</span>
<folder-picker
on-change=
"ctrl.onFolderChange"
root-folder-name=
"All"
></folder-picker>
</div>
<div
class=
"gf-form"
>
<span
class=
"gf-form-label width-6"
>
Tags
</span>
<span
class=
"gf-form-label width-6"
>
Tags
</span>
<bootstrap-tagsinput
ng-model=
"ctrl.panel.tags"
tagclass=
"label label-tag"
placeholder=
"add tags"
on-tags-updated=
"ctrl.refresh()"
>
<bootstrap-tagsinput
ng-model=
"ctrl.panel.tags"
tagclass=
"label label-tag"
placeholder=
"add tags"
on-tags-updated=
"ctrl.refresh()"
>
</bootstrap-tagsinput>
</bootstrap-tagsinput>
...
...
public/app/plugins/panel/dashlist/module.ts
View file @
533f2d3d
...
@@ -12,6 +12,7 @@ class DashListCtrl extends PanelCtrl {
...
@@ -12,6 +12,7 @@ class DashListCtrl extends PanelCtrl {
modes
:
any
[];
modes
:
any
[];
panelDefaults
=
{
panelDefaults
=
{
folder
:
''
,
query
:
''
,
query
:
''
,
limit
:
10
,
limit
:
10
,
tags
:
[],
tags
:
[],
...
@@ -19,6 +20,7 @@ class DashListCtrl extends PanelCtrl {
...
@@ -19,6 +20,7 @@ class DashListCtrl extends PanelCtrl {
search
:
false
,
search
:
false
,
starred
:
true
,
starred
:
true
,
headings
:
true
,
headings
:
true
,
folderId
:
0
};
};
/** @ngInject */
/** @ngInject */
...
@@ -87,6 +89,7 @@ class DashListCtrl extends PanelCtrl {
...
@@ -87,6 +89,7 @@ class DashListCtrl extends PanelCtrl {
limit
:
this
.
panel
.
limit
,
limit
:
this
.
panel
.
limit
,
query
:
this
.
panel
.
query
,
query
:
this
.
panel
.
query
,
tag
:
this
.
panel
.
tags
,
tag
:
this
.
panel
.
tags
,
folderId
:
this
.
panel
.
folderId
};
};
return
this
.
backendSrv
.
search
(
params
).
then
(
result
=>
{
return
this
.
backendSrv
.
search
(
params
).
then
(
result
=>
{
...
@@ -123,6 +126,11 @@ class DashListCtrl extends PanelCtrl {
...
@@ -123,6 +126,11 @@ class DashListCtrl extends PanelCtrl {
});
});
});
});
}
}
onFolderChange
(
parentId
)
{
this
.
$scope
.
$parent
.
ctrl
.
panel
.
folderId
=
parentId
;
this
.
$scope
.
$parent
.
ctrl
.
refresh
();
}
}
}
export
{
DashListCtrl
,
DashListCtrl
as
PanelCtrl
};
export
{
DashListCtrl
,
DashListCtrl
as
PanelCtrl
};
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