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
19850275
Commit
19850275
authored
Dec 08, 2017
by
Marcus Efraimsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashfolders: Folder picker should set correct default values. Fixes #10135
parent
b03b3604
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
43 additions
and
17 deletions
+43
-17
public/app/core/components/manage_dashboards/manage_dashboards.ts
+2
-2
public/app/features/dashboard/folder_picker/picker.ts
+26
-7
public/app/features/dashboard/move_to_folder_modal/move_to_folder.html
+2
-1
public/app/features/dashboard/move_to_folder_modal/move_to_folder.ts
+8
-0
public/app/features/dashboard/partials/settings.html
+1
-2
public/app/features/dashboard/save_as_modal.ts
+3
-3
public/app/plugins/panel/permissionlist/editor.html
+1
-2
No files found.
public/app/core/components/manage_dashboards/manage_dashboards.ts
View file @
19850275
...
@@ -134,12 +134,12 @@ export class ManageDashboardsCtrl {
...
@@ -134,12 +134,12 @@ export class ManageDashboardsCtrl {
const
selectedDashboards
=
this
.
getDashboardsToMove
();
const
selectedDashboards
=
this
.
getDashboardsToMove
();
const
template
=
'<move-to-folder-modal dismiss="dismiss()" '
+
const
template
=
'<move-to-folder-modal dismiss="dismiss()" '
+
'dashboards="model.dashboards" after-save="model.afterSave()">'
+
'dashboards="model.dashboards"
from-folder-id="model.fromFolderId"
after-save="model.afterSave()">'
+
'</move-to-folder-modal>`'
;
'</move-to-folder-modal>`'
;
appEvents
.
emit
(
'show-modal'
,
{
appEvents
.
emit
(
'show-modal'
,
{
templateHtml
:
template
,
templateHtml
:
template
,
modalClass
:
'modal--narrow'
,
modalClass
:
'modal--narrow'
,
model
:
{
dashboards
:
selectedDashboards
,
afterSave
:
this
.
getDashboards
.
bind
(
this
)
}
model
:
{
dashboards
:
selectedDashboards
,
fromFolderId
:
this
.
folderId
?
Number
(
this
.
folderId
)
:
0
,
afterSave
:
this
.
getDashboards
.
bind
(
this
)
}
});
});
}
}
...
...
public/app/features/dashboard/folder_picker/picker.ts
View file @
19850275
...
@@ -5,9 +5,10 @@ import _ from 'lodash';
...
@@ -5,9 +5,10 @@ import _ from 'lodash';
export
class
FolderPickerCtrl
{
export
class
FolderPickerCtrl
{
initialTitle
:
string
;
initialTitle
:
string
;
initialFolderId
:
number
;
initialFolderId
?
:
number
;
labelClass
:
string
;
labelClass
:
string
;
onChange
:
any
;
onChange
:
any
;
onLoad
:
any
;
rootName
=
'Root'
;
rootName
=
'Root'
;
folder
:
any
;
folder
:
any
;
...
@@ -17,12 +18,19 @@ export class FolderPickerCtrl {
...
@@ -17,12 +18,19 @@ export class FolderPickerCtrl {
this
.
labelClass
=
"width-7"
;
this
.
labelClass
=
"width-7"
;
}
}
if
(
this
.
initialFolderId
>
0
)
{
if
(
this
.
initialFolderId
&&
this
.
initialFolderId
>
0
)
{
this
.
getOptions
(
''
).
then
(
result
=>
{
this
.
getOptions
(
''
).
then
(
result
=>
{
this
.
folder
=
_
.
find
(
result
,
{
value
:
this
.
initialFolderId
});
this
.
folder
=
_
.
find
(
result
,
{
value
:
this
.
initialFolderId
});
this
.
onFolderLoad
();
});
});
}
else
{
}
else
{
this
.
folder
=
{
text
:
this
.
initialTitle
,
value
:
null
};
if
(
this
.
initialTitle
)
{
this
.
folder
=
{
text
:
this
.
initialTitle
,
value
:
null
};
}
else
{
this
.
folder
=
{
text
:
this
.
rootName
,
value
:
0
};
}
this
.
onFolderLoad
();
}
}
}
}
...
@@ -33,8 +41,12 @@ export class FolderPickerCtrl {
...
@@ -33,8 +41,12 @@ export class FolderPickerCtrl {
};
};
return
this
.
backendSrv
.
search
(
params
).
then
(
result
=>
{
return
this
.
backendSrv
.
search
(
params
).
then
(
result
=>
{
if
(
query
===
""
)
{
if
(
query
===
''
||
result
.
unshift
({
title
:
this
.
rootName
,
value
:
0
});
query
.
toLowerCase
()
===
"r"
||
query
.
toLowerCase
()
===
"ro"
||
query
.
toLowerCase
()
===
"roo"
||
query
.
toLowerCase
()
===
"root"
)
{
result
.
unshift
({
title
:
this
.
rootName
,
id
:
0
});
}
}
return
_
.
map
(
result
,
item
=>
{
return
_
.
map
(
result
,
item
=>
{
...
@@ -43,6 +55,12 @@ export class FolderPickerCtrl {
...
@@ -43,6 +55,12 @@ export class FolderPickerCtrl {
});
});
}
}
onFolderLoad
()
{
if
(
this
.
onLoad
)
{
this
.
onLoad
({
$folder
:
{
id
:
this
.
folder
.
value
,
title
:
this
.
folder
.
text
}});
}
}
onFolderChange
(
option
)
{
onFolderChange
(
option
)
{
this
.
onChange
({
$folder
:
{
id
:
option
.
value
,
title
:
option
.
text
}});
this
.
onChange
({
$folder
:
{
id
:
option
.
value
,
title
:
option
.
text
}});
}
}
...
@@ -69,11 +87,12 @@ export function folderPicker() {
...
@@ -69,11 +87,12 @@ export function folderPicker() {
bindToController
:
true
,
bindToController
:
true
,
controllerAs
:
'ctrl'
,
controllerAs
:
'ctrl'
,
scope
:
{
scope
:
{
initialTitle
:
"<"
,
initialTitle
:
'<'
,
initialFolderId
:
'<'
,
initialFolderId
:
'<'
,
labelClass
:
'@'
,
labelClass
:
'@'
,
rootName
:
'@'
,
rootName
:
'@'
,
onChange
:
'&'
onChange
:
'&'
,
onLoad
:
'&'
}
}
};
};
}
}
...
...
public/app/features/dashboard/move_to_folder_modal/move_to_folder.html
View file @
19850275
...
@@ -15,7 +15,8 @@
...
@@ -15,7 +15,8 @@
<div
class=
"p-t-2"
>
<div
class=
"p-t-2"
>
<div
class=
"gf-form"
>
<div
class=
"gf-form"
>
<folder-picker
initial-title=
"Choose"
<folder-picker
on-load=
"ctrl.onFolderChange($folder)"
on-change=
"ctrl.onFolderChange($folder)"
on-change=
"ctrl.onFolderChange($folder)"
label-class=
"width-7"
>
label-class=
"width-7"
>
</folder-picker>
</folder-picker>
...
...
public/app/features/dashboard/move_to_folder_modal/move_to_folder.ts
View file @
19850275
...
@@ -7,6 +7,7 @@ export class MoveToFolderCtrl {
...
@@ -7,6 +7,7 @@ export class MoveToFolderCtrl {
folder
:
any
;
folder
:
any
;
dismiss
:
any
;
dismiss
:
any
;
afterSave
:
any
;
afterSave
:
any
;
fromFolderId
:
number
;
/** @ngInject */
/** @ngInject */
constructor
(
private
backendSrv
,
private
$q
)
{}
constructor
(
private
backendSrv
,
private
$q
)
{}
...
@@ -16,10 +17,16 @@ export class MoveToFolderCtrl {
...
@@ -16,10 +17,16 @@ export class MoveToFolderCtrl {
}
}
save
()
{
save
()
{
if
(
this
.
folder
.
id
===
this
.
fromFolderId
)
{
appEvents
.
emit
(
'alert-error'
,
[
'Dashboard(s) already belong to this folder'
]);
return
;
}
const
promises
=
[];
const
promises
=
[];
for
(
let
dash
of
this
.
dashboards
)
{
for
(
let
dash
of
this
.
dashboards
)
{
const
promise
=
this
.
backendSrv
.
get
(
'/api/dashboards/'
+
dash
).
then
(
fullDash
=>
{
const
promise
=
this
.
backendSrv
.
get
(
'/api/dashboards/'
+
dash
).
then
(
fullDash
=>
{
const
model
=
new
DashboardModel
(
fullDash
.
dashboard
,
fullDash
.
meta
);
const
model
=
new
DashboardModel
(
fullDash
.
dashboard
,
fullDash
.
meta
);
model
.
folderId
=
this
.
folder
.
id
;
model
.
folderId
=
this
.
folder
.
id
;
model
.
meta
.
folderId
=
this
.
folder
.
id
;
model
.
meta
.
folderId
=
this
.
folder
.
id
;
model
.
meta
.
folderTitle
=
this
.
folder
.
title
;
model
.
meta
.
folderTitle
=
this
.
folder
.
title
;
...
@@ -53,6 +60,7 @@ export function moveToFolderModal() {
...
@@ -53,6 +60,7 @@ export function moveToFolderModal() {
scope
:
{
scope
:
{
dismiss
:
"&"
,
dismiss
:
"&"
,
dashboards
:
"="
,
dashboards
:
"="
,
fromFolderId
:
'<'
,
afterSave
:
"&"
afterSave
:
"&"
}
}
};
};
...
...
public/app/features/dashboard/partials/settings.html
View file @
19850275
...
@@ -37,9 +37,8 @@
...
@@ -37,9 +37,8 @@
<bootstrap-tagsinput
ng-model=
"ctrl.dashboard.tags"
tagclass=
"label label-tag"
placeholder=
"add tags"
>
<bootstrap-tagsinput
ng-model=
"ctrl.dashboard.tags"
tagclass=
"label label-tag"
placeholder=
"add tags"
>
</bootstrap-tagsinput>
</bootstrap-tagsinput>
</div>
</div>
<folder-picker
ng-if=
"!ctrl.dashboard.meta.isFolder"
<folder-picker
ng-if=
"!ctrl.dashboard.meta.isFolder"
initial-title=
"ctrl.dashboard.meta.folderTitle
"
initial-folder-id=
"ctrl.dashboard.folderId
"
on-change=
"ctrl.onFolderChange($folder)"
on-change=
"ctrl.onFolderChange($folder)"
label-class=
"width-7"
>
label-class=
"width-7"
>
</folder-picker>
</folder-picker>
...
...
public/app/features/dashboard/save_as_modal.ts
View file @
19850275
...
@@ -22,7 +22,7 @@ const template = `
...
@@ -22,7 +22,7 @@ const template = `
<input type="text" class="gf-form-input" ng-model="ctrl.clone.title" give-focus="true" required>
<input type="text" class="gf-form-input" ng-model="ctrl.clone.title" give-focus="true" required>
</div>
</div>
<div class="gf-form">
<div class="gf-form">
<folder-picker initial-
title="ctrl.folderTitle
"
<folder-picker initial-
folder-id="ctrl.folderId
"
on-change="ctrl.onFolderChange($folder)"
on-change="ctrl.onFolderChange($folder)"
label-class="width-7">
label-class="width-7">
</folder-picker>
</folder-picker>
...
@@ -39,7 +39,7 @@ const template = `
...
@@ -39,7 +39,7 @@ const template = `
export
class
SaveDashboardAsModalCtrl
{
export
class
SaveDashboardAsModalCtrl
{
clone
:
any
;
clone
:
any
;
folder
Title
:
any
;
folder
Id
:
any
;
dismiss
:
()
=>
void
;
dismiss
:
()
=>
void
;
/** @ngInject */
/** @ngInject */
...
@@ -50,7 +50,7 @@ export class SaveDashboardAsModalCtrl {
...
@@ -50,7 +50,7 @@ export class SaveDashboardAsModalCtrl {
this
.
clone
.
title
+=
' Copy'
;
this
.
clone
.
title
+=
' Copy'
;
this
.
clone
.
editable
=
true
;
this
.
clone
.
editable
=
true
;
this
.
clone
.
hideControls
=
false
;
this
.
clone
.
hideControls
=
false
;
this
.
folder
Title
=
dashboard
.
meta
.
folderTitle
||
'Root'
;
this
.
folder
Id
=
dashboard
.
folderId
;
// remove alerts if source dashboard is already persisted
// remove alerts if source dashboard is already persisted
// do not want to create alert dupes
// do not want to create alert dupes
...
...
public/app/plugins/panel/permissionlist/editor.html
View file @
19850275
...
@@ -2,8 +2,7 @@
...
@@ -2,8 +2,7 @@
<div
class=
"section gf-form-group"
>
<div
class=
"section gf-form-group"
>
<h5
class=
"section-heading"
>
Options
</h5>
<h5
class=
"section-heading"
>
Options
</h5>
<div
class=
"gf-form"
>
<div
class=
"gf-form"
>
<folder-picker
root-name=
"All"
<folder-picker
initial-folder-id=
"ctrl.panel.folderId"
initial-folder-id=
"ctrl.panel.folderId"
on-change=
"ctrl.onFolderChange($folder)"
on-change=
"ctrl.onFolderChange($folder)"
label-class=
"width-6"
>
label-class=
"width-6"
>
</folder-picker>
</folder-picker>
...
...
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