Skip to content

Commit 55a08e1

Browse files
committed
fix plugin getPartial
1 parent c504f6f commit 55a08e1

35 files changed

+120
-109
lines changed

Diff for: flowcharting-quality-code.sh

+8
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,12 @@ test_#_connect_disconnect() {
1717
done
1818
}
1919

20+
check_partials_objects() {
21+
_PARTIAL_PATH=${_FLOWCHARTING_SRC_PATH}/partials
22+
_OBJ_LIST=$(ag -o '{{.+}}'|cut -f3 -d':'|tr -d '{{' |tr -d '}}'|sort|uniq)
23+
for LINE in ${_OBJ_LIST}; do
24+
_OBJ=$(cut -f1 -d'.')
25+
done
26+
}
27+
2028
test_#_connect_disconnect

Diff for: src/flowchart_class.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type FlowchartSignals = typeof flowchartSignalsArray[number];
3030
export class Flowchart {
3131
data: gf.TFlowchartData;
3232
private container: HTMLDivElement;
33-
private xgraph: XGraph | undefined = undefined;
33+
private xgraph: XGraph | undefined;
3434
private stateHandler: StateHandler | undefined;
3535
private readonly $gf: $GF;
3636
uid: string;
@@ -378,7 +378,7 @@ export class Flowchart {
378378
this.setGraphContent(content);
379379
}
380380
if (this.xgraph !== undefined) {
381-
this.xgraph.setContent(this.getContent());
381+
this.xgraph?.setContent(this.getContent());
382382
}
383383
// this.applyOptions();
384384
}

