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
bcb44b7b
Commit
bcb44b7b
authored
Jan 19, 2016
by
utkarshcmu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UI and backend connectivity implemented
parent
1ab11540
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
108 additions
and
2 deletions
+108
-2
pkg/api/api.go
+1
-0
pkg/api/index.go
+1
-1
pkg/services/sqlstore/dashboard_snapshot.go
+1
-1
public/app/features/all.js
+1
-0
public/app/features/snapshot/all.js
+4
-0
public/app/features/snapshot/partials/snapshots.html
+39
-0
public/app/features/snapshot/snapshot_ctrl.js
+43
-0
public/app/features/snapshot/snapshot_routes.js
+18
-0
No files found.
pkg/api/api.go
View file @
bcb44b7b
...
@@ -69,6 +69,7 @@ func Register(r *macaron.Macaron) {
...
@@ -69,6 +69,7 @@ func Register(r *macaron.Macaron) {
// dashboard snapshots
// dashboard snapshots
r
.
Get
(
"/dashboard/snapshot/*"
,
Index
)
r
.
Get
(
"/dashboard/snapshot/*"
,
Index
)
r
.
Get
(
"/dashboard/snapshots/"
,
reqSignedIn
,
Index
)
// api for dashboard snapshots
// api for dashboard snapshots
r
.
Post
(
"/api/snapshots/"
,
bind
(
m
.
CreateDashboardSnapshotCommand
{}),
CreateDashboardSnapshot
)
r
.
Post
(
"/api/snapshots/"
,
bind
(
m
.
CreateDashboardSnapshotCommand
{}),
CreateDashboardSnapshot
)
...
...
pkg/api/index.go
View file @
bcb44b7b
...
@@ -63,7 +63,7 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) {
...
@@ -63,7 +63,7 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) {
data
.
MainNavLinks
=
append
(
data
.
MainNavLinks
,
&
dtos
.
NavLink
{
data
.
MainNavLinks
=
append
(
data
.
MainNavLinks
,
&
dtos
.
NavLink
{
Text
:
"Snapshots"
,
Text
:
"Snapshots"
,
Icon
:
"fa fa-fw fa-camera-retro"
,
Icon
:
"fa fa-fw fa-camera-retro"
,
Url
:
"/snapshots"
,
Url
:
"/
dashboard/
snapshots"
,
})
})
if
c
.
OrgRole
==
m
.
ROLE_ADMIN
{
if
c
.
OrgRole
==
m
.
ROLE_ADMIN
{
...
...
pkg/services/sqlstore/dashboard_snapshot.go
View file @
bcb44b7b
...
@@ -68,7 +68,7 @@ func GetDashboardSnapshot(query *m.GetDashboardSnapshotQuery) error {
...
@@ -68,7 +68,7 @@ func GetDashboardSnapshot(query *m.GetDashboardSnapshotQuery) error {
func
SearchDashboardSnapshots
(
query
*
m
.
GetDashboardSnapshotsQuery
)
error
{
func
SearchDashboardSnapshots
(
query
*
m
.
GetDashboardSnapshotsQuery
)
error
{
var
snapshots
=
make
(
m
.
DashboardSnapshots
,
0
)
var
snapshots
=
make
(
m
.
DashboardSnapshots
,
0
)
sess
:=
x
.
Cols
(
"name,key,delete_key"
)
.
Limit
(
query
.
Limit
)
sess
:=
x
.
Limit
(
query
.
Limit
)
if
query
.
Name
!=
""
{
if
query
.
Name
!=
""
{
sess
.
Where
(
"name LIKE ?"
,
query
.
Name
)
sess
.
Where
(
"name LIKE ?"
,
query
.
Name
)
...
...
public/app/features/all.js
View file @
bcb44b7b
...
@@ -5,6 +5,7 @@ define([
...
@@ -5,6 +5,7 @@ define([
'./templating/templateSrv'
,
'./templating/templateSrv'
,
'./dashboard/all'
,
'./dashboard/all'
,
'./playlist/all'
,
'./playlist/all'
,
'./snapshot/all'
,
'./panel/all'
,
'./panel/all'
,
'./profile/profileCtrl'
,
'./profile/profileCtrl'
,
'./profile/changePasswordCtrl'
,
'./profile/changePasswordCtrl'
,
...
...
public/app/features/snapshot/all.js
0 → 100644
View file @
bcb44b7b
define
([
'./snapshot_ctrl'
,
'./snapshot_routes'
],
function
()
{});
public/app/features/snapshot/partials/snapshots.html
0 → 100644
View file @
bcb44b7b
<navbar
icon=
"fa fa-fw fa-camera-retro"
title=
"Dashboard snapshots"
></navbar>
<div
class=
"page-container"
>
<div
class=
"page-wide"
>
<h2>
Available snapshots
</h2>
<table
class=
"filter-table"
style=
"margin-top: 20px"
>
<thead>
<th><strong>
Name
</strong></th>
<th><strong>
Snapshot url
</strong></th>
<th
style=
"width: 70px"
></th>
<th
style=
"width: 25px"
></th>
</thead>
<tr
ng-repeat=
"snapshot in snapshots"
>
<td>
<a
href=
"dashboard/snapshot/{{snapshot.Key}}"
>
{{snapshot.Name}}
</a>
</td>
<td
>
<a
href=
"dashboard/snapshot/{{snapshot.Key}}"
>
dashboard/snapshot/{{snapshot.Key}}
</a>
</td>
<td
class=
"text-center"
>
<a
href=
"dashboard/snapshot/{{snapshot.Key}}"
class=
"btn btn-inverse btn-mini"
>
<i
class=
"fa fa-eye"
></i>
View
</a>
</td>
<td
class=
"text-right"
>
<a
ng-click=
"removeSnapshot(snapshot)"
class=
"btn btn-danger btn-mini"
>
<i
class=
"fa fa-remove"
></i>
</a>
</td>
</tr>
</table>
</div>
</div>
public/app/features/snapshot/snapshot_ctrl.js
0 → 100644
View file @
bcb44b7b
define
([
'angular'
,
'lodash'
],
function
(
angular
,
_
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.controllers'
);
module
.
controller
(
'SnapshotsCtrl'
,
function
(
$scope
,
$location
,
backendSrv
)
{
backendSrv
.
get
(
'/api/dashboard/snapshots'
)
.
then
(
function
(
result
)
{
$scope
.
snapshots
=
result
;
});
$scope
.
removeSnapshotConfirmed
=
function
(
snapshot
)
{
_
.
remove
(
$scope
.
snapshots
,
{
Key
:
snapshot
.
Key
});
backendSrv
.
get
(
'/api/snapshots-delete/'
+
snapshot
.
DeleteKey
)
.
then
(
function
()
{
$scope
.
appEvent
(
'alert-success'
,
[
'Snapshot deleted'
,
''
]);
},
function
()
{
$scope
.
appEvent
(
'alert-error'
,
[
'Unable to delete snapshot'
,
''
]);
$scope
.
snapshots
.
push
(
snapshot
);
});
};
$scope
.
removeSnapshot
=
function
(
snapshot
)
{
$scope
.
appEvent
(
'confirm-modal'
,
{
title
:
'Confirm delete snapshot'
,
text
:
'Are you sure you want to delete snapshot '
+
snapshot
.
Name
+
'?'
,
yesText
:
"Delete"
,
icon
:
"fa-warning"
,
onConfirm
:
function
()
{
$scope
.
removeSnapshotConfirmed
(
snapshot
);
}
});
};
});
});
public/app/features/snapshot/snapshot_routes.js
0 → 100644
View file @
bcb44b7b
define
([
'angular'
,
'app/core/config'
,
'lodash'
],
function
(
angular
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.routes'
);
module
.
config
(
function
(
$routeProvider
)
{
$routeProvider
.
when
(
'/dashboard/snapshots'
,
{
templateUrl
:
'app/features/snapshot/partials/snapshots.html'
,
controller
:
'SnapshotsCtrl'
});
});
});
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