mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
tech: ran pretttier on all typescript files
This commit is contained in:
@@ -1,24 +1,23 @@
|
||||
import config from 'app/core/config';
|
||||
import coreModule from '../core_module';
|
||||
import appEvents from 'app/core/app_events';
|
||||
import config from "app/core/config";
|
||||
import coreModule from "../core_module";
|
||||
import appEvents from "app/core/app_events";
|
||||
|
||||
export class ErrorCtrl {
|
||||
|
||||
/** @ngInject */
|
||||
constructor($scope, contextSrv, navModelSrv) {
|
||||
$scope.navModel = navModelSrv.getNotFoundNav();
|
||||
$scope.appSubUrl = config.appSubUrl;
|
||||
|
||||
if (!contextSrv.isSignedIn) {
|
||||
appEvents.emit('toggle-sidemenu-hidden');
|
||||
appEvents.emit("toggle-sidemenu-hidden");
|
||||
}
|
||||
|
||||
$scope.$on("destroy", () => {
|
||||
if (!contextSrv.isSignedIn) {
|
||||
appEvents.emit('toggle-sidemenu-hidden');
|
||||
appEvents.emit("toggle-sidemenu-hidden");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
coreModule.controller('ErrorCtrl', ErrorCtrl);
|
||||
coreModule.controller("ErrorCtrl", ErrorCtrl);
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
import angular from 'angular';
|
||||
import _ from 'lodash';
|
||||
import $ from 'jquery';
|
||||
import coreModule from '../core_module';
|
||||
import angular from "angular";
|
||||
import _ from "lodash";
|
||||
import $ from "jquery";
|
||||
import coreModule from "../core_module";
|
||||
|
||||
export class InspectCtrl {
|
||||
|
||||
/** @ngInject */
|
||||
constructor($scope, $sanitize) {
|
||||
var model = $scope.inspector;
|
||||
|
||||
$scope.init = function () {
|
||||
$scope.init = function() {
|
||||
$scope.editor = { index: 0 };
|
||||
|
||||
if (!model.error) {
|
||||
if (!model.error) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -29,8 +28,11 @@ export class InspectCtrl {
|
||||
}
|
||||
|
||||
if (model.error.config && model.error.config.params) {
|
||||
$scope.request_parameters = _.map(model.error.config.params, function(value, key) {
|
||||
return { key: key, value: value};
|
||||
$scope.request_parameters = _.map(model.error.config.params, function(
|
||||
value,
|
||||
key
|
||||
) {
|
||||
return { key: key, value: value };
|
||||
});
|
||||
}
|
||||
|
||||
@@ -44,10 +46,15 @@ export class InspectCtrl {
|
||||
$scope.editor.index = 2;
|
||||
|
||||
if (_.isString(model.error.config.data)) {
|
||||
$scope.request_parameters = this.getParametersFromQueryString(model.error.config.data);
|
||||
} else {
|
||||
$scope.request_parameters = _.map(model.error.config.data, function(value, key) {
|
||||
return {key: key, value: angular.toJson(value, true)};
|
||||
$scope.request_parameters = this.getParametersFromQueryString(
|
||||
model.error.config.data
|
||||
);
|
||||
} else {
|
||||
$scope.request_parameters = _.map(model.error.config.data, function(
|
||||
value,
|
||||
key
|
||||
) {
|
||||
return { key: key, value: angular.toJson(value, true) };
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -59,11 +66,14 @@ export class InspectCtrl {
|
||||
for (var i = 0; i < parameters.length; i++) {
|
||||
var keyValue = parameters[i].split("=");
|
||||
if (keyValue[1].length > 0) {
|
||||
result.push({ key: keyValue[0], value: (<any>window).unescape(keyValue[1]) });
|
||||
result.push({
|
||||
key: keyValue[0],
|
||||
value: (<any>window).unescape(keyValue[1])
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
coreModule.controller('InspectCtrl', InspectCtrl);
|
||||
coreModule.controller("InspectCtrl", InspectCtrl);
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import coreModule from '../core_module';
|
||||
import config from 'app/core/config';
|
||||
import coreModule from "../core_module";
|
||||
import config from "app/core/config";
|
||||
|
||||
export class InvitedCtrl {
|
||||
|
||||
/** @ngInject */
|
||||
constructor($scope, $routeParams, contextSrv, backendSrv) {
|
||||
contextSrv.sidemenu = false;
|
||||
@@ -10,25 +9,24 @@ export class InvitedCtrl {
|
||||
|
||||
$scope.navModel = {
|
||||
main: {
|
||||
icon: 'gicon gicon-branding',
|
||||
subTitle: 'Register your Grafana account',
|
||||
breadcrumbs: [
|
||||
{ title: 'Login', url: '/login' },
|
||||
{ title: 'Invite' },
|
||||
]
|
||||
icon: "gicon gicon-branding",
|
||||
subTitle: "Register your Grafana account",
|
||||
breadcrumbs: [{ title: "Login", url: "/login" }, { title: "Invite" }]
|
||||
}
|
||||
};
|
||||
|
||||
$scope.init = function() {
|
||||
backendSrv.get('/api/user/invite/' + $routeParams.code).then(function(invite) {
|
||||
$scope.formModel.name = invite.name;
|
||||
$scope.formModel.email = invite.email;
|
||||
$scope.formModel.username = invite.email;
|
||||
$scope.formModel.inviteCode = $routeParams.code;
|
||||
backendSrv
|
||||
.get("/api/user/invite/" + $routeParams.code)
|
||||
.then(function(invite) {
|
||||
$scope.formModel.name = invite.name;
|
||||
$scope.formModel.email = invite.email;
|
||||
$scope.formModel.username = invite.email;
|
||||
$scope.formModel.inviteCode = $routeParams.code;
|
||||
|
||||
$scope.greeting = invite.name || invite.email || invite.username;
|
||||
$scope.invitedBy = invite.invitedBy;
|
||||
});
|
||||
$scope.greeting = invite.name || invite.email || invite.username;
|
||||
$scope.invitedBy = invite.invitedBy;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.submit = function() {
|
||||
@@ -36,13 +34,15 @@ export class InvitedCtrl {
|
||||
return;
|
||||
}
|
||||
|
||||
backendSrv.post('/api/user/invite/complete', $scope.formModel).then(function() {
|
||||
window.location.href = config.appSubUrl + '/';
|
||||
});
|
||||
backendSrv
|
||||
.post("/api/user/invite/complete", $scope.formModel)
|
||||
.then(function() {
|
||||
window.location.href = config.appSubUrl + "/";
|
||||
});
|
||||
};
|
||||
|
||||
$scope.init();
|
||||
}
|
||||
}
|
||||
|
||||
coreModule.controller('InvitedCtrl', InvitedCtrl);
|
||||
coreModule.controller("InvitedCtrl", InvitedCtrl);
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import angular from 'angular';
|
||||
import coreModule from '../core_module';
|
||||
import angular from "angular";
|
||||
import coreModule from "../core_module";
|
||||
|
||||
export class JsonEditorCtrl {
|
||||
|
||||
/** @ngInject */
|
||||
constructor($scope) {
|
||||
$scope.json = angular.toJson($scope.object, true);
|
||||
$scope.canUpdate = $scope.updateHandler !== void 0 && $scope.contextSrv.isEditor;
|
||||
$scope.canUpdate =
|
||||
$scope.updateHandler !== void 0 && $scope.contextSrv.isEditor;
|
||||
|
||||
$scope.update = function () {
|
||||
$scope.update = function() {
|
||||
var newObject = angular.fromJson($scope.json);
|
||||
$scope.updateHandler(newObject, $scope.object);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
coreModule.controller('JsonEditorCtrl', JsonEditorCtrl);
|
||||
coreModule.controller("JsonEditorCtrl", JsonEditorCtrl);
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import _ from 'lodash';
|
||||
import coreModule from '../core_module';
|
||||
import config from 'app/core/config';
|
||||
import _ from "lodash";
|
||||
import coreModule from "../core_module";
|
||||
import config from "app/core/config";
|
||||
|
||||
export class LoginCtrl {
|
||||
|
||||
/** @ngInject */
|
||||
constructor($scope, backendSrv, contextSrv, $location) {
|
||||
$scope.formModel = {
|
||||
user: '',
|
||||
email: '',
|
||||
password: '',
|
||||
user: "",
|
||||
email: "",
|
||||
password: ""
|
||||
};
|
||||
|
||||
contextSrv.sidemenu = false;
|
||||
@@ -19,16 +18,16 @@ export class LoginCtrl {
|
||||
|
||||
$scope.disableLoginForm = config.disableLoginForm;
|
||||
$scope.disableUserSignUp = config.disableUserSignUp;
|
||||
$scope.loginHint = config.loginHint;
|
||||
$scope.loginHint = config.loginHint;
|
||||
|
||||
$scope.loginMode = true;
|
||||
$scope.submitBtnText = 'Log in';
|
||||
$scope.submitBtnText = "Log in";
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.$watch("loginMode", $scope.loginModeChanged);
|
||||
|
||||
if (config.loginError) {
|
||||
$scope.appEvent('alert-warning', ['Login Failed', config.loginError]);
|
||||
$scope.appEvent("alert-warning", ["Login Failed", config.loginError]);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -41,7 +40,7 @@ export class LoginCtrl {
|
||||
};
|
||||
|
||||
$scope.loginModeChanged = function(newValue) {
|
||||
$scope.submitBtnText = newValue ? 'Log in' : 'Sign up';
|
||||
$scope.submitBtnText = newValue ? "Log in" : "Sign up";
|
||||
};
|
||||
|
||||
$scope.signUp = function() {
|
||||
@@ -49,13 +48,15 @@ export class LoginCtrl {
|
||||
return;
|
||||
}
|
||||
|
||||
backendSrv.post('/api/user/signup', $scope.formModel).then(function(result) {
|
||||
if (result.status === 'SignUpCreated') {
|
||||
$location.path('/signup').search({email: $scope.formModel.email});
|
||||
} else {
|
||||
window.location.href = config.appSubUrl + '/';
|
||||
}
|
||||
});
|
||||
backendSrv
|
||||
.post("/api/user/signup", $scope.formModel)
|
||||
.then(function(result) {
|
||||
if (result.status === "SignUpCreated") {
|
||||
$location.path("/signup").search({ email: $scope.formModel.email });
|
||||
} else {
|
||||
window.location.href = config.appSubUrl + "/";
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.login = function() {
|
||||
@@ -65,15 +66,15 @@ export class LoginCtrl {
|
||||
return;
|
||||
}
|
||||
|
||||
backendSrv.post('/login', $scope.formModel).then(function(result) {
|
||||
backendSrv.post("/login", $scope.formModel).then(function(result) {
|
||||
var params = $location.search();
|
||||
|
||||
if (params.redirect && params.redirect[0] === '/') {
|
||||
if (params.redirect && params.redirect[0] === "/") {
|
||||
window.location.href = config.appSubUrl + params.redirect;
|
||||
} else if (result.redirectUrl) {
|
||||
window.location.href = result.redirectUrl;
|
||||
} else {
|
||||
window.location.href = config.appSubUrl + '/';
|
||||
window.location.href = config.appSubUrl + "/";
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -82,4 +83,4 @@ export class LoginCtrl {
|
||||
}
|
||||
}
|
||||
|
||||
coreModule.controller('LoginCtrl', LoginCtrl);
|
||||
coreModule.controller("LoginCtrl", LoginCtrl);
|
||||
|
||||
@@ -1,26 +1,25 @@
|
||||
import coreModule from '../core_module';
|
||||
import coreModule from "../core_module";
|
||||
|
||||
export class ResetPasswordCtrl {
|
||||
|
||||
/** @ngInject */
|
||||
constructor($scope, contextSrv, backendSrv, $location) {
|
||||
contextSrv.sidemenu = false;
|
||||
$scope.formModel = {};
|
||||
$scope.mode = 'send';
|
||||
$scope.mode = "send";
|
||||
|
||||
var params = $location.search();
|
||||
if (params.code) {
|
||||
$scope.mode = 'reset';
|
||||
$scope.mode = "reset";
|
||||
$scope.formModel.code = params.code;
|
||||
}
|
||||
|
||||
$scope.navModel = {
|
||||
main: {
|
||||
icon: 'gicon gicon-branding',
|
||||
subTitle: 'Reset your Grafana password',
|
||||
icon: "gicon gicon-branding",
|
||||
subTitle: "Reset your Grafana password",
|
||||
breadcrumbs: [
|
||||
{ title: 'Login', url: '/login' },
|
||||
{ title: 'Reset Password' },
|
||||
{ title: "Login", url: "/login" },
|
||||
{ title: "Reset Password" }
|
||||
]
|
||||
}
|
||||
};
|
||||
@@ -29,24 +28,30 @@ export class ResetPasswordCtrl {
|
||||
if (!$scope.sendResetForm.$valid) {
|
||||
return;
|
||||
}
|
||||
backendSrv.post('/api/user/password/send-reset-email', $scope.formModel).then(function() {
|
||||
$scope.mode = 'email-sent';
|
||||
});
|
||||
backendSrv
|
||||
.post("/api/user/password/send-reset-email", $scope.formModel)
|
||||
.then(function() {
|
||||
$scope.mode = "email-sent";
|
||||
});
|
||||
};
|
||||
|
||||
$scope.submitReset = function() {
|
||||
if (!$scope.resetForm.$valid) { return; }
|
||||
|
||||
if ($scope.formModel.newPassword !== $scope.formModel.confirmPassword) {
|
||||
$scope.appEvent('alert-warning', ['New passwords do not match', '']);
|
||||
if (!$scope.resetForm.$valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
backendSrv.post('/api/user/password/reset', $scope.formModel).then(function() {
|
||||
$location.path('login');
|
||||
});
|
||||
if ($scope.formModel.newPassword !== $scope.formModel.confirmPassword) {
|
||||
$scope.appEvent("alert-warning", ["New passwords do not match", ""]);
|
||||
return;
|
||||
}
|
||||
|
||||
backendSrv
|
||||
.post("/api/user/password/reset", $scope.formModel)
|
||||
.then(function() {
|
||||
$location.path("login");
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
coreModule.controller('ResetPasswordCtrl', ResetPasswordCtrl);
|
||||
coreModule.controller("ResetPasswordCtrl", ResetPasswordCtrl);
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
///<reference path="../../headers/common.d.ts" />
|
||||
|
||||
import config from 'app/core/config';
|
||||
import coreModule from '../core_module';
|
||||
import config from "app/core/config";
|
||||
import coreModule from "../core_module";
|
||||
|
||||
export class SignUpCtrl {
|
||||
|
||||
/** @ngInject */
|
||||
constructor(
|
||||
private $scope: any,
|
||||
private backendSrv: any,
|
||||
$location: any,
|
||||
contextSrv: any) {
|
||||
|
||||
private $scope: any,
|
||||
private backendSrv: any,
|
||||
$location: any,
|
||||
contextSrv: any
|
||||
) {
|
||||
contextSrv.sidemenu = false;
|
||||
$scope.ctrl = this;
|
||||
|
||||
@@ -28,35 +27,34 @@ export class SignUpCtrl {
|
||||
|
||||
$scope.navModel = {
|
||||
main: {
|
||||
icon: 'gicon gicon-branding',
|
||||
subTitle: 'Register your Grafana account',
|
||||
breadcrumbs: [
|
||||
{ title: 'Login', url: '/login' },
|
||||
{ title: 'Sign Up' },
|
||||
]
|
||||
icon: "gicon gicon-branding",
|
||||
subTitle: "Register your Grafana account",
|
||||
breadcrumbs: [{ title: "Login", url: "/login" }, { title: "Sign Up" }]
|
||||
}
|
||||
};
|
||||
|
||||
backendSrv.get('/api/user/signup/options').then(options => {
|
||||
backendSrv.get("/api/user/signup/options").then(options => {
|
||||
$scope.verifyEmailEnabled = options.verifyEmailEnabled;
|
||||
$scope.autoAssignOrg = options.autoAssignOrg;
|
||||
});
|
||||
}
|
||||
|
||||
submit () {
|
||||
submit() {
|
||||
if (!this.$scope.signUpForm.$valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.backendSrv.post('/api/user/signup/step2', this.$scope.formModel).then(rsp => {
|
||||
if (rsp.code === 'redirect-to-select-org') {
|
||||
window.location.href = config.appSubUrl + '/profile/select-org?signup=1';
|
||||
} else {
|
||||
window.location.href = config.appSubUrl + '/';
|
||||
}
|
||||
});
|
||||
this.backendSrv
|
||||
.post("/api/user/signup/step2", this.$scope.formModel)
|
||||
.then(rsp => {
|
||||
if (rsp.code === "redirect-to-select-org") {
|
||||
window.location.href =
|
||||
config.appSubUrl + "/profile/select-org?signup=1";
|
||||
} else {
|
||||
window.location.href = config.appSubUrl + "/";
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
coreModule.controller('SignUpCtrl', SignUpCtrl);
|
||||
|
||||
coreModule.controller("SignUpCtrl", SignUpCtrl);
|
||||
|
||||
Reference in New Issue
Block a user