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
a854f0c4
Commit
a854f0c4
authored
Jan 20, 2016
by
utkarshcmu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switched snapshot ctrl to angularjs2
parent
aa1d2883
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
25 deletions
+24
-25
public/app/features/snapshot/partials/snapshots.html
+2
-2
public/app/features/snapshot/snapshot_ctrl.ts
+22
-23
No files found.
public/app/features/snapshot/partials/snapshots.html
View file @
a854f0c4
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
</thead>
</thead>
<tr
ng-repeat=
"snapshot in snapshots"
>
<tr
ng-repeat=
"snapshot in
ctrl.
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=
"removeSnapshot(snapshot)"
class=
"btn btn-danger btn-mini"
>
<a
ng-click=
"
ctrl.
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 @
a854f0c4
...
@@ -5,39 +5,38 @@ import _ from 'lodash';
...
@@ -5,39 +5,38 @@ import _ from 'lodash';
export
class
SnapshotsCtrl
{
export
class
SnapshotsCtrl
{
snapshots
:
any
;
/** @ngInject */
/** @ngInject */
constructor
(
backendSrv
,
$scope
)
{
constructor
(
private
$rootScope
,
private
backendSrv
)
{
$scope
.
init
=
function
()
{
this
.
backendSrv
.
get
(
'/api/dashboard/snapshots'
).
then
(
result
=>
{
backendSrv
.
get
(
'/api/dashboard/snapshots'
).
then
(
function
(
result
)
{
this
.
snapshots
=
result
;
$scope
.
snapshots
=
result
;
});
}
removeSnapshotConfirmed
(
snapshot
)
{
_
.
remove
(
this
.
snapshots
,
{
key
:
snapshot
.
key
});
this
.
backendSrv
.
get
(
'/api/snapshots-delete/'
+
snapshot
.
deleteKey
)
.
then
(()
=>
{
this
.
$rootScope
.
appEvent
(
'alert-success'
,
[
'Snapshot deleted'
,
''
]);
},
()
=>
{
this
.
$rootScope
.
appEvent
(
'alert-error'
,
[
'Unable to delete snapshot'
,
''
]);
this
.
snapshots
.
push
(
snapshot
);
});
});
};
}
$scope
.
removeSnapshot
=
function
(
snapshot
)
{
removeSnapshot
(
snapshot
)
{
$s
cope
.
appEvent
(
'confirm-modal'
,
{
this
.
$rootS
cope
.
appEvent
(
'confirm-modal'
,
{
title
:
'Confirm delete snapshot'
,
title
:
'Confirm delete snapshot'
,
text
:
'Are you sure you want to delete snapshot '
+
snapshot
.
name
+
'?'
,
text
:
'Are you sure you want to delete snapshot '
+
snapshot
.
name
+
'?'
,
yesText
:
"Delete"
,
yesText
:
"Delete"
,
icon
:
"fa-warning"
,
icon
:
"fa-warning"
,
onConfirm
:
function
()
{
onConfirm
:
()
=>
{
$scope
.
removeSnapshotConfirmed
(
snapshot
);
this
.
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
();
}
}
}
}
angular
.
module
(
'grafana.controllers'
).
controller
(
'SnapshotsCtrl'
,
SnapshotsCtrl
);
angular
.
module
(
'grafana.controllers'
).
controller
(
'SnapshotsCtrl'
,
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