terrier-engine 4.35.0 → 4.36.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6,7 +6,6 @@ import QueryEditor from "../queries/query-editor"
|
|
|
6
6
|
import {Logger} from "tuff-core/logging"
|
|
7
7
|
import QueryForm from "../queries/query-form"
|
|
8
8
|
import {TabContainerPart} from "../../terrier/tabs"
|
|
9
|
-
import PagePart from "../../terrier/parts/page-part"
|
|
10
9
|
import ContentPart from "../../terrier/parts/content-part"
|
|
11
10
|
import {ModalPart} from "../../terrier/modals"
|
|
12
11
|
import {DdDive} from "../gen/models"
|
|
@@ -21,6 +20,7 @@ import {FormFields} from "tuff-core/forms"
|
|
|
21
20
|
import Fragments from "../../terrier/fragments"
|
|
22
21
|
import {DiveDeliveryForm} from "./dive-delivery"
|
|
23
22
|
import DivePlotList from "../plots/dive-plot-list"
|
|
23
|
+
import {DivePage} from "./dive-page"
|
|
24
24
|
|
|
25
25
|
const log = new Logger("DiveEditor")
|
|
26
26
|
|
|
@@ -193,7 +193,7 @@ export default class DiveEditor extends ContentPart<DiveEditorState> {
|
|
|
193
193
|
// Editor Page
|
|
194
194
|
////////////////////////////////////////////////////////////////////////////////
|
|
195
195
|
|
|
196
|
-
export class DiveEditorPage extends
|
|
196
|
+
export class DiveEditorPage extends DivePage<{id: string}> {
|
|
197
197
|
|
|
198
198
|
editor!: DiveEditor
|
|
199
199
|
session!: DdSession
|
|
@@ -223,6 +223,8 @@ export class DiveEditorPage extends PagePart<{id: string}> {
|
|
|
223
223
|
icon: 'glyp-data_dive'
|
|
224
224
|
})
|
|
225
225
|
|
|
226
|
+
this.addDocsAction()
|
|
227
|
+
|
|
226
228
|
this.addToolbarInput('show-hints', 'checkbox', {
|
|
227
229
|
title: "Hints",
|
|
228
230
|
icon: 'glyp-hint',
|
|
@@ -424,3 +426,4 @@ class DuplicateQueryModal extends ModalPart<DuplicateQueryState> {
|
|
|
424
426
|
})
|
|
425
427
|
}
|
|
426
428
|
}
|
|
429
|
+
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {Logger} from "tuff-core/logging"
|
|
2
|
-
import PagePart from "../../terrier/parts/page-part"
|
|
3
2
|
import {PartTag} from "tuff-core/parts"
|
|
4
3
|
import Schema, {SchemaDef} from "../../terrier/schema"
|
|
5
4
|
import {DdDive, DdDiveGroup, UnpersistedDdDive, UnpersistedDdDiveGroup} from "../gen/models"
|
|
@@ -16,6 +15,7 @@ import TerrierPart from "../../terrier/parts/terrier-part"
|
|
|
16
15
|
import {DiveRunModal} from "./dive-runs"
|
|
17
16
|
import * as inflection from "inflection"
|
|
18
17
|
import Schedules from "../../terrier/schedules"
|
|
18
|
+
import {DivePage} from "./dive-page"
|
|
19
19
|
|
|
20
20
|
const log = new Logger("DiveList")
|
|
21
21
|
|
|
@@ -204,7 +204,7 @@ export class DiveListPart extends TerrierPart<DiveListState> {
|
|
|
204
204
|
// Page
|
|
205
205
|
////////////////////////////////////////////////////////////////////////////////
|
|
206
206
|
|
|
207
|
-
export class DiveListPage extends
|
|
207
|
+
export class DiveListPage extends DivePage<{}> {
|
|
208
208
|
|
|
209
209
|
listPart!: DiveListPart
|
|
210
210
|
newGroupKey = Messages.untypedKey()
|
|
@@ -216,6 +216,8 @@ export class DiveListPage extends PagePart<{}> {
|
|
|
216
216
|
|
|
217
217
|
this.listPart = this.makePart(DiveListPart, {mode: 'editor'})
|
|
218
218
|
|
|
219
|
+
this.addDocsAction()
|
|
220
|
+
|
|
219
221
|
this.addAction({
|
|
220
222
|
title: "New Group",
|
|
221
223
|
icon: 'glyp-plus_outline',
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import PagePart from "../../terrier/parts/page-part"
|
|
2
|
+
import Messages from "tuff-core/messages"
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export abstract class DivePage<T> extends PagePart<T> {
|
|
6
|
+
|
|
7
|
+
static docsKey = Messages.untypedKey()
|
|
8
|
+
|
|
9
|
+
addDocsAction() {
|
|
10
|
+
|
|
11
|
+
this.addAction({
|
|
12
|
+
title: 'Docs',
|
|
13
|
+
icon: 'glyp-help',
|
|
14
|
+
click: {key: DivePage.docsKey},
|
|
15
|
+
classes: ['data-dive-docs']
|
|
16
|
+
}, 'tertiary')
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
}
|
|
@@ -30,19 +30,25 @@ type BaseFilter = {
|
|
|
30
30
|
edit_label?: string
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
const directOperators = ['eq', 'ne', 'ilike', 'lt', 'gt', 'lte', 'gte'] as const
|
|
33
|
+
const directOperators = ['eq', 'ne', 'ilike', 'lt', 'gt', 'lte', 'gte', 'contains', 'excludes'] as const
|
|
34
34
|
export type DirectOperator = typeof directOperators[number]
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* Computes the operator options for the given column type.
|
|
38
38
|
* @param type
|
|
39
39
|
*/
|
|
40
|
-
function operatorOptions(
|
|
40
|
+
function operatorOptions(colDef?: ColumnDef): SelectOptions {
|
|
41
|
+
const type = colDef?.type || 'text'
|
|
41
42
|
let operators: DirectOperator[] = ['eq', 'ne'] // equality is the only thing we can assume for any type
|
|
42
43
|
switch (type) {
|
|
43
44
|
case 'text':
|
|
44
45
|
case 'string':
|
|
45
|
-
|
|
46
|
+
if (colDef?.array) {
|
|
47
|
+
operators = ['contains', 'excludes']
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
operators = ['eq', 'ne', 'ilike']
|
|
51
|
+
}
|
|
46
52
|
break
|
|
47
53
|
case 'float':
|
|
48
54
|
case 'integer':
|
|
@@ -111,7 +117,7 @@ function operatorDisplay(op: DirectOperator): string {
|
|
|
111
117
|
case 'gte':
|
|
112
118
|
return '≥'
|
|
113
119
|
default:
|
|
114
|
-
return
|
|
120
|
+
return op
|
|
115
121
|
}
|
|
116
122
|
}
|
|
117
123
|
|
|
@@ -402,7 +408,7 @@ class DirectFilterEditor extends FilterFields<DirectFilter> {
|
|
|
402
408
|
col.div('.tt-readonly-field', {text: this.data.column})
|
|
403
409
|
})
|
|
404
410
|
parent.div('.operator', col => {
|
|
405
|
-
const opts = operatorOptions(this.columnDef
|
|
411
|
+
const opts = operatorOptions(this.columnDef)
|
|
406
412
|
this.select(col, 'operator', opts)
|
|
407
413
|
})
|
|
408
414
|
parent.div('.filter', col => {
|
|
@@ -630,7 +636,8 @@ class AddFilterDropdown extends Dropdown<{modelDef: ModelDef, callback: AddFilte
|
|
|
630
636
|
return this.state.callback({id, filter_type: 'date_range', column, range: {period: 'year', relative: 0}})
|
|
631
637
|
default: // direct
|
|
632
638
|
const colType = colDef.type == 'number' || colDef.type == 'cents' ? colDef.type : 'text'
|
|
633
|
-
|
|
639
|
+
const defaultValue = colType == 'text' ? '' : '0'
|
|
640
|
+
return this.state.callback({id, filter_type: 'direct', column, column_type: colType, operator: 'eq', value: defaultValue})
|
|
634
641
|
}
|
|
635
642
|
}
|
|
636
643
|
else {
|
package/package.json
CHANGED
package/terrier/list-viewer.ts
CHANGED
|
@@ -87,12 +87,11 @@ export class ListViewerDetailsContext<T extends ListItem> {
|
|
|
87
87
|
* @param state
|
|
88
88
|
*/
|
|
89
89
|
makePart<PartType extends Part<StateType>, StateType>(partType: PartConstructor<PartType, StateType>, state: StateType) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
90
|
+
const parentPart = (this.viewer.layout == 'side')
|
|
91
|
+
? this.viewer.sideContainerPart
|
|
92
|
+
: this.viewer.currentItemPart
|
|
93
|
+
if (this.part) parentPart?.removeChild(this.part)
|
|
94
|
+
this.part = parentPart?.makePart(partType, state)
|
|
96
95
|
}
|
|
97
96
|
|
|
98
97
|
/**
|