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
fc54c01f
Commit
fc54c01f
authored
Mar 11, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(plugins): more work on plugin dashboard install, #4298
parent
2de439bd
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
70 additions
and
55 deletions
+70
-55
pkg/api/dtos/plugins.go
+4
-3
pkg/plugins/dashboard_installer.go
+2
-1
pkg/plugins/dashboards.go
+4
-2
public/app/core/routes/routes.ts
+3
-3
public/app/features/dashboard/all.js
+0
-1
public/app/features/datasources/all.js
+0
-4
public/app/features/org/all.js
+0
-1
public/app/features/plugins/all.ts
+6
-3
public/app/features/plugins/ds_edit_ctrl.ts
+1
-1
public/app/features/plugins/ds_list_ctrl.ts
+0
-0
public/app/features/plugins/import_list/import_list.html
+37
-0
public/app/features/plugins/import_list/import_list.ts
+11
-33
public/app/features/plugins/partials/ds_edit.html
+0
-0
public/app/features/plugins/partials/ds_http_settings.html
+0
-0
public/app/features/plugins/partials/ds_list.html
+0
-0
public/app/features/plugins/partials/plugin_edit.html
+0
-0
public/app/features/plugins/partials/plugin_list.html
+0
-0
public/app/features/plugins/partials/plugin_page.html
+0
-0
public/app/features/plugins/plugin_edit_ctrl.ts
+0
-0
public/app/features/plugins/plugin_list_ctrl.ts
+0
-0
public/app/features/plugins/plugin_page_ctrl.ts
+0
-0
public/app/plugins/datasource/graphite/dashboards/carbon_stats.json
+1
-1
public/app/plugins/datasource/graphite/plugin.json
+1
-2
No files found.
pkg/api/dtos/plugins.go
View file @
fc54c01f
...
...
@@ -27,7 +27,8 @@ type PluginListItem struct {
}
type
InstallPluginDashboardCmd
struct
{
PluginId
string
`json:"pluginId"`
Path
string
`json:"path"`
Inputs
map
[
string
]
interface
{}
`json:"inputs"`
PluginId
string
`json:"pluginId"`
Path
string
`json:"path"`
Reinstall
bool
`json:"reinstall"`
Inputs
map
[
string
]
interface
{}
`json:"inputs"`
}
pkg/plugins/dashboard_installer.go
View file @
fc54c01f
...
...
@@ -48,8 +48,9 @@ func InstallPluginDashboard(cmd *InstallPluginDashboardCommand) error {
Title
:
dashboard
.
Title
,
Path
:
cmd
.
Path
,
Revision
:
dashboard
.
GetString
(
"revision"
,
"1.0"
),
InstalledU
RI
:
"db/"
+
saveCmd
.
Result
.
Slug
,
InstalledU
ri
:
"db/"
+
saveCmd
.
Result
.
Slug
,
InstalledRevision
:
dashboard
.
GetString
(
"revision"
,
"1.0"
),
Installed
:
true
,
}
return
nil
...
...
pkg/plugins/dashboards.go
View file @
fc54c01f
...
...
@@ -12,7 +12,8 @@ import (
type
PluginDashboardInfoDTO
struct
{
PluginId
string
`json:"pluginId"`
Title
string
`json:"title"`
InstalledURI
string
`json:"installedURI"`
Installed
bool
`json:"installed"`
InstalledUri
string
`json:"installedUri"`
InstalledRevision
string
`json:"installedRevision"`
Revision
string
`json:"revision"`
Description
string
`json:"description"`
...
...
@@ -83,7 +84,8 @@ func getDashboardImportStatus(orgId int64, plugin *PluginBase, path string) (*Pl
return
nil
,
err
}
}
else
{
res
.
InstalledURI
=
"db/"
+
query
.
Result
.
Slug
res
.
Installed
=
true
res
.
InstalledUri
=
"db/"
+
query
.
Result
.
Slug
res
.
InstalledRevision
=
query
.
Result
.
GetString
(
"revision"
,
"1.0"
)
}
...
...
public/app/core/routes/routes.ts
View file @
fc54c01f
...
...
@@ -52,19 +52,19 @@ function setupAngularRoutes($routeProvider, $locationProvider) {
templateUrl
:
'public/app/features/datasources/partials/list.html'
,
controller
:
'DataSourcesCtrl'
,
controllerAs
:
'ctrl'
,
resolve
:
load
Org
Bundle
,
resolve
:
load
Plugins
Bundle
,
})
.
when
(
'/datasources/edit/:id'
,
{
templateUrl
:
'public/app/features/datasources/partials/edit.html'
,
controller
:
'DataSourceEditCtrl'
,
controllerAs
:
'ctrl'
,
resolve
:
load
Org
Bundle
,
resolve
:
load
Plugins
Bundle
,
})
.
when
(
'/datasources/new'
,
{
templateUrl
:
'public/app/features/datasources/partials/edit.html'
,
controller
:
'DataSourceEditCtrl'
,
controllerAs
:
'ctrl'
,
resolve
:
load
Org
Bundle
,
resolve
:
load
Plugins
Bundle
,
})
.
when
(
'/org'
,
{
templateUrl
:
'public/app/features/org/partials/orgDetails.html'
,
...
...
public/app/features/dashboard/all.js
View file @
fc54c01f
...
...
@@ -13,7 +13,6 @@ define([
'./timeSrv'
,
'./unsavedChangesSrv'
,
'./timepicker/timepicker'
,
'./import_list/import_list'
,
'./graphiteImportCtrl'
,
'./dynamicDashboardSrv'
,
'./importCtrl'
,
...
...
public/app/features/datasources/all.js
deleted
100644 → 0
View file @
2de439bd
define
([
'./list_ctrl'
,
'./edit_ctrl'
,
],
function
()
{});
public/app/features/org/all.js
View file @
fc54c01f
...
...
@@ -4,5 +4,4 @@ define([
'./userInviteCtrl'
,
'./orgApiKeysCtrl'
,
'./orgDetailsCtrl'
,
'../datasources/all'
,
],
function
()
{});
public/app/features/plugins/all.ts
View file @
fc54c01f
import
'./edit_ctrl'
;
import
'./page_ctrl'
;
import
'./list_ctrl'
;
import
'./plugin_edit_ctrl'
;
import
'./plugin_page_ctrl'
;
import
'./plugin_list_ctrl'
;
import
'./import_list/import_list'
;
import
'./ds_edit_ctrl'
;
import
'./ds_list_ctrl'
;
public/app/features/
datasources/
edit_ctrl.ts
→
public/app/features/
plugins/ds_
edit_ctrl.ts
View file @
fc54c01f
...
...
@@ -140,6 +140,6 @@ coreModule.controller('DataSourceEditCtrl', DataSourceEditCtrl);
coreModule
.
directive
(
'datasourceHttpSettings'
,
function
()
{
return
{
scope
:
{
current
:
"="
},
templateUrl
:
'public/app/features/
datasources/partials/
http_settings.html'
templateUrl
:
'public/app/features/
plugins/partials/ds_
http_settings.html'
};
});
public/app/features/
datasources/
list_ctrl.ts
→
public/app/features/
plugins/ds_
list_ctrl.ts
View file @
fc54c01f
File moved
public/app/features/plugins/import_list/import_list.html
0 → 100644
View file @
fc54c01f
<div
class=
"gf-form-group"
ng-if=
"ctrl.dashboards.length"
>
<table
class=
"filter-table"
>
<tbody>
<tr
ng-repeat=
"dash in ctrl.dashboards"
>
<td
class=
"width-1"
>
<i
class=
"icon-gf icon-gf-dashboard"
></i>
</td>
<td>
<a
href=
"dashboard/{{dash.installedUri}}"
ng-show=
"dash.installed"
>
{{dash.title}}
</a>
<span
ng-show=
"!dash.installed"
>
{{dash.title}}
</span>
</td>
<td>
v{{dash.revision}}
</td>
<td
ng-if=
"dash.installed"
>
Installed v{{dash.installedRevision}}
</td>
<td
style=
"text-align: right"
>
<button
class=
"btn btn-secondary"
ng-click=
"ctrl.import(dash, false)"
ng-show=
"!dash.installed"
>
Install
</button>
<button
class=
"btn btn-secondary"
ng-click=
"ctrl.import(dash, true)"
ng-show=
"dash.installed"
>
Re-Install
</button>
<button
class=
"btn btn-danger"
ng-click=
"ctrl.remove(dash)"
ng-show=
"dash.installed"
>
Un-install
</button>
</td>
</tr>
</tbody>
</table>
</div>
public/app/features/
dashboard
/import_list/import_list.ts
→
public/app/features/
plugins
/import_list/import_list.ts
View file @
fc54c01f
...
...
@@ -4,9 +4,6 @@ import angular from 'angular';
import
_
from
'lodash'
;
import
coreModule
from
'app/core/core_module'
;
class
DashboardScriptLoader
{
}
export
class
DashImportListCtrl
{
dashboards
:
any
[];
plugin
:
any
;
...
...
@@ -19,50 +16,32 @@ export class DashImportListCtrl {
});
}
import
(
dash
)
{
import
(
dash
,
reinstall
)
{
var
installCmd
=
{
pluginId
:
this
.
plugin
.
id
,
path
:
dash
.
path
,
reinstall
:
reinstall
,
inputs
:
{}
};
this
.
backendSrv
.
post
(
`/api/plugins/dashboards/install`
,
installCmd
).
then
(
res
=>
{
console
.
log
(
res
);
this
.
$rootScope
.
appEvent
(
'alert-success'
,
[
'Dashboard Installed'
,
dash
.
title
]);
_
.
extend
(
dash
,
res
);
});
}
remove
(
dash
)
{
this
.
backendSrv
.
delete
(
'/api/dashboards/'
+
dash
.
installedUri
).
then
(()
=>
{
this
.
$rootScope
.
appEvent
(
'alert-success'
,
[
'Dashboard Deleted'
,
dash
.
title
]);
dash
.
installed
=
false
;
});
}
}
var
template
=
`
<div class="gf-form-group" ng-if="ctrl.dashboards.length">
<table class="filter-table">
<tbody>
<tr ng-repeat="dash in ctrl.dashboards">
<td class="width-1">
<i class="icon-gf icon-gf-dashboard"></i>
</td>
<td>
{{dash.title}}
</td>
<td>
{{dash.revision}}
</td>
<td>
{{dash.installedRevision}}
</td>
<td class="width-2">
<button class="btn btn-secondary" ng-click="ctrl.import(dash)">Install</button>
</td>
</tr>
</tbody>
</table>
</div>
`
;
export
function
dashboardImportList
()
{
return
{
restrict
:
'E'
,
template
:
template
,
template
Url
:
'public/app/features/plugins/import_list/import_list.html'
,
controller
:
DashImportListCtrl
,
bindToController
:
true
,
controllerAs
:
'ctrl'
,
...
...
@@ -72,7 +51,6 @@ export function dashboardImportList() {
};
}
coreModule
.
directive
(
'dashboardImportList'
,
dashboardImportList
);
...
...
public/app/features/
datasources/partials/
edit.html
→
public/app/features/
plugins/partials/ds_
edit.html
View file @
fc54c01f
File moved
public/app/features/
datasources/partials/
http_settings.html
→
public/app/features/
plugins/partials/ds_
http_settings.html
View file @
fc54c01f
File moved
public/app/features/
datasources/partials/
list.html
→
public/app/features/
plugins/partials/ds_
list.html
View file @
fc54c01f
File moved
public/app/features/plugins/partials/edit.html
→
public/app/features/plugins/partials/
plugin_
edit.html
View file @
fc54c01f
File moved
public/app/features/plugins/partials/list.html
→
public/app/features/plugins/partials/
plugin_
list.html
View file @
fc54c01f
File moved
public/app/features/plugins/partials/page.html
→
public/app/features/plugins/partials/p
lugin_p
age.html
View file @
fc54c01f
File moved
public/app/features/plugins/edit_ctrl.ts
→
public/app/features/plugins/
plugin_
edit_ctrl.ts
View file @
fc54c01f
File moved
public/app/features/plugins/list_ctrl.ts
→
public/app/features/plugins/
plugin_
list_ctrl.ts
View file @
fc54c01f
File moved
public/app/features/plugins/page_ctrl.ts
→
public/app/features/plugins/p
lugin_p
age_ctrl.ts
View file @
fc54c01f
File moved
public/app/plugins/datasource/graphite/dashboards/carbon_stats.json
View file @
fc54c01f
...
...
@@ -6,7 +6,7 @@
}
},
"title"
:
"Carbon
s
tats"
,
"title"
:
"Carbon
Cache S
tats"
,
"version"
:
1
,
"rows"
:
[
{
...
...
public/app/plugins/datasource/graphite/plugin.json
View file @
fc54c01f
...
...
@@ -4,8 +4,7 @@
"id"
:
"graphite"
,
"includes"
:
[
{
"type"
:
"dashboard"
,
"name"
:
"Carbon Overview"
,
"path"
:
"dashboards/carbon_stats.json"
},
{
"type"
:
"dashboard"
,
"name"
:
"Carbon Agent Details"
,
"path"
:
"dashboards/carbon_stats.json"
}
{
"type"
:
"dashboard"
,
"name"
:
"Carbon Cache Stats"
,
"path"
:
"dashboards/carbon_stats.json"
}
],
"metrics"
:
true
,
...
...
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