generated from eea/volto-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs #131062 added Workflows.js from volto master, another commit wil…
…l follow to have diff changes
- Loading branch information
1 parent
694aab2
commit bf986ba
Showing
1 changed file
with
33 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Layouts. | ||
* @module constants/Workflows | ||
*/ | ||
|
||
import { last, split } from 'lodash'; | ||
|
||
export default function getWorkflowMapping(url, current) { | ||
const mapping = { | ||
published: { value: 'public', label: 'Public', color: '#007bc1', url }, | ||
publish: { value: 'public', label: 'Public', color: '#007bc1', url }, | ||
private: { value: 'private', label: 'Private', color: '#ed4033', url }, | ||
pending: { value: 'pending', label: 'Pending', color: '#f6a808', url }, | ||
send_back: { value: 'private', label: 'Private', color: '#ed4033', url }, | ||
retract: { value: 'private', label: 'Private', color: '#ed4033', url }, | ||
submit: { value: 'review', label: 'Review', color: '#f4e037', url }, | ||
}; | ||
|
||
if (url) { | ||
const key = last(split(url, '/')); | ||
if (key in mapping) { | ||
return mapping[key]; | ||
} | ||
|
||
return { value: key, label: key, color: '#000', url }; | ||
} | ||
|
||
if (current in mapping) { | ||
return mapping[current]; | ||
} | ||
|
||
return { value: current, label: current, color: '#000', url }; | ||
} |