Commit d1b31bb3 by Torkel Ödegaard

moved stuff around, trying to get rid of the pro folders and fixing some issues

parent 9be53f0a
......@@ -24,7 +24,7 @@ module.exports = function (grunt) {
grunt.log.writeln('Setting backend build mode');
config.modeOptions.zipSuffix = '-backend';
config.modeOptions.requirejs.path = { config: 'components/config' };
config.modeOptions.requirejs.excludeConfig = true;
config.modeOptions.requirejs.excludeConfig = false;
}
// load plugins
......
......@@ -6,4 +6,5 @@ define([
'./graphiteImport',
'./inspectCtrl',
'./jsonEditorCtrl',
'./loginCtrl',
], function () {});
define([
'angular',
'lodash'
],
function (angular, _) {
'use strict';
var module = angular.module('grafana.controllers');
module.controller('SharePanelCtrl', function($scope, $location, $timeout, timeSrv, $element, templateSrv, $routeParams) {
$scope.init = function() {
$scope.editor = { index: 0 };
$scope.forCurrent = true;
$scope.toPanel = true;
$scope.includeTemplateVars = true;
$scope.buildUrl();
};
$scope.buildUrl = function() {
var panelId = $scope.panel.id;
var range = timeSrv.timeRange(false);
var params = angular.copy($location.search());
if (_.isString(range.to) && range.to.indexOf('now')) {
range = timeSrv.timeRange();
}
params.from = range.from;
params.to = range.to;
if (_.isDate(params.from)) { params.from = params.from.getTime(); }
if (_.isDate(params.to)) { params.to = params.to.getTime(); }
if ($scope.includeTemplateVars) {
_.each(templateSrv.variables, function(variable) {
params['var-' + variable.name] = variable.current.text;
});
}
else {
_.each(templateSrv.variables, function(variable) {
delete params['var-' + variable.name];
});
}
if (!$scope.forCurrent) {
delete params.from;
delete params.to;
}
if ($scope.toPanel) {
params.panelId = panelId;
params.fullscreen = true;
} else {
delete params.panelId;
delete params.fullscreen;
}
var paramsArray = [];
_.each(params, function(value, key) {
var str = key;
if (value !== true) {
str += '=' + encodeURIComponent(value);
}
paramsArray.push(str);
});
var baseUrl = 'http://localhost:3000';
$scope.shareUrl = baseUrl + '/dashboard/db/' + $routeParams.id + "?" + paramsArray.join('&') ;
paramsArray.push('width=1000');
paramsArray.push('height=500');
$scope.imageUrl = baseUrl + '/render/dashboard/solo/' + $routeParams.id + '?' + paramsArray.join('&') ;
$timeout(function() {
var input = $element.find('[data-share-panel-url]');
input.focus();
input.select();
}, 10);
};
$scope.init();
});
});
<div ng-include="'app/partials/pro/navbar.html'" ng-init="pageTitle='Account Settings'"></div>
<div ng-include="'app/partials/navbar.html'" ng-init="pageTitle='Account Settings'"></div>
<div class="dashboard-edit-view">
<div class="editor-row">
......
<div ng-include="'app/partials/pro/navbar.html'" ng-init="pageTitle='Admin'"></div>
<div ng-include="'app/partials/navbar.html'" ng-init="pageTitle='Admin'"></div>
<div class="dashboard-edit-view" style="min-height: 500px">
<div class="editor-row">
......
......@@ -7,4 +7,6 @@ define([
'./opentsdb/datasource',
'./elasticsearch/datasource',
'./dashboard/all',
'./admin/accountCtrl',
'./admin/datasourcesCtrl',
], function () {});
......@@ -68,7 +68,13 @@ function (angular, _) {
}
});
$scope.shareUrl = baseUrl + "?" + paramsArray.join('&') ;
$scope.shareUrl = baseUrl + "?" + paramsArray.join('&');
// var baseUrl = 'http://localhost:3000';
// $scope.shareUrl = baseUrl + '/dashboard/db/' + $routeParams.id + "?" + paramsArray.join('&') ;
// paramsArray.push('width=1000');
// paramsArray.push('height=500');
// $scope.imageUrl = baseUrl + '/render/dashboard/solo/' + $routeParams.id + '?' + paramsArray.join('&') ;
$timeout(function() {
var input = $element.find('[data-share-panel-url]');
......
<div body-class class="dashboard" ng-class="{'dashboard-fullscreen': dashboardViewState.fullscreen}">
<div ng-include="'app/partials/pro/dashboard_topnav.html'">
<div ng-include="'app/partials/dashboard_topnav.html'">
</div>
<div ng-if="submenuEnabled" ng-include="'app/partials/submenu.html'">
......
......@@ -2,9 +2,12 @@
<div class="navbar-inner">
<div class="container-fluid">
<span class="brand">
<img class="logo-icon" src="img/fav32.png" bs-tooltip="'Grafana'" data-placement="bottom"></img>
<a ng-click="toggleProSideMenu()">
<img class="logo-icon" src="img/fav32.png" bs-tooltip="'Grafana'" data-placement="bottom"></img>
</a>
<span class="page-title">{{dashboard.title}}</span>
</span>
<ul class="nav pull-right" ng-controller='DashboardNavCtrl' ng-init="init()">
<li ng-show="dashboardViewState.fullscreen">
......
<div class="navbar navbar-static-top">
<div class="navbar-inner">
<div class="container-fluid">
<span class="brand">
<a ng-click="toggleProSideMenu()">
<img class="logo-icon" src="img/fav32.png" bs-tooltip="'Grafana'" data-placement="bottom"></img>
</a>
<span class="page-title">{{dashboard.title}}</span>
</span>
<ul class="nav pull-right" ng-controller='DashboardNavCtrl' ng-init="init()">
<li ng-show="dashboardViewState.fullscreen">
<a ng-click="exitFullscreen()">
Back to dashboard
</a>
</li>
<li class="grafana-menu-zoom-out">
<a class='small' ng-click='zoom(2)'>
Zoom Out
</a>
</li>
<li ng-repeat="pulldown in dashboard.nav" ng-controller="PulldownCtrl" ng-show="pulldown.enable">
<grafana-simple-panel type="pulldown.type" ng-cloak>
</grafana-simple-panel>
</li>
<li class="dropdown grafana-menu-save">
<a bs-tooltip="'Save'" data-placement="bottom" class="dropdown-toggle" data-toggle="dropdown" ng-click="openSaveDropdown()">
<i class='icon-save'></i>
</a>
<ul class="save-dashboard-dropdown dropdown-menu" ng-if="saveDropdownOpened">
<li>
<form class="input-prepend nomargin save-dashboard-dropdown-save-form">
<input class='input-medium' ng-model="dashboard.title" type="text" />
<button class="btn" ng-click="saveDashboard()"><i class="icon-save"></i></button>
</form>
</li>
<li>
<a class="link" ng-click="set_default()">Save as Home</a>
</li>
<li>
<a class="link" ng-click="purge_default()">Reset Home</a>
</li>
<li ng-show="!isFavorite">
<a class="link" ng-click="markAsFavorite()">Mark as favorite</a>
</li>
<li ng-show="isFavorite">
<a class="link" ng-click="removeAsFavorite()">Remove as favorite</a>
</li>
<li>
<a class="link" ng-click="editJson()">Dashboard JSON</a>
</li>
<li>
<a class="link" ng-click="exportDashboard()">Export dashboard</a>
</li>
<li ng-show="db.saveTemp">
<a bs-tooltip="'Share'" data-placement="bottom" ng-click="saveForSharing()" config-modal="app/partials/dashLoaderShare.html">
Share temp copy
</a>
</li>
</ul>
</li>
<li class="dropdown grafana-menu-load">
<a bs-tooltip="'Search'" ng-click="openSearch()">
<i class='icon-folder-open'></i>
</a>
</li>
<li class="grafana-menu-home"><a bs-tooltip="'Goto saved default'" data-placement="bottom" href='#/'><i class='icon-home'></i></a></li>
<li class="grafana-menu-edit" ng-show="dashboard.editable" bs-tooltip="'Configure dashboard'" data-placement="bottom"><a class="link" dash-editor-link="app/partials/dasheditor.html"><i class='icon-cog pointer'></i></a></li>
<li class="grafana-menu-stop-playlist hide">
<a class='small' ng-click='stopPlaylist(2)'>
Stop playlist
</a>
</li>
</ul>
</div>
</div>
</div>
define([
'angular',
'controllers/pro/accountCtrl',
'controllers/pro/datasourcesCtrl',
],
function (angular) {
"use strict";
......@@ -11,11 +9,11 @@ function (angular) {
module.config(function($routeProvider) {
$routeProvider
.when('/admin/datasources', {
templateUrl: 'app/partials/pro/datasources.html',
templateUrl: 'app/features/admin/partials/datasources.html',
controller : 'DataSourcesCtrl',
})
.when('/account', {
templateUrl: 'app/partials/pro/account.html',
templateUrl: 'app/features/admin/partials/account.html',
controller : 'AccountCtrl',
});
});
......
define([
'angular',
'controllers/pro/loginCtrl',
],
function (angular) {
"use strict";
......@@ -10,16 +9,16 @@ function (angular) {
module.config(function($routeProvider) {
$routeProvider
.when('/login', {
templateUrl: 'app/partials/pro/login.html',
templateUrl: 'app/partials/login.html',
controller : 'LoginCtrl',
})
.when('/register', {
templateUrl: 'app/partials/pro/register.html',
templateUrl: 'app/partials/register.html',
controller : 'RegisterCtrl',
});
});
module.controller('RegisterCtrl', function($scope, $http, $location) {
module.controller('RegisterCtrl', function($scope, backendSrv, $location) {
$scope.loginModel = {};
$scope.grafana.sidemenu = false;
......@@ -32,10 +31,8 @@ function (angular) {
return;
}
$http.post('/api/account', $scope.loginModel).then(function() {
backendSrv.post('/api/account', $scope.loginModel).then(function() {
$location.path('/login');
}, function(err) {
$scope.registerError = "Unexpected error: " + err;
});
};
......
......@@ -10,7 +10,7 @@ function (angular, $) {
module.config(function($routeProvider) {
$routeProvider
.when('/dashboard/solo/:id/', {
templateUrl: 'app/partials/pro/solo-panel.html',
templateUrl: 'app/partials/solo-panel.html',
controller : 'SoloPanelCtrl',
});
});
......
......@@ -30,7 +30,7 @@
<div class="pro-container" ng-class="{'pro-sidemenu-open': grafana.sidemenu}">
<aside class="pro-sidemenu" ng-if="grafana.sidemenu">
<div ng-include="'app/partials/pro/sidemenu.html'"></div>
<div ng-include="'app/partials/sidemenu.html'"></div>
</aside>
<div class="page-alert-list">
......
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