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
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
11 deletions
+38
-11
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
+15
-9
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 {
this
.
giveSearchFocus
=
0
;
this
.
selectedIndex
=
-
1
;
this
.
results
=
[];
this
.
query
=
{
query
:
''
,
tag
:
[],
starred
:
false
};
this
.
query
=
{
query
:
''
,
tag
:
[],
starred
:
false
,
mode
:
'tree'
};
this
.
currentSearchId
=
0
;
this
.
ignoreClose
=
true
;
...
...
public/app/features/dashboard/dashnav/dashnav.ts
View file @
533f2d3d
...
...
@@ -135,6 +135,10 @@ export class DashNavCtrl {
var
uri
=
"data:application/json;charset=utf-8,"
+
encodeURIComponent
(
html
);
var
newWindow
=
window
.
open
(
uri
);
}
onFolderChange
(
parentId
)
{
this
.
dashboard
.
parentId
=
parentId
;
}
}
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';
import
_
from
'lodash'
;
export
class
FolderPickerCtrl
{
dashboard
:
any
;
folders
:
Folder
[];
selectedFolder
:
number
;
selectedFolderSegment
:
any
;
onChange
:
any
;
rootFolderName
:
string
;
/** @ngInject */
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
.
get
(
this
.
dashboard
.
id
);
this
.
selectedFolderSegment
=
this
.
uiSegmentSrv
.
newSegment
({
value
:
this
.
rootFolderName
||
'Root'
,
selectMode
:
true
});
this
.
get
();
}
get
(
dashboardId
:
number
)
{
get
()
{
var
params
=
{
type
:
'dash-folder'
,
};
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
);
if
(
this
.
selectedFolder
)
{
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
);
}
});
}
...
...
@@ -43,7 +45,7 @@ export class FolderPickerCtrl {
folderChanged
()
{
const
selected
=
_
.
find
(
this
.
folders
,
{
title
:
this
.
selectedFolderSegment
.
value
});
if
(
selected
)
{
this
.
dashboard
.
parentId
=
selected
.
id
;
this
.
onChange
(
selected
.
id
)
;
}
}
}
...
...
@@ -66,7 +68,11 @@ export function folderPicker() {
controller
:
FolderPickerCtrl
,
bindToController
:
true
,
controllerAs
:
'ctrl'
,
scope
:
{
dashboard
:
"="
}
scope
:
{
selectedFolder
:
"<"
,
onChange
:
"<"
,
rootFolderName
:
"@"
}
};
}
...
...
public/app/features/dashboard/partials/settings.html
View file @
533f2d3d
...
...
@@ -45,7 +45,7 @@
</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
class=
"section"
>
...
...
public/app/features/dashboard/save_as_modal.ts
View file @
533f2d3d
...
...
@@ -66,6 +66,10 @@ export class SaveDashboardAsModalCtrl {
this
.
save
();
}
}
onFolderChange
(
parentId
)
{
this
.
clone
.
parentId
=
parentId
;
}
}
export
function
saveDashboardAsDirective
()
{
...
...
public/app/plugins/panel/dashlist/editor.html
View file @
533f2d3d
...
...
@@ -23,6 +23,11 @@
</div>
<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>
<bootstrap-tagsinput
ng-model=
"ctrl.panel.tags"
tagclass=
"label label-tag"
placeholder=
"add tags"
on-tags-updated=
"ctrl.refresh()"
>
</bootstrap-tagsinput>
...
...
public/app/plugins/panel/dashlist/module.ts
View file @
533f2d3d
...
...
@@ -12,6 +12,7 @@ class DashListCtrl extends PanelCtrl {
modes
:
any
[];
panelDefaults
=
{
folder
:
''
,
query
:
''
,
limit
:
10
,
tags
:
[],
...
...
@@ -19,6 +20,7 @@ class DashListCtrl extends PanelCtrl {
search
:
false
,
starred
:
true
,
headings
:
true
,
folderId
:
0
};
/** @ngInject */
...
...
@@ -87,6 +89,7 @@ class DashListCtrl extends PanelCtrl {
limit
:
this
.
panel
.
limit
,
query
:
this
.
panel
.
query
,
tag
:
this
.
panel
.
tags
,
folderId
:
this
.
panel
.
folderId
};
return
this
.
backendSrv
.
search
(
params
).
then
(
result
=>
{
...
...
@@ -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
};
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