Skip to content

Commit f6fbb2b

Browse files
authored
Merge pull request #353 from algenty:20220606_clean_code
debug = off
2 parents 1499390 + b1c62a1 commit f6fbb2b

10 files changed

+31
-24
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,15 @@ Special thanks to
5858

5959

6060
# Changelog
61-
## [[1.0.0d (Last build 2022-05-07)]](./built/)
61+
## [[1.0.0d (Last build 2022-06-06)]](./built/)
6262

6363
### Known issues
6464
- Shared cross on grafana 8.x (minor)
6565
- Flow animation on arrows (minor)
66+
- External image from diagrams.net not displayed (minor)
6667
### Added
68+
- Convert sync method to async : render graph before update states (speed x2)
69+
- clean dirty code
6770
- Support last version of grafana (8.5.x)
6871
- New initialization engine for drawio libs
6972
- New draw.io libs (17.x 2022-04-23)

src/flowchart_class.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { GFEvents } from 'flowcharting_base';
66
import { GFDrawio } from 'drawio_base';
77

88
// Debug
9-
const DEBUG = true;
9+
const DEBUG = false;
1010
const _log = (...args: any) => {
1111
DEBUG && console.log(...args);
1212
};
@@ -140,7 +140,7 @@ export class Flowchart {
140140
}
141141
this.data.csv = value;
142142
}
143-
this.change();
143+
this.change();
144144
}
145145
get source() {
146146
return this.data.type === 'csv' ? this.data.csv : this.data.xml;
@@ -152,7 +152,7 @@ export class Flowchart {
152152
return;
153153
}
154154
this.data.download = value;
155-
this.change();
155+
this.change();
156156
}
157157
get download() {
158158
return this.data.download;
@@ -371,8 +371,8 @@ export class Flowchart {
371371
}
372372

373373
init_stateHandler(): this {
374-
if(this.stateHandler) {
375-
this.stateHandler.free()
374+
if (this.stateHandler) {
375+
this.stateHandler.free();
376376
}
377377
if (this.xgraph) {
378378
this.stateHandler = new StateHandler(this.$gf, this.xgraph);
@@ -701,16 +701,16 @@ export class Flowchart {
701701
}
702702
}
703703
} else {
704-
if(!this.source || this.source.length === 0) {
704+
if (!this.source || this.source.length === 0) {
705705
content = await GFDrawio.getTemplate(this.type);
706-
if(this.type === 'xml'){
706+
if (this.type === 'xml') {
707707
this.data.xml = content;
708-
};
709-
if(this.type === 'csv'){
708+
}
709+
if (this.type === 'csv') {
710710
this.data.csv = content;
711-
};
711+
}
712712
}
713-
if(GFDrawio.isEncoded(content)) {
713+
if (GFDrawio.isEncoded(content)) {
714714
content = GFDrawio.decode(content);
715715
}
716716
content = $GF.resolveVars(this.source);
@@ -763,7 +763,6 @@ export class Flowchart {
763763
return this;
764764
}
765765

766-
767766
minify() {
768767
this.data.xml = $GF.utils.minify(this.data.xml);
769768
}

src/flowchart_ctrl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { defaults as _defaults, cloneDeep as _cloneDeep } from 'lodash';
1414
import { GFDrawio } from 'drawio_base';
1515

1616
// Debug
17-
const DEBUG = true;
17+
const DEBUG = false;
1818
const _log = (...args: any) => {
1919
DEBUG && console.log(...args);
2020
};

src/flowcharting_base.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ type Uid = String;
77
type ConnectedChild = Map<Uid, CallableFunction>;
88

99
// Debug
10-
const DEBUG=false;
11-
const _log = (...args: any) => {DEBUG && console.log(...args)}
10+
const DEBUG = false;
11+
const _log = (...args: any) => {
12+
DEBUG && console.log(...args);
13+
};
1214

1315
export class GFEvents<Signals> {
1416
private _declaredSignals: Signals[] = [];
@@ -18,7 +20,10 @@ export class GFEvents<Signals> {
1820
// Nothing to do
1921
}
2022

21-
static create<Signals>(signalName?: Readonly<Signals> | Readonly<Signals[]>, owner?: { uid: string }): GFEvents<Signals> {
23+
static create<Signals>(
24+
signalName?: Readonly<Signals> | Readonly<Signals[]>,
25+
owner?: { uid: string }
26+
): GFEvents<Signals> {
2227
const event: GFEvents<Signals> = new GFEvents();
2328
if (signalName) {
2429
event.declare(signalName);
@@ -97,9 +102,9 @@ export class GFEvents<Signals> {
97102
}
98103
}
99104

100-
emit(signalName: Signals, objToEmit?: unknown, from?: CallableSignalChild ) {
105+
emit(signalName: Signals, objToEmit?: unknown, from?: CallableSignalChild) {
101106
//, from?: { uid: string }
102-
_log('📨', `Emit signal [${signalName}]${from ? ' from [' + from.uid + ']': ''}`);
107+
_log('📨', `Emit signal [${signalName}]${from ? ' from [' + from.uid + ']' : ''}`);
103108
const _childFn = this._getCallableFunc(signalName);
104109
return Promise.all(
105110
_childFn.map(async (fn) => {

src/globals_class.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { MetricHandler } from 'metric_handler';
99
const safeEval = require('safe-eval');
1010

1111
// Debug
12-
const DEBUG = true;
12+
const DEBUG = false;
1313
const _log = (...args: any) => {
1414
DEBUG && console.log(...args);
1515
};

src/graph_class.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { GFEvents } from 'flowcharting_base';
99
import { GFDrawio } from 'drawio_base';
1010

1111
// Debug
12-
const DEBUG = true;
12+
const DEBUG = false;
1313
const _log = (...args: any) => {
1414
DEBUG && console.log(...args);
1515
};

src/mapping_class.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export interface MapDataCommonProp {
2020
}
2121

2222
// Debug
23-
const DEBUG = true;
23+
const DEBUG = false;
2424
const _log = (...args: any) => {
2525
DEBUG && console.log(...args);
2626
};

src/rule_class.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
import { GFEvents } from 'flowcharting_base';
1919

2020
// Debug
21-
const DEBUG = true;
21+
const DEBUG = false;
2222
const _log = (...args: any) => {
2323
DEBUG && console.log(...args);
2424
};

src/state_class.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { GFEvents } from 'flowcharting_base';
1010
const stateSignalsArray = ['state_initialized', 'state_updated', 'state_freed'] as const;
1111
type stateSignals = typeof stateSignalsArray[number];
1212

13-
const DEBUG = true;
13+
const DEBUG = false;
1414
const _log = (...args: any) => {
1515
DEBUG && console.log(...args);
1616
};

0 commit comments

Comments
 (0)