mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
migrated four files to ts, addd some code to config to make it work (#9980)
This commit is contained in:
parent
8ce05a7c24
commit
b752cfee1f
@ -17,6 +17,10 @@ class Settings {
|
||||
alertingEnabled: boolean;
|
||||
authProxyEnabled: boolean;
|
||||
ldapEnabled: boolean;
|
||||
oauth: any;
|
||||
disableUserSignUp: boolean;
|
||||
loginHint: any;
|
||||
loginError: any;
|
||||
|
||||
constructor(options) {
|
||||
var defaults = {
|
||||
|
@ -1,14 +1,10 @@
|
||||
define([
|
||||
'angular',
|
||||
'../core_module',
|
||||
'app/core/config',
|
||||
],
|
||||
function (angular, coreModule, config) {
|
||||
'use strict';
|
||||
import coreModule from '../core_module';
|
||||
import config from 'app/core/config';
|
||||
|
||||
config = config.default;
|
||||
export class InvitedCtrl {
|
||||
|
||||
coreModule.default.controller('InvitedCtrl', function($scope, $routeParams, contextSrv, backendSrv) {
|
||||
/** @ngInject */
|
||||
constructor($scope, $routeParams, contextSrv, backendSrv) {
|
||||
contextSrv.sidemenu = false;
|
||||
$scope.formModel = {};
|
||||
|
||||
@ -35,6 +31,7 @@ function (angular, coreModule, config) {
|
||||
};
|
||||
|
||||
$scope.init();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
coreModule.controller('InvitedCtrl', InvitedCtrl);
|
@ -1,15 +1,11 @@
|
||||
define([
|
||||
'angular',
|
||||
'lodash',
|
||||
'../core_module',
|
||||
'app/core/config',
|
||||
],
|
||||
function (angular, _, coreModule, config) {
|
||||
'use strict';
|
||||
import _ from 'lodash';
|
||||
import coreModule from '../core_module';
|
||||
import config from 'app/core/config';
|
||||
|
||||
config = config.default;
|
||||
export class LoginCtrl {
|
||||
|
||||
coreModule.default.controller('LoginCtrl', function($scope, backendSrv, contextSrv, $location) {
|
||||
/** @ngInject */
|
||||
constructor($scope, backendSrv, contextSrv, $location) {
|
||||
$scope.formModel = {
|
||||
user: '',
|
||||
email: '',
|
||||
@ -74,8 +70,7 @@ function (angular, _, coreModule, config) {
|
||||
|
||||
if (params.redirect && params.redirect[0] === '/') {
|
||||
window.location.href = config.appSubUrl + params.redirect;
|
||||
}
|
||||
else if (result.redirectUrl) {
|
||||
} else if (result.redirectUrl) {
|
||||
window.location.href = result.redirectUrl;
|
||||
} else {
|
||||
window.location.href = config.appSubUrl + '/';
|
||||
@ -84,5 +79,7 @@ function (angular, _, coreModule, config) {
|
||||
};
|
||||
|
||||
$scope.init();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
coreModule.controller('LoginCtrl', LoginCtrl);
|
@ -1,18 +1,11 @@
|
||||
define(['angular',
|
||||
'lodash',
|
||||
'jquery',
|
||||
'moment',
|
||||
'app/core/config',
|
||||
],
|
||||
function (angular, _, $, moment, config) {
|
||||
'use strict';
|
||||
import angular from 'angular';
|
||||
import moment from 'moment';
|
||||
import config from 'app/core/config';
|
||||
|
||||
config = config.default;
|
||||
|
||||
var module = angular.module('grafana.controllers');
|
||||
|
||||
module.controller('ShareModalCtrl', function($scope, $rootScope, $location, $timeout, timeSrv, templateSrv, linkSrv) {
|
||||
export class ShareModalCtrl {
|
||||
|
||||
/** @ngInject */
|
||||
constructor($scope, $rootScope, $location, $timeout, timeSrv, templateSrv, linkSrv) {
|
||||
$scope.options = { forCurrent: true, includeTemplateVars: true, theme: 'current' };
|
||||
$scope.editor = { index: $scope.tabIndex || 0};
|
||||
|
||||
@ -93,7 +86,7 @@ function (angular, _, $, moment, config) {
|
||||
$scope.getShareUrl = function() {
|
||||
return $scope.shareUrl;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
angular.module('grafana.controllers').controller('ShareModalCtrl', ShareModalCtrl);
|
@ -1,51 +0,0 @@
|
||||
define([
|
||||
'angular',
|
||||
'jquery',
|
||||
],
|
||||
function (angular, $) {
|
||||
"use strict";
|
||||
|
||||
var module = angular.module('grafana.routes');
|
||||
|
||||
module.controller('SoloPanelCtrl', function($scope, $routeParams, $location, dashboardLoaderSrv, contextSrv) {
|
||||
|
||||
var panelId;
|
||||
|
||||
$scope.init = function() {
|
||||
contextSrv.sidemenu = false;
|
||||
|
||||
var params = $location.search();
|
||||
panelId = parseInt(params.panelId);
|
||||
|
||||
$scope.onAppEvent("dashboard-initialized", $scope.initPanelScope);
|
||||
|
||||
dashboardLoaderSrv.loadDashboard($routeParams.type, $routeParams.slug).then(function(result) {
|
||||
result.meta.soloMode = true;
|
||||
$scope.initDashboard(result, $scope);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.initPanelScope = function() {
|
||||
var panelInfo = $scope.dashboard.getPanelInfoById(panelId);
|
||||
|
||||
// fake row ctrl scope
|
||||
$scope.ctrl = {
|
||||
row: panelInfo.row,
|
||||
dashboard: $scope.dashboard,
|
||||
};
|
||||
|
||||
$scope.ctrl.row.height = $(window).height();
|
||||
$scope.panel = panelInfo.panel;
|
||||
$scope.$index = 0;
|
||||
|
||||
if (!$scope.panel) {
|
||||
$scope.appEvent('alert-error', ['Panel not found', '']);
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.panel.span = 12;
|
||||
};
|
||||
|
||||
$scope.init();
|
||||
});
|
||||
});
|
49
public/app/features/panel/solo_panel_ctrl.ts
Normal file
49
public/app/features/panel/solo_panel_ctrl.ts
Normal file
@ -0,0 +1,49 @@
|
||||
import angular from 'angular';
|
||||
import $ from 'jquery';
|
||||
|
||||
export class SoloPanelCtrl {
|
||||
|
||||
/** @ngInject */
|
||||
constructor($scope, $routeParams, $location, dashboardLoaderSrv, contextSrv) {
|
||||
var panelId;
|
||||
|
||||
$scope.init = function() {
|
||||
contextSrv.sidemenu = false;
|
||||
|
||||
var params = $location.search();
|
||||
panelId = parseInt(params.panelId);
|
||||
|
||||
$scope.onAppEvent("dashboard-initialized", $scope.initPanelScope);
|
||||
|
||||
dashboardLoaderSrv.loadDashboard($routeParams.type, $routeParams.slug).then(function(result) {
|
||||
result.meta.soloMode = true;
|
||||
$scope.initDashboard(result, $scope);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.initPanelScope = function() {
|
||||
var panelInfo = $scope.dashboard.getPanelInfoById(panelId);
|
||||
|
||||
// fake row ctrl scope
|
||||
$scope.ctrl = {
|
||||
row: panelInfo.row,
|
||||
dashboard: $scope.dashboard,
|
||||
};
|
||||
|
||||
$scope.ctrl.row.height = $(window).height();
|
||||
$scope.panel = panelInfo.panel;
|
||||
$scope.$index = 0;
|
||||
|
||||
if (!$scope.panel) {
|
||||
$scope.appEvent('alert-error', ['Panel not found', '']);
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.panel.span = 12;
|
||||
};
|
||||
|
||||
$scope.init();
|
||||
}
|
||||
}
|
||||
|
||||
angular.module('grafana.routes').controller('SoloPanelCtrl', SoloPanelCtrl);
|
Loading…
Reference in New Issue
Block a user