@kinetis/vector-ui 0.11.3 → 0.12.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.
Files changed (179) hide show
  1. package/CHANGELOG.md +70 -1
  2. package/app/components/Vx/CommandPalette.vue +5 -2
  3. package/app/components/Vx/Confirm.vue +19 -3
  4. package/app/components/Vx/Input/Markdown.vue +2 -1
  5. package/app/components/Vx/Input/RichText.vue +3 -1
  6. package/app/components/Vx/Queues/Failed.vue +243 -0
  7. package/app/components/Vx/Queues/FailedDetail.vue +106 -0
  8. package/app/components/Vx/Queues/Metrics.vue +118 -0
  9. package/app/components/Vx/Queues/Overview.vue +167 -0
  10. package/app/components/Vx/Widget/Card.vue +11 -3
  11. package/app/components/Vx/Widget/Queues.vue +51 -0
  12. package/app/composables/useConfirm.ts +34 -5
  13. package/app/composables/useVectorExtensions.ts +16 -2
  14. package/app/composables/useVectorQueues.ts +81 -0
  15. package/app/composables/useVectorSchema.ts +1 -1
  16. package/app/i18n/ar/dashboard.ts +1 -0
  17. package/app/i18n/ar/index.ts +2 -1
  18. package/app/i18n/ar/queues.ts +118 -0
  19. package/app/i18n/de/dashboard.ts +1 -0
  20. package/app/i18n/de/index.ts +2 -1
  21. package/app/i18n/de/queues.ts +118 -0
  22. package/app/i18n/en/dashboard.ts +1 -0
  23. package/app/i18n/en/index.ts +2 -1
  24. package/app/i18n/en/queues.ts +118 -0
  25. package/app/i18n/es/dashboard.ts +1 -0
  26. package/app/i18n/es/index.ts +2 -1
  27. package/app/i18n/es/queues.ts +118 -0
  28. package/app/i18n/fr/dashboard.ts +1 -0
  29. package/app/i18n/fr/index.ts +2 -1
  30. package/app/i18n/fr/queues.ts +118 -0
  31. package/app/i18n/he/dashboard.ts +1 -0
  32. package/app/i18n/he/index.ts +2 -1
  33. package/app/i18n/he/queues.ts +118 -0
  34. package/app/i18n/it/dashboard.ts +1 -0
  35. package/app/i18n/it/index.ts +2 -1
  36. package/app/i18n/it/queues.ts +118 -0
  37. package/app/i18n/ja/dashboard.ts +1 -0
  38. package/app/i18n/ja/index.ts +2 -1
  39. package/app/i18n/ja/queues.ts +118 -0
  40. package/app/i18n/ko/dashboard.ts +1 -0
  41. package/app/i18n/ko/index.ts +2 -1
  42. package/app/i18n/ko/queues.ts +118 -0
  43. package/app/i18n/nl/dashboard.ts +1 -0
  44. package/app/i18n/nl/index.ts +2 -1
  45. package/app/i18n/nl/queues.ts +118 -0
  46. package/app/i18n/pl/dashboard.ts +1 -0
  47. package/app/i18n/pl/index.ts +2 -1
  48. package/app/i18n/pl/queues.ts +118 -0
  49. package/app/i18n/pt/dashboard.ts +1 -0
  50. package/app/i18n/pt/index.ts +2 -1
  51. package/app/i18n/pt/queues.ts +118 -0
  52. package/app/i18n/pt-BR/dashboard.ts +1 -0
  53. package/app/i18n/pt-BR/index.ts +2 -1
  54. package/app/i18n/pt-BR/queues.ts +118 -0
  55. package/app/i18n/ru/dashboard.ts +1 -0
  56. package/app/i18n/ru/index.ts +2 -1
  57. package/app/i18n/ru/queues.ts +118 -0
  58. package/app/i18n/tr/dashboard.ts +1 -0
  59. package/app/i18n/tr/index.ts +2 -1
  60. package/app/i18n/tr/queues.ts +118 -0
  61. package/app/i18n/uk/dashboard.ts +1 -0
  62. package/app/i18n/uk/index.ts +2 -1
  63. package/app/i18n/uk/queues.ts +118 -0
  64. package/app/i18n/zh-Hans/dashboard.ts +1 -0
  65. package/app/i18n/zh-Hans/index.ts +2 -1
  66. package/app/i18n/zh-Hans/queues.ts +118 -0
  67. package/app/layouts/vector.vue +5 -3
  68. package/app/pages/p/[name].vue +4 -2
  69. package/app/pages/queues/index.vue +58 -0
  70. package/app/plugins/vector-extensions.client.ts +30 -14
  71. package/app/types/vector.ts +95 -3
  72. package/app/utils/extensionLoader.ts +36 -0
  73. package/app/utils/queues.ts +153 -0
  74. package/dist/static/200.html +1 -1
  75. package/dist/static/404.html +1 -1
  76. package/dist/static/_nuxt/-CLe6vUm.js +1 -0
  77. package/dist/static/_nuxt/{qpVO-NAo.js → A_YrkIh-.js} +1 -1
  78. package/dist/static/_nuxt/B0taRzJN.js +1 -0
  79. package/dist/static/_nuxt/BC4n0Ghf.js +1 -0
  80. package/dist/static/_nuxt/{DzOxWOFX.js → BDLoIbc4.js} +1 -1
  81. package/dist/static/_nuxt/{CHpNSaGi.js → BDwgkdzs.js} +1 -1
  82. package/dist/static/_nuxt/BFBN0MCm.js +1 -0
  83. package/dist/static/_nuxt/BMS510w1.js +1 -0
  84. package/dist/static/_nuxt/BQH4NHkG.js +1 -0
  85. package/dist/static/_nuxt/BSYV8YR9.js +1 -0
  86. package/dist/static/_nuxt/{BOc3bd5G.js → BWmtnGCr.js} +1 -1
  87. package/dist/static/_nuxt/BZKBoSZy.js +1 -0
  88. package/dist/static/_nuxt/BhY1yzIk.js +1 -0
  89. package/dist/static/_nuxt/Bi_p8utQ.js +1 -0
  90. package/dist/static/_nuxt/{BH3E4sUK.js → BnRGraEc.js} +1 -1
  91. package/dist/static/_nuxt/{5WvxG0mj.js → BqBjYl5i.js} +1 -1
  92. package/dist/static/_nuxt/Br-v6nfV.js +1 -0
  93. package/dist/static/_nuxt/{C5Ez1FXH.js → BsCAElgq.js} +1 -1
  94. package/dist/static/_nuxt/{BwHwQnM0.js → BtSHpy4S.js} +1 -1
  95. package/dist/static/_nuxt/BzY34lc1.js +1 -0
  96. package/dist/static/_nuxt/C64NUw_T.js +1 -0
  97. package/dist/static/_nuxt/C6P-usW8.js +1 -0
  98. package/dist/static/_nuxt/{BVRr96yG.js → CCev1aKa.js} +1 -1
  99. package/dist/static/_nuxt/{Dorn4eG1.js → CEAJldjl.js} +1 -1
  100. package/dist/static/_nuxt/{Bs6-HCEW.js → CNKBVevI.js} +1 -1
  101. package/dist/static/_nuxt/{DGOB4cMy.js → C_g8bZuk.js} +1 -1
  102. package/dist/static/_nuxt/CgxSerDc.js +1 -0
  103. package/dist/static/_nuxt/CuG-8Z4K.js +105 -0
  104. package/dist/static/_nuxt/{2oUN-NEf.js → CvqfGMjv.js} +1 -1
  105. package/dist/static/_nuxt/CxlUCc9r.js +1 -0
  106. package/dist/static/_nuxt/D1Z538bJ.js +1 -0
  107. package/dist/static/_nuxt/{CXIZ5vIr.js → D1nKViyT.js} +1 -1
  108. package/dist/static/_nuxt/{D8kTmNUH.js → D7as59Fa.js} +1 -1
  109. package/dist/static/_nuxt/{B1-Pqo_7.js → D8QRJNA1.js} +1 -1
  110. package/dist/static/_nuxt/DB9Px0Zg.js +1 -0
  111. package/dist/static/_nuxt/DJsVN_9p.js +1 -0
  112. package/dist/static/_nuxt/DSIjvNuw.js +2 -0
  113. package/dist/static/_nuxt/{C_Ouo24Z.js → DayrADeq.js} +1 -1
  114. package/dist/static/_nuxt/DhiDhXgK.js +2 -0
  115. package/dist/static/_nuxt/{Dialog.B6aT2GLZ.css → Dialog.al_QQir4.css} +1 -1
  116. package/dist/static/_nuxt/DjPCgCyJ.js +1 -0
  117. package/dist/static/_nuxt/{BSfpIrlx.js → Dm7hGi3P.js} +1 -1
  118. package/dist/static/_nuxt/DqjZ16aB.js +1 -0
  119. package/dist/static/_nuxt/DssSpQf8.js +1 -0
  120. package/dist/static/_nuxt/VBtn.DYtpaadd.css +1 -0
  121. package/dist/static/_nuxt/{CADHRY6v.js → ZVCqzuKT.js} +1 -1
  122. package/dist/static/_nuxt/builds/latest.json +1 -1
  123. package/dist/static/_nuxt/builds/meta/f5ce5132-6b99-4f7d-9c7c-6cef19f59d51.json +1 -0
  124. package/dist/static/_nuxt/{entry.BW8eGVIg.css → entry.Sg6-iCOx.css} +1 -1
  125. package/dist/static/_nuxt/error-404.B9sBsxLH.css +1 -0
  126. package/dist/static/_nuxt/error-500.Dy1PcAYT.css +1 -0
  127. package/dist/static/_nuxt/mbGIOAkp.js +1 -0
  128. package/dist/static/_nuxt/qzTYEKJ1.js +2 -0
  129. package/dist/static/_nuxt/{BKxQp7go.js → rVO8WoV9.js} +3 -3
  130. package/dist/static/_nuxt/rkb3Oe3x.js +1 -0
  131. package/dist/static/_nuxt/sIY_uPia.js +1 -0
  132. package/dist/static/_nuxt/tm30M8Ch.js +1 -0
  133. package/dist/static/_nuxt/vab0LrNP.js +67 -0
  134. package/dist/static/_nuxt/{DmrPXKlp.js → vmqqxV_Q.js} +1 -1
  135. package/dist/static/_nuxt/{UfoGua8K.js → xd2mj56f.js} +1 -1
  136. package/dist/static/index.html +1 -1
  137. package/dist/static/jobs/index.html +1 -1
  138. package/dist/static/login/index.html +1 -1
  139. package/dist/static/queues/index.html +1 -0
  140. package/dist/static/settings/index.html +1 -1
  141. package/dist/static/vector-bundle.json +70 -71
  142. package/package.json +17 -17
  143. package/dist/static/_nuxt/B1NXg37X.js +0 -1
  144. package/dist/static/_nuxt/BHPSB5VN.js +0 -1
  145. package/dist/static/_nuxt/BQKTPMnh.js +0 -1
  146. package/dist/static/_nuxt/BZweJiQx.js +0 -1
  147. package/dist/static/_nuxt/B_RjakRk.js +0 -1
  148. package/dist/static/_nuxt/BfsupGyC.js +0 -1
  149. package/dist/static/_nuxt/BgRi2kFj.js +0 -1
  150. package/dist/static/_nuxt/BpaVnQT3.js +0 -1
  151. package/dist/static/_nuxt/C32HLL_3.js +0 -1
  152. package/dist/static/_nuxt/C3XkRFds.js +0 -1
  153. package/dist/static/_nuxt/C4rsQhBq.js +0 -1
  154. package/dist/static/_nuxt/CEMM7MyS.js +0 -100
  155. package/dist/static/_nuxt/CJCvPySI.js +0 -1
  156. package/dist/static/_nuxt/CQnAjs6t.js +0 -1
  157. package/dist/static/_nuxt/CXxZ_oTv.js +0 -1
  158. package/dist/static/_nuxt/C_zyLiGr.js +0 -1
  159. package/dist/static/_nuxt/CsTzOWPJ.js +0 -1
  160. package/dist/static/_nuxt/CtrzPVjw.js +0 -1
  161. package/dist/static/_nuxt/Cuw0Qa9p.js +0 -1
  162. package/dist/static/_nuxt/CxFDmUjN.js +0 -67
  163. package/dist/static/_nuxt/Cya8cjkR.js +0 -2
  164. package/dist/static/_nuxt/DFQG9ZD0.js +0 -1
  165. package/dist/static/_nuxt/DS8Zc0uz.js +0 -1
  166. package/dist/static/_nuxt/DZwwQ4WY.js +0 -1
  167. package/dist/static/_nuxt/DcteQ4TC.js +0 -1
  168. package/dist/static/_nuxt/DdqPXmq8.js +0 -1
  169. package/dist/static/_nuxt/DjL4J8kw.js +0 -2
  170. package/dist/static/_nuxt/F676SWHd.js +0 -1
  171. package/dist/static/_nuxt/Form.BfskSJ5D.css +0 -1
  172. package/dist/static/_nuxt/K6puNuXp.js +0 -2
  173. package/dist/static/_nuxt/VDialog.CZWf1yfq.css +0 -1
  174. package/dist/static/_nuxt/VSkeletonLoader.BXLoM9sb.css +0 -1
  175. package/dist/static/_nuxt/VTabs.buBMAvtA.css +0 -1
  176. package/dist/static/_nuxt/builds/meta/ba4cc360-829e-4272-bb1c-7391e700bb32.json +0 -1
  177. package/dist/static/_nuxt/error-404.B1_4-op0.css +0 -1
  178. package/dist/static/_nuxt/error-500.ueligmdw.css +0 -1
  179. package/dist/static/_nuxt/xkua0wtW.js +0 -1
