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
c504abb8
Commit
c504abb8
authored
Mar 13, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(plugins): added dashboards tab to plugin edit page, #4275
parent
2527289e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
24 deletions
+28
-24
public/app/features/plugins/partials/plugin_edit.html
+9
-15
public/app/features/plugins/plugin_edit_ctrl.ts
+19
-9
No files found.
public/app/features/plugins/partials/plugin_edit.html
View file @
c504abb8
<navbar
title=
"Plugins"
title-url=
"plugins"
icon=
"icon-gf icon-gf-apps"
>
<navbar
title=
"Plugins"
title-url=
"plugins"
icon=
"icon-gf icon-gf-apps"
>
<a
href=
"plugins/{{ctrl.model.pluginId}}/edit"
class=
"navbar-page-btn"
>
{{ctrl.model.name}}
</a>
</navbar>
</navbar>
<div
class=
"page-container"
ng-init=
"ctrl.init()"
>
<div
class=
"page-container"
ng-init=
"ctrl.init()"
>
...
@@ -23,7 +20,7 @@
...
@@ -23,7 +20,7 @@
</div>
</div>
<ul
class=
"gf-tabs"
>
<ul
class=
"gf-tabs"
>
<li
class=
"gf-tabs-item"
ng-repeat=
"tab in
::['Overview', 'Config']
"
>
<li
class=
"gf-tabs-item"
ng-repeat=
"tab in
ctrl.tabs
"
>
<a
class=
"gf-tabs-link"
ng-click=
"ctrl.tabIndex = $index"
ng-class=
"{active: ctrl.tabIndex === $index}"
>
<a
class=
"gf-tabs-link"
ng-click=
"ctrl.tabIndex = $index"
ng-class=
"{active: ctrl.tabIndex === $index}"
>
{{::tab}}
{{::tab}}
</a>
</a>
...
@@ -39,21 +36,18 @@
...
@@ -39,21 +36,18 @@
</div>
</div>
<div
class=
"tab-content page-content-with-sidebar"
ng-if=
"ctrl.tabIndex === 1"
>
<div
class=
"tab-content page-content-with-sidebar"
ng-if=
"ctrl.tabIndex === 1"
>
<div
class=
"gf-form-inline"
>
<div
class=
"gf-form"
>
<editor-checkbox
text=
"Enabled"
model=
"ctrl.model.enabled"
change=
"ctrl.toggleEnabled()"
></editor-checkbox>
</div>
<div
class=
"gf-form"
>
<editor-checkbox
text=
"Pinned"
model=
"ctrl.model.pinned"
change=
"ctrl.togglePinned()"
></editor-checkbox>
</div>
</div>
<div
ng-if=
"ctrl.model.id"
>
<div
ng-if=
"ctrl.model.id"
>
<plugin-component
type=
"app-config-ctrl"
></plugin-component>
<plugin-component
type=
"app-config-ctrl"
></plugin-component>
<div
class=
"clearfix"
></div>
<button
type=
"submit"
class=
"btn btn-success"
ng-click=
"ctrl.update()"
>
Save
</button>
<div
class=
"gf-form-button-row"
>
<button
type=
"submit"
class=
"btn btn-success"
ng-click=
"ctrl.enable()"
ng-show=
"!ctrl.model.enabled"
>
Enable
</button>
<button
type=
"submit"
class=
"btn btn-success"
ng-click=
"ctrl.update()"
ng-show=
"ctrl.model.enabled"
>
Update
</button>
</div>
</div>
</div>
</div>
<div
class=
"tab-content page-content-with-sidebar"
ng-if=
"ctrl.tabIndex === 2"
>
<dashboard-import-list
plugin=
"ctrl.model"
></dashboard-import-list>
</div>
</div>
<aside
class=
"page-sidebar"
>
<aside
class=
"page-sidebar"
>
...
...
public/app/features/plugins/plugin_edit_ctrl.ts
View file @
c504abb8
...
@@ -11,6 +11,8 @@ export class PluginEditCtrl {
...
@@ -11,6 +11,8 @@ export class PluginEditCtrl {
readmeHtml
:
any
;
readmeHtml
:
any
;
includedDatasources
:
any
;
includedDatasources
:
any
;
tabIndex
:
number
;
tabIndex
:
number
;
tabs
:
any
;
hasDashboards
:
any
;
preUpdateHook
:
()
=>
any
;
preUpdateHook
:
()
=>
any
;
postUpdateHook
:
()
=>
any
;
postUpdateHook
:
()
=>
any
;
...
@@ -19,6 +21,7 @@ export class PluginEditCtrl {
...
@@ -19,6 +21,7 @@ export class PluginEditCtrl {
this
.
model
=
{};
this
.
model
=
{};
this
.
pluginId
=
$routeParams
.
pluginId
;
this
.
pluginId
=
$routeParams
.
pluginId
;
this
.
tabIndex
=
0
;
this
.
tabIndex
=
0
;
this
.
tabs
=
[
'Overview'
];
}
}
init
()
{
init
()
{
...
@@ -35,6 +38,15 @@ export class PluginEditCtrl {
...
@@ -35,6 +38,15 @@ export class PluginEditCtrl {
return
plug
;
return
plug
;
});
});
if
(
this
.
model
.
type
===
'app'
)
{
this
.
tabs
.
push
(
'Config'
);
this
.
hasDashboards
=
_
.
findWhere
(
result
.
includes
,
{
type
:
'dashboard'
});
if
(
this
.
hasDashboards
)
{
this
.
tabs
.
push
(
'Dashboards'
);
}
}
return
this
.
initReadme
();
return
this
.
initReadme
();
});
});
}
}
...
@@ -54,6 +66,7 @@ export class PluginEditCtrl {
...
@@ -54,6 +66,7 @@ export class PluginEditCtrl {
case
'panel'
:
return
'icon-gf icon-gf-panel'
;
case
'panel'
:
return
'icon-gf icon-gf-panel'
;
case
'app'
:
return
'icon-gf icon-gf-apps'
;
case
'app'
:
return
'icon-gf icon-gf-apps'
;
case
'page'
:
return
'icon-gf icon-gf-share'
;
case
'page'
:
return
'icon-gf icon-gf-share'
;
case
'dashboard'
:
return
'icon-gf icon-gf-dashboard'
;
}
}
}
}
...
@@ -64,9 +77,7 @@ export class PluginEditCtrl {
...
@@ -64,9 +77,7 @@ export class PluginEditCtrl {
// the next step of execution will block until the promise resolves.
// the next step of execution will block until the promise resolves.
// if the promise is rejected, this update will be aborted.
// if the promise is rejected, this update will be aborted.
if
(
this
.
preUpdateHook
!=
null
)
{
if
(
this
.
preUpdateHook
!=
null
)
{
chain
=
chain
.
then
(
function
()
{
chain
=
self
.
preUpdateHook
();
return
Promise
.
resolve
(
self
.
preUpdateHook
());
});
}
}
// Perform the core update procedure
// Perform the core update procedure
...
@@ -86,7 +97,7 @@ export class PluginEditCtrl {
...
@@ -86,7 +97,7 @@ export class PluginEditCtrl {
// resolves. If the promise is rejected the page will not be reloaded.
// resolves. If the promise is rejected the page will not be reloaded.
if
(
this
.
postUpdateHook
!=
null
)
{
if
(
this
.
postUpdateHook
!=
null
)
{
chain
=
chain
.
then
(
function
()
{
chain
=
chain
.
then
(
function
()
{
return
Promise
.
resolve
(
this
.
postUpdateHook
()
);
return
this
.
postUpdateHook
(
);
});
});
}
}
...
@@ -101,17 +112,16 @@ export class PluginEditCtrl {
...
@@ -101,17 +112,16 @@ export class PluginEditCtrl {
this
.
preUpdateHook
=
callback
;
this
.
preUpdateHook
=
callback
;
}
}
setP
O
stUpdateHook
(
callback
:
()
=>
any
)
{
setP
o
stUpdateHook
(
callback
:
()
=>
any
)
{
this
.
postUpdateHook
=
callback
;
this
.
postUpdateHook
=
callback
;
}
}
toggleEnabled
()
{
enable
()
{
this
.
model
.
enabled
=
true
;
this
.
model
.
pinned
=
true
;
this
.
update
();
this
.
update
();
}
}
togglePinned
()
{
this
.
update
();
}
}
}
angular
.
module
(
'grafana.controllers'
).
controller
(
'PluginEditCtrl'
,
PluginEditCtrl
);
angular
.
module
(
'grafana.controllers'
).
controller
(
'PluginEditCtrl'
,
PluginEditCtrl
);
...
...
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