terrier-engine 4.30.0 → 4.31.0

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.
@@ -20,7 +20,7 @@ import Arrays from "tuff-core/arrays"
20
20
  import {FormFields} from "tuff-core/forms"
21
21
  import Fragments from "../../terrier/fragments"
22
22
  import {DiveDeliveryForm} from "./dive-delivery"
23
- import {DivePlotsForm} from "./dive-plots"
23
+ import {DivePlotsForm} from "../plots/dive-plots"
24
24
 
25
25
  const log = new Logger("DiveEditor")
26
26
 
@@ -4,7 +4,7 @@ import Db from "../dd-db"
4
4
  import DdSession from "../dd-session"
5
5
  import {FilterInput} from "../queries/filters"
6
6
  import Tables from "../queries/tables"
7
- import {SchemaDef} from "../../terrier/schema";
7
+ import {SchemaDef} from "../../terrier/schema"
8
8
 
9
9
 
10
10
  ////////////////////////////////////////////////////////////////////////////////
@@ -1,4 +1,4 @@
1
- // This file was automatically generated on 2024-05-16 13:17:01 -0500, DO NOT EDIT IT MANUALLY!
1
+ // This file was automatically generated on 2024-07-17 13:26:00 -0500, DO NOT EDIT IT MANUALLY!
2
2
 
3
3
  import { Query } from "../queries/queries"
4
4
 
@@ -10,6 +10,8 @@ import { Attachment } from "../../terrier/attachments"
10
10
 
11
11
  import { RegularSchedule } from "../../terrier/schedules"
12
12
 
13
+ import { DivePlotTrace, DivePlotLayout } from "../plots/dive-plots"
14
+
13
15
  import { OptionalProps } from "tuff-core/types"
14
16
 
