From 4c406dec2f5a9c9277f90c136ebaa8e86b52e0a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 5 Dec 2016 12:52:34 +0100 Subject: [PATCH] cleanup(): removed unused (old) migrate stuff --- public/app/core/routes/routes.ts | 4 - public/app/features/dashboard/all.js | 1 - public/app/features/dashboard/importCtrl.js | 81 ------------------- .../features/dashboard/partials/migrate.html | 44 ---------- 4 files changed, 130 deletions(-) delete mode 100644 public/app/features/dashboard/importCtrl.js delete mode 100644 public/app/features/dashboard/partials/migrate.html diff --git a/public/app/core/routes/routes.ts b/public/app/core/routes/routes.ts index 03a104a72fb..28e1dcf1cd1 100644 --- a/public/app/core/routes/routes.ts +++ b/public/app/core/routes/routes.ts @@ -44,10 +44,6 @@ function setupAngularRoutes($routeProvider, $locationProvider) { templateUrl: 'public/app/features/dashboard/partials/dash_list.html', controller : 'DashListCtrl', }) - .when('/dashboards/migrate', { - templateUrl: 'public/app/features/dashboard/partials/migrate.html', - controller : 'DashboardImportCtrl', - }) .when('/datasources', { templateUrl: 'public/app/features/plugins/partials/ds_list.html', controller : 'DataSourcesCtrl', diff --git a/public/app/features/dashboard/all.js b/public/app/features/dashboard/all.js index 8359338fa02..976bff07058 100644 --- a/public/app/features/dashboard/all.js +++ b/public/app/features/dashboard/all.js @@ -13,7 +13,6 @@ define([ './unsavedChangesSrv', './timepicker/timepicker', './graphiteImportCtrl', - './importCtrl', './impression_store', './upload', './import/dash_import', diff --git a/public/app/features/dashboard/importCtrl.js b/public/app/features/dashboard/importCtrl.js deleted file mode 100644 index 641a02e776f..00000000000 --- a/public/app/features/dashboard/importCtrl.js +++ /dev/null @@ -1,81 +0,0 @@ -define([ - 'angular', - 'lodash', -], -function (angular, _) { - 'use strict'; - - var module = angular.module('grafana.controllers'); - - module.controller('DashboardImportCtrl', function($scope, $http, backendSrv, datasourceSrv) { - - $scope.init = function() { - $scope.datasources = []; - $scope.sourceName = 'grafana'; - $scope.destName = 'grafana'; - $scope.imported = []; - $scope.dashboards = []; - $scope.infoText = ''; - $scope.importing = false; - - _.each(datasourceSrv.getAll(), function(ds, key) { - if (ds.type === 'influxdb_08' || ds.type === 'elasticsearch') { - $scope.sourceName = key; - $scope.datasources.push(key); - } - }); - }; - - $scope.startImport = function() { - datasourceSrv.get($scope.sourceName).then(function(ds) { - $scope.dashboardSource = ds; - $scope.dashboardSource.searchDashboards('title:').then(function(results) { - $scope.dashboards = results.dashboards; - - if ($scope.dashboards.length === 0) { - $scope.infoText = 'No dashboards found'; - return; - } - - $scope.importing = true; - $scope.imported = []; - $scope.next(); - }, function(err) { - var resp = err.message || err.statusText || 'Unknown error'; - var message = "Failed to load dashboards from selected data source, response from server was: " + resp; - $scope.appEvent('alert-error', ['Import failed', message]); - }); - }); - }; - - $scope.next = function() { - if ($scope.dashboards.length === 0) { - $scope.infoText = "Done! Imported " + $scope.imported.length + " dashboards"; - } - - var dash = $scope.dashboards.shift(); - if (!dash.title) { - console.log(dash); - return; - } - - var infoObj = {name: dash.title, info: 'Importing...'}; - $scope.imported.push(infoObj); - $scope.infoText = "Importing " + $scope.imported.length + '/' + ($scope.imported.length + $scope.dashboards.length); - - $scope.dashboardSource.getDashboard(dash.id).then(function(loadedDash) { - backendSrv.saveDashboard(loadedDash).then(function() { - infoObj.info = "Done!"; - $scope.next(); - }, function(err) { - err.isHandled = true; - infoObj.info = "Error: " + (err.data || { message: 'Unknown' }).message; - $scope.next(); - }); - }); - }; - - $scope.init(); - - }); -}); diff --git a/public/app/features/dashboard/partials/migrate.html b/public/app/features/dashboard/partials/migrate.html deleted file mode 100644 index 098dbd033cf..00000000000 --- a/public/app/features/dashboard/partials/migrate.html +++ /dev/null @@ -1,44 +0,0 @@ - - - -
- - -
- Import dashboards from Elasticsearch or InfluxDB -
- -
-
-
Dashboard source
-
- -
-
-
- -
-
- -
{{infoText}}
-
-
- - - - - -
{{dash.name}} - {{dash.info}} -
-
-
- -
- -
-