diff --git a/public/app/core/components/colorpicker.ts b/public/app/core/components/colorpicker.ts deleted file mode 100644 index f64903ad0b6..00000000000 --- a/public/app/core/components/colorpicker.ts +++ /dev/null @@ -1,69 +0,0 @@ -/// - -import coreModule from 'app/core/core_module'; - -var template = ` -
-
- - - -
- -

-   -

-
-`; - -export class ColorPickerCtrl { - colors: any; - autoClose: boolean; - series: any; - showAxisControls: boolean; - - /** @ngInject */ - constructor(private $scope, $rootScope) { - this.colors = $rootScope.colors; - this.autoClose = $scope.autoClose; - this.series = $scope.series; - } - - toggleAxis(yaxis) { - this.$scope.toggleAxis(); - - if (this.$scope.autoClose) { - this.$scope.dismiss(); - } - } - - colorSelected(color) { - this.$scope.colorSelected(color); - if (this.$scope.autoClose) { - this.$scope.dismiss(); - } - } -} - -export function colorPicker() { - return { - restrict: 'E', - controller: ColorPickerCtrl, - bindToController: true, - controllerAs: 'ctrl', - template: template, - }; -} - -coreModule.directive('gfColorPicker', colorPicker); diff --git a/public/app/core/components/colorpicker/ColorPickerPopover.tsx b/public/app/core/components/colorpicker/ColorPickerPopover.tsx index eaec3273507..49e1b1e2105 100644 --- a/public/app/core/components/colorpicker/ColorPickerPopover.tsx +++ b/public/app/core/components/colorpicker/ColorPickerPopover.tsx @@ -22,12 +22,6 @@ export class ColorPickerPopover extends React.Component { color: this.props.color, colorString: this.props.color }; - - this.onColorStringChange = this.onColorStringChange.bind(this); - this.onColorStringBlur = this.onColorStringBlur.bind(this); - this.sampleColorSelected = this.sampleColorSelected.bind(this); - this.spectrumColorSelected = this.spectrumColorSelected.bind(this); - this.setPickerNavElem = this.setPickerNavElem.bind(this); } setPickerNavElem(elem) { @@ -89,32 +83,32 @@ export class ColorPickerPopover extends React.Component { render() { const paletteTab = (
- +
); const spectrumTab = (
- +
); const currentTab = this.state.tab === 'palette' ? paletteTab : spectrumTab; return (
-
    + -
    +
    {currentTab}
    -
    - +
    +
    diff --git a/public/app/core/components/colorpicker/SeriesColorPicker.tsx b/public/app/core/components/colorpicker/SeriesColorPicker.tsx index 6ea8b1710b3..e7294aa6281 100644 --- a/public/app/core/components/colorpicker/SeriesColorPicker.tsx +++ b/public/app/core/components/colorpicker/SeriesColorPicker.tsx @@ -1,6 +1,6 @@ import React from 'react'; import coreModule from 'app/core/core_module'; -import { ColorPickerPopover } from './ColorPickerPopover'; +import {ColorPickerPopover} from './ColorPickerPopover'; export interface IProps { series: any; @@ -23,27 +23,33 @@ export class SeriesColorPicker extends React.Component { this.props.onToggleAxis(); } - render() { + renderAxisSelection() { const leftButtonClass = this.props.series.yaxis === 1 ? 'btn-success' : 'btn-inverse'; const rightButtonClass = this.props.series.yaxis === 2 ? 'btn-success' : 'btn-inverse'; + return ( +
    + + + +
    + ); + } + + render() { return (
    -
    - - - -
    - + {this.props.series && this.renderAxisSelection()} +
    ); } } -coreModule.directive('seriesColorPicker', function (reactDirective) { +coreModule.directive('seriesColorPicker', function(reactDirective) { return reactDirective(SeriesColorPicker, ['series', 'onColorChange', 'onToggleAxis']); }); diff --git a/public/app/core/core.ts b/public/app/core/core.ts index 9ac3fd8c2a2..95b2e20aab6 100644 --- a/public/app/core/core.ts +++ b/public/app/core/core.ts @@ -23,7 +23,6 @@ import {grafanaAppDirective} from './components/grafana_app'; import {sideMenuDirective} from './components/sidemenu/sidemenu'; import {searchDirective} from './components/search/search'; import {infoPopover} from './components/info_popover'; -import {colorPicker} from './components/colorpicker'; import {navbarDirective} from './components/navbar/navbar'; import {arrayJoin} from './directives/array_join'; import {liveSrv} from './live/live_srv'; @@ -55,7 +54,6 @@ export { sideMenuDirective, navbarDirective, searchDirective, - colorPicker, liveSrv, layoutSelector, switchDirective, diff --git a/public/app/plugins/panel/graph/series_overrides_ctrl.js b/public/app/plugins/panel/graph/series_overrides_ctrl.js index 945f8340b33..2df993ff70e 100644 --- a/public/app/plugins/panel/graph/series_overrides_ctrl.js +++ b/public/app/plugins/panel/graph/series_overrides_ctrl.js @@ -57,7 +57,7 @@ define([ element: $element.find(".dropdown")[0], position: 'top center', openOn: 'click', - template: '', + template: '', model: { autoClose: true, colorSelected: $scope.colorSelected, diff --git a/public/sass/components/_color_picker.scss b/public/sass/components/_color_picker.scss index 15c5db61794..22c96398160 100644 --- a/public/sass/components/_color_picker.scss +++ b/public/sass/components/_color_picker.scss @@ -36,8 +36,9 @@ z-index: 0; } -.colorpicker-container { - min-height: 190px; +.gf-color-picker__body { + padding-bottom: 10px; + padding-left: 6px; } .drop-popover.gf-color-picker { diff --git a/public/sass/components/_gf-form.scss b/public/sass/components/_gf-form.scss index 14c8220337a..a44bb39b0e2 100644 --- a/public/sass/components/_gf-form.scss +++ b/public/sass/components/_gf-form.scss @@ -171,6 +171,12 @@ $gf-form-margin: 0.25rem; pointer-events: none; } } + + &--small { + padding-top: 4px; + padding-bottom: 4px; + font-size: $font-size-sm; + } } .gf-form-hint {