-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: reorder steps on workflow card (#1118)
* feat: reorder steps on workflow card * refactor: duplicated style on StepCard * fix: too small hitbox on StepCard button
- Loading branch information
1 parent
4ab6ba7
commit a76e82c
Showing
7 changed files
with
265 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
source/javascripts/components/WorkflowCard/WorkflowCard.utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export function getUsedByText(usedBy: string[]) { | ||
switch (usedBy.length) { | ||
case 0: | ||
return 'not used by other Workflow'; | ||
case 1: | ||
return 'used by 1 Workflow'; | ||
default: | ||
return `used by ${usedBy.length} Workflows`; | ||
} | ||
} | ||
|
||
export function getSortableStepId(workflowId: string, stepIndex: number) { | ||
return `${workflowId}->${stepIndex}`; | ||
} | ||
|
||
export function parseSortableStepId(sortableStepId: string) { | ||
const [workflowId, stepIndexAsString] = sortableStepId.split('->'); | ||
return { workflowId, stepIndex: Number(stepIndexAsString) }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.