Skip to content

Commit 1bbb128

Browse files
committed
PT-FIXES: DOS-1818 Switch Filter Sink from MQL to AQL.
1 parent 17a8cdf commit 1bbb128

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

src/foam/core/reflow/FilteredDAOAgent.js

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ foam.CLASS({
1313

1414
requires: [
1515
'foam.mlang.sink.FilteredSink',
16+
'foam.parse.SimpleQueryParser',
1617
'foam.parse.QueryParser'
1718
],
1819

@@ -22,9 +23,33 @@ foam.CLASS({
2223
name: 'where',
2324
section: 'filter',
2425
displayWidth: 60,
26+
postSet: function(o, n) { if ( n ) this.enableAQL_ = false; },
27+
visibility: function(enableAQL_) { return enableAQL_ ? foam.u2.DisplayMode.HIDDEN : foam.u2.DisplayMode.RW; },
2528
view: { class: 'foam.core.reflow.PredicateSuggestedField' },
2629
documentation: 'Predicate expression to filter objects before putting them in the sink'
2730
},
31+
{
32+
class: 'Boolean',
33+
name: 'enableAQL_',
34+
transient: true,
35+
hidden: true,
36+
value: true,
37+
documentation: 'Temporary flag to determine if AQL is available.'
38+
},
39+
{
40+
class: 'String',
41+
name: 'aql',
42+
label: 'Where (autocomplete)',
43+
displayWidth: 60,
44+
visibility: function(enableAQL_) { return enableAQL_ ? foam.u2.DisplayMode.RW : foam.u2.DisplayMode.HIDDEN; },
45+
view: function(_, X) {
46+
var data = X.data;
47+
return {
48+
class: 'foam.parse.auto.SmartView',
49+
parser: data.SimpleQueryParser.create({of: data.of}, X)
50+
};
51+
}
52+
},
2853
{
2954
name: 'sink',
3055
view: 'foam.core.reflow.SinkView',
@@ -46,6 +71,13 @@ foam.CLASS({
4671
console.warn('FilteredDAOAgent: Failed to parse predicate:', this.where, x);
4772
}
4873
}
74+
if ( this.aql ) {
75+
predicate = this.SimpleQueryParser.create({of: this.of}).parseString(this.aql);
76+
}
77+
if ( predicate ) {
78+
dao = dao.where(predicate);
79+
}
80+
4981
var delegateSink = this.sink ? this.sink.createSink() : this.ArraySink.create();
5082

5183
return this.FilteredSink.create({
@@ -59,9 +91,10 @@ foam.CLASS({
5991
start().
6092
style({display: 'flex', paddingLeft: '12px'}).
6193
add(this.WHERE.__).
94+
add(this.AQL.__).
6295
add(this.SINK).
6396
end().
64-
endContext();
97+
endContext();
6598
}
6699
]
67100
});

0 commit comments

Comments
 (0)