Commit 4822d027 by Torkel Ödegaard

Things are starting to work again

parent 35cc0a1c
......@@ -25,7 +25,7 @@ function (angular, kbn) {
}
var title = kbn.slugifyForUrl(window.grafanaImportDashboard.title);
window.grafanaImportDashboard.id = null;
$location.path('/dashboard/import/' + title);
$location.path('/dashboard-import/' + title);
});
};
};
......
......@@ -71,12 +71,11 @@ function (angular, _, require, config) {
$scope.shareUrl = linkSrv.addParamsToUrl(baseUrl, params);
var soloUrl = $scope.shareUrl;
soloUrl = soloUrl.replace('/dashboard/db/', '/dashboard/solo/db/');
soloUrl = soloUrl.replace('/dashboard/snapshot/', '/dashboard/solo/snapshot/');
soloUrl = soloUrl.replace('/dashboard/', '/dashboard-solo/');
$scope.iframeHtml = '<iframe src="' + soloUrl + '" width="450" height="200" frameborder="0"></iframe>';
$scope.imageUrl = soloUrl.replace('/dashboard/', '/render/dashboard/');
$scope.imageUrl = soloUrl.replace('/dashboard', '/render/dashboard');
$scope.imageUrl += '&width=1000';
$scope.imageUrl += '&height=500';
};
......
......@@ -7,16 +7,7 @@ function (angular, $) {
var module = angular.module('grafana.routes');
module.controller('SoloPanelCtrl', function(
$scope,
backendSrv,
$routeParams,
dashboardSrv,
timeSrv,
$location,
templateValuesSrv,
dashboardLoaderSrv,
contextSrv) {
module.controller('SoloPanelCtrl', function($scope, $routeParams, $location, dashboardLoaderSrv, contextSrv) {
var panelId;
......@@ -28,7 +19,6 @@ function (angular, $) {
dashboardLoaderSrv.loadDashboard($routeParams.type, $routeParams.slug).then(function(result) {
$scope.initDashboard(result, $scope);
});
$scope.onAppEvent("dashboard-loaded", $scope.initPanelScope);
......@@ -49,10 +39,7 @@ function (angular, $) {
}
$scope.panel.span = 12;
$scope.dashboardViewState = { registerPanel: function() { }, state: {}};
timeSrv.init($scope.dashboard);
templateValuesSrv.init($scope.dashboard, $scope.dashboardViewState);
$scope.dashboardViewState = {registerPanel: function() { }, state: {}};
};
if (!$scope.skipAutoInit) {
......
......@@ -67,7 +67,7 @@
<i class="fa fa-plus"></i>
New
</button>
<a class="btn btn-inverse pull-left" href="dashboard/import">
<a class="btn btn-inverse pull-left" href="import/dashboard">
<i class="fa fa-download"></i>
Import
</a>
......
define([
'helpers',
'features/panel/soloPanelCtrl',
'features/dashboard/dashboardSrv',
], function(helpers) {
'use strict';
describe('SoloPanelCtrl', function() {
var ctx = new helpers.ControllerTestContext();
var backendSrv = {};
var routeParams = {};
var search = {};
var contextSrv = {
hasRole: sinon.stub().returns(true)
};
beforeEach(module('grafana.routes'));
beforeEach(module('grafana.services'));
beforeEach(ctx.providePhase({
$routeParams: routeParams,
contextSrv: contextSrv,
$location: {
search: function() {
return search;
}
},
templateValuesSrv: { init: sinon.stub() },
backendSrv: backendSrv
}));
beforeEach(ctx.createControllerPhase('SoloPanelCtrl'));
describe('setting up solo panel scope', function() {
beforeEach(function() {
var dashboard = {
dashboard: {
rows: [
{
panels: [
{
id: 23,
some: 'prop'
}
]
}
]
},
meta: {}
};
routeParams.slug = "my dash";
search.panelId = 23;
backendSrv.getDashboard = sinon.stub().returns(ctx.$q.when(dashboard));
ctx.scope.init();
ctx.scope.$digest();
});
it('should load dashboard and extract panel and setup panel scope', function() {
expect(ctx.scope.panel.id).to.be(23);
expect(ctx.scope.panel.some).to.be('prop');
});
it('should hide sidemenu', function() {
expect(contextSrv.sidemenu).to.be(false);
});
});
});
});
......@@ -139,7 +139,6 @@ require([
'specs/kbn-format-specs',
'specs/dashboardSrv-specs',
'specs/dashboardViewStateSrv-specs',
'specs/soloPanelCtrl-specs',
'specs/singlestat-specs',
'specs/dynamicDashboardSrv-specs',
'specs/unsavedChangesSrv-specs',
......
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