Commit bd4a7ddf by Torkel Ödegaard Committed by GitHub

TimePicker: Style and responsive fixes, restored dashboard settings (#17822)

* TimePicker: Restore time picker settings

* CleanUp: removed unuused angular-ui (calendar) components

* Fix angular boot dependency list

* TimePicker: set time to 23:59:00 when setting To time using calendar
parent d94bdb93
...@@ -193,3 +193,7 @@ $select-input-bg-disabled: $input-bg-disabled; ...@@ -193,3 +193,7 @@ $select-input-bg-disabled: $input-bg-disabled;
.gf-form-select-box-button-select { .gf-form-select-box-button-select {
height: auto; height: auto;
} }
.select-button {
display: flex;
}
...@@ -178,9 +178,7 @@ export class TimePicker extends PureComponent<Props, State> { ...@@ -178,9 +178,7 @@ export class TimePicker extends PureComponent<Props, State> {
const TimePickerTooltipContent = ({ timeRange }: { timeRange: TimeRange }) => ( const TimePickerTooltipContent = ({ timeRange }: { timeRange: TimeRange }) => (
<> <>
{timeRange.from.format(TIME_FORMAT)} {timeRange.from.format(TIME_FORMAT)}
<br /> <div className="text-center">to</div>
to
<br />
{timeRange.to.format(TIME_FORMAT)} {timeRange.to.format(TIME_FORMAT)}
</> </>
); );
......
...@@ -50,6 +50,9 @@ export class TimePickerPopover extends Component<Props, State> { ...@@ -50,6 +50,9 @@ export class TimePickerPopover extends Component<Props, State> {
}; };
onToCalendarChanged = (value: DateTime) => { onToCalendarChanged = (value: DateTime) => {
value.set('h', 23);
value.set('m', 59);
value.set('s', 0);
this.setState({ to: value }); this.setState({ to: value });
}; };
......
...@@ -7,10 +7,6 @@ ...@@ -7,10 +7,6 @@
} }
} }
.time-picker-popover-popper {
z-index: $zindex-timepicker-popover;
}
.time-picker-utc { .time-picker-utc {
color: $orange; color: $orange;
font-size: 75%; font-size: 75%;
...@@ -30,10 +26,11 @@ ...@@ -30,10 +26,11 @@
color: $popover-color; color: $popover-color;
box-shadow: $popover-shadow; box-shadow: $popover-shadow;
position: absolute; position: absolute;
z-index: $zindex-dropdown;
flex-direction: column; flex-direction: column;
max-width: 600px; max-width: 600px;
top: 48px; top: 50px;
right: 20px; right: 0px;
.time-picker-popover-body { .time-picker-popover-body {
display: flex; display: flex;
...@@ -188,11 +185,6 @@ $arrowPadding: $arrowPaddingToBorder * 3; ...@@ -188,11 +185,6 @@ $arrowPadding: $arrowPaddingToBorder * 3;
@include media-breakpoint-down(md) { @include media-breakpoint-down(md) {
.time-picker-popover { .time-picker-popover {
margin-left: $spacer;
display: flex;
flex-flow: column nowrap;
max-width: 400px;
.time-picker-popover-title { .time-picker-popover-title {
font-size: $font-size-md; font-size: $font-size-md;
} }
...@@ -217,6 +209,56 @@ $arrowPadding: $arrowPaddingToBorder * 3; ...@@ -217,6 +209,56 @@ $arrowPadding: $arrowPaddingToBorder * 3;
} }
.time-picker-calendar { .time-picker-calendar {
width: 100%; width: 320px;
}
}
.time-picker-button-select {
.select-button-value {
display: none;
@include media-breakpoint-up(sm) {
display: inline-block;
max-width: 100px;
overflow: hidden;
}
@include media-breakpoint-up(md) {
display: inline-block;
max-width: 150px;
overflow: hidden;
}
@include media-breakpoint-up(lg) {
max-width: 300px;
}
}
}
// special rules for when within explore toolbar in split
.explore-toolbar.splitted {
.time-picker-button-select {
.select-button-value {
display: none;
@include media-breakpoint-up(xl) {
display: inline-block;
max-width: 100px;
}
@media only screen and (max-width: 1545px) {
max-width: 300px;
}
}
}
}
.dashboard-timepicker-wrapper {
position: relative;
display: flex;
.gf-form-select-box__menu {
right: 0;
left: unset;
} }
} }
...@@ -171,7 +171,6 @@ $zindex-tooltip: ${theme.zIndex.tooltip}; ...@@ -171,7 +171,6 @@ $zindex-tooltip: ${theme.zIndex.tooltip};
$zindex-modal-backdrop: ${theme.zIndex.modalBackdrop}; $zindex-modal-backdrop: ${theme.zIndex.modalBackdrop};
$zindex-modal: ${theme.zIndex.modal}; $zindex-modal: ${theme.zIndex.modal};
$zindex-typeahead: ${theme.zIndex.typeahead}; $zindex-typeahead: ${theme.zIndex.typeahead};
$zindex-timepicker-popover: 1070;
// Buttons // Buttons
// //
......
...@@ -11,7 +11,6 @@ import 'react'; ...@@ -11,7 +11,6 @@ import 'react';
import 'react-dom'; import 'react-dom';
import 'vendor/bootstrap/bootstrap'; import 'vendor/bootstrap/bootstrap';
import 'vendor/angular-ui/ui-bootstrap-tpls';
import 'vendor/angular-other/angular-strap'; import 'vendor/angular-other/angular-strap';
import $ from 'jquery'; import $ from 'jquery';
...@@ -125,8 +124,6 @@ export class GrafanaApp { ...@@ -125,8 +124,6 @@ export class GrafanaApp {
'ang-drag-drop', 'ang-drag-drop',
'grafana', 'grafana',
'pasvaz.bindonce', 'pasvaz.bindonce',
'ui.bootstrap',
'ui.bootstrap.tpls',
'react', 'react',
]; ];
......
...@@ -95,7 +95,7 @@ export class DashNavTimeControls extends Component<Props> { ...@@ -95,7 +95,7 @@ export class DashNavTimeControls extends Component<Props> {
const timeZone = dashboard.getTimezone(); const timeZone = dashboard.getTimezone();
return ( return (
<> <div className="dashboard-timepicker-wrapper">
<TimePicker <TimePicker
value={timePickerValue} value={timePickerValue}
onChange={this.onChangeTimePicker} onChange={this.onChangeTimePicker}
...@@ -112,7 +112,7 @@ export class DashNavTimeControls extends Component<Props> { ...@@ -112,7 +112,7 @@ export class DashNavTimeControls extends Component<Props> {
intervals={intervals} intervals={intervals}
tooltip="Refresh dashboard" tooltip="Refresh dashboard"
/> />
</> </div>
); );
} }
} }
import coreModule from 'app/core/core_module';
import { DashboardModel } from 'app/features/dashboard/state';
export class TimePickerCtrl {
panel: any;
dashboard: DashboardModel;
constructor() {
this.panel = this.dashboard.timepicker;
this.panel.refresh_intervals = this.panel.refresh_intervals || [
'5s',
'10s',
'30s',
'1m',
'5m',
'15m',
'30m',
'1h',
'2h',
'1d',
];
}
}
const template = `
<div class="editor-row">
<h5 class="section-heading">Time Options</h5>
<div class="gf-form-group">
<div class="gf-form">
<label class="gf-form-label width-10">Timezone</label>
<div class="gf-form-select-wrapper">
<select ng-model="ctrl.dashboard.timezone" class='gf-form-input' ng-options="f.value as f.text for f in
[{value: '', text: 'Default'}, {value: 'browser', text: 'Local browser time'},{value: 'utc', text: 'UTC'}]">
</select>
</div>
</div>
<div class="gf-form">
<span class="gf-form-label width-10">Auto-refresh</span>
<input type="text" class="gf-form-input max-width-25" ng-model="ctrl.panel.refresh_intervals" array-join>
</div>
<div class="gf-form">
<span class="gf-form-label width-10">Now delay now-</span>
<input type="text" class="gf-form-input max-width-25" ng-model="ctrl.panel.nowDelay"
placeholder="0m"
valid-time-span
bs-tooltip="'Enter 1m to ignore the last minute (because it can contain incomplete metrics)'"
data-placement="right">
</div>
<gf-form-switch class="gf-form" label="Hide time picker" checked="ctrl.panel.hidden" label-class="width-10">
</gf-form-switch>
</div>
</div>
`;
export function TimePickerSettings() {
return {
restrict: 'E',
template: template,
controller: TimePickerCtrl,
bindToController: true,
controllerAs: 'ctrl',
scope: {
dashboard: '=',
},
};
}
coreModule.directive('gfTimePickerSettings', TimePickerSettings);
export { SettingsCtrl } from './SettingsCtrl'; export { SettingsCtrl } from './SettingsCtrl';
export { DashboardSettings } from './DashboardSettings'; export { DashboardSettings } from './DashboardSettings';
export { TimePickerSettings } from './TimePickerSettings';
...@@ -198,7 +198,7 @@ export class UnConnectedExploreToolbar extends PureComponent<Props, {}> { ...@@ -198,7 +198,7 @@ export class UnConnectedExploreToolbar extends PureComponent<Props, {}> {
})} })}
</div> </div>
) : null} ) : null}
<div className="explore-toolbar-content-item timepicker"> <div className="explore-toolbar-content-item">
<ExploreTimeControls <ExploreTimeControls
exploreId={exploreId} exploreId={exploreId}
hasLiveOption={hasLiveOption} hasLiveOption={hasLiveOption}
......
...@@ -288,28 +288,6 @@ export function grafanaAppDirective( ...@@ -288,28 +288,6 @@ export function grafanaAppDirective(
if (popover.length > 0 && target.parents('.graph-legend').length === 0) { if (popover.length > 0 && target.parents('.graph-legend').length === 0) {
popover.hide(); popover.hide();
} }
// hide time picker
const timePickerDropDownIsOpen = elem.find('.gf-timepicker-dropdown').length > 0;
if (timePickerDropDownIsOpen) {
const targetIsInTimePickerDropDown = target.parents('.gf-timepicker-dropdown').length > 0;
const targetIsInTimePickerNav = target.parents('.gf-timepicker-nav').length > 0;
const targetIsDatePickerRowBtn = target.parents('td[id^="datepicker-"]').length > 0;
const targetIsDatePickerHeaderBtn = target.parents('button[id^="datepicker-"]').length > 0;
if (
targetIsInTimePickerNav ||
targetIsInTimePickerDropDown ||
targetIsDatePickerRowBtn ||
targetIsDatePickerHeaderBtn
) {
return;
}
scope.$apply(() => {
scope.appEvent('closeTimepicker');
});
}
}); });
}, },
}; };
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
@import '../../node_modules/react-table/react-table.css'; @import '../../node_modules/react-table/react-table.css';
// VENDOR // VENDOR
@import '../vendor/css/timepicker.css';
@import '../vendor/css/rc-cascader.scss'; @import '../vendor/css/rc-cascader.scss';
// MIXINS // MIXINS
...@@ -67,7 +66,6 @@ ...@@ -67,7 +66,6 @@
@import 'components/gf-form'; @import 'components/gf-form';
@import 'components/sidemenu'; @import 'components/sidemenu';
@import 'components/navbar'; @import 'components/navbar';
@import 'components/timepicker';
@import 'components/filter-controls'; @import 'components/filter-controls';
@import 'components/filter-list'; @import 'components/filter-list';
@import 'components/filter-table'; @import 'components/filter-table';
......
...@@ -6,10 +6,6 @@ ...@@ -6,10 +6,6 @@
max-width: 200px; max-width: 200px;
} }
.gf-timepicker-nav-btn {
max-width: 120px;
}
.navbar-buttons--tv, .navbar-buttons--tv,
.navbar-buttons--actions { .navbar-buttons--actions {
display: none; display: none;
...@@ -30,9 +26,6 @@ ...@@ -30,9 +26,6 @@
.navbar-page-btn { .navbar-page-btn {
max-width: 250px; max-width: 250px;
} }
.gf-timepicker-nav-btn {
max-width: 200px;
}
} }
@include media-breakpoint-up(md) { @include media-breakpoint-up(md) {
...@@ -43,9 +36,6 @@ ...@@ -43,9 +36,6 @@
.navbar-page-btn { .navbar-page-btn {
max-width: 325px; max-width: 325px;
} }
.gf-timepicker-nav-btn {
max-width: 240px;
}
} }
@include media-breakpoint-up(lg) { @include media-breakpoint-up(lg) {
...@@ -55,9 +45,6 @@ ...@@ -55,9 +45,6 @@
.navbar-page-btn { .navbar-page-btn {
max-width: 450px; max-width: 450px;
} }
.gf-timepicker-nav-btn {
max-width: none;
}
} }
@include media-breakpoint-up(xl) { @include media-breakpoint-up(xl) {
......
...@@ -174,7 +174,6 @@ $zindex-tooltip: 1030; ...@@ -174,7 +174,6 @@ $zindex-tooltip: 1030;
$zindex-modal-backdrop: 1040; $zindex-modal-backdrop: 1040;
$zindex-modal: 1050; $zindex-modal: 1050;
$zindex-typeahead: 1060; $zindex-typeahead: 1060;
$zindex-timepicker-popover: 1070;
// Buttons // Buttons
// //
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
.navbar-button--settings, .navbar-button--settings,
.navbar-page-btn .fa-caret-down, .navbar-page-btn .fa-caret-down,
.refresh-picker, .refresh-picker,
.gf-timepicker-nav { .time-picker {
display: none; display: none;
} }
......
.timepicker-timestring {
font-weight: normal;
}
.gf-timepicker-nav {
flex-wrap: nowrap;
display: flex;
}
.gf-timepicker-nav-btn {
text-overflow: ellipsis;
overflow: hidden;
.fa-clock-o {
margin-right: 4px;
}
}
.gf-timepicker-dropdown {
background-color: $page-bg;
border-radius: 0 0 0 4px;
box-shadow: $search-shadow;
z-index: $zindex-dropdown;
display: flex;
flex-direction: column;
position: absolute;
left: 20px;
right: 20px;
top: $navbarHeight;
@include media-breakpoint-up(md) {
left: auto;
width: 550px;
}
.popover-box {
max-width: 100%;
&:first-child {
border-radius: $border-radius $border-radius 0 0;
border-bottom: 0;
}
&:last-child {
border-radius: 0 0 $border-radius $border-radius;
}
}
}
.gf-timepicker-btn-apply {
margin: 0 0 0 15px;
}
.gf-timepicker-utc {
color: $orange;
font-size: 75%;
padding: 3px;
border-radius: 2px;
font-weight: 500;
margin-left: 4px;
}
.gf-timepicker-relative-section {
min-height: 237px;
float: left;
ul {
list-style: none;
float: left;
margin: 0 30px 10px 0px;
li {
line-height: 22px;
}
li.active {
border-bottom: 1px solid $blue;
margin: 3px 0;
font-weight: 500;
}
}
}
.gf-timepicker-component {
padding: $spacer/2 0 $spacer 0;
td {
padding: 1px;
}
button {
@include buttonBackground($btn-inverse-bg, $btn-inverse-bg-hl);
background-image: none;
border: none;
color: $text-color;
&.active span {
color: $blue;
font-weight: bold;
}
.text-info {
color: $orange;
font-weight: bold;
}
&.btn-sm {
font-size: $font-size-sm;
padding: 5px 11px;
}
&:hover {
color: $text-color-strong;
}
&[disabled] {
color: $text-color;
}
}
}
.input-datetime-format {
color: $link-color-disabled;
}
.fa {
display: inline-block;
font: normal normal normal 14px/1 FontAwesome;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.fa-chevron-left::before {
content: '\f053';
}
.fa-chevron-right::before {
content: '\f054';
}
.glyphicon-chevron-right {
@extend .fa;
@extend .fa-chevron-right;
}
.glyphicon-chevron-left {
@extend .fa;
@extend .fa-chevron-left;
}
...@@ -10,14 +10,6 @@ ...@@ -10,14 +10,6 @@
transform: rotate(90deg); transform: rotate(90deg);
} }
.timepicker {
display: flex;
}
.timepicker-rangestring {
margin-left: 0.5em;
}
.datasource-picker { .datasource-picker {
.ds-picker { .ds-picker {
min-width: 200px; min-width: 200px;
...@@ -91,17 +83,14 @@ ...@@ -91,17 +83,14 @@
display: flex; display: flex;
flex-flow: row wrap; flex-flow: row wrap;
align-items: center; align-items: center;
justify-content: space-between; justify-content: flex-end;
} }
.explore-toolbar-content-item { .explore-toolbar-content-item {
display: flex;
padding: 10px 2px; padding: 10px 2px;
} }
.explore-toolbar-content-item.timepicker {
z-index: $zindex-timepicker-popover;
}
.explore-toolbar-content-item:first-child { .explore-toolbar-content-item:first-child {
padding-left: $dashboard-padding; padding-left: $dashboard-padding;
margin-right: auto; margin-right: auto;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment