@conduction/nextcloud-vue 2.56.0-beta.74 → 2.56.0-beta.75

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
@@ -18,7 +18,7 @@ import Undo from 'vue-material-design-icons/Undo.vue'
18
18
  import { formatRelativeDate } from '../utils/boardDate.js'
19
19
  import { fetchReferenceObjects } from '../utils/boardReferenceColumns.js'
20
20
  import { fillTemplate } from '../utils/fillTemplate.js'
21
- import { FLOW_RUN_ERROR_STATUSES, flowRunStatuses } from '../utils/flowRunStatus.js'
21
+ import { FLOW_RUN_ERROR_STATUSES, flowRunCounters, flowRunStatuses, flowRunSubjects } from '../utils/flowRunStatus.js'
22
22
  import { fetchGroupMembers, fetchPresence, fetchStatuses, fetchUsers } from '../utils/nextcloudDirectory.js'
23
23
  import { readPath } from '../utils/readPath.js'
24
24
  import { resolveNextcloudUser } from '../utils/userAutocomplete.js'
@@ -106,14 +106,19 @@ export function flowTriggerCell(flow, catalog = []) {
106
106
  * last run ended, how often it ran this week), read in one request from
107
107
  * the run summary rather than derived from a page of runs.
108
108
  *
109
+ * `sourceConfig.extraColumns` adds `health` (a dot before the name) and `owner`
110
+ * (before the status) to the default columns, as board OrFlows draws them.
111
+ *
109
112
  * The quick filters (All, Active, Paused, With errors) narrow the loaded
110
113
  * list in place: every flow of the app is already loaded, so the counts on
111
114
  * the tabs and the rows they show can never disagree.
112
115
  *
116
+ * @param config
113
117
  * @return {object} The source adapter.
114
118
  */
115
- function flowsSource() {
119
+ function flowsSource(config = {}) {
116
120
  const store = useFlowStore()
121
+ const extraColumns = [].concat(config.extraColumns ?? [])
117
122
  const view = reactive({ state: 'all', owners: [], runsRoute: '/flow-runs', flowsRoute: '/flows' })
118
123
  const statuses = flowRunStatuses()
119
124
 
@@ -220,6 +225,7 @@ function flowsSource() {
220
225
  loading: () => !!store.loading,
221
226
 
222
227
  columns: [
228
+ ...(extraColumns.includes('health') ? [{ key: 'lastRunStatus', label: t('nextcloud-vue', 'Health'), widget: 'flowHealth' }] : []),
223
229
  { key: 'name', label: t('nextcloud-vue', 'Flow'), secondary: 'description' },
224
230
  {
225
231
  key: 'triggerLabel',
@@ -236,6 +242,7 @@ function flowsSource() {
236
242
  widgetProps: { colorMap: lastRunColors },
237
243
  },
238
244
  { key: 'runsThisWeek', label: t('nextcloud-vue', 'Runs this week'), class: 'cn-table-col--end' },
245
+ ...(extraColumns.includes('owner') ? [{ key: 'owner', label: t('nextcloud-vue', 'Owner') }] : []),
239
246
  {
240
247
  key: 'statusLabel',
241
248
  label: t('nextcloud-vue', 'Status'),
@@ -354,9 +361,14 @@ function flowsSource() {
354
361
  * the rows are the runs the flows tab counted. A row opens the run on its
355
362
  * flow's canvas (`/flows/:flowId?run=:uuid`), where CnFlowDetail shows it.
356
363
  *
364
+ * `sourceConfig.counters` draws the run counters above the list and adds the
365
+ * Subject column; `sourceConfig.flowId` narrows the list to one flow (board
366
+ * OrFlowOverzicht).
367
+ *
368
+ * @param {object} [config] The page's source config.
357
369
  * @return {object} The source adapter.
358
370
  */
359
- function flowRunsSource() {
371
+ function flowRunsSource(config = {}) {
360
372
  const store = useFlowStore()
361
373
  const view = reactive({ runsRoute: '/flow-runs', flowsRoute: '/flows' })
362
374
  const statuses = flowRunStatuses()
@@ -392,7 +404,7 @@ function flowRunsSource() {
392
404
  view.runsRoute = config?.runsRoute || '/flow-runs'
393
405
  view.flowsRoute = config?.flowsRoute || '/flows'
394
406
  await store.load({ app: config?.app })
395
- const ids = (store.flows || []).map((flow) => flow.id || flow.uuid)
407
+ const ids = config?.flowId ? [config.flowId] : (store.flows || []).map((flow) => flow.id || flow.uuid)
396
408
  const since = startOfWeek()
397
409
  await Promise.all([store.loadRecentRuns(ids, since), store.loadRunSummary(ids, since)])
398
410
  },
@@ -411,9 +423,16 @@ function flowRunsSource() {
411
423
  flowName: names[run.flowId] || run.flowId,
412
424
  statusLabel: (statuses[run.status] && statuses[run.status].label) || String(run.status || ''),
413
425
  startedAt: formatRelativeDate(run.created, { withTime: true }),
426
+ subjectLabel: flowRunSubjects(run).map((subject) => subject.uuid).join(', '),
427
+ subjectRoles: flowRunSubjects(run).map((subject) => subject.role).filter(Boolean).join(', '),
414
428
  }))
415
429
  },
416
430
 
431
+ /**
432
+ * @return {Array<object>} The tiles above the list, when the page asks for them.
433
+ */
434
+ counters: () => (config.counters === true ? flowRunCounters(store.recentRuns || []) : []),
435
+
417
436
  /**
418
437
  * @return {boolean} Whether a load is in flight.
419
438
  */
@@ -421,6 +440,7 @@ function flowRunsSource() {
421
440
 
422
441
  columns: [
423
442
  { key: 'flowName', label: t('nextcloud-vue', 'Flow'), secondary: 'error' },
443
+ ...(config.counters === true ? [{ key: 'subjectLabel', label: t('nextcloud-vue', 'Subject'), secondary: 'subjectRoles' }] : []),
424
444
  { key: 'statusLabel', label: t('nextcloud-vue', 'Status'), widget: 'badge', widgetProps: { colorMap: statusColors } },
425
445
  { key: 'startedAt', label: t('nextcloud-vue', 'Started') },
426
446
  { key: 'trigger', label: t('nextcloud-vue', 'Trigger') },
@@ -26,6 +26,8 @@ import axios from '@nextcloud/axios'
26
26
  import { translate as t } from '@nextcloud/l10n'
27
27
  import { generateUrl } from '@nextcloud/router'
28
28
  import { defineStore } from 'pinia'
29
+ import { flowEdgeCondition, flowEdgeConditionText } from '../utils/flowCondition.js'
30
+ import { flowStepBridge, flowStepSwap, flowStepTail, insertStepEdges, swapStepEdges, swapStepPlaces } from '../utils/flowStepList.js'
29
31
  import { layoutFlowNodes, needsFullLayout, placeLooseNodes } from './flowGraphLayout.js'
30
32
  import { DEFAULT_EDGE_LINE_TYPE } from './useFlowEdgeStyles.js'
31
33
 
@@ -555,6 +557,8 @@ export const useFlowStore = defineStore('cnFlow', {
555
557
  return (value === null || value === undefined || value === '') ? [] : [value]
556
558
  }
557
559
 
560
+ const nodeOf = (id) => (state.flow.nodes || []).find((node) => node.id === id) || null
561
+
558
562
  const lines = []
559
563
  for (const [index, edge] of (state.flow.edges || []).entries()) {
560
564
  const sources = toList(edge.source ?? edge.from)
@@ -630,6 +634,8 @@ export const useFlowStore = defineStore('cnFlow', {
630
634
  lineType: edge.lineType || DEFAULT_EDGE_LINE_TYPE,
631
635
  labelT: edge.labelT,
632
636
  label: edge.title || edge.label || '',
637
+ condition: flowEdgeCondition(edge, nodeOf(source)),
638
+ conditionText: flowEdgeConditionText(edge, nodeOf(source)),
633
639
  edge,
634
640
  },
635
641
  })
@@ -661,6 +667,15 @@ export const useFlowStore = defineStore('cnFlow', {
661
667
  return nodes.length ? [nodes[0].id] : []
662
668
  },
663
669
 
670
+ /**
671
+ * The flow as the list view reads it (see `utils/flowStepList.js`).
672
+ *
673
+ * @return {{nodes: Array<object>, lines: Array<object>, startIds: Array<string>, roleOf: Function}} The graph.
674
+ */
675
+ stepGraph() {
676
+ return { nodes: this.nodes, lines: this.canvasEdges, startIds: this.startNodeIds, roleOf: this.roleOfNodeType }
677
+ },
678
+
664
679
  /**
665
680
  * What stops this flow from ever finishing, by node ROLE.
666
681
  *
@@ -1194,6 +1209,59 @@ export const useFlowStore = defineStore('cnFlow', {
1194
1209
  this.selectedNodeId = node.id
1195
1210
  this.dirty = true
1196
1211
  this.checkResult = null
1212
+
1213
+ return node.id
1214
+ },
1215
+
1216
+ /**
1217
+ * Add a step at the bottom of the list view: wired in before the
1218
+ * closing step, else after the last step, as one undoable change.
1219
+ *
1220
+ * @param {string} type The step type.
1221
+ * @return {string|undefined} The new node's id, unless the graph is locked.
1222
+ */
1223
+ appendStep(type) {
1224
+ const tail = flowStepTail(this.stepGraph)
1225
+ const id = this.addNode(type)
1226
+ if (id !== undefined) {
1227
+ this.flow.edges = insertStepEdges(this.edges, { id, ...tail })
1228
+ }
1229
+
1230
+ return id
1231
+ },
1232
+
1233
+ /**
1234
+ * Swap a step with its neighbour in the list view, in the flow itself.
1235
+ * A move the list cannot make (a step on a branch) changes nothing.
1236
+ *
1237
+ * @param {{id: string, by: number}} move The step and -1 (up) or 1 (down).
1238
+ * @return {void}
1239
+ */
1240
+ moveStep(move) {
1241
+ const pair = flowStepSwap(this.stepGraph, move)
1242
+ if (pair === null || !this.pushUndo()) {
1243
+ return
1244
+ }
1245
+
1246
+ this.flow.edges = swapStepEdges(this.edges, pair)
1247
+ this.flow.nodes = swapStepPlaces(this.nodes, pair)
1248
+ this.dirty = true
1249
+ this.checkResult = null
1250
+ },
1251
+
1252
+ /**
1253
+ * Remove a step in the list view: a step in a chain leaves no gap, the
1254
+ * line into it goes on to the step after it.
1255
+ *
1256
+ * @param {string} id The step.
1257
+ * @return {void}
1258
+ */
1259
+ removeStep(id) {
1260
+ const bridge = flowStepBridge(this.stepGraph, id)
1261
+ this.removeNode(id)
1262
+ if (bridge !== null && !this.nodes.some((node) => node.id === id)) {
1263
+ this.flow.edges = [...this.edges, bridge]
1264
+ }
1197
1265
  },
1198
1266
 
1199
1267
  /**
@@ -2148,13 +2216,14 @@ export const useFlowStore = defineStore('cnFlow', {
2148
2216
  },
2149
2217
 
2150
2218
  /**
2151
- * Try the saved flow with a record, changing and sending nothing.
2219
+ * Try the saved flow with a record or an example payload, changing and
2220
+ * sending nothing.
2152
2221
  *
2153
2222
  * OpenRegister's dry-run walks the flow against the record: steps without
2154
2223
  * side effects run, every other step says what it would do. The answer,
2155
- * with the record, is kept in `dryRunResult` for the board to show.
2224
+ * with the subject, is kept in `dryRunResult` for the board to show.
2156
2225
  *
2157
- * @param {object} subject `{uuid, register, schema}` of the record.
2226
+ * @param {object} subject `{uuid, register, schema}` of the record, or `{payload}`.
2158
2227
  * @return {Promise<object|null>} The answer (`{status, steps, error?}`), or null.
2159
2228
  * @spec openspec/changes/flow-test-with-a-record/specs/flow-test-with-a-record/spec.md#requirement-testing-a-flow-with-a-record-changes-nothing
2160
2229
  */
@@ -2168,7 +2237,9 @@ export const useFlowStore = defineStore('cnFlow', {
2168
2237
  try {
2169
2238
  const response = await axios.post(
2170
2239
  generateUrl(`/apps/openregister/api/flows/${this.flow.id}/dry-run`),
2171
- { register: subject.register, schema: subject.schema, objectId: subject.uuid },
2240
+ subject.payload === undefined
2241
+ ? { register: subject.register, schema: subject.schema, objectId: subject.uuid }
2242
+ : { payload: subject.payload },
2172
2243
  )
2173
2244
  const result = response.data || { status: '', steps: [] }
2174
2245
  this.dryRunResult = { ...result, subject: { ...subject } }
@@ -37,6 +37,10 @@
37
37
  margin-bottom: calc(4 * var(--default-grid-baseline));
38
38
  }
39
39
 
40
+ .cn-index-page__counters {
41
+ margin-block-end: 12px;
42
+ }
43
+
40
44
  /* A below-header wrapper whose slot renders nothing on this route (e.g. an
41
45
  empty breadcrumb trail at the root) must not leave its margin as a blank
42
46
  band above the actions bar. Vue leaves only comment placeholders for
@@ -11,6 +11,12 @@
11
11
  {{ endpoints }}
12
12
  </p>
13
13
 
14
+ <p v-if="conditionLine"
15
+ class="cn-flow-edge-edit__condition"
16
+ data-testid="flow-edge-condition">
17
+ {{ conditionLine }}
18
+ </p>
19
+
14
20
  <NcTextField :modelValue="draft.title"
15
21
  :label="t('nextcloud-vue', 'Label')"
16
22
  :helperText="t('nextcloud-vue', 'Shown on the line. A branch reads better named — “approved”, “over budget” — than as an unlabelled arrow.')"
@@ -43,11 +49,13 @@ import { translate as t } from '@nextcloud/l10n'
43
49
  import { NcButton, NcDialog, NcSelect, NcTextField } from '@nextcloud/vue'
44
50
  import { EDGE_LINE_TYPES } from '../composables/useFlowEdgeStyles.js'
45
51
  import { useFlowStore } from '../composables/useFlowStore.js'
52
+ import { flowEdgeCondition, flowEdgeConditionText } from '../utils/flowCondition.js'
46
53
 
47
54
  /**
48
55
  * CnFlowEdgeEditModal — edit one connection between two steps.
49
56
  *
50
57
  * A line carries two authored things: what it is CALLED, and how it is DRAWN.
58
+ * When a condition decides it, the dialog says that condition in words.
51
59
  * The label is the one that matters on a branching flow — an unlabelled arrow
52
60
  * out of a routing step says nothing about which branch it is — and the router
53
61
  * is the escape hatch for the one line an automatic layout puts through a node.
@@ -122,6 +130,21 @@ export default {
122
130
  to: this.nodeLabel(pair.target),
123
131
  })
124
132
  },
133
+
134
+ /**
135
+ * @return {string} When this line is taken, in words, or '' when it is simply followed.
136
+ */
137
+ conditionLine() {
138
+ const pair = this.store.editingEdge
139
+ const found = pair ? this.store.locateEdge(pair) : null
140
+ if (found === null) {
141
+ return ''
142
+ }
143
+ const source = this.store.nodes.find((node) => node.id === pair.source) || null
144
+ const text = flowEdgeConditionText(found.edge, source)
145
+
146
+ return flowEdgeCondition(found.edge, source) === null ? text : t('nextcloud-vue', 'Only if {condition}', { condition: text })
147
+ },
125
148
  },
126
149
 
127
150
  methods: {
@@ -201,4 +224,9 @@ export default {
201
224
  color: var(--color-text-maxcontrast);
202
225
  font-size: 0.9em;
203
226
  }
227
+
228
+ .cn-flow-edge-edit__condition {
229
+ margin: 0;
230
+ font-weight: 600;
231
+ }
204
232
  </style>
@@ -1,11 +1,11 @@
1
1
  <!--
2
2
  CnFlowEditModal — edit a flow without leaving the page.
3
3
 
4
- This is what Buildiq's "Edit flows…" opens. It hosts the SAME components as
5
- the flow detail page — CnFlowDetail for the canvas, CnFlowSidebar for the
6
- controls — rather than a second, simpler editor. A modal that could only edit
7
- a flow's name would quietly become a different product surface from the page,
8
- and the two would drift.
4
+ What Buildiq's "Edit flows…" opens for an app without a flow page in list mode.
5
+ It is no editor of its own: it hosts the SAME components as the flow detail
6
+ page, CnFlowDetail in its list view with the Canvas / List switch and
7
+ CnFlowSidebar for the controls, so a flow behaves the same wherever it opens.
8
+ New callers link to the flow page with `?view=list` instead (decision 379).
9
9
 
10
10
  `size="full"` because a graph needs the room: the canvas and the controls have
11
11
  to be on screen together, and at any smaller size the sidebar either wraps
@@ -22,8 +22,13 @@
22
22
  <div class="cn-flow-modal__canvas">
23
23
  <CnFlowDetail :id="flowId"
24
24
  :app="app"
25
+ :view="activeView"
25
26
  @save="onSave"
26
- @run="onRun" />
27
+ @run="onRun">
28
+ <template #toolbar-start>
29
+ <CnFlowViewSwitch v-model="activeView" />
30
+ </template>
31
+ </CnFlowDetail>
27
32
  </div>
28
33
  <aside class="cn-flow-modal__side">
29
34
  <!-- `embedded`: NcAppSidebar's app-layout positioning has no
@@ -57,8 +62,13 @@
57
62
  import { NcButton, NcDialog } from '@nextcloud/vue'
58
63
  import CnFlowDetail from '../components/CnFlowDetail/CnFlowDetail.vue'
59
64
  import CnFlowSidebar from '../components/CnFlowDetail/CnFlowSidebar.vue'
65
+ import CnFlowViewSwitch from '../components/CnFlowDetail/CnFlowViewSwitch.vue'
60
66
  import { useFlowStore } from '../composables/useFlowStore.js'
61
67
 
68
+ /**
69
+ * @deprecated Link to the flow page in list mode (`/flows/{id}?view=list`).
70
+ * Kept while callers move; it renders that same list view in a dialog.
71
+ */
62
72
  export default {
63
73
  name: 'CnFlowEditModal',
64
74
 
@@ -67,6 +77,7 @@ export default {
67
77
  NcDialog,
68
78
  CnFlowDetail,
69
79
  CnFlowSidebar,
80
+ CnFlowViewSwitch,
70
81
  },
71
82
 
72
83
  props: {
@@ -85,6 +96,14 @@ export default {
85
96
  type: String,
86
97
  default: null,
87
98
  },
99
+
100
+ /**
101
+ * The view on arrival: `list` or `canvas`.
102
+ */
103
+ view: {
104
+ type: String,
105
+ default: 'list',
106
+ },
88
107
  },
89
108
 
90
109
  emits: ['close', 'saved'],
@@ -95,6 +114,7 @@ export default {
95
114
 
96
115
  data() {
97
116
  return {
117
+ activeView: this.view,
98
118
  confirmDiscard: false,
99
119
  }
100
120
  },
@@ -133,6 +133,14 @@ export default {
133
133
 
134
134
  components: { NcDialog, NcSelect, NcTextField },
135
135
 
136
+ props: {
137
+ /** Add the step at the bottom of the list view, wired in, not loose on the canvas. */
138
+ append: {
139
+ type: Boolean,
140
+ default: false,
141
+ },
142
+ },
143
+
136
144
  emits: ['close'],
137
145
 
138
146
  setup() {
@@ -290,7 +298,11 @@ export default {
290
298
  * @return {void}
291
299
  */
292
300
  add(id) {
293
- this.store.addNode(id)
301
+ if (this.append) {
302
+ this.store.appendStep(id)
303
+ } else {
304
+ this.store.addNode(id)
305
+ }
294
306
  this.$emit('close')
295
307
  },
296
308
  },
package/src/index.js CHANGED
@@ -176,7 +176,9 @@ export {
176
176
  CnFlowRunsWidgetForm,
177
177
  CnFlowSidebar,
178
178
  CnFlowsPage,
179
+ CnFlowStepList,
179
180
  CnFlowStepOutcomes,
181
+ CnFlowViewSwitch,
180
182
  CnFolderSidebar,
181
183
  CnFolderTree,
182
184
  CnFollowToggle,
@@ -2,17 +2,19 @@
2
2
  // SPDX-License-Identifier: EUPL-1.2
3
3
 
4
4
  /**
5
- * The three dialog widths of the screens canon (section 5 of UNIFORM-canon.md),
6
- * by role. No other width is reachable through the `width` prop of a `Cn*`
7
- * dialog.
5
+ * The dialog widths of the screens canon (section 5 of UNIFORM-canon.md), by
6
+ * role. `browse` is the search-and-pick dialog with a filter column beside its
7
+ * results (learniq/LqOpenLesmateriaal). No other width is reachable through the
8
+ * `width` prop of a `Cn*` dialog.
8
9
  *
9
- * @spec openspec/changes/screens-dialog-parity/specs/dialog-system/spec.md#requirement-a-dialog-takes-one-of-three-widths
10
+ * @spec openspec/changes/screens-dialog-parity/specs/dialog-system/spec.md#requirement-a-dialog-takes-one-of-four-widths
10
11
  * @type {Readonly<Record<string, number>>}
11
12
  */
12
13
  export const DIALOG_WIDTHS = Object.freeze({
13
14
  confirm: 560,
14
15
  form: 640,
15
16
  wizard: 720,
17
+ browse: 1120,
16
18
  })
17
19
 
18
20
  /**
@@ -0,0 +1,173 @@
1
+ /**
2
+ * SPDX-License-Identifier: EUPL-1.2
3
+ * SPDX-FileCopyrightText: 2026 Conduction B.V. <info@conduction.nl>
4
+ */
5
+
6
+ import { translate as t } from '@nextcloud/l10n'
7
+
8
+ /**
9
+ * Readable text for the JSONLogic that routes a flow.
10
+ *
11
+ * The engine evaluates a condition on one of a node's `exits`, and an edge
12
+ * names its exit in `fromExit`; `condition` on the edge itself is read as well
13
+ * because documents carry it. The JSONLogic stays where it is: this module only
14
+ * says it in words.
15
+ */
16
+
17
+ /**
18
+ * @param {unknown} value A candidate condition.
19
+ * @return {boolean} Whether it is a non-empty JSONLogic object.
20
+ */
21
+ function isLogic(value) {
22
+ return value !== null && typeof value === 'object' && !Array.isArray(value) && Object.keys(value).length > 0
23
+ }
24
+
25
+ /**
26
+ * @param {unknown} operand A `{ var }` operand or a plain value.
27
+ * @return {string|null} The field it reads, without the item's `json.` prefix, or null.
28
+ */
29
+ function fieldOf(operand) {
30
+ if (operand === null || typeof operand !== 'object' || !('var' in operand)) {
31
+ return null
32
+ }
33
+ const path = Array.isArray(operand.var) ? operand.var[0] : operand.var
34
+
35
+ return String(path ?? '').replace(/^json\./, '')
36
+ }
37
+
38
+ /**
39
+ * @param {unknown} value A literal operand.
40
+ * @return {string} It as text.
41
+ */
42
+ function literal(value) {
43
+ return Array.isArray(value) ? value.map(literal).join(', ') : String(value ?? '')
44
+ }
45
+
46
+ const comparisons = {
47
+ '==': (parts) => t('nextcloud-vue', '{field} is {value}', parts),
48
+ '===': (parts) => t('nextcloud-vue', '{field} is {value}', parts),
49
+ '!=': (parts) => t('nextcloud-vue', '{field} is not {value}', parts),
50
+ '!==': (parts) => t('nextcloud-vue', '{field} is not {value}', parts),
51
+ '>': (parts) => t('nextcloud-vue', '{field} is more than {value}', parts),
52
+ '>=': (parts) => t('nextcloud-vue', '{field} is at least {value}', parts),
53
+ '<': (parts) => t('nextcloud-vue', '{field} is less than {value}', parts),
54
+ '<=': (parts) => t('nextcloud-vue', '{field} is at most {value}', parts),
55
+ in: (parts) => t('nextcloud-vue', '{field} is one of {value}', parts),
56
+ }
57
+
58
+ const presence = {
59
+ '!!': (field) => t('nextcloud-vue', '{field} is filled in', { field }),
60
+ '!': (field) => t('nextcloud-vue', '{field} is empty', { field }),
61
+ }
62
+
63
+ /**
64
+ * @param {string} op A comparison operator.
65
+ * @param {Array} args Its operands.
66
+ * @return {string|null} The sentence, or null when neither side is a plain field and value.
67
+ */
68
+ function compare(op, args) {
69
+ const field = fieldOf(args[0])
70
+ if (field === null || fieldOf(args[1]) !== null) {
71
+ return null
72
+ }
73
+
74
+ return comparisons[op]({ field, value: literal(args[1]) })
75
+ }
76
+
77
+ /**
78
+ * @param {string} op `and` or `or`.
79
+ * @param {Array} args The joined conditions.
80
+ * @return {string|null} The sentence, or null when one part has no words.
81
+ */
82
+ function join(op, args) {
83
+ const parts = args.map((part) => {
84
+ const text = sentence(part)
85
+ const nested = isLogic(part) && ('and' in part || 'or' in part) && args.length > 1
86
+ return text !== null && nested ? `(${text})` : text
87
+ })
88
+ if (parts.length === 0 || parts.includes(null)) {
89
+ return null
90
+ }
91
+
92
+ return parts.join(op === 'and' ? ` ${t('nextcloud-vue', 'and')} ` : ` ${t('nextcloud-vue', 'or')} `)
93
+ }
94
+
95
+ /**
96
+ * @param {unknown} logic A JSONLogic expression.
97
+ * @return {string|null} It in words, or null when it has none.
98
+ */
99
+ function sentence(logic) {
100
+ if (!isLogic(logic)) {
101
+ return null
102
+ }
103
+ const [op] = Object.keys(logic)
104
+ const args = [].concat(logic[op])
105
+ if (op === 'and' || op === 'or') {
106
+ return join(op, args)
107
+ }
108
+ if (comparisons[op]) {
109
+ return compare(op, args)
110
+ }
111
+ const field = presence[op] ? fieldOf(args[0]) : null
112
+
113
+ return field === null ? null : presence[op](field)
114
+ }
115
+
116
+ /**
117
+ * A JSONLogic condition in words.
118
+ *
119
+ * @param {object|null} logic The condition.
120
+ * @return {string} The sentence, a fixed line when it cannot be put in words, or '' without a condition.
121
+ */
122
+ export function flowConditionText(logic) {
123
+ if (!isLogic(logic)) {
124
+ return ''
125
+ }
126
+
127
+ return sentence(logic) ?? t('nextcloud-vue', 'A custom condition')
128
+ }
129
+
130
+ /**
131
+ * @param {object} edge The stored edge.
132
+ * @param {object|null} source The node the edge leaves.
133
+ * @return {object|null} The exit the edge leaves through, if the node declares it.
134
+ */
135
+ function exitOf(edge, source) {
136
+ const exits = Array.isArray(source?.exits) ? source.exits : []
137
+
138
+ return exits.find((exit) => exit && exit.id === edge?.fromExit) || null
139
+ }
140
+
141
+ /**
142
+ * The JSONLogic that decides whether a line is taken.
143
+ *
144
+ * @param {object} edge The stored edge.
145
+ * @param {object|null} source The node the edge leaves.
146
+ * @return {object|null} The condition, or null.
147
+ */
148
+ export function flowEdgeCondition(edge, source) {
149
+ if (isLogic(edge?.condition)) {
150
+ return edge.condition
151
+ }
152
+ const exit = exitOf(edge, source)
153
+
154
+ return isLogic(exit?.condition) ? exit.condition : null
155
+ }
156
+
157
+ /**
158
+ * When a line is taken, in words: its condition, or "Otherwise" on the exit
159
+ * without a condition beside exits that have one.
160
+ *
161
+ * @param {object} edge The stored edge.
162
+ * @param {object|null} source The node the edge leaves.
163
+ * @return {string} The text, or '' for a line that is simply followed.
164
+ */
165
+ export function flowEdgeConditionText(edge, source) {
166
+ const logic = flowEdgeCondition(edge, source)
167
+ if (logic !== null) {
168
+ return flowConditionText(logic)
169
+ }
170
+ const branches = exitOf(edge, source) !== null && source.exits.some((exit) => isLogic(exit?.condition))
171
+
172
+ return branches ? t('nextcloud-vue', 'Otherwise') : ''
173
+ }
@@ -31,3 +31,66 @@ export function flowRunStatuses() {
31
31
  * The engine statuses a "with errors" filter counts as an error.
32
32
  */
33
33
  export const FLOW_RUN_ERROR_STATUSES = ['failed', 'dead_letter']
34
+
35
+ /**
36
+ * The engine statuses a run waits in for a person or a time.
37
+ */
38
+ const FLOW_RUN_WAITING_STATUSES = ['suspended', 'awaiting_consent']
39
+
40
+ /**
41
+ * The objects a run works with, each under its role.
42
+ *
43
+ * `subjects` is what the run declared; a run that declared none still has the
44
+ * object its trigger fired on.
45
+ *
46
+ * @param {object} run A run.
47
+ * @return {Array<{role: string, uuid: string}>} The subjects.
48
+ */
49
+ export function flowRunSubjects(run) {
50
+ const declared = Object.entries(run?.subjects || {}).map(([role, subject]) => ({ role, uuid: String(subject?.uuid ?? '') }))
51
+ if (declared.length > 0) {
52
+ return declared
53
+ }
54
+ const uuid = run?.subjectUuid ?? run?.subject?.uuid
55
+
56
+ return uuid ? [{ role: '', uuid: String(uuid) }] : []
57
+ }
58
+
59
+ /**
60
+ * The tile over the distinct subjects of some runs.
61
+ *
62
+ * @param {Array<object>} runs The runs.
63
+ * @return {object} The tile: how many objects, and under which roles.
64
+ */
65
+ function subjectsCounter(runs) {
66
+ const subjects = runs.flatMap(flowRunSubjects)
67
+ const roles = [...new Set(subjects.map((subject) => subject.role).filter(Boolean))]
68
+
69
+ return {
70
+ id: 'subjects',
71
+ label: t('nextcloud-vue', 'Subjects'),
72
+ count: new Set(subjects.map((subject) => subject.uuid)).size,
73
+ note: roles.join(', '),
74
+ variant: 'default',
75
+ }
76
+ }
77
+
78
+ /**
79
+ * The counters above a run history (board OrFlowRuns).
80
+ *
81
+ * @param {Array<object>} runs The runs in the list.
82
+ * @return {Array<{id: string, label: string, count: number, note: string, variant: string}>} The tiles.
83
+ */
84
+ export function flowRunCounters(runs) {
85
+ const counted = (statuses) => runs.filter((run) => statuses.includes(run.status)).length
86
+ const finished = counted(['completed'])
87
+ const share = runs.length > 0 ? `${Math.round((finished / runs.length) * 100)}%` : ''
88
+
89
+ return [
90
+ { id: 'runs', label: t('nextcloud-vue', 'Runs'), count: runs.length, note: '', variant: 'default' },
91
+ { id: 'finished', label: t('nextcloud-vue', 'Finished'), count: finished, note: share, variant: 'success' },
92
+ { id: 'failed', label: t('nextcloud-vue', 'Failed'), count: counted(FLOW_RUN_ERROR_STATUSES), note: '', variant: 'error' },
93
+ { id: 'waiting', label: t('nextcloud-vue', 'Waiting'), count: counted(FLOW_RUN_WAITING_STATUSES), note: '', variant: 'warning' },
94
+ subjectsCounter(runs),
95
+ ]
96
+ }