Commit 00e7779f711a528b00a6ca4f1afd7eb3bb2e655f

Authored by Igor Kulikov
1 parent 28d48933

Minor UI fixes

@@ -492,8 +492,8 @@ export class DashboardComponent extends PageComponent implements IDashboardCompo @@ -492,8 +492,8 @@ export class DashboardComponent extends PageComponent implements IDashboardCompo
492 const parentHeight = this.gridster.el.offsetHeight; 492 const parentHeight = this.gridster.el.offsetHeight;
493 if (this.isMobileSize && this.mobileAutofillHeight && parentHeight) { 493 if (this.isMobileSize && this.mobileAutofillHeight && parentHeight) {
494 this.updateMobileOpts(parentHeight); 494 this.updateMobileOpts(parentHeight);
495 - this.notifyGridsterOptionsChanged();  
496 } 495 }
  496 + this.notifyGridsterOptionsChanged();
497 } 497 }
498 498
499 private updateLayoutOpts() { 499 private updateLayoutOpts() {
@@ -84,9 +84,6 @@ export class DateRangeNavigatorWidgetComponent extends PageComponent implements @@ -84,9 +84,6 @@ export class DateRangeNavigatorWidgetComponent extends PageComponent implements
84 } 84 }
85 85
86 ngOnInit(): void { 86 ngOnInit(): void {
87 - this.dashboardTimewindowChangedSubscription = this.ctx.dashboard.dashboardTimewindowChanged.subscribe(() => {  
88 - this.widgetContextTimewindowSync();  
89 - });  
90 this.settings = this.ctx.settings; 87 this.settings = this.ctx.settings;
91 this.settings.useSessionStorage = isDefined(this.settings.useSessionStorage) ? this.settings.useSessionStorage : true; 88 this.settings.useSessionStorage = isDefined(this.settings.useSessionStorage) ? this.settings.useSessionStorage : true;
92 let selection; 89 let selection;
@@ -110,6 +107,9 @@ export class DateRangeNavigatorWidgetComponent extends PageComponent implements @@ -110,6 +107,9 @@ export class DateRangeNavigatorWidgetComponent extends PageComponent implements
110 } 107 }
111 this.selectedStepSize = this.datesMap[this.settings.stepSize || 'day'].ts; 108 this.selectedStepSize = this.datesMap[this.settings.stepSize || 'day'].ts;
112 this.widgetContextTimewindowSync(); 109 this.widgetContextTimewindowSync();
  110 + this.dashboardTimewindowChangedSubscription = this.ctx.dashboard.dashboardTimewindowChanged.subscribe(() => {
  111 + this.widgetContextTimewindowSync();
  112 + });
113 } 113 }
114 114
115 ngOnDestroy(): void { 115 ngOnDestroy(): void {
@@ -474,7 +474,8 @@ export class DashboardWidget implements GridsterItem, IDashboardWidget { @@ -474,7 +474,8 @@ export class DashboardWidget implements GridsterItem, IDashboardWidget {
474 if (mobileHeight) { 474 if (mobileHeight) {
475 res = mobileHeight; 475 res = mobileHeight;
476 } else { 476 } else {
477 - res = this.widget.sizeY * 24 / this.dashboard.gridsterOpts.minCols; 477 + const sizeY = this.widgetLayout ? this.widgetLayout.sizeY : this.widget.sizeY;
  478 + res = sizeY * 24 / this.dashboard.gridsterOpts.minCols;
478 } 479 }
479 } else { 480 } else {
480 if (this.widgetLayout) { 481 if (this.widgetLayout) {
@@ -15,7 +15,6 @@ @@ -15,7 +15,6 @@
15 /// 15 ///
16 16
17 import { 17 import {
18 - ChangeDetectionStrategy,  
19 Component, 18 Component,
20 ElementRef, 19 ElementRef,
21 forwardRef, 20 forwardRef,
@@ -106,6 +105,8 @@ export class JsonFormComponent implements OnInit, ControlValueAccessor, Validato @@ -106,6 +105,8 @@ export class JsonFormComponent implements OnInit, ControlValueAccessor, Validato
106 105
107 private propagateChange = null; 106 private propagateChange = null;
108 private propagateChangePending = false; 107 private propagateChangePending = false;
  108 + private writingValue = false;
  109 + private updateViewPending = false;
109 110
110 constructor(public elementRef: ElementRef, 111 constructor(public elementRef: ElementRef,
111 private translate: TranslateService, 112 private translate: TranslateService,
@@ -143,6 +144,7 @@ export class JsonFormComponent implements OnInit, ControlValueAccessor, Validato @@ -143,6 +144,7 @@ export class JsonFormComponent implements OnInit, ControlValueAccessor, Validato
143 } 144 }
144 145
145 writeValue(data: JsonFormComponentData): void { 146 writeValue(data: JsonFormComponentData): void {
  147 + this.writingValue = true;
146 this.data = data; 148 this.data = data;
147 this.schema = this.data && this.data.schema ? deepClone(this.data.schema) : { 149 this.schema = this.data && this.data.schema ? deepClone(this.data.schema) : {
148 type: 'object' 150 type: 'object'
@@ -154,19 +156,29 @@ export class JsonFormComponent implements OnInit, ControlValueAccessor, Validato @@ -154,19 +156,29 @@ export class JsonFormComponent implements OnInit, ControlValueAccessor, Validato
154 this.model = inspector.sanitize(this.schema, this.model).data; 156 this.model = inspector.sanitize(this.schema, this.model).data;
155 this.updateAndRender(); 157 this.updateAndRender();
156 this.isModelValid = this.validateModel(); 158 this.isModelValid = this.validateModel();
157 - if (!this.isModelValid) { 159 + this.writingValue = false;
  160 + if (!this.isModelValid || this.updateViewPending) {
158 this.updateView(); 161 this.updateView();
159 } 162 }
160 } 163 }
161 164
162 updateView() { 165 updateView() {
163 - if (this.data) {  
164 - this.data.model = this.model;  
165 - if (this.propagateChange) {  
166 - this.propagateChange(this.data);  
167 - } else {  
168 - this.propagateChangePending = true; 166 + if (!this.writingValue) {
  167 + this.updateViewPending = false;
  168 + if (this.data) {
  169 + this.data.model = this.model;
  170 + if (this.propagateChange) {
  171 + try {
  172 + this.propagateChange(this.data);
  173 + } catch (e) {
  174 + this.propagateChangePending = true;
  175 + }
  176 + } else {
  177 + this.propagateChangePending = true;
  178 + }
169 } 179 }
  180 + } else {
  181 + this.updateViewPending = true;
170 } 182 }
171 } 183 }
172 184