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
546f9031
Commit
546f9031
authored
Aug 28, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ds: minor fix that resets data source model when switching data source type
parent
c2b05341
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
public/app/features/plugins/ds_edit_ctrl.ts
+12
-2
public/app/features/plugins/partials/ds_edit.html
+1
-1
No files found.
public/app/features/plugins/ds_edit_ctrl.ts
View file @
546f9031
...
@@ -58,7 +58,7 @@ export class DataSourceEditCtrl {
...
@@ -58,7 +58,7 @@ export class DataSourceEditCtrl {
}
}
initNewDatasourceModel
()
{
initNewDatasourceModel
()
{
this
.
current
=
angular
.
copy
(
defaults
);
this
.
current
=
_
.
cloneDeep
(
defaults
);
// We are coming from getting started
// We are coming from getting started
if
(
this
.
$location
.
search
().
gettingstarted
)
{
if
(
this
.
$location
.
search
().
gettingstarted
)
{
...
@@ -93,11 +93,21 @@ export class DataSourceEditCtrl {
...
@@ -93,11 +93,21 @@ export class DataSourceEditCtrl {
});
});
}
}
userChangedType
()
{
// reset model but keep name & default flag
this
.
current
=
_
.
defaults
({
id
:
this
.
current
.
id
,
name
:
this
.
current
.
name
,
isDefault
:
this
.
current
.
isDefault
,
type
:
this
.
current
.
type
,
},
_
.
cloneDeep
(
defaults
));
this
.
typeChanged
();
}
typeChanged
()
{
typeChanged
()
{
this
.
hasDashboards
=
false
;
this
.
hasDashboards
=
false
;
return
this
.
backendSrv
.
get
(
'/api/plugins/'
+
this
.
current
.
type
+
'/settings'
).
then
(
pluginInfo
=>
{
return
this
.
backendSrv
.
get
(
'/api/plugins/'
+
this
.
current
.
type
+
'/settings'
).
then
(
pluginInfo
=>
{
this
.
datasourceMeta
=
pluginInfo
;
this
.
datasourceMeta
=
pluginInfo
;
console
.
log
(
this
.
datasourceMeta
)
;
this
.
hasDashboards
=
_
.
find
(
pluginInfo
.
includes
,
{
type
:
'dashboard'
});
this
.
hasDashboards
=
_
.
find
(
pluginInfo
.
includes
,
{
type
:
'dashboard'
});
});
});
}
}
...
...
public/app/features/plugins/partials/ds_edit.html
View file @
546f9031
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
<div
class=
"gf-form"
>
<div
class=
"gf-form"
>
<span
class=
"gf-form-label width-7"
>
Type
</span>
<span
class=
"gf-form-label width-7"
>
Type
</span>
<div
class=
"gf-form-select-wrapper max-width-23"
>
<div
class=
"gf-form-select-wrapper max-width-23"
>
<select
class=
"gf-form-input"
ng-model=
"ctrl.current.type"
ng-options=
"v.id as v.name for v in ctrl.types"
ng-change=
"ctrl.
typeChanged
()"
></select>
<select
class=
"gf-form-input"
ng-model=
"ctrl.current.type"
ng-options=
"v.id as v.name for v in ctrl.types"
ng-change=
"ctrl.
userChangedType
()"
></select>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
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