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
281ec600
Commit
281ec600
authored
Jan 19, 2016
by
utkarshcmu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UI and backend working
parent
09f5e6f4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
11 deletions
+33
-11
pkg/api/dashboard_snapshot.go
+0
-1
public/app/features/snapshot/partials/snapshots.html
+3
-3
public/app/features/snapshot/snapshot_ctrl.ts
+30
-7
No files found.
pkg/api/dashboard_snapshot.go
View file @
281ec600
...
@@ -36,7 +36,6 @@ func CreateDashboardSnapshot(c *middleware.Context, cmd m.CreateDashboardSnapsho
...
@@ -36,7 +36,6 @@ func CreateDashboardSnapshot(c *middleware.Context, cmd m.CreateDashboardSnapsho
cmd
.
DeleteKey
=
util
.
GetRandomString
(
32
)
cmd
.
DeleteKey
=
util
.
GetRandomString
(
32
)
cmd
.
OrgId
=
c
.
OrgId
cmd
.
OrgId
=
c
.
OrgId
cmd
.
UserId
=
c
.
UserId
cmd
.
UserId
=
c
.
UserId
cmd
.
Name
=
c
.
Name
metrics
.
M_Api_Dashboard_Snapshot_Create
.
Inc
(
1
)
metrics
.
M_Api_Dashboard_Snapshot_Create
.
Inc
(
1
)
}
}
...
...
public/app/features/snapshot/partials/snapshots.html
View file @
281ec600
<navbar
icon=
"fa fa-fw fa-camera-retro"
title=
"Dashboard snapshots"
></navbar>
<navbar
icon=
"fa fa-fw fa-camera-retro"
title=
"Dashboard snapshots"
></navbar>
<div
class=
"page-container"
>
<div
class=
"page-container"
>
<div
class=
"page-wide"
ng-init=
"ctrl.init()"
>
<div
class=
"page-wide"
>
<h2>
Available snapshots
</h2>
<h2>
Available snapshots
</h2>
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
</thead>
</thead>
<tr
ng-repeat=
"snapshot in
ctrl.
snapshots"
>
<tr
ng-repeat=
"snapshot in snapshots"
>
<td>
<td>
<a
href=
"dashboard/snapshot/{{snapshot.Key}}"
>
{{snapshot.Name}}
</a>
<a
href=
"dashboard/snapshot/{{snapshot.Key}}"
>
{{snapshot.Name}}
</a>
</td>
</td>
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
</a>
</a>
</td>
</td>
<td
class=
"text-right"
>
<td
class=
"text-right"
>
<a
ng-click=
"
ctrl.
removeSnapshot(snapshot)"
class=
"btn btn-danger btn-mini"
>
<a
ng-click=
"removeSnapshot(snapshot)"
class=
"btn btn-danger btn-mini"
>
<i
class=
"fa fa-remove"
></i>
<i
class=
"fa fa-remove"
></i>
</a>
</a>
</td>
</td>
...
...
public/app/features/snapshot/snapshot_ctrl.ts
View file @
281ec600
...
@@ -4,16 +4,39 @@ import angular from 'angular';
...
@@ -4,16 +4,39 @@ import angular from 'angular';
import
_
from
'lodash'
;
import
_
from
'lodash'
;
export
class
SnapshotsCtrl
{
export
class
SnapshotsCtrl
{
snapshots
:
any
[];
/** @ngInject */
/** @ngInject */
constructor
(
private
backendSrv
:
any
)
{}
constructor
(
backendSrv
,
$scope
)
{
$scope
.
init
=
function
()
{
backendSrv
.
get
(
'/api/dashboard/snapshots'
).
then
(
function
(
result
)
{
$scope
.
snapshots
=
result
;
});
};
init
()
{
$scope
.
removeSnapshot
=
function
(
snapshot
)
{
this
.
backendSrv
.
get
(
'/api/dashboard/snapshots'
).
then
(
snapshots
=>
{
$scope
.
appEvent
(
'confirm-modal'
,
{
this
.
snapshots
=
snapshots
;
title
:
'Confirm delete snapshot'
,
});
text
:
'Are you sure you want to delete snapshot '
+
snapshot
.
Name
+
'?'
,
console
.
log
(
this
.
snapshots
);
yesText
:
"Delete"
,
icon
:
"fa-warning"
,
onConfirm
:
function
()
{
$scope
.
removeSnapshotConfirmed
(
snapshot
);
}
});
};
$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
.
init
();
}
}
}
}
...
...
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