terrier-engine 4.24.0 → 4.24.2
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.
- package/data-dive/dives/dive-list.ts +20 -3
- package/data-dive/dives/dive-runs.ts +10 -9
- package/package.json +1 -1
- package/terrier/schedules.ts +28 -1
|
@@ -14,6 +14,8 @@ import Messages from "tuff-core/messages"
|
|
|
14
14
|
import Arrays from "tuff-core/arrays"
|
|
15
15
|
import TerrierPart from "../../terrier/parts/terrier-part"
|
|
16
16
|
import {DiveRunModal} from "./dive-runs"
|
|
17
|
+
import * as inflection from "inflection"
|
|
18
|
+
import Schedules from "../../terrier/schedules"
|
|
17
19
|
|
|
18
20
|
const log = new Logger("DiveList")
|
|
19
21
|
|
|
@@ -112,7 +114,7 @@ export class DiveListPart extends TerrierPart<DiveListState> {
|
|
|
112
114
|
|
|
113
115
|
const groupedDives = Arrays.groupBy(this.result.dives, 'dd_dive_group_id')
|
|
114
116
|
|
|
115
|
-
parent.div('.dd-group-grid', grid => {
|
|
117
|
+
parent.div('.dd-group-grid.tt-typography', grid => {
|
|
116
118
|
const groups = Arrays.sortBy(Object.values(this.groupMap), 'name')
|
|
117
119
|
for (const group of groups) {
|
|
118
120
|
this.renderGroupPanel(grid, group, groupedDives[group.id] || [])
|
|
@@ -156,7 +158,8 @@ export class DiveListPart extends TerrierPart<DiveListState> {
|
|
|
156
158
|
a.i('.glyp-data_dive')
|
|
157
159
|
.data({tooltip: "Public Dive"})
|
|
158
160
|
}
|
|
159
|
-
a.
|
|
161
|
+
a.div('.name').text(dive.name)
|
|
162
|
+
this.renderDiveSchedule(a, dive)
|
|
160
163
|
}).data({tooltip: "Open Editor"})
|
|
161
164
|
row.a('.icon-only', a => {
|
|
162
165
|
a.i('.glyp-settings')
|
|
@@ -173,7 +176,8 @@ export class DiveListPart extends TerrierPart<DiveListState> {
|
|
|
173
176
|
a.i('.glyp-data_dive')
|
|
174
177
|
.data({tooltip: "Public Dive"})
|
|
175
178
|
}
|
|
176
|
-
a.
|
|
179
|
+
a.div('.name').text(dive.name)
|
|
180
|
+
this.renderDiveSchedule(a, dive)
|
|
177
181
|
})
|
|
178
182
|
.data({tooltip: "Run Dive"})
|
|
179
183
|
.emitClick(this.runDiveKey, {id: dive.id})
|
|
@@ -181,6 +185,19 @@ export class DiveListPart extends TerrierPart<DiveListState> {
|
|
|
181
185
|
})
|
|
182
186
|
}
|
|
183
187
|
|
|
188
|
+
renderDiveSchedule(row: PartTag, dive: DdDive) {
|
|
189
|
+
log.info(`Rendering dive schedule: ${dive.delivery_schedule?.schedule_type}`, dive.delivery_schedule)
|
|
190
|
+
if (!dive.delivery_schedule || dive.delivery_schedule.schedule_type == 'none') {
|
|
191
|
+
return
|
|
192
|
+
}
|
|
193
|
+
let description = Schedules.describeRegular(dive.delivery_schedule)
|
|
194
|
+
if (dive.delivery_recipients?.length) {
|
|
195
|
+
description += ` to:<br>${dive.delivery_recipients.join('<br>')}`
|
|
196
|
+
}
|
|
197
|
+
row.div(".glyp-setup.with-icon").text(inflection.titleize(dive.delivery_schedule.schedule_type))
|
|
198
|
+
.data({tooltip: description})
|
|
199
|
+
}
|
|
200
|
+
|
|
184
201
|
}
|
|
185
202
|
|
|
186
203
|
|
|
@@ -184,7 +184,7 @@ export class DiveRunModal extends ModalPart<{dive: DdDive }> {
|
|
|
184
184
|
// inputs and outputs row
|
|
185
185
|
col.div('.tt-flex.collapsible.gap.tt-form', row => {
|
|
186
186
|
// inputs
|
|
187
|
-
row.div('.tt-flex.column.
|
|
187
|
+
row.div('.tt-flex.column.dd-dive-run-inputs', col => {
|
|
188
188
|
for (const filter of this.filters) {
|
|
189
189
|
this.renderInput(col, filter)
|
|
190
190
|
}
|
|
@@ -229,23 +229,24 @@ export class DiveRunModal extends ModalPart<{dive: DdDive }> {
|
|
|
229
229
|
const res = this.queryResults[query.id]
|
|
230
230
|
const status = res?.status || 'pending'
|
|
231
231
|
|
|
232
|
-
parent.div('.query-run', status,
|
|
233
|
-
|
|
234
|
-
|
|
232
|
+
parent.div('.query-run', status, runView => {
|
|
233
|
+
runView.div('.tt-flex.gap.align-center', row => {
|
|
234
|
+
row.i(statusIcons[status])
|
|
235
|
+
row.div('.name').text(query.name)
|
|
236
|
+
})
|
|
235
237
|
if (res?.status == 'error') {
|
|
236
|
-
|
|
238
|
+
runView.div('.tt-bubble.alert').text(res.message || "Error!")
|
|
237
239
|
}
|
|
238
240
|
else if (res?.message?.length) {
|
|
239
|
-
|
|
241
|
+
runView.div('.details').text(res.message)
|
|
240
242
|
}
|
|
241
243
|
})
|
|
242
244
|
}
|
|
243
245
|
|
|
244
246
|
renderFileOutput(parent: DivTag, fileOutput: RunFileOutput) {
|
|
245
247
|
parent.a('.file-output', {href: fileOutput.url}, row => {
|
|
246
|
-
row.
|
|
247
|
-
row.div('.
|
|
248
|
-
row.div('.details.glyp-download').text("Click to download")
|
|
248
|
+
row.div('.name.glyp-file_spreadsheet.with-icon').text(fileOutput.name)
|
|
249
|
+
row.div('.details.glyp-download.with-icon').text("Click to download")
|
|
249
250
|
})
|
|
250
251
|
}
|
|
251
252
|
|
package/package.json
CHANGED
package/terrier/schedules.ts
CHANGED
|
@@ -166,6 +166,32 @@ export class RegularScheduleForm extends TerrierFormPart<CombinedRegularSchedule
|
|
|
166
166
|
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
|
|
170
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
171
|
+
// Display
|
|
172
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Generate an english description of the given regular schedule.
|
|
176
|
+
* @param schedule
|
|
177
|
+
*/
|
|
178
|
+
function describeRegular(schedule: CombinedRegularSchedule): string {
|
|
179
|
+
const timeString = dayjs().hour(parseInt(schedule.hour_of_day || '0')).format('h A')
|
|
180
|
+
switch (schedule.schedule_type) {
|
|
181
|
+
case 'none':
|
|
182
|
+
return "Unscheduled"
|
|
183
|
+
case 'daily':
|
|
184
|
+
return `Daily at ${timeString}`
|
|
185
|
+
case 'weekly':
|
|
186
|
+
return `Every ${inflection.titleize(schedule.day_of_week || 'sunday')} at ${timeString}`
|
|
187
|
+
case 'monthly':
|
|
188
|
+
return `Every ${inflection.ordinalize(schedule.day_of_month || '1')} of the month at ${timeString}`
|
|
189
|
+
default:
|
|
190
|
+
throw `Invalid schedule type: ${schedule.schedule_type}`
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
|
|
169
195
|
////////////////////////////////////////////////////////////////////////////////
|
|
170
196
|
// Export
|
|
171
197
|
////////////////////////////////////////////////////////////////////////////////
|
|
@@ -173,7 +199,8 @@ export class RegularScheduleForm extends TerrierFormPart<CombinedRegularSchedule
|
|
|
173
199
|
const Schedules = {
|
|
174
200
|
DaysOfWeek,
|
|
175
201
|
DaysOfMonth,
|
|
176
|
-
HoursOfDay
|
|
202
|
+
HoursOfDay,
|
|
203
|
+
describeRegular
|
|
177
204
|
}
|
|
178
205
|
export default Schedules
|
|
179
206
|
|