@uipath/apollo-react 6.2.0 → 6.3.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.
@@ -1,14 +1,14 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Padding, Spacing } from "@uipath/apollo-core";
3
- import { Column, Row } from "../../layouts/index.js";
2
+ import { Spacing } from "@uipath/apollo-core";
3
+ import { Row } from "../../layouts/index.js";
4
4
  import { Badge, Button, Spinner } from "@uipath/apollo-wind";
5
5
  import debounce from "debounce";
6
- import { CirclePlay } from "lucide-react";
6
+ import { CirclePlay, Redo2, RotateCcw } from "lucide-react";
7
7
  import { memo, useCallback, useMemo, useState } from "react";
8
8
  import { useSafeLingui } from "../../../i18n/index.js";
9
9
  import { CanvasTooltip } from "../CanvasTooltip.js";
10
10
  import { ExecutionStatusIcon } from "../ExecutionStatusIcon/index.js";
11
- import { StageTaskIcon, StageTaskRetryDuration } from "./StageNode.styles.js";
11
+ import { StageTaskIcon } from "./StageNode.styles.js";
12
12
  import { StageTaskEntryConditionIcon } from "./StageTaskEntryConditionIcon.js";
13
13
  import { useExecutionStatusLabel } from "./useExecutionStatusLabel.js";
14
14
  const ProcessCanvasIcon = ()=>/*#__PURE__*/ jsxs("svg", {
@@ -47,7 +47,7 @@ const ProcessCanvasIcon = ()=>/*#__PURE__*/ jsxs("svg", {
47
47
  })
48
48
  ]
49
49
  });
50
- const TaskPlayButton = /*#__PURE__*/ memo(({ taskId, onTaskPlay, small })=>{
50
+ const TaskPlayButton = /*#__PURE__*/ memo(({ taskId, onTaskPlay })=>{
51
51
  const [playLoading, setPlayLoading] = useState(false);
52
52
  const { _ } = useSafeLingui();
53
53
  const triggerTaskLabel = _({
@@ -85,7 +85,7 @@ const TaskPlayButton = /*#__PURE__*/ memo(({ taskId, onTaskPlay, small })=>{
85
85
  onMouseDown: (e)=>e.stopPropagation(),
86
86
  onKeyDown: (e)=>e.stopPropagation(),
87
87
  "aria-label": triggerTaskLabel,
88
- className: small ? 'task-menu-icon-button h-4 w-4 [&_svg]:size-3.5 rounded-sm' : 'task-menu-icon-button h-4 w-4 rounded-sm',
88
+ className: "task-menu-icon-button h-4 w-4 rounded-sm",
89
89
  style: {
90
90
  color: 'var(--canvas-icon-default)',
91
91
  minWidth: 'unset',
@@ -101,174 +101,153 @@ const TaskContent = /*#__PURE__*/ memo(({ task, taskExecution, isDragging, onTas
101
101
  const { _ } = useSafeLingui();
102
102
  const getStatusName = useExecutionStatusLabel();
103
103
  const hasExecutionStatus = !!taskExecution?.status;
104
- const badgeText = useMemo(()=>{
105
- if (!taskExecution?.badge) return;
106
- if (taskExecution.retryCount && taskExecution.retryCount > 1) {
107
- if ('InProgress' === taskExecution.status) return _({
108
- id: 'stage-node.task-badge.running-again',
109
- message: 'Running again'
110
- });
111
- return _({
112
- id: 'stage-node.task-badge.ran-n-times',
113
- message: '{count, plural, one {Ran # time} other {Ran # times}}',
114
- values: {
115
- count: taskExecution.retryCount
116
- }
117
- });
104
+ const retries = taskExecution?.retryCount ?? 0;
105
+ const hasRuns = retries > 0;
106
+ const totalRuns = retries + 1;
107
+ const runsTooltip = taskExecution?.status === 'InProgress' ? _({
108
+ id: 'stage-node.task-badge.running-again',
109
+ message: 'Running again'
110
+ }) : _({
111
+ id: 'stage-node.task-badge.ran-n-times',
112
+ message: '{count, plural, one {Ran # time} other {Ran # times}}',
113
+ values: {
114
+ count: totalRuns
118
115
  }
119
- return taskExecution.badge;
120
- }, [
121
- taskExecution?.badge,
122
- taskExecution?.retryCount,
123
- taskExecution?.status,
124
- _
125
- ]);
126
- const hasSecondRowContent = taskExecution && (taskExecution.duration || taskExecution.retryDuration || badgeText);
127
- const showTaskPlayButton = onTaskPlay && hasExecutionStatus;
116
+ });
117
+ const hasRework = !!taskExecution?.retryDuration;
118
+ const reworkTooltip = _({
119
+ id: 'stage-node.task-badge.rework-time',
120
+ message: 'Reworked (+{duration})',
121
+ values: {
122
+ duration: taskExecution?.retryDuration ?? ''
123
+ }
124
+ });
128
125
  const taskStatusFallbackName = hasExecutionStatus ? getStatusName(taskExecution?.status) : '';
129
126
  const taskStatusTooltip = taskExecution?.message || taskStatusFallbackName;
130
- const durationLabel = useMemo(()=>taskExecution?.duration ? /*#__PURE__*/ jsx("span", {
131
- className: "text-xs text-foreground-muted",
132
- children: taskExecution.duration
133
- }) : null, [
134
- taskExecution?.duration
135
- ]);
136
- return /*#__PURE__*/ jsxs(Column, {
127
+ const showRequiredMarker = task.isRequired && !task.isAdhoc && 'adhoc' !== task.taskGroupType;
128
+ const durationLabel = taskExecution?.duration ? /*#__PURE__*/ jsx("span", {
129
+ className: "text-xs text-foreground-muted",
130
+ children: taskExecution.duration
131
+ }) : null;
132
+ return /*#__PURE__*/ jsxs(Row, {
137
133
  flex: 1,
134
+ align: "center",
135
+ justify: "space-between",
136
+ gap: Spacing.SpacingXs,
138
137
  style: {
139
- overflow: 'hidden',
140
- textOverflow: 'ellipsis',
141
- whiteSpace: 'nowrap'
138
+ overflow: 'hidden'
142
139
  },
143
- gap: Padding.PadXs,
144
140
  children: [
145
141
  /*#__PURE__*/ jsxs(Row, {
146
- align: "center",
147
- justify: "space-between",
148
142
  gap: Spacing.SpacingXs,
143
+ align: "center",
144
+ style: {
145
+ overflow: 'hidden',
146
+ textOverflow: 'ellipsis',
147
+ whiteSpace: 'nowrap'
148
+ },
149
149
  children: [
150
- /*#__PURE__*/ jsxs(Row, {
151
- gap: Spacing.SpacingXs,
152
- align: "center",
153
- style: {
154
- overflow: 'hidden',
155
- textOverflow: 'ellipsis',
156
- whiteSpace: 'nowrap'
150
+ /*#__PURE__*/ jsx(StageTaskIcon, {
151
+ children: task.icon ?? /*#__PURE__*/ jsx(ProcessCanvasIcon, {})
152
+ }),
153
+ /*#__PURE__*/ jsx(CanvasTooltip, {
154
+ content: task.label,
155
+ placement: "top",
156
+ smartTooltip: true,
157
+ ...isDragging && {
158
+ isOpen: false
157
159
  },
158
- children: [
159
- /*#__PURE__*/ jsx(StageTaskIcon, {
160
- children: task.icon ?? /*#__PURE__*/ jsx(ProcessCanvasIcon, {})
161
- }),
162
- /*#__PURE__*/ jsx(CanvasTooltip, {
163
- content: task.label,
164
- placement: "top",
165
- smartTooltip: true,
166
- ...isDragging && {
167
- isOpen: false
168
- },
169
- children: /*#__PURE__*/ jsxs(Row, {
170
- gap: '2px',
171
- align: "center",
160
+ children: /*#__PURE__*/ jsxs(Row, {
161
+ gap: '2px',
162
+ align: "center",
163
+ style: {
164
+ overflow: 'hidden',
165
+ textOverflow: 'ellipsis',
166
+ whiteSpace: 'nowrap'
167
+ },
168
+ children: [
169
+ /*#__PURE__*/ jsx("span", {
170
+ className: "text-sm truncate",
172
171
  style: {
173
- overflow: 'hidden',
174
- textOverflow: 'ellipsis',
175
- whiteSpace: 'nowrap'
172
+ minWidth: 0
176
173
  },
177
- children: [
178
- /*#__PURE__*/ jsx("span", {
179
- className: "text-sm truncate",
180
- style: {
181
- minWidth: 0
182
- },
183
- children: task.label
184
- }),
185
- task.isRequired && /*#__PURE__*/ jsx("span", {
186
- className: "text-sm",
187
- style: {
188
- flexShrink: 0
189
- },
190
- children: '*'
191
- })
192
- ]
193
- })
194
- })
195
- ]
196
- }),
197
- /*#__PURE__*/ jsxs(Row, {
198
- align: "center",
199
- gap: Spacing.SpacingXs,
200
- style: {
201
- flexShrink: 0
202
- },
203
- children: [
204
- hasExecutionStatus && /*#__PURE__*/ jsx(CanvasTooltip, {
205
- content: taskStatusTooltip,
206
- placement: "top",
207
- children: /*#__PURE__*/ jsx(Button, {
208
- variant: "ghost",
209
- size: "icon",
210
- className: "h-4 w-4 rounded-sm",
211
- "aria-label": taskStatusTooltip,
212
- children: /*#__PURE__*/ jsx(ExecutionStatusIcon, {
213
- status: taskExecution.status
214
- })
174
+ children: task.label
175
+ }),
176
+ showRequiredMarker && /*#__PURE__*/ jsx("span", {
177
+ className: "text-sm",
178
+ style: {
179
+ flexShrink: 0
180
+ },
181
+ children: '*'
215
182
  })
216
- }),
217
- !hasSecondRowContent && /*#__PURE__*/ jsx(StageTaskEntryConditionIcon, {
218
- task: task
219
- }),
220
- showTaskPlayButton && !hasSecondRowContent && /*#__PURE__*/ jsx(TaskPlayButton, {
221
- taskId: task.id,
222
- onTaskPlay: onTaskPlay
223
- }),
224
- onTaskPlay && !hasExecutionStatus && /*#__PURE__*/ jsx(TaskPlayButton, {
225
- taskId: task.id,
226
- onTaskPlay: onTaskPlay
227
- })
228
- ]
183
+ ]
184
+ })
229
185
  })
230
186
  ]
231
187
  }),
232
- taskExecution && hasSecondRowContent && /*#__PURE__*/ jsxs(Row, {
188
+ /*#__PURE__*/ jsxs(Row, {
233
189
  align: "center",
234
- justify: "space-between",
190
+ gap: Spacing.SpacingMicro,
191
+ style: {
192
+ flexShrink: 0
193
+ },
235
194
  children: [
236
- /*#__PURE__*/ jsxs(Row, {
237
- gap: '2px',
238
- children: [
239
- durationLabel && (taskExecution?.durationTooltip ? /*#__PURE__*/ jsx(CanvasTooltip, {
240
- content: taskExecution.durationTooltip,
241
- placement: "top",
242
- hide: isDragging,
243
- children: durationLabel
244
- }) : durationLabel),
245
- taskExecution?.retryDuration && /*#__PURE__*/ jsx(StageTaskRetryDuration, {
246
- status: taskExecution.badgeStatus ?? 'warning',
247
- children: /*#__PURE__*/ jsx("span", {
248
- className: "text-xs",
249
- children: `(+${taskExecution.retryDuration})`
250
- })
195
+ durationLabel && (taskExecution?.durationTooltip ? /*#__PURE__*/ jsx(CanvasTooltip, {
196
+ content: taskExecution.durationTooltip,
197
+ placement: "top",
198
+ hide: isDragging,
199
+ children: durationLabel
200
+ }) : durationLabel),
201
+ hasRuns && /*#__PURE__*/ jsx(CanvasTooltip, {
202
+ content: runsTooltip,
203
+ placement: "top",
204
+ hide: isDragging,
205
+ children: /*#__PURE__*/ jsxs(Badge, {
206
+ variant: "warning",
207
+ role: "img",
208
+ "aria-label": runsTooltip,
209
+ className: "h-[14px] gap-px rounded-full px-1 py-0 text-[11px] leading-none [&>svg]:size-3",
210
+ children: [
211
+ /*#__PURE__*/ jsx(Redo2, {
212
+ "aria-hidden": true
213
+ }),
214
+ totalRuns
215
+ ]
216
+ })
217
+ }),
218
+ hasRework && /*#__PURE__*/ jsx(CanvasTooltip, {
219
+ content: reworkTooltip,
220
+ placement: "top",
221
+ hide: isDragging,
222
+ children: /*#__PURE__*/ jsx(Badge, {
223
+ variant: "warning",
224
+ role: "img",
225
+ "aria-label": reworkTooltip,
226
+ className: "h-[14px] rounded-full px-1 py-0 [&>svg]:size-3",
227
+ children: /*#__PURE__*/ jsx(RotateCcw, {
228
+ "aria-hidden": true
251
229
  })
252
- ]
230
+ })
253
231
  }),
254
- /*#__PURE__*/ jsxs(Row, {
255
- align: "center",
256
- gap: Spacing.SpacingXs,
257
- children: [
258
- badgeText && /*#__PURE__*/ jsx(Badge, {
259
- variant: taskExecution.badgeStatus,
260
- children: badgeText
261
- }),
262
- /*#__PURE__*/ jsx(StageTaskEntryConditionIcon, {
263
- task: task,
264
- small: true
265
- }),
266
- showTaskPlayButton && /*#__PURE__*/ jsx(TaskPlayButton, {
267
- taskId: task.id,
268
- onTaskPlay: onTaskPlay,
269
- small: true
232
+ /*#__PURE__*/ jsx(StageTaskEntryConditionIcon, {
233
+ task: task
234
+ }),
235
+ hasExecutionStatus && /*#__PURE__*/ jsx(CanvasTooltip, {
236
+ content: taskStatusTooltip,
237
+ placement: "top",
238
+ children: /*#__PURE__*/ jsx(Button, {
239
+ variant: "ghost",
240
+ size: "icon",
241
+ className: "h-4 w-4 rounded-sm",
242
+ "aria-label": taskStatusTooltip,
243
+ children: /*#__PURE__*/ jsx(ExecutionStatusIcon, {
244
+ status: taskExecution.status
270
245
  })
271
- ]
246
+ })
247
+ }),
248
+ onTaskPlay && /*#__PURE__*/ jsx(TaskPlayButton, {
249
+ taskId: task.id,
250
+ onTaskPlay: onTaskPlay
272
251
  })
273
252
  ]
274
253
  })