Diff for: src/flowchart_ctrl.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class FlowchartCtrl extends MetricsPanelCtrl {
2828
flowchartsDiv: HTMLDivElement;
2929
templateSrv: any;
3030
version: any;
31+
GFPlugin!: GFPlugin; // Initialized in GFPlugin.init()
3132
graphOverTimeStamp = 0;
3233
message: GFMessage | undefined;
3334
changedSource: boolean;
@@ -56,7 +57,7 @@ class FlowchartCtrl extends MetricsPanelCtrl {
5657
constructor($scope: any, $injector: any, $rootScope: any, templateSrv: any) {
5758
super($scope, $injector);
5859
this.$gf = $GF.create($scope, templateSrv, this.dashboard, this);
59-
this.$scope.$GF = this.$gf;
60+
// this.$scope.$GF = this.$gf;
6061
this.$rootScope = $rootScope;
6162
this.$scope = $scope;
6263
$scope.editor = this;
@@ -65,9 +66,6 @@ class FlowchartCtrl extends MetricsPanelCtrl {
6566
this.changedSource = true;
6667
this.changedData = true;
6768
this.changedOptions = true;
68-
this.rulesHandler = undefined;
69-
this.flowchartHandler = undefined;
70-
this.metricHandler = undefined;
7169
this.onMapping = new InteractiveMap();
7270
this.parentDiv = document.createElement('div');
7371
this.flowchartsDiv = document.createElement('div');
@@ -263,7 +261,7 @@ class FlowchartCtrl extends MetricsPanelCtrl {
263261
this.flowchartHandler = undefined;
264262
this.init_handlers();
265263
}
266-
this.flowchartHandler?.render();
264+
this.flowchartHandler?.update();
267265
}
268266

269267
private _on_grafana_data_received(dataList: any) {
@@ -278,7 +276,7 @@ class FlowchartCtrl extends MetricsPanelCtrl {
278276

279277
private _on_global_debug_asked() {
280278
_log('📬', this.constructor.name, '_on_global_debug_asked');
281-
_log('🧰', 'DATA', this.panel);
279+
_log('🗃️', 'DATA', this.panel);
282280
}
283281

284282
private _on_global_panel_closed() {

Diff for: src/flowcharts_options.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,18 @@ export class FlowchartsOptionsCtrl {
2626
// onColorChange : () => any;
2727

2828
/** @ngInject */
29+
// $scope: gf.TIFlowchartOptionsScope
2930
constructor($scope: gf.TIFlowchartOptionsScope) {
3031
$scope.editor = this;
3132
this.ctrl = $scope.ctrl;
32-
this.$gf = this.ctrl.$gf;
33-
$scope.$GF = this.$gf
33+
$scope.GFPlugin = this.ctrl.GFPlugin;
34+
$scope.$GF = this.ctrl.$gf;
35+
this.$gf = this.ctrl.$gf
3436
this.$scope = $scope;
3537
// this.panel = this.ctrl.panel;
3638
this.flowchartHandler = this.ctrl.flowchartHandler;
3739
this.currentFlowchart = this.flowchartHandler?.getFlowchart();
3840
let index = 0;
39-
4041
this.flowchartsTableData = {
4142
data: [],
4243
columns: [

Diff for: src/globals_class.ts

+7-4
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,9 @@ export class GFPlugin {
580580
* @returns {GFPlugin}
581581
* @memberof GFPlugin
582582
*/
583-
static init($scope: any, templateSrv: any, $gf: $GF) {
583+
static init($scope: any, templateSrv: any, ctrl: any) {
584+
$scope.GFPlugin = this;
585+
ctrl.GFPlugin = this;
584586
GFPlugin.contextRoot = GFPlugin.defaultContextRoot;
585587
GFPlugin.templateSrv = templateSrv;
586588
if ($scope === undefined) {
@@ -844,7 +846,7 @@ export class $GF {
844846
private _globalvars: GFVariables = GFVariables.create();
845847
static graphHover = false;
846848
static GHTimeStamp = 0;
847-
static DEBUG = true;
849+
DEBUG = true;
848850
notify: CallableFunction = (message: string, type: string) => {};
849851
clearNotify: CallableFunction = () => {};
850852
$refresh: CallableFunction = () => {};
@@ -891,7 +893,8 @@ export class $GF {
891893
static create($scope: any, templateSrv: any, dashboard: any, ctrl: any): $GF {
892894
const _gf = new $GF();
893895
GFPlugin.init($scope, templateSrv, ctrl);
894-
if ($GF.DEBUG) {
896+
$scope.$GF = _gf;
897+
if (_gf.DEBUG) {
895898
console.log('DEBUG Scope', $scope);
896899
console.log('DEBUG TemplateSrv', templateSrv);
897900
console.log('DEBUG Theme', dashboard.style);
@@ -1381,7 +1384,7 @@ export class $GF {
13811384
//### EVENTS
13821385
//###########################################################################
13831386
private _on_global_debug_asked() {
1384-
_log('🧰', $GF.constructor.name, this);
1387+
_log('🗃️', $GF.constructor.name, this);
13851388
}
13861389

13871390
private _on_global_panel_closed() {

Diff for: src/graph_class.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ export class XGraph {
11261126
//#############################################################################
11271127
private _on_global_debug_asked() {
11281128
_log('📬', this.constructor.name, '_on_global_debug_asked');
1129-
_log('🧰', this.constructor.name, this);
1129+
_log('🗃️', this.constructor.name, this);
11301130
}
11311131

11321132
private _on_drawio_drawio_initialized() {

Diff for: src/index.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ declare module gf {
6969
declare interface TIFlowchartOptionsScope extends ng.IScope {
7070
editor: FlowchartOptionsCtrl;
7171
$GF: $GF;
72+
GFPlugin: GFPlugin;
7273
ctrl: any;
7374
}
7475

@@ -434,6 +435,7 @@ declare module gf {
434435
flowchartHandler: any;
435436
editor: InspectOptionsCtrl;
436437
$GF: $GF;
438+
GFPlugin: GFPlugin;
437439
ctrl: FlowchartCtrl;
438440
}
439441

@@ -465,6 +467,7 @@ declare module gf {
465467
declare interface TRulesOptionsScope extends ng.IScope {
466468
editor: RulesOptionsCtrl;
467469
$GF: $GF;
470+
GFPlugin: GFPlugin;
468471
ctrl: FlowchartCtrl;
469472
}
470473

Diff for: src/inspect_options.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class InspectOptionsCtrl {
1616
statesTable: GFTable;
1717
// panel: any;
1818
parentDiv: HTMLDivElement;
19-
headerTable: HTMLDivElement | undefined;
19+
headerTable: HTMLDivElement | undefined ;
2020
bodyTable: HTMLDivElement | undefined;
2121
indexTable = 0;
2222
pressed = false;
@@ -121,11 +121,12 @@ export class InspectOptionsCtrl {
121121
const statesTable = $statesTable[0];
122122
this.statesTable = new GFTable(this.statesTableData, statesTable);
123123
this.ctrl = $scope.ctrl;
124-
this.$gf = this.ctrl.$gf;
125-
$scope.$GF = this.$gf;
126-
// this.panel = this.ctrl.panel;
124+
$scope.GFPlugin = this.ctrl.GFPlugin;
125+
$scope.$GF = this.ctrl.$gf;
126+
this.$gf = this.ctrl.$gf // this.panel = this.ctrl.panel;
127127
this.flowchartHandler = this.ctrl.flowchartHandler;
128128
this.stateHandler = this.flowchartHandler?.getFlowchart().getStateHandler();
129+
129130
}
130131

131132
render() {
@@ -186,7 +187,7 @@ export class InspectOptionsCtrl {
186187
sh.edited = false;
187188
}
188189
flowchart?.applyModel();
189-
this.ctrl.notify('Save the dashboard to apply the modifications');
190+
this.$gf.notify('Save the dashboard to apply the modifications');
190191
}
191192

192193
selectCell(state: State) {

Diff for: src/metric_handler.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ export class MetricHandler {
243243
}
244244

245245
private _on_global_debug_asked() {
246-
_log("🧰", this.constructor.name, this);
246+
_log("🗃️", this.constructor.name, this);
247247
}
248248

249249
private _on_global_panel_closed() {

Diff for: src/partials/flowcharts/flowchartsTab.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ <h5 class="section-heading">
3030
</div>
3131
</div>
3232
<div class="editor-row">
33-
<ng-include src="$GF.plugin.getPartialPath() + 'flowcharts/flowchartsTable.html'"> </ng-include>
33+
<ng-include src="GFPlugin.getPartialPath() + 'flowcharts/flowchartsTable.html'"> </ng-include>
3434
</div>
3535
</div>

Diff for: src/partials/flowcharts/flowchartsTable.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@
195195
</div>
196196
<div ng-show="flowchart.reduce==false" class="gf-table-row_body">
197197
<!-- GRAPH TOOLTIP -->
198-
<ng-include src="$GF.plugin.getPartialPath() + 'flowcharts/flowchartBody.html'"> </ng-include>
198+
<ng-include src="GFPlugin.getPartialPath() + 'flowcharts/flowchartBody.html'"> </ng-include>
199199
</div>
200200
</div>
201201
</div>

Diff for: src/partials/inspect/inspectTab.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ <h5 class="section-heading">
1818
</gf-form-switch>
1919

2020
<!-- STATES MAPPING -->
21-
<ng-include src="$GF.plugin.getPartialPath() + 'inspect/states/statesSection.html'" ng-if="editor.enable">
21+
<ng-include src="GFPlugin.getPartialPath() + 'inspect/states/statesSection.html'" ng-if="editor.enable">
2222
</ng-include>
2323
<hr />
2424

@@ -65,4 +65,4 @@ <h5 class="section-heading">Anonymize Graph to export or to share</h5>
6565
</div>
6666
</div>
6767
</div>
68-
</div>
68+
</div>

Diff for: src/partials/inspect/states/statesSection.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- <div class="edit-tab-content" id="templateInspect"> -->
22
<div class="editor-row">
3-
<ng-include src="$GF.plugin.getPartialPath() + 'inspect/states/statesTable.html'"> </ng-include>
3+
<ng-include src="GFPlugin.getPartialPath() + 'inspect/states/statesTable.html'"> </ng-include>
44
</div>
55
<!-- </div> -->
66

@@ -16,4 +16,4 @@
1616
</button>
1717
</div>
1818
</div> -->
19-
<!-- </div> -->
19+
<!-- </div> -->

Diff for: src/partials/inspect/states/statesTable.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@
273273
</div>
274274
</div>
275275
<div class="gf-table-row_body" ng-show="state.reduce === false && editor.initPreview(state)">
276-
<ng-include src="$GF.plugin.getPartialPath() + 'inspect/states/stateBody.html'"> </ng-include>
276+
<ng-include src="GFPlugin.getPartialPath() + 'inspect/states/stateBody.html'"> </ng-include>
277277
</div>
278278
</div>
279279
</div>
@@ -300,4 +300,4 @@
300300
</div>
301301
</div>
302302
</div>
303-
</div>
303+
</div>

Diff for: src/partials/module.html

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
ng-click="editor.displayNextFlowchart()"><i class="fa fa-caret-right fa-lg"></i></div>
2222
</div>
2323
</div>
24-
2524
<div id="flowcharting-debug" class="gf-navigation" ng-show="$GF.DEBUG">
2625
<div id="flowcharting-navigation-content">
2726
<button class="btn btn-danger btn-small" ng-click="$GF.debug()" title="Debugger">

Diff for: src/partials/rules/events/eventsSection.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ <h5 class="section-heading">
4242
</gf-form-switch>
4343
</div>
4444
<!-- Table -->
45-
<ng-include src="$GF.plugin.getPartialPath() + 'rules/events/eventsTable.html'"> </ng-include>
45+
<ng-include src="GFPlugin.getPartialPath() + 'rules/events/eventsTable.html'"> </ng-include>
4646
</div>
47-
</div>
47+
</div>

Diff for: src/partials/rules/events/eventsTable.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@
117117
</div>
118118
<!-- TBODY -->
119119
<div class="gf-table-body">
120-
<div role="row" class="gf-table-rows-2 gf-table-rows-resizable"
120+
<div role="row" class="gf-table-rows-2 gf-table-rows-resizable"
121121
ng-repeat="elt in rule.getEventMaps()"
122-
ng-mouseenter="editor.setCurrentMap(elt);"
122+
ng-mouseenter="editor.setCurrentMap(elt);"
123123
ng-mouseleave="editor.unsetCurrentMap();">
124124
<!-- CELLS -->
125125
<div class="gf-table-row_line" ng-init="elt.displayEdit = [];elt.inEdit = [];"
@@ -294,7 +294,7 @@
294294
</div>
295295
</div>
296296
<div class="gf-table-row_body" ng-show="elt.reduce === false">
297-
<ng-include src="$GF.plugin.getPartialPath() + 'rules/events/eventBody.html'"> </ng-include>
297+
<ng-include src="GFPlugin.getPartialPath() + 'rules/events/eventBody.html'"> </ng-include>
298298
</div>
299299
</div>
300300
</div>
@@ -327,4 +327,4 @@
327327
</div>
328328
</div>
329329
</div>
330-
</div>
330+
</div>

Diff for: src/partials/rules/labels/labelsSection.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ <h5 class="section-heading">
4242
</gf-form-switch>
4343
</div>
4444
<!-- Table -->
45-
<ng-include src="$GF.plugin.getPartialPath() + 'rules/labels/labelsTable.html'"> </ng-include>
45+
<ng-include src="GFPlugin.getPartialPath() + 'rules/labels/labelsTable.html'"> </ng-include>
4646
</div>
47-
</div>
47+
</div>

Diff for: src/partials/rules/labels/labelsTable.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
<div role="row" class="gf-table-rows-2 gf-table-rows-resizable" ng-repeat="text in rule.getTextMaps()"
107107
ng-mouseenter="editor.setCurrentMap(text);" ng-mouseleave="editor.unsetCurrentMap();">
108108
<!-- CELLS -->
109-
<div class="gf-table-row_line"
109+
<div class="gf-table-row_line"
110110
ng-mouseleave="editor.unhighlightXCells(text);"
111111
ng-mouseover="editor.highlightXCells(text)">
112112
<!-- EXPAND -->
@@ -132,7 +132,7 @@
132132
</div>
133133
<div ng-show="text.displayWhatEdit === true && text.whatEdit !== true"
134134
ng-click="text.whatEdit = true;$GF.setFocus( text.uid + '-what' )"
135-
title="Edit pattern"
135+
title="Edit pattern"
136136
class="gf-icon-action gf-icon-edit gf-icon-withcontent">
137137
</div>
138138
<div ng-show="text.displayWhatEdit === true && text.whatEdit !== true && !editor.flowchartHandler.isMapping(text)"
@@ -141,7 +141,7 @@
141141
title="Select a text in diagram">
142142
</div>
143143
<input type="text" class="gf-form-input" ng-model="text.getData().pattern"
144-
style="margin-right: 2px;width : 100%"
144+
style="margin-right: 2px;width : 100%"
145145
ng-attr-id="{{text.uid + '-what'}}"
146146
ng-show="text.whatEdit === true" ng-model-onblur
147147
ng-blur="editor.onRulesChange();text.whatEdit = false;"
@@ -235,7 +235,7 @@
235235
</div>
236236
</div>
237237
<div class="gf-table-row_body" ng-show="text.reduce==false">
238-
<ng-include src="$GF.plugin.getPartialPath() + 'rules/labels/labelBody.html'"> </ng-include>
238+
<ng-include src="GFPlugin.getPartialPath() + 'rules/labels/labelBody.html'"> </ng-include>
239239
</div>
240240
</div>
241241
</div>
@@ -268,4 +268,4 @@
268268
</div>
269269
</div>
270270
</div>
271-
</div>
271+
</div>

Diff for: src/partials/rules/links/linksSection.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ <h5 class="section-heading">
4141
tooltip="Disable this option if you don't use regular expressions in field 'What' below to improve performance">
4242
</gf-form-switch>
4343
</div>
44-
<ng-include src="$GF.plugin.getPartialPath() + 'rules/links/linksTable.html'"> </ng-include>
44+
<ng-include src="GFPlugin.getPartialPath() + 'rules/links/linksTable.html'"> </ng-include>
4545
</div>
46-
</div>
46+
</div>

0 commit comments

Comments
 (0)