Turn off verbose logging in prod version
This commit is contained in:
@@ -17,6 +17,7 @@ import { CompositeDisposable, Disposable } from 'ts-disposables';
|
||||
import * as _$ from 'jquery';
|
||||
import * as _ from 'lodash';
|
||||
import { Observable, Subject, BehaviorSubject } from 'rxjs';
|
||||
import { Logger } from '../shared/logger';
|
||||
const joint: any = Flo.joint;
|
||||
const $: any = _$;
|
||||
|
||||
@@ -962,7 +963,7 @@ export class EditorComponent implements OnInit, OnDestroy {
|
||||
* then update the view based on that new information.
|
||||
*/
|
||||
updateGraphRepresentation(): Promise<any> {
|
||||
console.debug(`Updating graph to represent '${this._dslText}'`);
|
||||
Logger.debug(`Updating graph to represent '${this._dslText}'`);
|
||||
if (this.metamodel && this.metamodel.textToGraph) {
|
||||
return this.metamodel.textToGraph(this.editorContext, this._dslText).then(() => {
|
||||
this.textToGraphConversionCompleted.next();
|
||||
|
||||
@@ -7,6 +7,7 @@ import '../shared/shapes';
|
||||
import { Shapes, Constants } from '../shared/shapes';
|
||||
import { DOCUMENT } from '@angular/common'
|
||||
import * as _$ from 'jquery';
|
||||
import {Logger} from '../shared/logger';
|
||||
const joint: any = Flo.joint;
|
||||
const $: any = _$;
|
||||
|
||||
@@ -84,7 +85,7 @@ export class Palette implements OnInit, OnDestroy {
|
||||
|
||||
@Input()
|
||||
set paletteSize(size: number) {
|
||||
console.debug('Palette Size: ' + size);
|
||||
Logger.debug('Palette Size: ' + size);
|
||||
if (this._paletteSize !== size) {
|
||||
this._paletteSize = size;
|
||||
if (this.palette) {
|
||||
@@ -170,7 +171,7 @@ export class Palette implements OnInit, OnDestroy {
|
||||
this.initialized = true;
|
||||
});
|
||||
} else {
|
||||
console.error('No Metamodel service specified for palette!');
|
||||
Logger.error('No Metamodel service specified for palette!');
|
||||
}
|
||||
|
||||
this._paletteSize = this._paletteSize || $(this.element.nativeElement.parentNode).width();
|
||||
@@ -255,7 +256,7 @@ export class Palette implements OnInit, OnDestroy {
|
||||
let groupAdded: Set<string> = new Set<string>();
|
||||
|
||||
let parentWidth: number = this._paletteSize - Flo.SCROLLBAR_WIDTH;
|
||||
console.debug(`Parent Width: ${parentWidth}`);
|
||||
Logger.debug(`Parent Width: ${parentWidth}`);
|
||||
|
||||
// The field closedGroups tells us which should not be shown
|
||||
// Work out the list of active groups/nodes based on the filter text
|
||||
@@ -282,7 +283,7 @@ export class Palette implements OnInit, OnDestroy {
|
||||
this.layout();
|
||||
|
||||
this.paletteReady.emit(true);
|
||||
console.debug('buildPalette took ' + (new Date().getTime() - startTime) + 'ms');
|
||||
Logger.debug('buildPalette took ' + (new Date().getTime() - startTime) + 'ms');
|
||||
}
|
||||
|
||||
private layout() {
|
||||
@@ -296,7 +297,7 @@ export class Palette implements OnInit, OnDestroy {
|
||||
let paletteNodes: Array<dia.Cell> = [];
|
||||
|
||||
let parentWidth: number = this._paletteSize - Flo.SCROLLBAR_WIDTH;
|
||||
console.debug(`Parent Width: ${parentWidth}`);
|
||||
Logger.debug(`Parent Width: ${parentWidth}`);
|
||||
|
||||
const presentGroups = new Set<string>();
|
||||
|
||||
@@ -429,7 +430,7 @@ export class Palette implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
this.palette.setDimensions(parentWidth, ypos);
|
||||
console.debug('buildPalette layout ' + (new Date().getTime() - startTime) + 'ms');
|
||||
Logger.debug('buildPalette layout ' + (new Date().getTime() - startTime) + 'ms');
|
||||
|
||||
}
|
||||
|
||||
@@ -553,8 +554,8 @@ export class Palette implements OnInit, OnDestroy {
|
||||
|
||||
private handleDrag(event: any) {
|
||||
// TODO offsetX/Y not on firefox
|
||||
// console.debug("tracking move: x="+event.pageX+",y="+event.pageY);
|
||||
// console.debug('Element = ' + (this.clickedElement ? this.clickedElement.attr('metadata/name'): 'null'));
|
||||
// Logger.debug("tracking move: x="+event.pageX+",y="+event.pageY);
|
||||
// Logger.debug('Element = ' + (this.clickedElement ? this.clickedElement.attr('metadata/name'): 'null'));
|
||||
if (this.clickedElement && this.clickedElement.get('metadata')) {
|
||||
if (!this.viewBeingDragged) {
|
||||
|
||||
@@ -605,24 +606,6 @@ export class Palette implements OnInit, OnDestroy {
|
||||
|
||||
resizeObserver.observe(this.viewBeingDragged.el);
|
||||
|
||||
// const interval = setInterval(() => {
|
||||
// if (this.viewBeingDragged) {
|
||||
// // let box: dia.BBox = (<dia.ElementView>this.viewBeingDragged).getBBox();
|
||||
// // console.log(`Current view size: w=${box.width} h=${box.height}`);
|
||||
//
|
||||
// // const modelSize = floaternode.size();
|
||||
// // console.log(`Current model size: w=${modelSize.width} h=${modelSize.height}`);
|
||||
//
|
||||
// const width = Math.random() * 400;
|
||||
// const height = Math.random() * 300;
|
||||
// console.log(`Setting width=${width} height=${height}`);
|
||||
// (<dia.ElementView>this.viewBeingDragged).model.size(width, height);
|
||||
// // (<dia.ElementView>this.viewBeingDragged).update();
|
||||
// } else {
|
||||
// clearInterval(interval);
|
||||
// }
|
||||
// }, 2000);
|
||||
|
||||
let box: dia.BBox = (<dia.ElementView>this.viewBeingDragged).getBBox();
|
||||
let size: dia.Size = floaternode.size();
|
||||
// Account for node real size including ports
|
||||
|
||||
28
src/lib/shared/logger.ts
Normal file
28
src/lib/shared/logger.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { isDevMode } from '@angular/core';
|
||||
|
||||
export class Logger {
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
static log(value: any, ...rest: any[]) {
|
||||
if (isDevMode()) {
|
||||
console.log(value, ...rest);
|
||||
}
|
||||
}
|
||||
|
||||
static debug(value: any, ...rest: any[]) {
|
||||
if (isDevMode()) {
|
||||
console.debug(value, ...rest);
|
||||
}
|
||||
}
|
||||
|
||||
static error(value: any, ...rest: any[]) {
|
||||
console.error(value, ...rest);
|
||||
}
|
||||
|
||||
static warn(value: any, ...rest: any[]) {
|
||||
console.warn(value, ...rest);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -432,7 +432,7 @@ export function loadShapes() {
|
||||
// $(nodeDescription).text(description);
|
||||
// }, function(error: any) {
|
||||
// if (error) {
|
||||
// console.error(error);
|
||||
// Logger.error(error);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
@@ -466,14 +466,14 @@ export function loadShapes() {
|
||||
// }
|
||||
// }, function(error: any) {
|
||||
// if (error) {
|
||||
// console.error(error);
|
||||
// Logger.error(error);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// $('.node-tooltip').css({ top: mousey, left: mousex });
|
||||
// } else if (this.model.get('type') === joint.shapes.flo.DECORATION_TYPE && this.model.attr('./kind') === 'error') {
|
||||
// console.debug('mouse enter: ERROR box=' + JSON.stringify(this.model.getBBox()));
|
||||
// Logger.debug('mouse enter: ERROR box=' + JSON.stringify(this.model.getBBox()));
|
||||
// nodeTooltip = document.createElement('div');
|
||||
// var errors = this.model.attr('messages');
|
||||
// if (errors && errors.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user