Skip to content

Commit

Permalink
Merge remote-tracking branch 'grafana/master' into min-max-field
Browse files Browse the repository at this point in the history
* grafana/master:
  build: restore postgres integration tests (grafana#16801)
  docs: explain correct access control model of GCS buckets (grafana#16792)
  Chore: Fixed no implicit any Typescript errors (grafana#16799)
  Feature: introduce LdapActiveSyncEnabled setting (grafana#16787)
  Plugins: ReactPanelPlugin to VizPanelPlugin (grafana#16779)
  UX: Improve Grafana usage for smaller screens  (grafana#16783)
  ThresholdEditor: Minor style fix for smaller screens (grafana#16791)
  Build: Use isolated modules for ts-jest (grafana#16786)
  • Loading branch information
ryantxu committed Apr 29, 2019
2 parents f796729 + decd656 commit 88e33c1
Show file tree
Hide file tree
Showing 71 changed files with 332 additions and 332 deletions.
2 changes: 1 addition & 1 deletion conf/defaults.ini
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,10 @@ headers =
enabled = false
config_file = /etc/grafana/ldap.toml
allow_sign_up = true
sync_cron = @hourly

# LDAP backround sync (Enterprise only)
sync_cron = @hourly
active_sync_enabled = false

#################################### SMTP / Emailing #####################
[smtp]
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/installation/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ basic auth password
Path to JSON key file associated with a Google service account to authenticate and authorize.
Service Account keys can be created and downloaded from https://console.developers.google.com/permissions/serviceaccounts.

Service Account should have "Storage Object Writer" role.
Service Account should have "Storage Object Writer" role. The access control model of the bucket needs to be "Set object-level and bucket-level permissions". Grafana itself will make the images public readable.

### bucket name
Bucket Name on Google Cloud Storage.
Expand Down
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ module.exports = {
"./public/test/jest-setup.ts"
],
"snapshotSerializers": ["enzyme-to-json/serializer"],
"globals": { "ts-jest": { "isolatedModules": true } },
};
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}
}

@include media-breakpoint-up(md) {
@include media-breakpoint-up(sm) {
display: block;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
cursor: pointer;

&:hover {
Expand All @@ -40,6 +41,7 @@

.thresholds-row-color-indicator {
width: 10px;
flex-shrink: 0;
}

.thresholds-row-input {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ exports[`Render should render with base threshold 1`] = `
},
"breakpoints": Object {
"lg": "992px",
"md": "768px",
"md": "769px",
"sm": "544px",
"xl": "1200px",
"xs": "0",
Expand Down Expand Up @@ -272,7 +272,7 @@ exports[`Render should render with base threshold 1`] = `
},
"breakpoints": Object {
"lg": "992px",
"md": "768px",
"md": "769px",
"sm": "544px",
"xl": "1200px",
"xs": "0",
Expand Down
2 changes: 1 addition & 1 deletion packages/grafana-ui/src/themes/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const theme: GrafanaThemeCommons = {
breakpoints: {
xs: '0',
sm: '544px',
md: '768px',
md: '769px', // 1 more than regular ipad in portrait
lg: '992px',
xl: '1200px',
},
Expand Down
2 changes: 1 addition & 1 deletion packages/grafana-ui/src/types/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export type PanelTypeChangedHandler<TOptions = any> = (
prevOptions: any
) => Partial<TOptions>;

export class ReactPanelPlugin<TOptions = any> {
export class PanelPlugin<TOptions = any> {
panel: ComponentType<PanelProps<TOptions>>;
editor?: ComponentClass<PanelEditorProps<TOptions>>;
defaults?: TOptions;
Expand Down
14 changes: 8 additions & 6 deletions pkg/setting/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,11 @@ var (
GoogleTagManagerId string

// LDAP
LdapEnabled bool
LdapConfigFile string
LdapSyncCron string
LdapAllowSignup = true
LdapEnabled bool
LdapConfigFile string
LdapSyncCron string
LdapAllowSignup bool
LdapActiveSyncEnabled bool

// QUOTA
Quota QuotaSettings
Expand Down Expand Up @@ -971,10 +972,11 @@ type RemoteCacheOptions struct {

func (cfg *Cfg) readLDAPConfig() {
ldapSec := cfg.Raw.Section("auth.ldap")
LdapEnabled = ldapSec.Key("enabled").MustBool(false)
LdapConfigFile = ldapSec.Key("config_file").String()
LdapAllowSignup = ldapSec.Key("allow_sign_up").MustBool(true)
LdapSyncCron = ldapSec.Key("sync_cron").String()
LdapEnabled = ldapSec.Key("enabled").MustBool(false)
LdapActiveSyncEnabled = ldapSec.Key("active_sync_enabled").MustBool(false)
LdapAllowSignup = ldapSec.Key("allow_sign_up").MustBool(true)
}

func (cfg *Cfg) readSessionConfig() {
Expand Down
4 changes: 2 additions & 2 deletions public/app/core/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'lodash';
import { PanelPlugin } from 'app/types/plugins';
import { PanelPluginMeta } from 'app/types/plugins';
import { GrafanaTheme, getTheme, GrafanaThemeType, DataSourceInstanceSettings } from '@grafana/ui';

export interface BuildInfo {
Expand All @@ -13,7 +13,7 @@ export interface BuildInfo {

export class Settings {
datasources: { [str: string]: DataSourceInstanceSettings };
panels: { [key: string]: PanelPlugin };
panels: { [key: string]: PanelPluginMeta };
appSubUrl: string;
windowTitlePrefix: string;
buildInfo: BuildInfo;
Expand Down
2 changes: 1 addition & 1 deletion public/app/core/controllers/error_ctrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import appEvents from 'app/core/app_events';

export class ErrorCtrl {
/** @ngInject */
constructor($scope, contextSrv, navModelSrv) {
constructor($scope: any, contextSrv: any, navModelSrv: any) {
$scope.navModel = navModelSrv.getNotFoundNav();
$scope.appSubUrl = config.appSubUrl;

Expand Down
4 changes: 2 additions & 2 deletions public/app/core/controllers/invited_ctrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import config from 'app/core/config';

export class InvitedCtrl {
/** @ngInject */
constructor($scope, $routeParams, contextSrv, backendSrv) {
constructor($scope: any, $routeParams: any, contextSrv: any, backendSrv: any) {
contextSrv.sidemenu = false;
$scope.formModel = {};

Expand All @@ -17,7 +17,7 @@ export class InvitedCtrl {
};

$scope.init = () => {
backendSrv.get('/api/user/invite/' + $routeParams.code).then(invite => {
backendSrv.get('/api/user/invite/' + $routeParams.code).then((invite: any) => {
$scope.formModel.name = invite.name;
$scope.formModel.email = invite.email;
$scope.formModel.username = invite.email;
Expand Down
2 changes: 1 addition & 1 deletion public/app/core/controllers/json_editor_ctrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import coreModule from '../core_module';

export class JsonEditorCtrl {
/** @ngInject */
constructor($scope) {
constructor($scope: any) {
$scope.json = angular.toJson($scope.model.object, true);
$scope.canUpdate = $scope.model.updateHandler !== void 0 && $scope.model.canUpdate;
$scope.canCopy = $scope.model.enableCopy;
Expand Down
11 changes: 5 additions & 6 deletions public/app/core/controllers/login_ctrl.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import _ from 'lodash';
import coreModule from '../core_module';
import config from 'app/core/config';
import { BackendSrv } from '../services/backend_srv';

export class LoginCtrl {
/** @ngInject */
constructor($scope, backendSrv, contextSrv, $location) {
constructor($scope: any, backendSrv: BackendSrv, $location: any) {
$scope.formModel = {
user: '',
email: '',
Expand All @@ -15,8 +16,6 @@ export class LoginCtrl {
$scope.result = '';
$scope.loggingIn = false;

contextSrv.sidemenu = false;

$scope.oauth = config.oauth;
$scope.oauthEnabled = _.keys(config.oauth).length > 0;
$scope.ldapEnabled = config.ldapEnabled;
Expand Down Expand Up @@ -83,7 +82,7 @@ export class LoginCtrl {
$scope.toGrafana();
};

$scope.loginModeChanged = newValue => {
$scope.loginModeChanged = (newValue: boolean) => {
$scope.submitBtnText = newValue ? 'Log in' : 'Sign up';
};

Expand All @@ -92,7 +91,7 @@ export class LoginCtrl {
return;
}

backendSrv.post('/api/user/signup', $scope.formModel).then(result => {
backendSrv.post('/api/user/signup', $scope.formModel).then((result: any) => {
if (result.status === 'SignUpCreated') {
$location.path('/signup').search({ email: $scope.formModel.email });
} else {
Expand All @@ -111,7 +110,7 @@ export class LoginCtrl {

backendSrv
.post('/login', $scope.formModel)
.then(result => {
.then((result: any) => {
$scope.result = result;

if ($scope.formModel.password !== 'admin' || $scope.ldapEnabled || $scope.authProxyEnabled) {
Expand Down
4 changes: 2 additions & 2 deletions public/app/core/controllers/reset_password_ctrl.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import coreModule from '../core_module';
import config from 'app/core/config';
import { BackendSrv } from '../services/backend_srv';

export class ResetPasswordCtrl {
/** @ngInject */
constructor($scope, contextSrv, backendSrv, $location) {
contextSrv.sidemenu = false;
constructor($scope: any, backendSrv: BackendSrv, $location: any) {
$scope.formModel = {};
$scope.mode = 'send';
$scope.ldapEnabled = config.ldapEnabled;
Expand Down
6 changes: 3 additions & 3 deletions public/app/core/directives/array_join.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ export function arrayJoin() {
return {
restrict: 'A',
require: 'ngModel',
link: (scope, element, attr, ngModel) => {
function split_array(text) {
link: (scope: any, element: any, attr: any, ngModel: any) => {
function split_array(text: string) {
return (text || '').split(',');
}

function join_array(text) {
function join_array(text: string) {
if (_.isArray(text)) {
return ((text || '') as any).join(',');
} else {
Expand Down
2 changes: 1 addition & 1 deletion public/app/core/directives/autofill_event_fix.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import coreModule from '../core_module';

/** @ngInject */
export function autofillEventFix($compile) {
export function autofillEventFix($compile: any) {
return {
link: ($scope: any, elem: any) => {
const input = elem[0];
Expand Down
8 changes: 4 additions & 4 deletions public/app/core/directives/diff-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ export class DeltaCtrl {
observer: any;

/** @ngInject */
constructor(private $rootScope) {
const waitForCompile = mutations => {
constructor(private $rootScope: any) {
const waitForCompile = (mutations: any) => {
if (mutations.length === 1) {
this.$rootScope.appEvent('json-diff-ready');
}
Expand Down Expand Up @@ -42,10 +42,10 @@ coreModule.directive('diffDelta', delta);
// Link to JSON line number
export class LinkJSONCtrl {
/** @ngInject */
constructor(private $scope, private $rootScope, private $anchorScroll) {}
constructor(private $scope: any, private $rootScope: any, private $anchorScroll: any) {}

goToLine(line: number) {
let unbind;
let unbind: () => void;

const scroll = () => {
this.$anchorScroll(`l${line}`);
Expand Down
22 changes: 11 additions & 11 deletions public/app/core/directives/dropdown_typeahead.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import $ from 'jquery';
import coreModule from '../core_module';

/** @ngInject */
export function dropdownTypeahead($compile) {
export function dropdownTypeahead($compile: any) {
const inputTemplate =
'<input type="text"' +
' class="gf-form-input input-medium tight-form-input"' +
Expand All @@ -20,7 +20,7 @@ export function dropdownTypeahead($compile) {
dropdownTypeaheadOnSelect: '&dropdownTypeaheadOnSelect',
model: '=ngModel',
},
link: ($scope, elem, attrs) => {
link: ($scope: any, elem: any, attrs: any) => {
const $input = $(inputTemplate);
const $button = $(buttonTemplate);
$input.appendTo(elem);
Expand All @@ -31,7 +31,7 @@ export function dropdownTypeahead($compile) {
}

if (attrs.ngModel) {
$scope.$watch('model', newValue => {
$scope.$watch('model', (newValue: any) => {
_.each($scope.menuItems, item => {
_.each(item.submenu, subItem => {
if (subItem.value === newValue) {
Expand Down Expand Up @@ -59,7 +59,7 @@ export function dropdownTypeahead($compile) {
[]
);

$scope.menuItemSelected = (index, subIndex) => {
$scope.menuItemSelected = (index: number, subIndex: number) => {
const menuItem = $scope.menuItems[index];
const payload: any = { $item: menuItem };
if (menuItem.submenu && subIndex !== void 0) {
Expand All @@ -73,7 +73,7 @@ export function dropdownTypeahead($compile) {
source: typeaheadValues,
minLength: 1,
items: 10,
updater: value => {
updater: (value: string) => {
const result: any = {};
_.each($scope.menuItems, menuItem => {
_.each(menuItem.submenu, submenuItem => {
Expand Down Expand Up @@ -123,7 +123,7 @@ export function dropdownTypeahead($compile) {
}

/** @ngInject */
export function dropdownTypeahead2($compile) {
export function dropdownTypeahead2($compile: any) {
const inputTemplate =
'<input type="text"' + ' class="gf-form-input"' + ' spellcheck="false" style="display:none"></input>';

Expand All @@ -139,7 +139,7 @@ export function dropdownTypeahead2($compile) {
model: '=ngModel',
buttonTemplateClass: '@',
},
link: ($scope, elem, attrs) => {
link: ($scope: any, elem: any, attrs: any) => {
const $input = $(inputTemplate);

if (!$scope.buttonTemplateClass) {
Expand All @@ -148,7 +148,7 @@ export function dropdownTypeahead2($compile) {

const $button = $(buttonTemplate);
const timeoutId = {
blur: null,
blur: null as any,
};
$input.appendTo(elem);
$button.appendTo(elem);
Expand All @@ -158,7 +158,7 @@ export function dropdownTypeahead2($compile) {
}

if (attrs.ngModel) {
$scope.$watch('model', newValue => {
$scope.$watch('model', (newValue: any) => {
_.each($scope.menuItems, item => {
_.each(item.submenu, subItem => {
if (subItem.value === newValue) {
Expand Down Expand Up @@ -194,7 +194,7 @@ export function dropdownTypeahead2($compile) {
elem.removeClass('open');
};

$scope.menuItemSelected = (index, subIndex) => {
$scope.menuItemSelected = (index: number, subIndex: number) => {
const menuItem = $scope.menuItems[index];
const payload: any = { $item: menuItem };
if (menuItem.submenu && subIndex !== void 0) {
Expand All @@ -209,7 +209,7 @@ export function dropdownTypeahead2($compile) {
source: typeaheadValues,
minLength: 1,
items: 10,
updater: value => {
updater: (value: string) => {
const result: any = {};
_.each($scope.menuItems, menuItem => {
_.each(menuItem.submenu, submenuItem => {
Expand Down
6 changes: 3 additions & 3 deletions public/app/core/directives/give_focus.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import coreModule from '../core_module';

coreModule.directive('giveFocus', () => {
return (scope, element, attrs) => {
element.click(e => {
return (scope: any, element: any, attrs: any) => {
element.click((e: any) => {
e.stopPropagation();
});

scope.$watch(
attrs.giveFocus,
newValue => {
(newValue: any) => {
if (!newValue) {
return;
}
Expand Down
Loading

0 comments on commit 88e33c1

Please sign in to comment.