Commit c82bf7f6 by Torkel Ödegaard

fix: changing edit / view fullscreen modes now work

parent df822a66
...@@ -6,6 +6,7 @@ function dashClass($timeout) { ...@@ -6,6 +6,7 @@ function dashClass($timeout) {
return { return {
link: ($scope, elem) => { link: ($scope, elem) => {
$scope.ctrl.dashboard.events.on('view-mode-changed', panel => { $scope.ctrl.dashboard.events.on('view-mode-changed', panel => {
console.log('view-mode-changed', panel.fullscreen);
if (panel.fullscreen) { if (panel.fullscreen) {
elem.addClass('panel-in-fullscreen'); elem.addClass('panel-in-fullscreen');
} else { } else {
......
...@@ -2,6 +2,7 @@ import React, { PureComponent } from 'react'; ...@@ -2,6 +2,7 @@ import React, { PureComponent } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import config from 'app/core/config'; import config from 'app/core/config';
import { PanelPlugin } from 'app/types/plugins'; import { PanelPlugin } from 'app/types/plugins';
import CustomScrollbar from 'app/core/components/CustomScrollbar/CustomScrollbar';
import _ from 'lodash'; import _ from 'lodash';
interface Props { interface Props {
...@@ -49,13 +50,19 @@ export class VizTypePicker extends PureComponent<Props, State> { ...@@ -49,13 +50,19 @@ export class VizTypePicker extends PureComponent<Props, State> {
render() { render() {
return ( return (
<div className="viz-picker"> <div className="viz-picker">
<div className="gf-form gf-form--grow"> <div className="viz-picker__search">
<label className="gf-form--has-input-icon gf-form--grow"> <div className="gf-form gf-form--grow">
<input type="text" className="gf-form-input" placeholder="Search type" /> <label className="gf-form--has-input-icon gf-form--grow">
<i className="gf-form-input-icon fa fa-search" /> <input type="text" className="gf-form-input" placeholder="Search type" />
</label> <i className="gf-form-input-icon fa fa-search" />
</label>
</div>
</div>
<div className="viz-picker__items">
<CustomScrollbar>
<div className="scroll-margin-helper">{this.state.pluginList.map(this.renderVizPlugin)}</div>
</CustomScrollbar>
</div> </div>
<div className="viz-picker-list">{this.state.pluginList.map(this.renderVizPlugin)}</div>
</div> </div>
); );
} }
......
...@@ -11,7 +11,6 @@ export class DashboardViewState { ...@@ -11,7 +11,6 @@ export class DashboardViewState {
panelScopes: any; panelScopes: any;
$scope: any; $scope: any;
dashboard: DashboardModel; dashboard: DashboardModel;
editStateChanged: any;
fullscreenPanel: any; fullscreenPanel: any;
oldTimeRange: any; oldTimeRange: any;
...@@ -72,9 +71,6 @@ export class DashboardViewState { ...@@ -72,9 +71,6 @@ export class DashboardViewState {
} }
} }
// remember if editStateChanged
this.editStateChanged = (state.edit || false) !== (this.state.edit || false);
_.extend(this.state, state); _.extend(this.state, state);
this.dashboard.meta.fullscreen = this.state.fullscreen; this.dashboard.meta.fullscreen = this.state.fullscreen;
...@@ -128,17 +124,11 @@ export class DashboardViewState { ...@@ -128,17 +124,11 @@ export class DashboardViewState {
return; return;
} }
if (this.fullscreenPanel) {
// if already fullscreen
if (this.fullscreenPanel === panel && this.editStateChanged === false) {
return;
} else {
this.leaveFullscreen();
}
}
if (!panel.fullscreen) { if (!panel.fullscreen) {
this.enterFullscreen(panel); this.enterFullscreen(panel);
} else {
// already in fullscreen view just update the view mode
this.dashboard.setViewMode(panel, this.state.fullscreen, this.state.edit);
} }
} else if (this.fullscreenPanel) { } else if (this.fullscreenPanel) {
this.leaveFullscreen(); this.leaveFullscreen();
......
...@@ -307,6 +307,7 @@ ...@@ -307,6 +307,7 @@
.view { .view {
display: flex; display: flex;
flex-grow: 1; flex-grow: 1;
flex-direction: column;
} }
.track-vertical { .track-vertical {
...@@ -337,3 +338,7 @@ ...@@ -337,3 +338,7 @@
border-radius: 6px; border-radius: 6px;
} }
} }
.scroll-margin-helper {
margin-right: 12px;
}
...@@ -19,12 +19,13 @@ ...@@ -19,12 +19,13 @@
height: 100%; height: 100%;
} }
.viz-picker-list { .viz-picker__search {
padding-top: $spacer; flex-grow: 0;
display: flex; }
flex-direction: column;
overflow: auto; .viz-picker__items {
flex-grow: 1; flex-grow: 1;
height: calc(100% - 50px);
} }
.viz-picker__item { .viz-picker__item {
...@@ -41,13 +42,15 @@ ...@@ -41,13 +42,15 @@
display: flex; display: flex;
flex-shrink: 0; flex-shrink: 0;
border: 1px solid transparent; border: 1px solid transparent;
@include left-brand-border;
&:hover { &:hover {
background: $card-background-hover; background: $card-background-hover;
} }
&--selected { &--selected {
border: 1px solid $orange; // border: 1px solid $orange;
@include left-brand-border-gradient();
.viz-picker__item-name { .viz-picker__item-name {
color: $text-color; color: $text-color;
......
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