terrier-engine 4.72.0 → 4.72.3

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/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "files": [
5
5
  "*"
6
6
  ],
7
- "version": "4.72.0",
7
+ "version": "4.72.3",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Terrier-Tech/terrier-engine"
@@ -285,6 +285,26 @@ export default class DbClient<PM extends ModelTypeMap, UM extends ModelTypeMap,
285
285
  }
286
286
  }
287
287
 
288
+ /**
289
+ * Partially update the given record and assume it will succeed.
290
+ * This call should be wrapped in a try/catch.
291
+ * @param modelType the camel_case name of the model
292
+ * @param id the id of the record
293
+ * @param record the record to update
294
+ * @param includes relations to include in the returned record
295
+ */
296
+ async safePartialUpdate<T extends keyof PM & string>(modelType: T, id: string, record: PartialRecord<UM[T]>, includes: Includes<PM,T,I> = {}): Promise<PM[T]> {
297
+ const res = await this.partialUpdate(modelType, id, record, includes)
298
+ if (res.status == 'success') {
299
+ return res.record
300
+ } else if (res.record) {
301
+ throw new DbSaveException<PM, T>(res.message, res.record as UM[T], res.errors)
302
+ } else {
303
+ throw `Error updating ${modelType}: ${res.message}`
304
+ }
305
+ }
306
+
307
+
288
308
  /**
289
309
  * Inserts a new record for the given model type.
290
310
  * @param modelType the camel_case name of the model
package/terrier/tabs.ts CHANGED
@@ -14,11 +14,13 @@ export type TabParams = {
14
14
  key: string
15
15
  title: string
16
16
  icon?: IconName
17
+ iconColor?: ColorName
17
18
  state?: 'enabled' | 'disabled' | 'hidden'
18
19
  classes?: string[]
19
20
  tabClasses?: string[]
20
21
  click?: Packet
21
- iconColor?: ColorName
22
+ secondaryIcon?: IconName
23
+ secondaryIconColor?: ColorName
22
24
  }
23
25
 
24
26
  /**
@@ -201,6 +203,11 @@ export class TabContainerPart extends TerrierPart<TabContainerState> {
201
203
  if (tab.key === currentTabKey) a.class('active')
202
204
  if (tab.icon) this.theme.renderIcon(a, tab.icon, tab.iconColor ? tab.iconColor : 'secondary')
203
205
  a.span({ text: tab.title })
206
+ if (tab.secondaryIcon) {
207
+ a.span('.tt-tab-secondary-icon', span => {
208
+ this.theme.renderIcon(span, tab.secondaryIcon!, tab.secondaryIconColor ? tab.secondaryIconColor : 'secondary')
209
+ })
210
+ }
204
211
  a.emitClick(this.changeTabKey, { tabKey: tab.key })
205
212
  if (tab.click) a.emitClick(tab.click.key, tab.click.data || {})
206
213
  })