diff --git a/public/app/core/components/Login/LoginBackground.tsx b/public/app/core/components/Login/LoginBackground.tsx index fb554845240..83e228ab6e0 100644 --- a/public/app/core/components/Login/LoginBackground.tsx +++ b/public/app/core/components/Login/LoginBackground.tsx @@ -4,14 +4,10 @@ const xCount = 50; const yCount = 50; function Cell({ x, y, flipIndex }) { - const index = y * xCount + x; + const index = (y * xCount) + x; const bgColor1 = getColor(x, y); return ( -
+
); } @@ -35,7 +31,7 @@ export default class LoginBackground extends Component { } flipElements() { - const elementIndexToFlip = getRandomInt(0, xCount * yCount - 1); + const elementIndexToFlip = getRandomInt(0, (xCount * yCount) - 1); this.setState(prevState => { return { ...prevState, @@ -61,7 +57,9 @@ export default class LoginBackground extends Component { return (
{Array.from(Array(xCount)).map((el2, x) => { - return ; + return ( + + ); })}
); @@ -1238,5 +1236,5 @@ function getColor(x, y) { // let randY = getRandomInt(0, y); // let randIndex = randY * xCount + randX; - return colors[(y * xCount + x) % colors.length]; + return colors[(y*xCount + x) % colors.length]; } diff --git a/public/app/core/components/PasswordStrength.tsx b/public/app/core/components/PasswordStrength.tsx index 4830ebdb61b..8f92b18445c 100644 --- a/public/app/core/components/PasswordStrength.tsx +++ b/public/app/core/components/PasswordStrength.tsx @@ -5,27 +5,28 @@ export interface IProps { } export class PasswordStrength extends React.Component { + constructor(props) { super(props); } render() { const { password } = this.props; - let strengthText = 'strength: strong like a bull.'; - let strengthClass = 'password-strength-good'; + let strengthText = "strength: strong like a bull."; + let strengthClass = "password-strength-good"; if (!password) { return null; } if (password.length <= 8) { - strengthText = 'strength: you can do better.'; - strengthClass = 'password-strength-ok'; + strengthText = "strength: you can do better."; + strengthClass = "password-strength-ok"; } if (password.length < 4) { - strengthText = 'strength: weak sauce.'; - strengthClass = 'password-strength-bad'; + strengthText = "strength: weak sauce."; + strengthClass = "password-strength-bad"; } return ( @@ -35,3 +36,5 @@ export class PasswordStrength extends React.Component { ); } } + + diff --git a/public/app/core/components/colorpicker/ColorPalette.tsx b/public/app/core/components/colorpicker/ColorPalette.tsx index 812827996c7..07b25a32046 100644 --- a/public/app/core/components/colorpicker/ColorPalette.tsx +++ b/public/app/core/components/colorpicker/ColorPalette.tsx @@ -29,8 +29,7 @@ export class ColorPalette extends React.Component { key={paletteColor} className={'pointer fa ' + cssClass} style={{ color: paletteColor }} - onClick={this.onColorSelect(paletteColor)} - > + onClick={this.onColorSelect(paletteColor)}>   ); @@ -42,3 +41,4 @@ export class ColorPalette extends React.Component { ); } } + diff --git a/public/app/core/components/colorpicker/ColorPickerPopover.tsx b/public/app/core/components/colorpicker/ColorPickerPopover.tsx index 4ac4161a160..360c3fdd5c4 100644 --- a/public/app/core/components/colorpicker/ColorPickerPopover.tsx +++ b/public/app/core/components/colorpicker/ColorPickerPopover.tsx @@ -19,7 +19,7 @@ export class ColorPickerPopover extends React.Component { this.state = { tab: 'palette', color: this.props.color || DEFAULT_COLOR, - colorString: this.props.color || DEFAULT_COLOR, + colorString: this.props.color || DEFAULT_COLOR }; } @@ -32,7 +32,7 @@ export class ColorPickerPopover extends React.Component { if (newColor.isValid()) { this.setState({ color: newColor.toString(), - colorString: newColor.toString(), + colorString: newColor.toString() }); this.props.onColorSelect(color); } @@ -50,7 +50,7 @@ export class ColorPickerPopover extends React.Component { onColorStringChange(e) { let colorString = e.target.value; this.setState({ - colorString: colorString, + colorString: colorString }); let newColor = tinycolor(colorString); @@ -71,11 +71,11 @@ export class ColorPickerPopover extends React.Component { componentDidMount() { this.pickerNavElem.find('li:first').addClass('active'); - this.pickerNavElem.on('show', e => { + this.pickerNavElem.on('show', (e) => { // use href attr (#name => name) let tab = e.target.hash.slice(1); this.setState({ - tab: tab, + tab: tab }); }); } @@ -97,24 +97,19 @@ export class ColorPickerPopover extends React.Component {
-
{currentTab}
+
+ {currentTab} +
- + +
); diff --git a/public/app/core/components/colorpicker/SpectrumPicker.tsx b/public/app/core/components/colorpicker/SpectrumPicker.tsx index 7242c094cde..eef04545308 100644 --- a/public/app/core/components/colorpicker/SpectrumPicker.tsx +++ b/public/app/core/components/colorpicker/SpectrumPicker.tsx @@ -29,17 +29,14 @@ export class SpectrumPicker extends React.Component { } componentDidMount() { - let spectrumOptions = _.assignIn( - { - flat: true, - showAlpha: true, - showButtons: false, - color: this.props.color, - appendTo: this.elem, - move: this.onSpectrumMove, - }, - this.props.options - ); + let spectrumOptions = _.assignIn({ + flat: true, + showAlpha: true, + showButtons: false, + color: this.props.color, + appendTo: this.elem, + move: this.onSpectrumMove, + }, this.props.options); this.elem.spectrum(spectrumOptions); this.elem.spectrum('show'); @@ -67,6 +64,9 @@ export class SpectrumPicker extends React.Component { } render() { - return
; + return ( +
+ ); } } + diff --git a/public/app/core/components/search/SearchResult.tsx b/public/app/core/components/search/SearchResult.tsx index 5ab4bba8edb..6d6b001cc1d 100644 --- a/public/app/core/components/search/SearchResult.tsx +++ b/public/app/core/components/search/SearchResult.tsx @@ -1,7 +1,7 @@ -import React from 'react'; -import classNames from 'classnames'; -import { observer } from 'mobx-react'; -import { store } from 'app/stores/store'; +import React from "react"; +import classNames from "classnames"; +import { observer } from "mobx-react"; +import { store } from "app/stores/store"; export interface SearchResultProps { search: any; @@ -13,7 +13,7 @@ export class SearchResult extends React.Component { super(props); this.state = { - search: store.search, + search: store.search }; store.search.query(); @@ -56,20 +56,29 @@ export class SearchResultSection extends React.Component { render() { let collapseClassNames = classNames({ fa: true, - 'fa-plus': !this.props.section.expanded, - 'fa-minus': this.props.section.expanded, - 'search-section__header__toggle': true, + "fa-plus": !this.props.section.expanded, + "fa-minus": this.props.section.expanded, + "search-section__header__toggle": true }); return (
- - {this.props.section.title} + + + {this.props.section.title} +
{this.props.section.expanded && ( -
{this.props.section.items.map(this.renderItem)}
+
+ {this.props.section.items.map(this.renderItem)} +
)}
); diff --git a/public/app/core/specs/PasswordStrength.jest.tsx b/public/app/core/specs/PasswordStrength.jest.tsx index 1bd52ee6d50..a0a2df69029 100644 --- a/public/app/core/specs/PasswordStrength.jest.tsx +++ b/public/app/core/specs/PasswordStrength.jest.tsx @@ -1,21 +1,24 @@ import React from 'react'; -import { shallow } from 'enzyme'; +import {shallow} from 'enzyme'; -import { PasswordStrength } from '../components/PasswordStrength'; +import {PasswordStrength} from '../components/PasswordStrength'; describe('PasswordStrength', () => { + it('should have class bad if length below 4', () => { const wrapper = shallow(); - expect(wrapper.find('.password-strength-bad')).toHaveLength(1); + expect(wrapper.find(".password-strength-bad")).toHaveLength(1); }); it('should have class ok if length below 8', () => { const wrapper = shallow(); - expect(wrapper.find('.password-strength-ok')).toHaveLength(1); + expect(wrapper.find(".password-strength-ok")).toHaveLength(1); }); it('should have class good if length above 8', () => { const wrapper = shallow(); - expect(wrapper.find('.password-strength-good')).toHaveLength(1); + expect(wrapper.find(".password-strength-good")).toHaveLength(1); }); + }); + diff --git a/public/app/core/utils/kbn.ts b/public/app/core/utils/kbn.ts index c2bcf1ba70e..3b78ccfc001 100644 --- a/public/app/core/utils/kbn.ts +++ b/public/app/core/utils/kbn.ts @@ -133,12 +133,12 @@ kbn.secondsToHms = function(seconds) { kbn.secondsToHhmmss = function(seconds) { var strings = []; - var numhours = Math.floor(seconds / 3600); - var numminutes = Math.floor((seconds % 3600) / 60); - var numseconds = Math.floor((seconds % 3600) % 60); - numhours > 9 ? strings.push('' + numhours) : strings.push('0' + numhours); - numminutes > 9 ? strings.push('' + numminutes) : strings.push('0' + numminutes); - numseconds > 9 ? strings.push('' + numseconds) : strings.push('0' + numseconds); + var numhours = Math.floor(seconds/3600); + var numminutes = Math.floor((seconds%3600)/60); + var numseconds = Math.floor((seconds%3600)%60); + numhours > 9 ? strings.push(''+numhours) : strings.push('0'+numhours); + numminutes > 9 ? strings.push(''+numminutes) : strings.push('0'+numminutes); + numseconds > 9 ? strings.push(''+numseconds) : strings.push('0'+numseconds); return strings.join(':'); }; diff --git a/public/app/features/dashboard/dashgrid/DashboardPanel.tsx b/public/app/features/dashboard/dashgrid/DashboardPanel.tsx index f135d94431a..27fe64d4660 100644 --- a/public/app/features/dashboard/dashgrid/DashboardPanel.tsx +++ b/public/app/features/dashboard/dashgrid/DashboardPanel.tsx @@ -1,9 +1,9 @@ import React from 'react'; -import { PanelModel } from '../panel_model'; -import { PanelContainer } from './PanelContainer'; -import { AttachedPanel } from './PanelLoader'; -import { DashboardRow } from './DashboardRow'; -import { AddPanelPanel } from './AddPanelPanel'; +import {PanelModel} from '../panel_model'; +import {PanelContainer} from './PanelContainer'; +import {AttachedPanel} from './PanelLoader'; +import {DashboardRow} from './DashboardRow'; +import {AddPanelPanel} from './AddPanelPanel'; export interface DashboardPanelProps { panel: PanelModel; @@ -46,6 +46,9 @@ export class DashboardPanel extends React.Component { return ; } - return
(this.element = element)} className="panel-height-helper" />; + return ( +
this.element = element} className="panel-height-helper" /> + ); } } +