summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/projects/commit_box/info/utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/projects/commit_box/info/utils.js')
-rw-r--r--app/assets/javascripts/projects/commit_box/info/utils.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/assets/javascripts/projects/commit_box/info/utils.js b/app/assets/javascripts/projects/commit_box/info/utils.js
new file mode 100644
index 00000000000..ea7eb35cbaf
--- /dev/null
+++ b/app/assets/javascripts/projects/commit_box/info/utils.js
@@ -0,0 +1,14 @@
+export const formatStages = (graphQLStages = [], restStages = []) => {
+ if (graphQLStages.length !== restStages.length) {
+ throw new Error('Rest stages and graphQl stages must be the same length');
+ }
+
+ return graphQLStages.map((stage, index) => {
+ return {
+ name: stage.name,
+ status: stage.detailedStatus,
+ dropdown_path: restStages[index]?.dropdown_path || '',
+ title: restStages[index].title || '',
+ };
+ });
+};