Commit 4c406dec by Torkel Ödegaard

cleanup(): removed unused (old) migrate stuff

parent aea3093d
...@@ -44,10 +44,6 @@ function setupAngularRoutes($routeProvider, $locationProvider) { ...@@ -44,10 +44,6 @@ function setupAngularRoutes($routeProvider, $locationProvider) {
templateUrl: 'public/app/features/dashboard/partials/dash_list.html', templateUrl: 'public/app/features/dashboard/partials/dash_list.html',
controller : 'DashListCtrl', controller : 'DashListCtrl',
}) })
.when('/dashboards/migrate', {
templateUrl: 'public/app/features/dashboard/partials/migrate.html',
controller : 'DashboardImportCtrl',
})
.when('/datasources', { .when('/datasources', {
templateUrl: 'public/app/features/plugins/partials/ds_list.html', templateUrl: 'public/app/features/plugins/partials/ds_list.html',
controller : 'DataSourcesCtrl', controller : 'DataSourcesCtrl',
......
...@@ -13,7 +13,6 @@ define([ ...@@ -13,7 +13,6 @@ define([
'./unsavedChangesSrv', './unsavedChangesSrv',
'./timepicker/timepicker', './timepicker/timepicker',
'./graphiteImportCtrl', './graphiteImportCtrl',
'./importCtrl',
'./impression_store', './impression_store',
'./upload', './upload',
'./import/dash_import', './import/dash_import',
......
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();
});
});
<navbar title="Migrate" title-url="dashboards/migrate" icon="fa fa-download">
</navbar>
<div class="page-container">
<div class="page-header">
<h1>
Migrate dashboards
</h1>
</div>
<h5 class="section-heading">
Import dashboards from Elasticsearch or InfluxDB
</h5>
<div class="gf-form-inline gf-form-group">
<div class="gf-form">
<div class="gf-form-label">Dashboard source</div>
<div class="gf-form-select-wrapper">
<select class="gf-form-input gf-size-auto" ng-model="sourceName" ng-options="f for f in datasources"></select>
</div>
</div>
<div class="gf-form">
<button class="btn btn-success gf-form-btn" ng-click="startImport()">Import</button>
</div>
</div>
<h5 class="section-heading" ng-if="importing">{{infoText}}</h5>
<div class="editor-row" ng-if="importing">
<div class="editor-row row">
<table class="grafana-options-table span5">
<tr ng-repeat="dash in imported">
<td>{{dash.name}}</td>
<td>
{{dash.info}}
</td>
</tr>
</table>
</div>
</div>
<div ng-include="'public/app/features/dashboard/partials/graphiteImport.html'"></div>
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment