@conduction/nextcloud-vue 2.178.0 → 2.179.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 (106) hide show
  1. package/dist/esm/components/CnBuildiqEditButton/CnBuildiqEditButton.vue.js +1 -1
  2. package/dist/esm/components/CnBuildiqEditButton/CnBuildiqEditButton.vue2.js +12 -1
  3. package/dist/esm/components/CnBuildiqEditButton/CnBuildiqEditButton.vue2.js.map +1 -1
  4. package/dist/esm/components/CnBuildiqEditButton/CnBuildiqEditButton.vue3.js.map +1 -1
  5. package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue.js +1 -1
  6. package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue2.js +10 -8
  7. package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue2.js.map +1 -1
  8. package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue3.js +95 -88
  9. package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue3.js.map +1 -1
  10. package/dist/esm/components/CnFlowDetail/CnFlowDetail.vue.js +1 -1
  11. package/dist/esm/components/CnFlowDetail/CnFlowDetail.vue2.js +86 -8
  12. package/dist/esm/components/CnFlowDetail/CnFlowDetail.vue2.js.map +1 -1
  13. package/dist/esm/components/CnFlowDetail/CnFlowDetail.vue3.js +137 -121
  14. package/dist/esm/components/CnFlowDetail/CnFlowDetail.vue3.js.map +1 -1
  15. package/dist/esm/components/CnFlowDetail/CnFlowDryRunResult.vue.js +1 -1
  16. package/dist/esm/components/CnFlowDetail/CnFlowDryRunResult.vue2.js +56 -4
  17. package/dist/esm/components/CnFlowDetail/CnFlowDryRunResult.vue2.js.map +1 -1
  18. package/dist/esm/components/CnFlowDetail/CnFlowDryRunResult.vue3.js +166 -70
  19. package/dist/esm/components/CnFlowDetail/CnFlowDryRunResult.vue3.js.map +1 -1
  20. package/dist/esm/components/CnFlowDetail/CnFlowStepList.vue.js +9 -0
  21. package/dist/esm/components/CnFlowDetail/CnFlowStepList.vue.js.map +1 -0
  22. package/dist/esm/components/CnFlowDetail/CnFlowStepList.vue2.js +123 -0
  23. package/dist/esm/components/CnFlowDetail/CnFlowStepList.vue2.js.map +1 -0
  24. package/dist/esm/components/CnFlowDetail/CnFlowStepList.vue3.js +268 -0
  25. package/dist/esm/components/CnFlowDetail/CnFlowStepList.vue3.js.map +1 -0
  26. package/dist/esm/components/CnFlowDetail/CnFlowViewSwitch.vue.js +9 -0
  27. package/dist/esm/components/CnFlowDetail/CnFlowViewSwitch.vue.js.map +1 -0
  28. package/dist/esm/components/CnFlowDetail/CnFlowViewSwitch.vue2.js +49 -0
  29. package/dist/esm/components/CnFlowDetail/CnFlowViewSwitch.vue2.js.map +1 -0
  30. package/dist/esm/components/CnFlowDetail/CnFlowViewSwitch.vue3.js +41 -0
  31. package/dist/esm/components/CnFlowDetail/CnFlowViewSwitch.vue3.js.map +1 -0
  32. package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue.js +1 -1
  33. package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue2.js +116 -8
  34. package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue2.js.map +1 -1
  35. package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue3.js +110 -58
  36. package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue3.js.map +1 -1
  37. package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue2.js +78 -1
  38. package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue2.js.map +1 -1
  39. package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue3.js +44 -3
  40. package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue3.js.map +1 -1
  41. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +90 -75
  42. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
  43. package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js +46 -22
  44. package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
  45. package/dist/esm/composables/indexSources.js +24 -4
  46. package/dist/esm/composables/indexSources.js.map +1 -1
  47. package/dist/esm/composables/useFlowStore.js +75 -4
  48. package/dist/esm/composables/useFlowStore.js.map +1 -1
  49. package/dist/esm/dialogs/CnFlowEdgeEditModal.vue.js +1 -1
  50. package/dist/esm/dialogs/CnFlowEdgeEditModal.vue2.js +17 -0
  51. package/dist/esm/dialogs/CnFlowEdgeEditModal.vue2.js.map +1 -1
  52. package/dist/esm/dialogs/CnFlowEdgeEditModal.vue3.js +9 -1
  53. package/dist/esm/dialogs/CnFlowEdgeEditModal.vue3.js.map +1 -1
  54. package/dist/esm/dialogs/CnFlowEditModal.vue.js +1 -1
  55. package/dist/esm/dialogs/CnFlowEditModal.vue2.js +15 -0
  56. package/dist/esm/dialogs/CnFlowEditModal.vue2.js.map +1 -1
  57. package/dist/esm/dialogs/CnFlowEditModal.vue3.js +13 -3
  58. package/dist/esm/dialogs/CnFlowEditModal.vue3.js.map +1 -1
  59. package/dist/esm/dialogs/CnFlowStepPickerModal.vue.js +1 -1
  60. package/dist/esm/dialogs/CnFlowStepPickerModal.vue2.js +13 -1
  61. package/dist/esm/dialogs/CnFlowStepPickerModal.vue2.js.map +1 -1
  62. package/dist/esm/dialogs/CnFlowStepPickerModal.vue3.js.map +1 -1
  63. package/dist/esm/index.js +2 -0
  64. package/dist/esm/index.js.map +1 -1
  65. package/dist/esm/l10n/en.json.js +40 -1
  66. package/dist/esm/l10n/en.json.js.map +1 -1
  67. package/dist/esm/l10n/nl.json.js +39 -1
  68. package/dist/esm/l10n/nl.json.js.map +1 -1
  69. package/dist/esm/library-style.js +1 -1
  70. package/dist/esm/nextcloud-vue.css +566 -337
  71. package/dist/esm/utils/dialogWidths.js +6 -4
  72. package/dist/esm/utils/dialogWidths.js.map +1 -1
  73. package/dist/esm/utils/flowCondition.js +177 -0
  74. package/dist/esm/utils/flowCondition.js.map +1 -0
  75. package/dist/esm/utils/flowRunStatus.js +64 -1
  76. package/dist/esm/utils/flowRunStatus.js.map +1 -1
  77. package/dist/esm/utils/flowStepList.js +385 -0
  78. package/dist/esm/utils/flowStepList.js.map +1 -0
  79. package/dist/nextcloud-vue.cjs.js +12543 -10668
  80. package/dist/nextcloud-vue.cjs.js.map +2 -2
  81. package/dist/nextcloud-vue.css +566 -337
  82. package/l10n/en.json +40 -1
  83. package/l10n/nl.json +39 -1
  84. package/package.json +1 -1
  85. package/src/components/CnBuildiqEditButton/CnBuildiqEditButton.vue +12 -1
  86. package/src/components/CnCellRenderer/CnCellRenderer.vue +8 -0
  87. package/src/components/CnFlowDetail/CnFlowDetail.vue +110 -12
  88. package/src/components/CnFlowDetail/CnFlowDryRunResult.vue +163 -5
  89. package/src/components/CnFlowDetail/CnFlowStepList.vue +408 -0
  90. package/src/components/CnFlowDetail/CnFlowViewSwitch.vue +117 -0
  91. package/src/components/CnFlowDetail/index.js +2 -0
  92. package/src/components/CnFlowsPage/CnFlowBoard.vue +182 -25
  93. package/src/components/CnFlowsPage/CnFlowEditorPage.vue +101 -3
  94. package/src/components/CnIndexPage/CnIndexPage.vue +29 -0
  95. package/src/components/index.js +1 -1
  96. package/src/composables/indexSources.js +24 -4
  97. package/src/composables/useFlowStore.js +75 -4
  98. package/src/css/index-page.css +4 -0
  99. package/src/dialogs/CnFlowEdgeEditModal.vue +28 -0
  100. package/src/dialogs/CnFlowEditModal.vue +26 -6
  101. package/src/dialogs/CnFlowStepPickerModal.vue +13 -1
  102. package/src/index.js +2 -0
  103. package/src/utils/dialogWidths.js +6 -4
  104. package/src/utils/flowCondition.js +173 -0
  105. package/src/utils/flowRunStatus.js +63 -0
  106. package/src/utils/flowStepList.js +381 -0
package/l10n/en.json CHANGED
@@ -2713,7 +2713,46 @@
2713
2713
  "Task form": "Task form",
2714
2714
  "No rows match the filters.": "No rows match the filters.",
2715
2715
  "An item cannot be ticked in more than one column.": "An item cannot be ticked in more than one column.",
2716
- "The options could not be read.": "The options could not be read."
2716
+ "The options could not be read.": "The options could not be read.",
2717
+ "{field} is more than {value}": "{field} is more than {value}",
2718
+ "{field} is one of {value}": "{field} is one of {value}",
2719
+ "{field} is empty": "{field} is empty",
2720
+ "A custom condition": "A custom condition",
2721
+ "Otherwise": "Otherwise",
2722
+ "Only if {condition}": "Only if {condition}",
2723
+ "Then, in this order": "Then, in this order",
2724
+ "A new step goes at the bottom; use the arrows to put it in place.": "A new step goes at the bottom; use the arrows to put it in place.",
2725
+ "Change trigger": "Change trigger",
2726
+ "This flow has no trigger yet.": "This flow has no trigger yet.",
2727
+ "Not connected": "Not connected",
2728
+ "Routes:": "Routes:",
2729
+ "Actions for step {n}": "Actions for step {n}",
2730
+ "Up": "Up",
2731
+ "Down": "Down",
2732
+ "Steps on a branch are moved on the canvas.": "Steps on a branch are moved on the canvas.",
2733
+ "Step {n}": "Step {n}",
2734
+ "View of the flow": "View of the flow",
2735
+ "Canvas": "Canvas",
2736
+ "The same flow and the same steps as on the canvas; what you change here changes there too.": "The same flow and the same steps as on the canvas; what you change here changes there too.",
2737
+ "The same flow as a list: the trigger and the steps in order, for anyone who prefers no canvas.": "The same flow as a list: the trigger and the steps in order, for anyone who prefers no canvas.",
2738
+ "Flow steps": "Flow steps",
2739
+ "Edit a step to see its settings.": "Edit a step to see its settings.",
2740
+ "Admins only": "Admins only",
2741
+ "Only admins may use this action. You can read this step, but not change or save it; ask an admin.": "Only admins may use this action. You can read this step, but not change or save it; ask an admin.",
2742
+ "Test: a trial run without carrying anything out": "Test: a trial run without carrying anything out",
2743
+ "Nothing was sent or changed; the saved flow was worked through, not the canvas.": "Nothing was sent or changed; the saved flow was worked through, not the canvas.",
2744
+ "Step": "Step",
2745
+ "Would do": "Would do",
2746
+ "Test again": "Test again",
2747
+ "Example payload": "Example payload",
2748
+ "Would fail": "Would fail",
2749
+ "Skipped": "Skipped",
2750
+ "Would succeed": "Would succeed",
2751
+ "This is not a JSON object.": "This is not a JSON object.",
2752
+ "The saved flow is tried with the example you enter. Nothing is changed or sent.": "The saved flow is tried with the example you enter. Nothing is changed or sent.",
2753
+ "Test": "Test",
2754
+ "Health": "Health",
2755
+ "Subjects": "Subjects"
2717
2756
  },
2718
2757
  "plurals": {
2719
2758
  "{count} member": [
package/l10n/nl.json CHANGED
@@ -2978,7 +2978,45 @@
2978
2978
  "Task form": "Taakformulier",
2979
2979
  "No rows match the filters.": "Geen rijen voldoen aan de filters.",
2980
2980
  "An item cannot be ticked in more than one column.": "Een item kan niet in meer dan één kolom aangevinkt zijn.",
2981
- "The options could not be read.": "De keuzes konden niet worden gelezen."
2981
+ "The options could not be read.": "De keuzes konden niet worden gelezen.",
2982
+ "{field} is more than {value}": "{field} is meer dan {value}",
2983
+ "{field} is one of {value}": "{field} is een van {value}",
2984
+ "{field} is empty": "{field} is leeg",
2985
+ "A custom condition": "Een eigen voorwaarde",
2986
+ "Otherwise": "Anders",
2987
+ "Only if {condition}": "Alleen als {condition}",
2988
+ "Then, in this order": "Dan, in deze volgorde",
2989
+ "A new step goes at the bottom; use the arrows to put it in place.": "Een nieuwe stap komt onderaan; zet hem met de pijlen op zijn plek.",
2990
+ "Change trigger": "Trigger wijzigen",
2991
+ "This flow has no trigger yet.": "Deze flow heeft nog geen trigger.",
2992
+ "Not connected": "Niet verbonden",
2993
+ "Routes:": "Routes:",
2994
+ "Actions for step {n}": "Acties voor stap {n}",
2995
+ "Up": "Omhoog",
2996
+ "Down": "Omlaag",
2997
+ "Steps on a branch are moved on the canvas.": "Stappen in een vertakking verplaatst u op het canvas.",
2998
+ "Step {n}": "Stap {n}",
2999
+ "View of the flow": "Weergave van de flow",
3000
+ "Canvas": "Canvas",
3001
+ "The same flow and the same steps as on the canvas; what you change here changes there too.": "Dezelfde flow en dezelfde stappen als op het canvas; wat u hier wijzigt, staat daar ook.",
3002
+ "The same flow as a list: the trigger and the steps in order, for anyone who prefers no canvas.": "Dezelfde flow als lijst: de trigger en de stappen op volgorde, voor wie geen canvas wil.",
3003
+ "Flow steps": "Stappen van de flow",
3004
+ "Edit a step to see its settings.": "Bewerk een stap om de instellingen te zien.",
3005
+ "Admins only": "Alleen beheerders",
3006
+ "Only admins may use this action. You can read this step, but not change or save it; ask an admin.": "Alleen beheerders mogen deze actie gebruiken. U kunt deze stap lezen, maar niet wijzigen of opslaan; vraag een beheerder.",
3007
+ "Test: a trial run without carrying anything out": "Testen: proefrun zonder iets uit te voeren",
3008
+ "Nothing was sent or changed; the saved flow was worked through, not the canvas.": "Er is niets verstuurd of gewijzigd; de opgeslagen flow is doorgerekend, niet het canvas.",
3009
+ "Would do": "Zou doen",
3010
+ "Test again": "Opnieuw testen",
3011
+ "Example payload": "Voorbeeldgegevens",
3012
+ "Would fail": "Zou mislukken",
3013
+ "Skipped": "Overgeslagen",
3014
+ "Would succeed": "Zou slagen",
3015
+ "This is not a JSON object.": "Dit is geen JSON-object.",
3016
+ "The saved flow is tried with the example you enter. Nothing is changed or sent.": "De opgeslagen flow wordt geprobeerd met het voorbeeld dat u invult. Er wordt niets gewijzigd of verstuurd.",
3017
+ "Test": "Testen",
3018
+ "Health": "Gezondheid",
3019
+ "Subjects": "Onderwerpen"
2982
3020
  },
2983
3021
  "plurals": {
2984
3022
  "{count} member": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conduction/nextcloud-vue",
3
- "version": "2.178.0",
3
+ "version": "2.179.0",
4
4
  "description": "Shared Vue component library for Conduction Nextcloud apps — complements @nextcloud/vue with higher-level components, OpenRegister integration, and NL Design System support",
5
5
  "homepage": "https://github.com/ConductionNL/nextcloud-vue#readme",
6
6
  "bugs": {
@@ -391,6 +391,13 @@ export default {
391
391
  return this.activeEditor ? this.unref(this.activeEditor.working) : null
392
392
  },
393
393
 
394
+ /** @return {string} Where flows open in list mode, '' for an app without such a page. */
395
+ flowListRoute() {
396
+ const page = (this.effectiveManifest?.pages || []).find((candidate) => ['flow', 'flow-detail'].includes(candidate?.type) && candidate?.config?.listMode === true)
397
+
398
+ return page ? String(page.route || '').replace(':id', 'new') : ''
399
+ },
400
+
394
401
  /** The manifest to read page metadata from: working copy, else the live one. */
395
402
  effectiveManifest() {
396
403
  return this.workingManifest || this.unref(this.cnManifest) || null
@@ -766,7 +773,11 @@ export default {
766
773
  * store, and there is one editor for it.
767
774
  */
768
775
  onEditFlows() {
769
- this.showFlowsCanvasModal = true
776
+ if (this.flowListRoute !== '' && this.$router) {
777
+ this.$router.push({ path: this.flowListRoute, query: { view: 'list' } })
778
+ } else {
779
+ this.showFlowsCanvasModal = true
780
+ }
770
781
  this.menuOpen = false
771
782
  /**
772
783
  * @event edit-flows Emitted when the flows editor opens.
@@ -360,6 +360,12 @@
360
360
  </span>
361
361
  </template>
362
362
 
363
+ <!-- Built-in "flowHealth" widget: a flow's health dot, read off the row
364
+ of a `flows` source (`enabled`, `lastRunStatus`). -->
365
+ <template v-else-if="widget === 'flowHealth'">
366
+ <CnFlowHealthDot :enabled="row.enabled !== false" :lastRunStatus="row.lastRunStatus || null" />
367
+ </template>
368
+
363
369
  <!-- Explicit column formatter — overrides the type-aware paths below -->
364
370
  <template v-else-if="hasFormatter">
365
371
  <span :title="rawTitle">{{ formattedValue }}</span>
@@ -449,6 +455,7 @@ import { NcAvatar, NcButton, NcCheckboxRadioSwitch, NcDateTime } from '@nextclou
449
455
  import CheckBold from 'vue-material-design-icons/CheckBold.vue'
450
456
  import Lock from 'vue-material-design-icons/Lock.vue'
451
457
  import CnFkResolveCell from '../CnFkResolveCell/CnFkResolveCell.vue'
458
+ import CnFlowHealthDot from '../CnFlowDetail/CnFlowHealthDot.vue'
452
459
  import CnIcon from '../CnIcon/CnIcon.vue'
453
460
  import CnGroupNameCell from './CnGroupNameCell.vue'
454
461
  import { normalizeLook } from '../../composables/useLook.js'
@@ -494,6 +501,7 @@ export default {
494
501
  name: 'CnCellRenderer',
495
502
 
496
503
  components: {
504
+ CnFlowHealthDot,
497
505
  CnIcon,
498
506
  CnStatusBadge,
499
507
  NcCheckboxRadioSwitch,
@@ -21,7 +21,7 @@
21
21
  SPDX-License-Identifier: EUPL-1.2
22
22
  -->
23
23
  <template>
24
- <div class="cn-flow-detail" :class="{ 'cn-flow-detail--card-nodes': !!nodeBadge, 'cn-flow-detail--quiet-lines': !!nodeBadge && !store.inRunView }">
24
+ <div class="cn-flow-detail" :class="{ 'cn-flow-detail--card-nodes': !!nodeBadge, 'cn-flow-detail--quiet-lines': !!nodeBadge && !store.inRunView, 'cn-flow-detail--list': inList }">
25
25
  <!-- The editor's controls, ON the canvas: the actions that concern the
26
26
  graph live with the graph, the way every flow tool draws it. -->
27
27
  <div class="cn-flow-detail__toolbar" role="toolbar" :aria-label="toolbarLabel">
@@ -60,7 +60,7 @@
60
60
  several seconds later. Pressing this produces an immediate
61
61
  message beside the graph it is about.
62
62
  -->
63
- <NcButton v-if="addStep && editingShown"
63
+ <NcButton v-if="addStep && editingShown && !inList"
64
64
  data-testid="flow-add-step"
65
65
  @click="stepPickerOpen = true">
66
66
  <template #icon>
@@ -106,7 +106,7 @@
106
106
  </template>
107
107
  {{ t('nextcloud-vue', 'Check') }}
108
108
  </NcButton>
109
- <NcButton v-if="editingShown"
109
+ <NcButton v-if="editingShown && !inList"
110
110
  variant="tertiary"
111
111
  :disabled="!store.nodes.length"
112
112
  :aria-label="t('nextcloud-vue', 'Arrange steps automatically')"
@@ -140,7 +140,7 @@
140
140
  {{ t('nextcloud-vue', 'Opening the run') }}
141
141
  </span>
142
142
 
143
- <div class="cn-flow-detail__toolbar-group">
143
+ <div v-if="!inList" class="cn-flow-detail__toolbar-group">
144
144
  <NcButton variant="tertiary"
145
145
  :disabled="zoom <= minZoom"
146
146
  :aria-label="t('nextcloud-vue', 'Zoom out')"
@@ -203,7 +203,13 @@
203
203
  existing `edges` prop: Vue Flow applies an edge's `class` to the
204
204
  line it draws, so the canvas itself stays a geometry-only renderer
205
205
  with no status concept (ADR-065). -->
206
+ <CnFlowStepList v-if="inList"
207
+ :readonlySteps="readonlySteps"
208
+ :stepState="listStepState"
209
+ @add="stepPickerOpen = true"
210
+ @edit="onListEdit" />
206
211
  <CnGraphCanvas
212
+ v-else
207
213
  ref="canvas"
208
214
  :nodes="canvasNodes"
209
215
  :edges="canvasEdgesWithRunState"
@@ -275,14 +281,15 @@
275
281
  </div>
276
282
  </template>
277
283
 
278
- <!-- A connection's own name, on the connection.
284
+ <!-- A connection's own name, on the connection, else its condition in
285
+ words when the host asks for that (`edgeConditions`).
279
286
 
280
- Rendered only when the author gave the line one: CnFlowEdge
281
- gates the label control on what this slot RENDERS, not on
282
- whether it exists, so an unnamed line draws no empty chip. -->
287
+ Rendered only when there is text: CnFlowEdge gates the label
288
+ control on what this slot RENDERS, not on whether it exists, so
289
+ an unnamed line draws no empty chip. -->
283
290
  <template #edge-label="{ edge }">
284
- <template v-if="edge.data && edge.data.label">
285
- {{ edge.data.label }}
291
+ <template v-if="edgeText(edge)">
292
+ {{ edgeText(edge) }}
286
293
  </template>
287
294
  </template>
288
295
  </CnGraphCanvas>
@@ -332,7 +339,7 @@
332
339
  </template>
333
340
  </NcEmptyContent>
334
341
  <NcEmptyContent
335
- v-else-if="store.nodes.length === 0"
342
+ v-else-if="store.nodes.length === 0 && !inList"
336
343
  class="cn-flow-detail__empty"
337
344
  data-testid="flow-canvas-empty"
338
345
  :name="t('nextcloud-vue', 'No steps yet')"
@@ -341,7 +348,7 @@
341
348
  <Sitemap :size="20" />
342
349
  </template>
343
350
  </NcEmptyContent>
344
- <CnFlowStepPickerModal v-if="stepPickerOpen" @close="stepPickerOpen = false" />
351
+ <CnFlowStepPickerModal v-if="stepPickerOpen" :append="inList" @close="stepPickerOpen = false" />
345
352
  </div>
346
353
  </template>
347
354
 
@@ -369,6 +376,7 @@ import CnFlowStepPickerModal from '../../dialogs/CnFlowStepPickerModal.vue'
369
376
  import CnContextMenu from '../CnContextMenu/CnContextMenu.vue'
370
377
  import CnGraphCanvas from '../CnGraphCanvas/CnGraphCanvas.vue'
371
378
  import CnFlowCanvasMessages from './CnFlowCanvasMessages.vue'
379
+ import CnFlowStepList from './CnFlowStepList.vue'
372
380
  import { useContextMenu } from '../../composables/useContextMenu.js'
373
381
  import { DEFAULT_EDGE_LINE_TYPE, EDGE_LINE_TYPES } from '../../composables/useFlowEdgeStyles.js'
374
382
  import { resolveFlowNodeEditor } from '../../composables/useFlowNodeEditors.js'
@@ -411,6 +419,9 @@ const REPLAY_HOP_MIN_MS = 200
411
419
  const REPLAY_HOP_MAX_MS = 1500
412
420
 
413
421
  /** The canvas messages a quiet run keeps: what went wrong with the run itself. */
422
+ /** The badge colour of a step's outcome in the list view. */
423
+ const RUN_STATE_VARIANTS = { active: 'info', done: 'success', failed: 'error', hold: 'warning' }
424
+
414
425
  const QUIET_RUN_MESSAGES = ['flow-not-found', 'action-failed', 'run-graph-unsaved', 'run-graph-unreadable', 'run-skipped']
415
426
 
416
427
  export default {
@@ -421,6 +432,7 @@ export default {
421
432
  CnFlowCanvasMessages,
422
433
  CnFlowEdgeEditModal,
423
434
  CnFlowNodeEditModal,
435
+ CnFlowStepList,
424
436
  CnFlowStepPickerModal,
425
437
  CnContextMenu,
426
438
  CnGraphCanvas,
@@ -536,6 +548,41 @@ export default {
536
548
  type: Boolean,
537
549
  default: true,
538
550
  },
551
+
552
+ /**
553
+ * Write a line's condition on the line when it has no name of its own
554
+ * ("amount is more than 1000"). Manifest key `config.edgeConditions`.
555
+ */
556
+ edgeConditions: {
557
+ type: Boolean,
558
+ default: false,
559
+ },
560
+
561
+ /**
562
+ * What edits the flow: `canvas` draws the graph, `list` the trigger and
563
+ * the steps in order. Both edit the one flow in the store.
564
+ */
565
+ view: {
566
+ type: String,
567
+ default: 'canvas',
568
+ },
569
+
570
+ /**
571
+ * The host shows the selected step in a panel of its own, so Edit in
572
+ * the list view selects the step instead of opening the step dialog.
573
+ */
574
+ stepPanel: {
575
+ type: Boolean,
576
+ default: false,
577
+ },
578
+
579
+ /**
580
+ * The ids of the steps the viewer can only read, for the list view.
581
+ */
582
+ readonlySteps: {
583
+ type: Array,
584
+ default: () => [],
585
+ },
539
586
  },
540
587
 
541
588
  emits: ['save', 'run'],
@@ -646,6 +693,13 @@ export default {
646
693
  },
647
694
 
648
695
  computed: {
696
+ /**
697
+ * @return {boolean} Whether the list view is on screen in place of the canvas.
698
+ */
699
+ inList() {
700
+ return this.view === 'list'
701
+ },
702
+
649
703
  /**
650
704
  * Whether a run named by the URL is still being opened.
651
705
  *
@@ -2308,6 +2362,37 @@ export default {
2308
2362
  return this.store.catalogEntry(type) === null
2309
2363
  },
2310
2364
 
2365
+ /**
2366
+ * @param {string} id A step.
2367
+ * @return {{label: string, variant: string}|null} Its outcome in the open run, for the list view.
2368
+ */
2369
+ listStepState(id) {
2370
+ const state = this.runStateOf(id)
2371
+
2372
+ return state ? { label: this.runStateLabel(state), variant: RUN_STATE_VARIANTS[state] || 'default' } : null
2373
+ },
2374
+
2375
+ /**
2376
+ * @param {string} id The step to edit from the list view.
2377
+ * @return {void}
2378
+ */
2379
+ onListEdit(id) {
2380
+ this.store.selectedNodeId = id
2381
+ if (!this.stepPanel) {
2382
+ this.store.editingNodeId = id
2383
+ }
2384
+ },
2385
+
2386
+ /**
2387
+ * @param {object} edge A drawn line.
2388
+ * @return {string} What the line says: its name, else its condition when asked for.
2389
+ */
2390
+ edgeText(edge) {
2391
+ const data = edge.data || {}
2392
+
2393
+ return data.label || (this.edgeConditions ? data.conditionText : '') || ''
2394
+ },
2395
+
2311
2396
  /**
2312
2397
  * Human label for a node type, from the catalogue.
2313
2398
  *
@@ -2389,6 +2474,19 @@ export default {
2389
2474
  background-size: 20px 20px;
2390
2475
  }
2391
2476
 
2477
+ /* The list is not a canvas: no dotted grid under it, and its own scrolling. */
2478
+ .cn-flow-detail--list {
2479
+ display: flex;
2480
+ flex-direction: column;
2481
+ background-image: none;
2482
+ }
2483
+
2484
+ .cn-flow-detail--list .cn-flow-detail__toolbar {
2485
+ position: static;
2486
+ align-self: flex-start;
2487
+ box-shadow: none;
2488
+ }
2489
+
2392
2490
  /* The canvas paints an opaque main-background of its own, which sat exactly
2393
2491
  on top of the grid above. Cleared here, for flow editors only — other
2394
2492
  CnGraphCanvas consumers keep their solid ground. */
@@ -4,7 +4,69 @@
4
4
  -->
5
5
 
6
6
  <template>
7
- <section class="cn-flow-dry-run" :aria-label="title" data-testid="flow-dry-run-result">
7
+ <section v-if="card"
8
+ class="cn-flow-dry-run cn-flow-dry-run--card"
9
+ :aria-label="title"
10
+ data-testid="flow-dry-run-card">
11
+ <h3 class="cn-flow-dry-run__title">
12
+ {{ t('nextcloud-vue', 'Test: a trial run without carrying anything out') }}
13
+ </h3>
14
+ <p class="cn-flow-dry-run__intro" data-testid="flow-dry-run-note">
15
+ <InformationOutline :size="18" />
16
+ <span>{{ t('nextcloud-vue', 'Nothing was sent or changed; the saved flow was worked through, not the canvas.') }}</span>
17
+ </p>
18
+ <p v-if="result.error"
19
+ class="cn-flow-dry-run__error"
20
+ role="alert"
21
+ data-testid="flow-dry-run-error">
22
+ {{ result.error }}
23
+ </p>
24
+ <table class="cn-flow-dry-run__table">
25
+ <thead>
26
+ <tr>
27
+ <th scope="col">
28
+ {{ subjectHead }}
29
+ </th>
30
+ <th scope="col">
31
+ {{ t('nextcloud-vue', 'Step') }}
32
+ </th>
33
+ <th scope="col">
34
+ {{ t('nextcloud-vue', 'Would do') }}
35
+ </th>
36
+ </tr>
37
+ </thead>
38
+ <tbody>
39
+ <tr v-for="(step, index) in steps"
40
+ :key="`${index}-${step.nodeId}`"
41
+ data-testid="flow-dry-run-row">
42
+ <td>
43
+ <strong v-if="index === 0">{{ subjectName }}</strong>
44
+ </td>
45
+ <td>{{ step.label || step.type || step.nodeId }}</td>
46
+ <td>
47
+ <CnStatusBadge :label="outcomeOf(step).label" :variant="outcomeOf(step).variant" size="small" />
48
+ {{ wouldDo(step) }}
49
+ </td>
50
+ </tr>
51
+ </tbody>
52
+ </table>
53
+ <div class="cn-flow-dry-run__foot">
54
+ <span class="cn-flow-dry-run__count">{{ n('nextcloud-vue', '%n step', '%n steps', steps.length) }}</span>
55
+ <NcButton data-testid="flow-dry-run-again" @click="$emit('again')">
56
+ <template #icon>
57
+ <Autorenew :size="18" />
58
+ </template>
59
+ {{ t('nextcloud-vue', 'Test again') }}
60
+ </NcButton>
61
+ <NcButton variant="primary" data-testid="flow-dry-run-close" @click="$emit('close')">
62
+ {{ t('nextcloud-vue', 'Close') }}
63
+ </NcButton>
64
+ </div>
65
+ </section>
66
+ <section v-else
67
+ class="cn-flow-dry-run"
68
+ :aria-label="title"
69
+ data-testid="flow-dry-run-result">
8
70
  <div class="cn-flow-dry-run__head">
9
71
  <h3 class="cn-flow-dry-run__title">
10
72
  {{ title }}
@@ -47,22 +109,26 @@
47
109
  </template>
48
110
 
49
111
  <script>
50
- import { translate as t } from '@nextcloud/l10n'
112
+ import { translatePlural as n, translate as t } from '@nextcloud/l10n'
51
113
  import { NcButton } from '@nextcloud/vue'
114
+ import Autorenew from 'vue-material-design-icons/Autorenew.vue'
115
+ import InformationOutline from 'vue-material-design-icons/InformationOutline.vue'
116
+ import { CnStatusBadge } from '../CnStatusBadge/index.js'
52
117
 
53
118
  /**
54
119
  * CnFlowDryRunResult — what trying a flow with a record showed: every step
55
120
  * the flow reached, in order, what it did (a step without side effects) or
56
121
  * would do (any other step), the fields it would change and the messages it
57
122
  * would send. Drawn beside the canvas by CnFlowBoard (DqFlow "Testen met een
58
- * zaak"). Nothing was changed or sent, and the panel says so.
123
+ * zaak"). Nothing was changed or sent, and the panel says so. With `card` it
124
+ * is the test run card of board OrFlowTestrunKaart: the same answer as a table.
59
125
  *
60
126
  * @spec openspec/changes/flow-test-with-a-record/specs/flow-test-with-a-record/spec.md#requirement-the-result-shows-each-step-beside-the-canvas
61
127
  */
62
128
  export default {
63
129
  name: 'CnFlowDryRunResult',
64
130
 
65
- components: { NcButton },
131
+ components: { Autorenew, CnStatusBadge, InformationOutline, NcButton },
66
132
 
67
133
  props: {
68
134
  /**
@@ -74,9 +140,15 @@ export default {
74
140
  type: Object,
75
141
  required: true,
76
142
  },
143
+
144
+ /** Draw the test run card, a table with Test again. */
145
+ card: {
146
+ type: Boolean,
147
+ default: false,
148
+ },
77
149
  },
78
150
 
79
- emits: ['close'],
151
+ emits: ['close', 'again'],
80
152
 
81
153
  computed: {
82
154
  /** @return {Array<object>} The steps reached, in order. */
@@ -88,10 +160,52 @@ export default {
88
160
  title() {
89
161
  return t('nextcloud-vue', 'Test result')
90
162
  },
163
+
164
+ /** @return {boolean} Whether the flow was tried on an example payload. */
165
+ onPayload() {
166
+ return this.result.subject?.payload !== undefined
167
+ },
168
+
169
+ /** @return {string} The head of the first column. */
170
+ subjectHead() {
171
+ return this.onPayload ? t('nextcloud-vue', 'Example') : t('nextcloud-vue', 'Record')
172
+ },
173
+
174
+ /** @return {string} What the flow was tried on. */
175
+ subjectName() {
176
+ return this.onPayload ? t('nextcloud-vue', 'Example payload') : (this.result.subject?.label || this.result.subject?.uuid || '')
177
+ },
91
178
  },
92
179
 
93
180
  methods: {
94
181
  t,
182
+ n,
183
+
184
+ /**
185
+ * @param {object} step A step.
186
+ * @return {{label: string, variant: string}} How the step came out.
187
+ */
188
+ outcomeOf(step) {
189
+ if (step.status === 'failed') {
190
+ return { label: t('nextcloud-vue', 'Would fail'), variant: 'error' }
191
+ }
192
+ if (step.status === 'skipped') {
193
+ return { label: t('nextcloud-vue', 'Skipped'), variant: 'default' }
194
+ }
195
+
196
+ return { label: t('nextcloud-vue', 'Would succeed'), variant: 'success' }
197
+ },
198
+
199
+ /**
200
+ * @param {object} step A step.
201
+ * @return {string} What it would do, with the fields and messages it names.
202
+ */
203
+ wouldDo(step) {
204
+ const fields = this.changesOf(step).map((change) => `${change.field}: ${this.valueText(change.value)}`)
205
+ const messages = this.messagesOf(step).map((message) => t('nextcloud-vue', 'To {recipients}', { recipients: (message.to || []).join(', ') }))
206
+
207
+ return [this.summaryOf(step), ...fields, ...messages].filter(Boolean).join(' · ')
208
+ },
95
209
 
96
210
  /**
97
211
  * @param {object} step A step.
@@ -135,6 +249,50 @@ export default {
135
249
  gap: 8px;
136
250
  }
137
251
 
252
+ .cn-flow-dry-run--card {
253
+ gap: 12px;
254
+ }
255
+
256
+ .cn-flow-dry-run__intro {
257
+ display: flex;
258
+ align-items: flex-start;
259
+ gap: 8px;
260
+ margin: 0;
261
+ font-size: 13px;
262
+ }
263
+
264
+ .cn-flow-dry-run__table {
265
+ inline-size: 100%;
266
+ border-collapse: collapse;
267
+ font-size: 13px;
268
+ }
269
+
270
+ .cn-flow-dry-run__table th {
271
+ color: var(--color-text-maxcontrast);
272
+ font-weight: 600;
273
+ text-align: start;
274
+ }
275
+
276
+ .cn-flow-dry-run__table th,
277
+ .cn-flow-dry-run__table td {
278
+ padding: 6px 8px 6px 0;
279
+ border-block-end: 1px solid var(--color-border);
280
+ vertical-align: top;
281
+ }
282
+
283
+ .cn-flow-dry-run__foot {
284
+ display: flex;
285
+ flex-wrap: wrap;
286
+ align-items: center;
287
+ gap: 8px;
288
+ }
289
+
290
+ .cn-flow-dry-run__count {
291
+ flex: 1 1 auto;
292
+ color: var(--color-text-maxcontrast);
293
+ font-size: 13px;
294
+ }
295
+
138
296
  .cn-flow-dry-run__head {
139
297
  display: flex;
140
298
  align-items: center;