mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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
This commit is contained in:
parent
d94bdb930f
commit
bd4a7ddf3a
@ -193,3 +193,7 @@ $select-input-bg-disabled: $input-bg-disabled;
|
||||
.gf-form-select-box-button-select {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.select-button {
|
||||
display: flex;
|
||||
}
|
||||
|
@ -178,9 +178,7 @@ export class TimePicker extends PureComponent<Props, State> {
|
||||
const TimePickerTooltipContent = ({ timeRange }: { timeRange: TimeRange }) => (
|
||||
<>
|
||||
{timeRange.from.format(TIME_FORMAT)}
|
||||
<br />
|
||||
to
|
||||
<br />
|
||||
<div className="text-center">to</div>
|
||||
{timeRange.to.format(TIME_FORMAT)}
|
||||
</>
|
||||
);
|
||||
|
@ -50,6 +50,9 @@ export class TimePickerPopover extends Component<Props, State> {
|
||||
};
|
||||
|
||||
onToCalendarChanged = (value: DateTime) => {
|
||||
value.set('h', 23);
|
||||
value.set('m', 59);
|
||||
value.set('s', 0);
|
||||
this.setState({ to: value });
|
||||
};
|
||||
|
||||
|
@ -7,10 +7,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.time-picker-popover-popper {
|
||||
z-index: $zindex-timepicker-popover;
|
||||
}
|
||||
|
||||
.time-picker-utc {
|
||||
color: $orange;
|
||||
font-size: 75%;
|
||||
@ -30,10 +26,11 @@
|
||||
color: $popover-color;
|
||||
box-shadow: $popover-shadow;
|
||||
position: absolute;
|
||||
z-index: $zindex-dropdown;
|
||||
flex-direction: column;
|
||||
max-width: 600px;
|
||||
top: 48px;
|
||||
right: 20px;
|
||||
top: 50px;
|
||||
right: 0px;
|
||||
|
||||
.time-picker-popover-body {
|
||||
display: flex;
|
||||
@ -188,11 +185,6 @@ $arrowPadding: $arrowPaddingToBorder * 3;
|
||||
|
||||
@include media-breakpoint-down(md) {
|
||||
.time-picker-popover {
|
||||
margin-left: $spacer;
|
||||
display: flex;
|
||||
flex-flow: column nowrap;
|
||||
max-width: 400px;
|
||||
|
||||
.time-picker-popover-title {
|
||||
font-size: $font-size-md;
|
||||
}
|
||||
@ -217,6 +209,56 @@ $arrowPadding: $arrowPaddingToBorder * 3;
|
||||
}
|
||||
|
||||
.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};
|
||||
$zindex-modal-backdrop: ${theme.zIndex.modalBackdrop};
|
||||
$zindex-modal: ${theme.zIndex.modal};
|
||||
$zindex-typeahead: ${theme.zIndex.typeahead};
|
||||
$zindex-timepicker-popover: 1070;
|
||||
|
||||
// Buttons
|
||||
//
|
||||
|
@ -11,7 +11,6 @@ import 'react';
|
||||
import 'react-dom';
|
||||
|
||||
import 'vendor/bootstrap/bootstrap';
|
||||
import 'vendor/angular-ui/ui-bootstrap-tpls';
|
||||
import 'vendor/angular-other/angular-strap';
|
||||
|
||||
import $ from 'jquery';
|
||||
@ -125,8 +124,6 @@ export class GrafanaApp {
|
||||
'ang-drag-drop',
|
||||
'grafana',
|
||||
'pasvaz.bindonce',
|
||||
'ui.bootstrap',
|
||||
'ui.bootstrap.tpls',
|
||||
'react',
|
||||
];
|
||||
|
||||
|
@ -95,7 +95,7 @@ export class DashNavTimeControls extends Component<Props> {
|
||||
const timeZone = dashboard.getTimezone();
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="dashboard-timepicker-wrapper">
|
||||
<TimePicker
|
||||
value={timePickerValue}
|
||||
onChange={this.onChangeTimePicker}
|
||||
@ -112,7 +112,7 @@ export class DashNavTimeControls extends Component<Props> {
|
||||
intervals={intervals}
|
||||
tooltip="Refresh dashboard"
|
||||
/>
|
||||
</>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,71 @@
|
||||
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);
|
@ -1,2 +1,3 @@
|
||||
export { SettingsCtrl } from './SettingsCtrl';
|
||||
export { DashboardSettings } from './DashboardSettings';
|
||||
export { TimePickerSettings } from './TimePickerSettings';
|
||||
|
@ -198,7 +198,7 @@ export class UnConnectedExploreToolbar extends PureComponent<Props, {}> {
|
||||
})}
|
||||
</div>
|
||||
) : null}
|
||||
<div className="explore-toolbar-content-item timepicker">
|
||||
<div className="explore-toolbar-content-item">
|
||||
<ExploreTimeControls
|
||||
exploreId={exploreId}
|
||||
hasLiveOption={hasLiveOption}
|
||||
|
@ -288,28 +288,6 @@ export function grafanaAppDirective(
|
||||
if (popover.length > 0 && target.parents('.graph-legend').length === 0) {
|
||||
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 @@
|
||||
@import '../../node_modules/react-table/react-table.css';
|
||||
|
||||
// VENDOR
|
||||
@import '../vendor/css/timepicker.css';
|
||||
@import '../vendor/css/rc-cascader.scss';
|
||||
|
||||
// MIXINS
|
||||
@ -67,7 +66,6 @@
|
||||
@import 'components/gf-form';
|
||||
@import 'components/sidemenu';
|
||||
@import 'components/navbar';
|
||||
@import 'components/timepicker';
|
||||
@import 'components/filter-controls';
|
||||
@import 'components/filter-list';
|
||||
@import 'components/filter-table';
|
||||
|
@ -6,10 +6,6 @@
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
.gf-timepicker-nav-btn {
|
||||
max-width: 120px;
|
||||
}
|
||||
|
||||
.navbar-buttons--tv,
|
||||
.navbar-buttons--actions {
|
||||
display: none;
|
||||
@ -30,9 +26,6 @@
|
||||
.navbar-page-btn {
|
||||
max-width: 250px;
|
||||
}
|
||||
.gf-timepicker-nav-btn {
|
||||
max-width: 200px;
|
||||
}
|
||||
}
|
||||
|
||||
@include media-breakpoint-up(md) {
|
||||
@ -43,9 +36,6 @@
|
||||
.navbar-page-btn {
|
||||
max-width: 325px;
|
||||
}
|
||||
.gf-timepicker-nav-btn {
|
||||
max-width: 240px;
|
||||
}
|
||||
}
|
||||
|
||||
@include media-breakpoint-up(lg) {
|
||||
@ -55,9 +45,6 @@
|
||||
.navbar-page-btn {
|
||||
max-width: 450px;
|
||||
}
|
||||
.gf-timepicker-nav-btn {
|
||||
max-width: none;
|
||||
}
|
||||
}
|
||||
|
||||
@include media-breakpoint-up(xl) {
|
||||
|
@ -174,7 +174,6 @@ $zindex-tooltip: 1030;
|
||||
$zindex-modal-backdrop: 1040;
|
||||
$zindex-modal: 1050;
|
||||
$zindex-typeahead: 1060;
|
||||
$zindex-timepicker-popover: 1070;
|
||||
|
||||
// Buttons
|
||||
//
|
||||
|
@ -35,7 +35,7 @@
|
||||
.navbar-button--settings,
|
||||
.navbar-page-btn .fa-caret-down,
|
||||
.refresh-picker,
|
||||
.gf-timepicker-nav {
|
||||
.time-picker {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
@ -1,151 +0,0 @@
|
||||
.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 @@
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
.timepicker {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.timepicker-rangestring {
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
|
||||
.datasource-picker {
|
||||
.ds-picker {
|
||||
min-width: 200px;
|
||||
@ -91,17 +83,14 @@
|
||||
display: flex;
|
||||
flex-flow: row wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.explore-toolbar-content-item {
|
||||
display: flex;
|
||||
padding: 10px 2px;
|
||||
}
|
||||
|
||||
.explore-toolbar-content-item.timepicker {
|
||||
z-index: $zindex-timepicker-popover;
|
||||
}
|
||||
|
||||
.explore-toolbar-content-item:first-child {
|
||||
padding-left: $dashboard-padding;
|
||||
margin-right: auto;
|
||||
|
1274
public/vendor/angular-ui/ui-bootstrap-tpls.js
vendored
1274
public/vendor/angular-ui/ui-bootstrap-tpls.js
vendored
File diff suppressed because it is too large
Load Diff
4034
public/vendor/jquery-ui/custom.js
vendored
4034
public/vendor/jquery-ui/custom.js
vendored
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user