@@ -0,0 +1,167 @@
1
+ <script setup lang="ts">
2
+ import type { VectorQueue, VectorQueuePermissions } from '#vector/app/types/vector'
3
+
4
+ // The overview: GET /vector/queues every QUEUE_POLL_MS while the page is
5
+ // visible, one request at a time — the next is scheduled only once the last
6
+ // settled — and never after the tab is unmounted or once the server refused
7
+ // the dashboard. The Failed column is there only with failed jobs.
8
+ const props = defineProps<{ permissions: VectorQueuePermissions, failedJobs: boolean }>()
9
+
10
+ const { t } = useVectorT()
11
+ const queues = useVectorQueues()
12
+ const notifications = useVectorNotifications()
13
+ const { confirmTyped } = useConfirm()
14
+ const uid = useId()
15
+
16
+ const rows = ref<VectorQueue[] | null>(null)
17
+ const refused = ref(false)
18
+ const error = ref<string | null>(null)
19
+ // the queue being cleared: only its row's Clear shows as loading, and no second clear starts meanwhile
20
+ const acting = ref<string | null>(null)
21
+ let timer: ReturnType<typeof setTimeout> | null = null
22
+ let inFlight = false
23
+ let again = false
24
+ let stopped = false
25
+
26
+ function unschedule() {
27
+ if (timer !== null) clearTimeout(timer)
28
+ timer = null
29
+ }
30
+
31
+ function schedule() {
32
+ unschedule()
33
+ if (!stopped && !document.hidden) timer = setTimeout(refresh, QUEUE_POLL_MS)
34
+ }
35
+
36
+ async function refresh() {
37
+ if (inFlight) {
38
+ again = true
39
+ return
40
+ }
41
+ unschedule()
42
+ if (stopped) return
43
+ inFlight = true
44
+ try {
45
+ rows.value = await queues.overview()
46
+ error.value = null
47
+ } catch (caught) {
48
+ if (queueAccessRefused(caught)) {
49
+ refused.value = true
50
+ stopped = true
51
+ } else {
52
+ error.value = describeQueueError(caught)
53
+ }
54
+ } finally {
55
+ inFlight = false
56
+ if (again) {
57
+ again = false
58
+ void refresh()
59
+ } else {
60
+ schedule()
61
+ }
62
+ }
63
+ }
64
+
65
+ function onVisibility() {
66
+ if (document.hidden) unschedule()
67
+ else if (!inFlight) void refresh()
68
+ }
69
+
70
+ onMounted(() => {
71
+ document.addEventListener('visibilitychange', onVisibility)
72
+ void refresh()
73
+ })
74
+
75
+ onBeforeUnmount(() => {
76
+ stopped = true
77
+ unschedule()
78
+ document.removeEventListener('visibilitychange', onVisibility)
79
+ })
80
+
81
+ const canClear = (row: VectorQueue) => props.permissions.clear[row.name] === true
82
+
83
+ /** Asks the user to type the queue's name, then sends what they typed as the server's `confirm`. */
84
+ async function clear(queue: string) {
85
+ if (acting.value !== null) return
86
+ const typed = await confirmTyped({
87
+ title: t('queues.overview.clearTitle', { queue }),
88
+ text: t('queues.overview.clearText', { queue }),
89
+ confirmText: t('queues.actions.confirm'),
90
+ cancelText: t('queues.actions.cancel'),
91
+ destructive: true,
92
+ requireText: queue,
93
+ requireLabel: t('queues.overview.clearType', { queue }),
94
+ })
95
+ if (typed === null || acting.value !== null) return
96
+
97
+ acting.value = queue
98
+ try {
99
+ const cleared = await queues.clear(queue, typed)
100
+ notifications.success(t('queues.overview.cleared', { queue, count: cleared }))
101
+ } catch (caught) {
102
+ const status = queueErrorStatus(caught)
103
+ notifications.error(status === 409
104
+ ? t('queues.overview.clearUnsupported', { queue })
105
+ : status === 422 ? t('queues.overview.clearInvalid', { queue, detail: vectorErrorMessage(caught) }) : describeQueueError(caught))
106
+ } finally {
107
+ acting.value = null
108
+ }
109
+ void refresh()
110
+ }
111
+ </script>
112
+
113
+ <template>
114
+ <v-alert v-if="refused" type="warning" variant="tonal" :text="t('queues.noAccess')" data-state="no-access" />
115
+ <template v-else-if="rows === null">
116
+ <v-alert v-if="error" type="error" variant="tonal" :text="error" />
117
+ <v-progress-linear v-else indeterminate color="primary" :aria-label="t('queues.loading')" />
118
+ </template>
119
+ <div v-else>
120
+ <v-alert v-if="error" type="error" variant="tonal" density="compact" class="mb-3" :text="error" />
121
+ <p v-if="rows.length === 0" class="text-medium-emphasis">{{ t('queues.overview.empty') }}</p>
122
+ <v-table v-else hover>
123
+ <thead>
124
+ <tr>
125
+ <th scope="col" class="text-start">{{ t('queues.overview.queue') }}</th>
126
+ <th scope="col" class="text-end">{{ t('queues.overview.size') }}</th>
127
+ <th v-if="failedJobs" scope="col" class="text-end" data-column="failed">{{ t('queues.overview.failed') }}</th>
128
+ <th scope="col" class="text-end"><span class="d-sr-only">{{ t('common.actions') }}</span></th>
129
+ </tr>
130
+ </thead>
131
+ <tbody>
132
+ <tr v-for="(row, index) in rows" :key="row.name" :data-queue="row.name">
133
+ <td>{{ row.name }}</td>
134
+ <td class="text-end" style="font-variant-numeric: tabular-nums">{{ row.size === null ? t('queues.overview.unknownSize') : queueNumber(row.size) }}</td>
135
+ <td v-if="failedJobs" class="text-end" style="font-variant-numeric: tabular-nums">
136
+ <v-chip v-if="(row.failed ?? 0) > 0" size="small" color="error" variant="tonal" label>{{ queueNumber(row.failed) }}</v-chip>
137
+ <template v-else>{{ queueNumber(row.failed) }}</template>
138
+ </td>
139
+ <td class="text-end">
140
+ <template v-if="canClear(row)">
141
+ <v-btn
142
+ v-if="row.clearable"
143
+ size="small"
144
+ variant="tonal"
145
+ color="error"
146
+ prepend-icon="mdi-delete-sweep-outline"
147
+ :loading="acting === row.name"
148
+ data-action="clear"
149
+ @click="clear(row.name)"
150
+ >{{ t('queues.overview.clear') }}</v-btn>
151
+ <!-- a disabled button receives neither pointer events nor focus: the tooltip hangs on a
152
+ wrapper the keyboard reaches, which also names the reason for a screen reader -->
153
+ <v-tooltip v-else :text="t('queues.overview.clearUnavailable')" location="top">
154
+ <template #activator="{ props: activator }">
155
+ <span v-bind="activator" tabindex="0" :aria-describedby="`${uid}-unavailable-${index}`" class="d-inline-block" data-state="clear-unavailable">
156
+ <v-btn size="small" variant="tonal" color="error" prepend-icon="mdi-delete-sweep-outline" disabled data-action="clear">{{ t('queues.overview.clear') }}</v-btn>
157
+ <span :id="`${uid}-unavailable-${index}`" class="d-sr-only">{{ t('queues.overview.clearUnavailable') }}</span>
158
+ </span>
159
+ </template>
160
+ </v-tooltip>
161
+ </template>
162
+ </td>
163
+ </tr>
164
+ </tbody>
165
+ </v-table>
166
+ </div>
167
+ </template>
@@ -43,11 +43,18 @@ const builtIn: Record<string, Component> = {
43
43
  partition: defineAsyncComponent(() => import('#vector/app/components/Vx/Widget/Partition.vue')),
44
44
  progress: defineAsyncComponent(() => import('#vector/app/components/Vx/Widget/Progress.vue')),
45
45
  table: defineAsyncComponent(() => import('#vector/app/components/Vx/Widget/Table.vue')),
46
+ queues: defineAsyncComponent(() => import('#vector/app/components/Vx/Widget/Queues.vue')),
46
47
  }
