diff --git a/public/app/core/routes/all.js b/public/app/core/routes/all.js
index ba993134455..521e8008f98 100644
--- a/public/app/core/routes/all.js
+++ b/public/app/core/routes/all.js
@@ -134,7 +134,8 @@ define([
})
.when('/dashboard/snapshots', {
templateUrl: 'app/features/snapshot/partials/snapshots.html',
- controller : 'SnapshotsCtrl'
+ controller : 'SnapshotsCtrl',
+ controllerAs: 'ctrl',
})
.when('/apps', {
templateUrl: 'app/features/apps/partials/list.html',
diff --git a/public/app/features/snapshot/all.js b/public/app/features/snapshot/all.js
deleted file mode 100644
index b0f66edc414..00000000000
--- a/public/app/features/snapshot/all.js
+++ /dev/null
@@ -1,3 +0,0 @@
-define([
- './snapshot_ctrl',
-], function () {});
diff --git a/public/app/features/snapshot/all.ts b/public/app/features/snapshot/all.ts
new file mode 100644
index 00000000000..521c7a4c111
--- /dev/null
+++ b/public/app/features/snapshot/all.ts
@@ -0,0 +1 @@
+import './snapshot_ctrl';
diff --git a/public/app/features/snapshot/partials/snapshots.html b/public/app/features/snapshot/partials/snapshots.html
index 58b6c872617..9d1b688fd35 100644
--- a/public/app/features/snapshot/partials/snapshots.html
+++ b/public/app/features/snapshot/partials/snapshots.html
@@ -1,7 +1,7 @@
-
+
Available snapshots
@@ -14,7 +14,7 @@
-
+
|
{{snapshot.Name}}
|
@@ -28,7 +28,7 @@
-
+
|
diff --git a/public/app/features/snapshot/snapshot_ctrl.js b/public/app/features/snapshot/snapshot_ctrl.js
deleted file mode 100644
index 345638f4770..00000000000
--- a/public/app/features/snapshot/snapshot_ctrl.js
+++ /dev/null
@@ -1,43 +0,0 @@
-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);
- }
- });
-
- };
-
- });
-});
diff --git a/public/app/features/snapshot/snapshot_ctrl.ts b/public/app/features/snapshot/snapshot_ctrl.ts
new file mode 100644
index 00000000000..b194fbf9119
--- /dev/null
+++ b/public/app/features/snapshot/snapshot_ctrl.ts
@@ -0,0 +1,20 @@
+///
+
+import angular from 'angular';
+import _ from 'lodash';
+
+export class SnapshotsCtrl {
+ snapshots: any[];
+
+ /** @ngInject */
+ constructor(private backendSrv: any) {}
+
+ init() {
+ this.backendSrv.get('/api/dashboard/snapshots').then(snapshots => {
+ this.snapshots = snapshots;
+ });
+ console.log(this.snapshots);
+ }
+}
+
+angular.module('grafana.controllers').controller('SnapshotsCtrl', SnapshotsCtrl);