mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
cleanup(): removed unused (old) migrate stuff
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -13,7 +13,6 @@ define([
|
||||
'./unsavedChangesSrv',
|
||||
'./timepicker/timepicker',
|
||||
'./graphiteImportCtrl',
|
||||
'./importCtrl',
|
||||
'./impression_store',
|
||||
'./upload',
|
||||
'./import/dash_import',
|
||||
|
||||
@@ -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();
|
||||
|
||||
});
|
||||
});
|
||||
@@ -1,44 +0,0 @@
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user