15
17
  export type DdDive = {
@@ -31,6 +33,7 @@ export type DdDive = {
31
33
  sort_order?: number
32
34
  query_data?: { queries: Query[] }
33
35
  dive_types: string[]
36
+ delivery_mode?: string
34
37
  delivery_recipients?: string[]
35
38
  delivery_schedule?: RegularSchedule
36
39
  created_by?: DdUser
@@ -59,6 +62,7 @@ export type UnpersistedDdDive = {
59
62
  sort_order?: number
60
63
  query_data?: { queries: Query[] }
61
64
  dive_types: string[]
65
+ delivery_mode?: string
62
66
  delivery_recipients?: string[]
63
67
  delivery_schedule?: RegularSchedule
64
68
  created_by?: DdUser
@@ -114,6 +118,44 @@ export type UnpersistedDdDiveGroup = {
114
118
  dd_dives?: OptionalProps<UnpersistedDdDive, "dd_dive_group_id">[]
115
119
  }
116
120
 
121
+ export type DdDivePlot = {
122
+ id: string
123
+ created_at: string
124
+ updated_at: string
125
+ _state: number
126
+ created_by_id?: string
127
+ created_by_name: string
128
+ extern_id?: string
129
+ updated_by_id?: string
130
+ updated_by_name?: string
131
+ title: string
132
+ traces: DivePlotTrace[]
133
+ layout: DivePlotLayout
134
+ dd_dive_id: string
135
+ created_by?: DdUser
136
+ updated_by?: DdUser
137
+ dd_dive?: DdDive
138
+ }
139
+
140
+ export type UnpersistedDdDivePlot = {
141
+ id?: string
142
+ created_at?: string
143
+ updated_at?: string
144
+ _state?: number
145
+ created_by_id?: string
146
+ created_by_name?: string
147
+ extern_id?: string
148
+ updated_by_id?: string
149
+ updated_by_name?: string
150
+ title: string
151
+ traces: DivePlotTrace[]
152
+ layout: DivePlotLayout
153
+ dd_dive_id: string
154
+ created_by?: DdUser
155
+ updated_by?: DdUser
156
+ dd_dive?: DdDive
157
+ }
158
+
117
159
  export type DdDiveRun = {
118
160
  id: string
119
161
  created_at: string
@@ -170,6 +212,7 @@ export const DdDiveRunEnumFields = {
170
212
  export type PersistedModelTypeMap = {
171
213
  dd_dive: DdDive
172
214
  dd_dive_group: DdDiveGroup
215
+ dd_dive_plot: DdDivePlot
173
216
  dd_dive_run: DdDiveRun
174
217
  }
175
218
 
@@ -179,6 +222,7 @@ export type PersistedModelTypeMap = {
179
222
  export type UnpersistedModelTypeMap = {
180
223
  dd_dive: UnpersistedDdDive
181
224
  dd_dive_group: UnpersistedDdDiveGroup
225
+ dd_dive_plot: UnpersistedDdDivePlot
182
226
  dd_dive_run: UnpersistedDdDiveRun
183
227
  }
184
228
 
@@ -188,6 +232,7 @@ export type UnpersistedModelTypeMap = {
188
232
  export type ModelIncludesMap = {
189
233
  dd_dive: "created_by" | "dd_dive_group" | "dd_dive_runs" | "owner" | "updated_by"
190
234
  dd_dive_group: "created_by" | "dd_dives" | "updated_by"
235
+ dd_dive_plot: "created_by" | "dd_dive" | "updated_by"
191
236
  dd_dive_run: "created_by" | "dd_dive" | "updated_by"
192
237
  }
193
238
 
@@ -0,0 +1,29 @@
1
+ import TerrierFormPart from "../../terrier/parts/terrier-form-part"
2
+ import {DiveEditorState} from "../dives/dive-editor"
3
+ import {PartTag} from "tuff-core/parts"
4
+ import {MarkerStyle, TraceStyle, TraceType, YAxisName} from "tuff-plot/trace"
5
+ import {PlotLayout} from "tuff-plot/layout"
6
+
7
+
8
+ export type DivePlotTrace = {
9
+ id: string
10
+ type: TraceType
11
+ title: string
12
+ query_id: string
13
+ x: string
14
+ y: string
15
+ y_axis: YAxisName
16
+ style?: TraceStyle
17
+ marker?: MarkerStyle
18
+ }
19
+
20
+ // maybe we'll add more in the future
21
+ export type DivePlotLayout = PlotLayout
22
+
23
+
24
+ export class DivePlotsForm extends TerrierFormPart<DiveEditorState> {
25
+ render(parent: PartTag): any {
26
+ parent.h3(".coming-soon.glyp-developer").text("Coming Soon")
27
+ }
28
+
29
+ }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "files": [
5
5
  "*"
6
6
  ],
7
- "version": "4.30.0",
7
+ "version": "4.31.0",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Terrier-Tech/terrier-engine"
@@ -19,6 +19,7 @@
19
19
  "dayjs": "^1.11.7",
20
20
  "inflection": "^2.0.1",
21
21
  "tuff-core": "latest",
22
+ "tuff-plot": "^0.2.0",
22
23
  "tuff-sortable": "latest",
23
24
  "turbolinks": "^5.2.0"
24
25
  },
@@ -1,4 +1,4 @@
1
- // This file was automatically generated, DO NOT EDIT IT MANUALLY!
1
+ // This file was automatically generated on 2024-07-17 08:41:32 -0500, DO NOT EDIT IT MANUALLY!
2
2
 
3
3
  import * as inflection from "inflection"
4
4
 
@@ -14,6 +14,7 @@ const log = new Logger('List Viewer')
14
14
  export type ListItem = {
15
15
  listId: string
16
16
  listClickable?: boolean
17
+ listClear?: boolean
17
18
  listStyle?: 'none' | 'panel' | 'header'
18
19
  }
19
20
 
@@ -35,6 +36,9 @@ class ListItemPart<T extends ListItem> extends Part<T> {
35
36
  itemView.class('clickable')
36
37
  itemView.emitClick(this.viewer.itemClickedKey, {listId: this.state.listId})
37
38
  }
39
+ else if (this.state.listClear) {
40
+ itemView.emitClick(this.viewer.clearCurrentKey)
41
+ }
38
42
  if (isCurrent) {
39
43
  itemView.class('current')
40
44
  }
@@ -128,6 +132,7 @@ class SideContainerPart extends Part<{viewer: ListViewerPart<any>}> {
128
132
  }
129
133
  else {
130
134
  log.debug(`[SideContainerPart] No details part to render`)
135
+ this.viewer.renderEmptyDetails(parent)
131
136
  }
132
137
  }
133
138
 
@@ -156,8 +161,25 @@ export abstract class ListViewerPart<T extends ListItem> extends TerrierPart<any
156
161
  items: T[] = []
157
162
  itemPartMap: Record<string, ListItemPart<T>> = {}
158
163
 
164
+ /**
165
+ * Emit this key when a specific item is clicked.
166
+ */
159
167
  itemClickedKey = Messages.typedKey<ListItem>()
160
168
 
169
+ /**
170
+ * Emit this key to clear the current selection.
171
+ */
172
+ clearCurrentKey = Messages.untypedKey()
173
+
174
+ /**
175
+ * Clears the currently selected item.
176
+ */
177
+ clearCurrent() {
178
+ this.detailsContext?.clear()
179
+ this.detailsContext = undefined
180
+ this.dirty()
181
+ }
182
+
161
183
  /**
162
184
  * A message with this key gets emitted whenever the details are shown.
163
185
  */
@@ -175,6 +197,11 @@ export abstract class ListViewerPart<T extends ListItem> extends TerrierPart<any
175
197
  log.debug(`Clicked on list item ${m.data.listId}`, m)
176
198
  this.showDetails(m.data.listId)
177
199
  })
200
+
201
+ this.onClick(this.clearCurrentKey, m => {
202
+ log.debug(`Clicked clear key`, m)
203
+ this.clearCurrent()
204
+ })
178
205
  }
179
206
 
180
207
 
@@ -185,6 +212,13 @@ export abstract class ListViewerPart<T extends ListItem> extends TerrierPart<any
185
212
  */
186
213
  abstract fetchItems(): Promise<T[]>
187
214
 
215
+ /**
216
+ * Subclasses can override this to automatically load the first item in the list.
217
+ */
218
+ get shouldLoadFirstItem(): boolean {
219
+ return false
220
+ }
221
+
188
222
  /**
189
223
  * Fetches the items with `fetchItems()` and re-renders the list.
190
224
  */
@@ -215,7 +249,7 @@ export abstract class ListViewerPart<T extends ListItem> extends TerrierPart<any
215
249
  log.info(`Showing item specified in params: ${id}`)
216
250
  this.showDetails(id)
217
251
  }
218
- else {
252
+ else if (this.shouldLoadFirstItem) {
219
253
  const firstClickable = this.items.filter(item => item.listClickable)[0]
220
254
  if (firstClickable) {
221
255
  log.info(`Showing first clickable item`)
@@ -257,6 +291,14 @@ export abstract class ListViewerPart<T extends ListItem> extends TerrierPart<any
257
291
  */
258
292
  abstract renderDetails(context: ListViewerDetailsContext<T>): any
259
293
 
294
+ /**
295
+ * Subclasses should override this to render custom content when there's no item selected (and layout=side).
296
+ * @param parent
297
+ */
298
+ renderEmptyDetails(parent: PartTag) {
299
+ parent.div(".text-center").text("Nothing to see here")
300
+ }
301
+
260
302
 
261
303
  // Details
262
304
 
@@ -1,11 +0,0 @@
1
- import TerrierFormPart from "../../terrier/parts/terrier-form-part"
2
- import {DiveEditorState} from "./dive-editor"
3
- import {PartTag} from "tuff-core/parts"
4
-
5
-
6
- export class DivePlotsForm extends TerrierFormPart<DiveEditorState> {
7
- render(parent: PartTag): any {
8
- parent.h3(".coming-soon.glyp-developer").text("Coming Soon")
9
- }
10
-
11
- }