47
48
 
49
+ // null for a type with no built-in card and no registered renderer: an
50
+ // extension type the application registered no card for (defineWidget in
51
+ // its runtime extension, or app.config vector.widgets), or whose runtime
52
+ // extension failed to load. The card says so instead of guessing at a shape.
53
+ // The registries are taken in setup; the computed only reads them.
54
+ const extensions = useVectorExtensions()
48
55
  const component = computed(() => {
49
- const override = appConfig.vector.widgets[props.widget.type] ?? useVectorExtensions().widgets.get(props.widget.type)
50
- if (!override) return builtIn[props.widget.type] ?? builtIn.stat!
56
+ const override = appConfig.vector.widgets[props.widget.type] ?? extensions.widgets.get(props.widget.type)
57
+ if (!override) return builtIn[props.widget.type] ?? null
51
58
  return typeof override === 'string' ? resolveComponent(override) : override
52
59
  })
53
60
  </script>
@@ -73,7 +80,8 @@ const component = computed(() => {
73
80
  </template>
74
81
  </v-card-item>
75
82
  <v-card-text class="flex-grow-1 d-flex flex-column justify-center">
76
- <v-progress-linear v-if="loading && !data" indeterminate color="primary" :aria-label="t('dashboard.loading')" />
83
+ <v-alert v-if="!component" type="warning" variant="tonal" density="compact" :text="t('dashboard.noRenderer', { type: widget.type })" />
84
+ <v-progress-linear v-else-if="loading && !data" indeterminate color="primary" :aria-label="t('dashboard.loading')" />
77
85
  <v-alert v-else-if="error" type="error" variant="tonal" density="compact" :text="error" />
78
86
  <component :is="component" v-else-if="data" :data="data" :widget="widget" />
79
87
  </v-card-text>
@@ -0,0 +1,51 @@
1
+ <script setup lang="ts">
2
+ import type { VectorWidgetData } from '#vector/app/types/vector'
3
+
4
+ // The queue dashboard's card, the built-in `queues` type: the jobs waiting
5
+ // and failed across the watched queues, read from GET /vector/queues itself
6
+ // (the widget's own answer carries no data), and a link to the Queues page.
7
+ // The failed figure is there only with failed jobs: the overview's `failed`
8
+ // is null without them.
9
+ defineProps<{ data: VectorWidgetData }>()
10
+
11
+ const { t } = useVectorT()
12
+ const appConfig = useAppConfig()
13
+ const queues = useVectorQueues()
14
+ const totals = ref<{ pending: number | null, failed: number | null } | null>(null)
15
+ const refused = ref(false)
16
+ const error = ref<string | null>(null)
17
+
18
+ onMounted(async () => {
19
+ try {
20
+ const rows = await queues.overview()
21
+ const known = rows.filter(row => row.size !== null)
22
+ const counted = rows.filter(row => row.failed !== null)
23
+ totals.value = {
24
+ pending: known.length === 0 ? null : known.reduce((sum, row) => sum + (row.size ?? 0), 0),
25
+ failed: counted.length === 0 ? null : counted.reduce((sum, row) => sum + (row.failed ?? 0), 0),
26
+ }
27
+ } catch (caught) {
28
+ if (queueAccessRefused(caught)) refused.value = true
29
+ else error.value = describeQueueError(caught)
30
+ }
31
+ })
32
+ </script>
33
+
34
+ <template>
35
+ <v-alert v-if="refused" type="warning" variant="tonal" density="compact" :text="t('queues.noAccess')" data-state="no-access" />
36
+ <v-alert v-else-if="error" type="error" variant="tonal" density="compact" :text="error" />
37
+ <v-progress-linear v-else-if="totals === null" indeterminate color="primary" :aria-label="t('queues.loading')" />
38
+ <div v-else>
39
+ <div class="d-flex ga-4 mb-2">
40
+ <div class="flex-grow-1" data-figure="pending">
41
+ <div class="text-h4" style="font-variant-numeric: tabular-nums">{{ queueNumber(totals.pending) }}</div>
42
+ <div class="text-caption text-medium-emphasis">{{ t('queues.widget.pending') }}</div>
43
+ </div>
44
+ <div v-if="totals.failed !== null" class="flex-grow-1" data-figure="failed">
45
+ <div class="text-h4" :class="{ 'text-error': totals.failed > 0 }" style="font-variant-numeric: tabular-nums">{{ queueNumber(totals.failed) }}</div>
46
+ <div class="text-caption text-medium-emphasis">{{ t('queues.widget.failed') }}</div>
47
+ </div>
48
+ </div>
49
+ <v-btn variant="text" size="small" append-icon="mdi-arrow-right" class="px-0" :to="`${appConfig.vector.basePath}/queues`">{{ t('queues.widget.open') }}</v-btn>
50
+ </div>
51
+ </template>
@@ -4,31 +4,60 @@ export interface ConfirmOptions {
4
4
  confirmText?: string
5
5
  cancelText?: string
6
6
  destructive?: boolean
7
+ /**
8
+ * A typed guard: the dialog shows a field, and its confirm button stays
9
+ * disabled until what was typed equals this exactly.
10
+ */
11
+ requireText?: string
12
+ /** The typed field's label; required wherever `requireText` is set, so the field has an accessible name. */
13
+ requireLabel?: string
7
14
  }
8
15
 
9
16
  interface PendingConfirm extends ConfirmOptions {
10
- resolve: (confirmed: boolean) => void
17
+ /** What was typed on confirm ('' without `requireText`), or null when declined. */
18
+ resolve: (typed: string | null) => void
11
19
  }
12
20
 
13
21
  /**
14
22
  * A promise-based confirmation. Vuetify ships no programmatic dialog;
15
23
  * VxConfirm, mounted once in the layout, renders whatever is pending.
24
+ * `confirmTyped()` asks for a typed confirmation and resolves to what was
25
+ * typed, so a caller sends the user's own text rather than its own copy.
16
26
  */
17
27
  export function useConfirm() {
18
28
  const pending = useState<PendingConfirm | null>('vector.confirm', () => null)
29
+ const typed = useState<string>('vector.confirm.typed', () => '')
30
+ const canConfirm = computed(() => pending.value !== null
31
+ && (pending.value.requireText === undefined || typed.value === pending.value.requireText))
19
32
 
20
- function confirm(options: ConfirmOptions): Promise<boolean> {
21
- pending.value?.resolve(false) // whoever asked first is answered, not left waiting
33
+ function ask(options: ConfirmOptions): Promise<string | null> {
34
+ pending.value?.resolve(null) // whoever asked first is answered, not left waiting
35
+ typed.value = ''
22
36
 
23
37
  return new Promise((resolve) => {
24
38
  pending.value = { ...options, resolve }
25
39
  })
26
40
  }
27
41
 
42
+ function confirm(options: ConfirmOptions): Promise<boolean> {
43
+ return ask(options).then(answer => answer !== null)
44
+ }
45
+
46
+ /** Resolves to the typed text — equal to `requireText` — on confirm, or null when declined. */
47
+ function confirmTyped(options: ConfirmOptions & { requireText: string, requireLabel: string }): Promise<string | null> {
48
+ return ask(options)
49
+ }
50
+
51
+ /** Answers the pending question; a confirm before the typed text matches is ignored, the dialog stays open. */
28
52
  function settle(confirmed: boolean) {
29
- pending.value?.resolve(confirmed)
53
+ const current = pending.value
54
+ if (current === null) return
55
+ if (confirmed && !canConfirm.value) return
56
+ const answer = confirmed ? typed.value : null
30
57
  pending.value = null
58
+ typed.value = ''
59
+ current.resolve(answer)
31
60
  }
32
61
 
33
- return { pending, confirm, settle }
62
+ return { pending, typed, canConfirm, confirm, confirmTyped, settle }
34
63
  }
@@ -1,15 +1,29 @@
1
1
  import type { Component } from 'vue'
2
2
  import type { AnyExtension } from '@tiptap/core'
3
3
 
4
+ /**
5
+ * A custom page's title or menu section: a string, or a function returning
6
+ * one — `() => t('stock.title')` — called each time it is shown, so it
7
+ * follows a change of language.
8
+ */
9
+ export type VectorPageLabel = string | (() => string)
10
+
4
11
  /** A custom page: a menu entry and a route, `/p/{name}`, rendering the component. */
5
12
  export interface VectorPageDefinition {
6
- title: string
13
+ title: VectorPageLabel
7
14
  icon?: string
8
15
  /** The menu section it appears under; the "Pages" section when omitted. */
9
- group?: string
16
+ group?: VectorPageLabel
10
17
  component: Component | string
11
18
  }
12
19
 
20
+ /** The text of a page's title or group: a function is called now, inside whatever computed or render reads it. */
21
+ export function pageLabel(label: VectorPageLabel): string
22
+ export function pageLabel(label: VectorPageLabel | undefined): string | undefined
23
+ export function pageLabel(label: VectorPageLabel | undefined): string | undefined {
24
+ return typeof label === 'function' ? label() : label
25
+ }
26
+
13
27
  /**
14
28
  * The registries runtime extensions fill through `window.Vector`:
15
29
  * cells, inputs, widget renderers and custom pages by name. Reactive, so
@@ -0,0 +1,81 @@
1
+ import type {
2
+ VectorFailedJob,
3
+ VectorFailedJobFilters,
4
+ VectorFailedJobPage,
5
+ VectorQueue,
6
+ VectorQueueMetrics,
7
+ VectorQueuePermissions,
8
+ VectorRetryResult,
9
+ } from '#vector/app/types/vector'
10
+
11
+ /**
12
+ * The queue dashboard's API, under /vector/queues: the overview, the
13
+ * permissions the policy grants, the failed jobs (where the descriptor's
14
+ * `capabilities.failedJobs` says they are there) and the job metrics.
15
+ * What the permissions disallow the UI leaves out, but that is cosmetic:
16
+ * the server asks the policy on every call.
17
+ */
18
+ export function useVectorQueues() {
19
+ const api = useVectorApi()
20
+ const path = (queue: string) => `/vector/queues/${encodeURIComponent(queue)}`
21
+
22
+ async function overview(): Promise<VectorQueue[]> {
23
+ return (await api<{ data: VectorQueue[] }>('/vector/queues')).data
24
+ }
25
+
26
+ async function permissions(): Promise<VectorQueuePermissions> {
27
+ return await api<VectorQueuePermissions>('/vector/queues/permissions')
28
+ }
29
+
30
+ /**
31
+ * Discards every job waiting on `queue`. `confirm` is the name the user
32
+ * typed, sent as typed: the server clears only when it equals `queue`
33
+ * and answers 422 otherwise.
34
+ */
35
+ async function clear(queue: string, confirm: string): Promise<number> {
36
+ return (await api<{ data: { queue: string, cleared: number } }>(`${path(queue)}/clear`, { method: 'POST', body: { confirm } })).data.cleared
37
+ }
38
+
39
+ /** One page, newest first: the first for `filters`, or the one after `cursor`. */
40
+ async function failed(filters: VectorFailedJobFilters, cursor: string | null = null): Promise<VectorFailedJobPage> {
41
+ const query = compactQuery({
42
+ queue: filters.queue,
43
+ class: filters.class.trim(),
44
+ failedFrom: toRfc3339(filters.failedFrom),
45
+ failedTo: toRfc3339(filters.failedTo),
46
+ cursor,
47
+ })
48
+ return await api<VectorFailedJobPage>('/vector/queues/failed', { query })
49
+ }
50
+
51
+ async function failedJob(id: string): Promise<VectorFailedJob> {
52
+ return (await api<{ data: VectorFailedJob }>(`/vector/queues/failed/${encodeURIComponent(id)}`)).data
53
+ }
54
+
55
+ /** Retries up to QUEUE_MAX_RETRY_BATCH jobs, one result each. */
56
+ async function retry(ids: string[]): Promise<VectorRetryResult[]> {
57
+ return (await api<{ data: VectorRetryResult[] }>('/vector/queues/failed/retry', { method: 'POST', body: { ids } })).data
58
+ }
59
+
60
+ async function forget(id: string): Promise<void> {
61
+ await api(`/vector/queues/failed/${encodeURIComponent(id)}`, { method: 'DELETE' })
62
+ }
63
+
64
+ /** Deletes every failure record older than `days`, on every queue; how many it deleted. */
65
+ async function prune(days: number): Promise<number> {
66
+ return (await api<{ data: { deleted: number, olderThanSeconds: number } }>('/vector/queues/failed/prune', { method: 'POST', body: { days } })).data.deleted
67
+ }
68
+
69
+ /**
70
+ * The metrics for the last `minutes` minutes on `queue` ('' for all):
71
+ * both ends from this clock, so the window is exactly the one chosen
72
+ * whatever the server's clock says.
73
+ */
74
+ async function metrics(queue: string, minutes: number): Promise<VectorQueueMetrics> {
75
+ const to = Math.floor(Date.now() / 60000) * 60
76
+ const from = to - (minutes - 1) * 60
77
+ return (await api<{ data: VectorQueueMetrics }>('/vector/queues/metrics', { query: compactQuery({ queue, from, to }) })).data
78
+ }
79
+
80
+ return { overview, permissions, clear, failed, failedJob, retry, forget, prune, metrics }
81
+ }
@@ -5,7 +5,7 @@ import type { VectorResource, VectorSchema } from '#vector/app/types/vector'
5
5
  let latestLoad = 0
6
6
 
7
7
  /** The descriptor contract this UI reads: the `version` kinetis/vector publishes (VectorRegistry::VERSION). */
8
- export const DESCRIPTOR_VERSION = 4
8
+ export const DESCRIPTOR_VERSION = 5
9
9
 
10
10
  /**
11
11
  * The descriptor, loaded once per session and shared by every page. The
@@ -3,6 +3,7 @@ export default {
3
3
  title: 'لوحة المعلومات',
4
4
  range: 'النطاق',
5
5
  loading: 'جارٍ التحميل',
6
+ noRenderer: 'لا يوجد عارض مسجَّل لنوع الأداة {type}.',
6
7
  percent: '{value}%',
7
8
  duration: {
8
9
  minutes: '{value} دقيقة',
@@ -4,9 +4,10 @@ import dashboard from './dashboard'
4
4
  import fields from './fields'
5
5
  import jobs from './jobs'
6
6
  import list from './list'
7
+ import queues from './queues'
7
8
  import record from './record'
8
9
  import settings from './settings'
9
10
  import shell from './shell'
10
11
 
11
12
  /** Arabic (machine translation): one object per area of the UI, mirroring en. */
12
- export default { common, shell, list, record, actions, dashboard, jobs, settings, fields }
13
+ export default { common, shell, list, record, actions, dashboard, jobs, queues, settings, fields }
@@ -0,0 +1,118 @@
1
+ // The queue dashboard's strings; see common.ts for words every area shares.
2
+ export default {
3
+ title: 'قوائم الانتظار',
4
+ loading: 'جارٍ التحميل…',
5
+ none: '—',
6
+ percent: '{value}%',
7
+ noAccess: 'لا يمكن لحسابك عرض لوحة قوائم الانتظار.',
8
+ tabs: {
9
+ overview: 'نظرة عامة',
10
+ failed: 'المهام الفاشلة',
11
+ metrics: 'المقاييس',
12
+ },
13
+ actions: {
14
+ cancel: 'إلغاء',
15
+ confirm: 'تأكيد',
16
+ refresh: 'تحديث',
17
+ back: 'رجوع',
18
+ },
19
+ errors: {
20
+ forbidden: 'لا يمكن لحسابك القيام بذلك.',
21
+ notFound: 'لم يعد موجودًا.',
22
+ conflict: 'رفض الخادم ذلك: {detail}',
23
+ invalid: 'تم رفض الطلب: {detail}',
24
+ failed: 'حدث خطأ ما: {detail}',
25
+ },
26
+ overview: {
27
+ queue: 'قائمة الانتظار',
28
+ size: 'قيد الانتظار',
29
+ failed: 'فاشلة',
30
+ unknownSize: 'غير معروف',
31
+ empty: 'لا توجد قوائم انتظار قيد المراقبة.',
32
+ clear: 'تفريغ',
33
+ clearUnavailable: 'لا يمكن لواجهة قائمة الانتظار هذه تجاهل المهام المنتظرة.',
34
+ clearTitle: 'تفريغ "{queue}"؟',
35
+ clearText: 'سيتم تجاهل كل المهام المنتظرة في "{queue}". لا يمكن التراجع عن ذلك.',
36
+ cleared: 'تم تجاهل {count} مهمة من "{queue}".',
37
+ clearUnsupported: 'لا يمكن لواجهة قائمة الانتظار هذه تجاهل المهام المنتظرة، لذا لم يتم تفريغ "{queue}".',
38
+ clearInvalid: 'لم يتم تفريغ "{queue}": {detail}',
39
+ clearType: 'Type "{queue}" to confirm',
40
+ },
41
+ failed: {
42
+ filters: {
43
+ queue: 'قائمة الانتظار',
44
+ allQueues: 'كل قوائم الانتظار',
45
+ class: 'فئة المهمة',
46
+ from: 'فشلت منذ',
47
+ to: 'فشلت حتى',
48
+ apply: 'تطبيق',
49
+ reset: 'إعادة تعيين',
50
+ invalidDate: 'Enter a complete, valid date and time.',
51
+ },
52
+ select: 'تحديد {id}',
53
+ selection: 'Selection',
54
+ id: 'المعرّف',
55
+ class: 'فئة المهمة',
56
+ queue: 'قائمة الانتظار',
57
+ attempts: 'المحاولات',
58
+ attemptsOf: '{attempts} من {max}',
59
+ exception: 'الاستثناء',
60
+ failedAt: 'وقت الفشل',
61
+ empty: 'لا توجد مهام فاشلة مطابقة.',
62
+ loadMore: 'تحميل المزيد',
63
+ open: 'التفاصيل',
64
+ retry: 'إعادة المحاولة',
65
+ retrySelected: 'إعادة محاولة المحدد ({count})',
66
+ retryLimit: 'تتم إعادة محاولة {max} مهمة كحد أقصى في المرة الواحدة.',
67
+ retryTitle: 'إعادة محاولة {count} مهمة؟',
68
+ retryText: 'تُعاد كل مهمة إلى قائمة انتظارها ويُحذف سجل فشلها.',
69
+ retried: 'أُعيدت محاولة {retried}؛ لم يُعثر على {notFound}؛ فشلت {failed}.',
70
+ forget: 'نسيان',
71
+ forgetTitle: 'نسيان هذه المهمة الفاشلة؟',
72
+ forgetText: 'يُحذف السجل دون إعادة محاولة المهمة.',
73
+ forgotten: 'تم نسيان المهمة الفاشلة.',
74
+ prune: 'تنظيف',
75
+ pruneDays: 'أقدم من (أيام)',
76
+ pruneTitle: 'تنظيف المهام الفاشلة الأقدم من {days} يوم؟',
77
+ pruneText: 'يُحذف كل سجل فشل أقدم من ذلك، في كل قوائم الانتظار.',
78
+ pruned: 'تم حذف {count} سجل فشل.',
79
+ detail: {
80
+ title: 'المهمة الفاشلة {id}',
81
+ connection: 'الاتصال',
82
+ message: 'الرسالة',
83
+ trace: 'تتبع المكدس',
84
+ noTrace: 'لا يُسجَّل تتبع للمكدس للمهام الفاشلة.',
85
+ args: 'المعاملات',
86
+ },
87
+ },
88
+ metrics: {
89
+ queue: 'قائمة الانتظار',
90
+ allQueues: 'كل قوائم الانتظار',
91
+ window: 'النافذة الزمنية',
92
+ windows: {
93
+ m15: 'آخر 15 دقيقة',
94
+ m60: 'آخر ساعة',
95
+ m360: 'آخر 6 ساعات',
96
+ m1440: 'آخر 24 ساعة',
97
+ m10080: 'آخر 7 أيام',
98
+ },
99
+ succeeded: 'الناجحة',
100
+ released: 'المُعادة',
101
+ failed: 'الفاشلة',
102
+ failureRate: 'معدل الفشل',
103
+ averageDuration: 'المتوسط (مللي ثانية)',
104
+ maxDuration: 'الأطول (مللي ثانية)',
105
+ lastProcessed: 'آخر معالجة',
106
+ class: 'فئة المهمة',
107
+ byQueue: 'حسب قائمة الانتظار',
108
+ byClass: 'حسب فئة المهمة',
109
+ throughput: 'المحاولات في الدقيقة',
110
+ throughputLabel: 'Attempts per minute, {window}, {queue}: {total} in total',
111
+ empty: 'لم يُنفَّذ شيء في هذه النافذة.',
112
+ },
113
+ widget: {
114
+ pending: 'قيد الانتظار',
115
+ failed: 'فاشلة',
116
+ open: 'فتح قوائم الانتظار',
117
+ },
118
+ }
@@ -3,6 +3,7 @@ export default {
3
3
  title: 'Dashboard',
4
4
  range: 'Zeitraum',
5
5
  loading: 'Wird geladen',
6
+ noRenderer: 'Für den Widget-Typ {type} ist kein Renderer registriert.',
6
7
  percent: '{value} %',
7
8
  duration: {
8
9
  minutes: '{value} Min.',
@@ -4,9 +4,10 @@ import dashboard from './dashboard'
4
4
  import fields from './fields'
5
5
  import jobs from './jobs'
6
6
  import list from './list'
7
+ import queues from './queues'
7
8
  import record from './record'
8
9
  import settings from './settings'
9
10
  import shell from './shell'
10
11
 
11
12
  /** German (machine translation): one object per area of the UI, mirroring en. */
12
- export default { common, shell, list, record, actions, dashboard, jobs, settings, fields }
13
+ export default { common, shell, list, record, actions, dashboard, jobs, queues, settings, fields }