@castlabs/ui 7.13.0 → 7.15.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.
@@ -25,6 +25,7 @@ declare module '@castlabs/ui/dist/castlabs-ui.module.js' {
25
25
  export function clFormatDate (date: Date): string
26
26
  export function clFormatTimeUTC (date: Date): string
27
27
  export function clFormatDateTimeUTC (date: Date, seconds?: boolean): string
28
+ export function clFormatDateTimeTabularUTC (date: Date, year?:boolean, month?:boolean, day?:boolean, time?:boolean, seconds?:boolean): string
28
29
  export function clFormatDuration (from: Date, until: Date, seconds?: boolean, ms?: boolean): string
29
30
  export function clFormatPeriod (date: Date): string
30
31
  export function clFormatNumber (amount: number, decimalPlaces?: number): string
@@ -1,4 +1,4 @@
1
- /* @castlabs/ui v7.13.0 */
1
+ /* @castlabs/ui v7.15.0 */
2
2
 
3
3
  /*!
4
4
  * Bootstrap v5.3.8 (https://getbootstrap.com/)
@@ -174,20 +174,20 @@ function clCookieBannerShow (accept = clCookieBannerAccept, decline = clCookieBa
174
174
  >privacy policy</a>.
175
175
  </p>
176
176
 
177
- <div class="cl-spacing-box text-center">
177
+ <div class="cl-spacing-box cl-spread">
178
178
  <button
179
- id="cl-button-cookie-accept"
179
+ id="cl-button-cookie-decline"
180
180
  type="button"
181
- class="btn btn-sm cl-color-red it-ok"
181
+ class="btn btn-sm cl-color-night it-cancel"
182
182
  >
183
- Accept
183
+ Decline
184
184
  </button>
185
185
  <button
186
- id="cl-button-cookie-decline"
186
+ id="cl-button-cookie-accept"
187
187
  type="button"
188
- class="btn btn-sm cl-color-night it-cancel"
188
+ class="btn btn-sm cl-color-red it-ok"
189
189
  >
190
- Decline
190
+ Accept
191
191
  </button>
192
192
  </div>
193
193
  </div>
@@ -621,7 +621,11 @@ const APPS = {
621
621
  roles: [ROLE.VTK_USER_URN, ROLE.VTK_ADMIN_URN],
622
622
  title: SERVICE.VTK,
623
623
  urlManage: (env, oid) =>
624
- getEnvUrl(env, `https://vtk.castlabs.com/${oid}`, `https://vtks.castlabs.com/${oid}`),
624
+ getEnvUrl(
625
+ env,
626
+ `https://vtk.castlabs.com/${oid}/jobs/`,
627
+ `https://vtks.castlabs.com/${oid}/jobs/`
628
+ ),
625
629
  urlPlan: (env, oid) => urlCS(env, oid, '/plans/vtk'),
626
630
  sidenav: true
627
631
  }
@@ -1187,6 +1191,45 @@ export function clFormatDateTimeUTC (date, seconds = false) {
1187
1191
  return `${clFormatDate(date)} ${clFormatTimeUTC(date, seconds)}`
1188
1192
  }
1189
1193
 
1194
+ /**
1195
+ * Format a date and time into a sortable string.
1196
+ *
1197
+ * @param {Date} date Date to format.
1198
+ * @param {boolean} year If true (default), the output will contain a year.
1199
+ * @param {boolean} month If true (default), the output will contain a year.
1200
+ * @param {boolean} day If true (default), the output will contain a year.
1201
+ * @param {boolean} hour If true (default), the output will contain hour.
1202
+ * @param {boolean} minute If true (default), the output will contain hours and minutes.
1203
+ * @param {boolean} seconds If true (default false), the output will contain seconds.
1204
+ * @return {string} Formatted date, e.g. '2021-08-01 18:21'.
1205
+ */
1206
+ export function clFormatDateTimeTabularUTC (
1207
+ date,
1208
+ year = true,
1209
+ month = true,
1210
+ day = true,
1211
+ time = true,
1212
+ seconds = false
1213
+ ) {
1214
+ const YYYY = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(date)
1215
+ const MM = new Intl.DateTimeFormat('en', { month: '2-digit' }).format(date)
1216
+ const DD = new Intl.DateTimeFormat('en', { day: '2-digit' }).format(date)
1217
+ const [hh, mm, ss] = [
1218
+ ('' + date.getUTCHours()).padStart(2, '0'),
1219
+ ('' + date.getUTCMinutes()).padStart(2, '0'),
1220
+ ('' + date.getUTCSeconds()).padStart(2, '0')
1221
+ ]
1222
+
1223
+ let result = ''
1224
+ if (year) result += ` ${YYYY}`
1225
+ if (month) result += `-${MM}`
1226
+ if (day) result += `-${DD}`
1227
+ if (time) result += ` ${hh}:${mm}`
1228
+ if (seconds) result += `:${ss}`
1229
+
1230
+ return result.trim()
1231
+ }
1232
+
1190
1233
  /**
1191
1234
  * Format the duration between two dates. Format can adapt on scale of duraction (years/weeks, milliseconds, ...)
1192
1235
  *