summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2016-11-16 16:11:27 -0500
committerAlfredo Sumaran <alfredo@gitlab.com>2016-11-21 13:57:10 -0500
commit2748a01a3a0dc6c6e946c41c68ec866bc87e8f8b (patch)
tree729e62cdc12c21e22d80de937cd4807b93911d24 /app
parentfe5ae3b0af46cfd5f370fb9d111c8b0f2cd1e0d4 (diff)
downloadgitlab-ce-2748a01a3a0dc6c6e946c41c68ec866bc87e8f8b.tar.gz
Use stage description form endpoint response
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/cycle_analytics/components/item_issue_component.js.es65
-rw-r--r--app/assets/javascripts/cycle_analytics/components/stage_code_component.js.es62
-rw-r--r--app/assets/javascripts/cycle_analytics/components/stage_issue_component.js.es62
-rw-r--r--app/assets/javascripts/cycle_analytics/components/stage_plan_component.js.es62
-rw-r--r--app/assets/javascripts/cycle_analytics/components/stage_production_component.js.es62
-rw-r--r--app/assets/javascripts/cycle_analytics/components/stage_review_component.js.es63
-rw-r--r--app/assets/javascripts/cycle_analytics/components/stage_staging_component.js.es63
-rw-r--r--app/assets/javascripts/cycle_analytics/components/stage_test_component.js.es62
-rw-r--r--app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js6
-rw-r--r--app/assets/javascripts/cycle_analytics/cycle_analytics_store.js.es617
-rw-r--r--app/controllers/projects/cycle_analytics_controller.rb10
-rw-r--r--app/views/projects/cycle_analytics/show.html.haml4
12 files changed, 35 insertions, 23 deletions
diff --git a/app/assets/javascripts/cycle_analytics/components/item_issue_component.js.es6 b/app/assets/javascripts/cycle_analytics/components/item_issue_component.js.es6
index 57e20b2aa4e..e73b2db1ba8 100644
--- a/app/assets/javascripts/cycle_analytics/components/item_issue_component.js.es6
+++ b/app/assets/javascripts/cycle_analytics/components/item_issue_component.js.es6
@@ -15,7 +15,6 @@
*/
global.cycleAnalytics.ItemIssueComponent = Vue.extend({
- template: '#item-issue-component',
props: {
issue: Object,
},
@@ -39,8 +38,8 @@
</span>
<span>
by
- <a href="issue.profile" class="issue-author-link">
- {{ issue.author }}
+ <a :href="issue.author.web_url" class="issue-author-link">
+ {{ issue.author.name }}
</a>
</span>
</div>
diff --git a/app/assets/javascripts/cycle_analytics/components/stage_code_component.js.es6 b/app/assets/javascripts/cycle_analytics/components/stage_code_component.js.es6
index 0a61ac797dd..b070d22af8a 100644
--- a/app/assets/javascripts/cycle_analytics/components/stage_code_component.js.es6
+++ b/app/assets/javascripts/cycle_analytics/components/stage_code_component.js.es6
@@ -13,7 +13,7 @@
template: `
<div>
<div class="events-description">
- {{ stage.shortDescription }}
+ {{ stage.description }}
</div>
<ul class="stage-event-list">
<li class="stage-event-item" v-for="mergeRequest in items">
diff --git a/app/assets/javascripts/cycle_analytics/components/stage_issue_component.js.es6 b/app/assets/javascripts/cycle_analytics/components/stage_issue_component.js.es6
index 16b392138a6..204f4d1b806 100644
--- a/app/assets/javascripts/cycle_analytics/components/stage_issue_component.js.es6
+++ b/app/assets/javascripts/cycle_analytics/components/stage_issue_component.js.es6
@@ -13,7 +13,7 @@
template: `
<div>
<div class="events-description">
- {{ stage.shortDescription }}
+ {{ stage.description }}
</div>
<ul class="stage-event-list">
<li class="stage-event-item" v-for="issue in items">
diff --git a/app/assets/javascripts/cycle_analytics/components/stage_plan_component.js.es6 b/app/assets/javascripts/cycle_analytics/components/stage_plan_component.js.es6
index 87b189adacb..637f3877a2e 100644
--- a/app/assets/javascripts/cycle_analytics/components/stage_plan_component.js.es6
+++ b/app/assets/javascripts/cycle_analytics/components/stage_plan_component.js.es6
@@ -13,7 +13,7 @@
template: `
<div>
<div class="events-description">
- {{ stage.shortDescription }}
+ {{ stage.description }}
</div>
<ul class="stage-event-list">
<li class="stage-event-item" v-for="commit in items">
diff --git a/app/assets/javascripts/cycle_analytics/components/stage_production_component.js.es6 b/app/assets/javascripts/cycle_analytics/components/stage_production_component.js.es6
index 15477f957fd..8616316d69b 100644
--- a/app/assets/javascripts/cycle_analytics/components/stage_production_component.js.es6
+++ b/app/assets/javascripts/cycle_analytics/components/stage_production_component.js.es6
@@ -13,7 +13,7 @@
template: `
<div>
<div class="events-description">
- {{ stage.shortDescription }}
+ {{ stage.description }}
</div>
<ul>
<li v-for="issue in items">
diff --git a/app/assets/javascripts/cycle_analytics/components/stage_review_component.js.es6 b/app/assets/javascripts/cycle_analytics/components/stage_review_component.js.es6
index b52ecbb21f3..516c259722c 100644
--- a/app/assets/javascripts/cycle_analytics/components/stage_review_component.js.es6
+++ b/app/assets/javascripts/cycle_analytics/components/stage_review_component.js.es6
@@ -8,11 +8,12 @@
},
props: {
items: Array,
+ stage: Object,
},
template: `
<div>
<div class="events-description">
- The time taken to review the code
+ {{ stage.description }}
</div>
<ul class="stage-event-list">
<li class="stage-event-item" v-for="mergeRequest in items">
diff --git a/app/assets/javascripts/cycle_analytics/components/stage_staging_component.js.es6 b/app/assets/javascripts/cycle_analytics/components/stage_staging_component.js.es6
index c07f556ed84..1f983ecbab9 100644
--- a/app/assets/javascripts/cycle_analytics/components/stage_staging_component.js.es6
+++ b/app/assets/javascripts/cycle_analytics/components/stage_staging_component.js.es6
@@ -9,11 +9,12 @@
},
props: {
items: Array,
+ stage: Object,
},
template: `
<div>
<div class="events-description">
- The time taken in staging
+ {{ stage.description }}
</div>
<ul>
<li v-for="build in items">
diff --git a/app/assets/javascripts/cycle_analytics/components/stage_test_component.js.es6 b/app/assets/javascripts/cycle_analytics/components/stage_test_component.js.es6
index b09fd8c8a6f..ecb730e7b7c 100644
--- a/app/assets/javascripts/cycle_analytics/components/stage_test_component.js.es6
+++ b/app/assets/javascripts/cycle_analytics/components/stage_test_component.js.es6
@@ -13,7 +13,7 @@
template: `
<div>
<div class="events-description">
- {{ stage.shortDescription }}
+ {{ stage.description }}
</div>
<ul class="stage-event-list">
<li class="stage-event-item" v-for="build in items">
diff --git a/app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js b/app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js
index 05038c3c500..6ca12cb7e78 100644
--- a/app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js
+++ b/app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js
@@ -86,7 +86,7 @@ $(() => {
if (this.currentStage === stage) return;
this.isLoadingStage = true;
- cycleAnalyticsStore.setStageItems([]);
+ cycleAnalyticsStore.setStageEvents([]);
cycleAnalyticsStore.setActiveStage(stage);
cycleAnalyticsService
@@ -95,8 +95,8 @@ $(() => {
startDate: this.startDate,
})
.done((response) => {
- this.isEmptyStage = !response.items.length;
- cycleAnalyticsStore.setStageItems(response.items);
+ this.isEmptyStage = !response.events.length;
+ cycleAnalyticsStore.setStageEvents(response.events);
})
.error(() => {
this.isEmptyStage = true;
diff --git a/app/assets/javascripts/cycle_analytics/cycle_analytics_store.js.es6 b/app/assets/javascripts/cycle_analytics/cycle_analytics_store.js.es6
index bef741c879a..9315f7621a7 100644
--- a/app/assets/javascripts/cycle_analytics/cycle_analytics_store.js.es6
+++ b/app/assets/javascripts/cycle_analytics/cycle_analytics_store.js.es6
@@ -6,7 +6,7 @@
summary: '',
stats: '',
analytics: '',
- items: [],
+ events: [],
stages:[],
},
setCycleAnalyticsData(data) {
@@ -47,8 +47,19 @@
this.deactivateAllStages();
stage.active = true;
},
- setStageItems(items) {
- this.state.items = items;
+ setStageEvents(events) {
+ this.state.events = this.decorateEvents(events);
+ },
+ decorateEvents(events) {
+ let newEvents = events;
+
+ newEvents.forEach((item) => {
+ item.totalTime = item.total_time;
+
+ delete item.total_time;
+ });
+
+ return newEvents;
},
currentActiveStage() {
return this.state.stages.find(stage => stage.active);
diff --git a/app/controllers/projects/cycle_analytics_controller.rb b/app/controllers/projects/cycle_analytics_controller.rb
index 2fb496053a5..fd263960b93 100644
--- a/app/controllers/projects/cycle_analytics_controller.rb
+++ b/app/controllers/projects/cycle_analytics_controller.rb
@@ -31,11 +31,11 @@ class Projects::CycleAnalyticsController < Projects::ApplicationController
cycle_analytics_view_data = [[:issue, "Issue", "Related Issues", "Time before an issue gets scheduled"],
[:plan, "Plan", "Related Commits", "Time before an issue starts implementation"],
- [:code, "Code", "Related Merge Requests", "Time until first merge request"],
- [:test, "Test", "Relative Builds Trigger by Commits", "Total test time for all commits/merges"],
- [:review, "Review", "Relative Merged Requests", "Time between merge request creation and merge/close"],
- [:staging, "Staging", "Relative Deployed Builds", "From merge request merge until deploy to production"],
- [:production, "Production", "Related Issues", "From issue creation until deploy to production"]]
+ [:code, "Code", "Related Merge Requests", "Time spent coding"],
+ [:test, "Test", "Relative Builds Trigger by Commits", "The time taken to build and test the application"],
+ [:review, "Review", "Relative Merged Requests", "The time taken to review the code"],
+ [:staging, "Staging", "Relative Deployed Builds", "The time taken in staging"],
+ [:production, "Production", "Related Issues", "The total time taken from idea to production"]]
stats = cycle_analytics_view_data.reduce([]) do |stats, (stage_method, stage_text, stage_legend, stage_description)|
value = @cycle_analytics.send(stage_method).presence
diff --git a/app/views/projects/cycle_analytics/show.html.haml b/app/views/projects/cycle_analytics/show.html.haml
index cf496b46e4f..010f64b3bb5 100644
--- a/app/views/projects/cycle_analytics/show.html.haml
+++ b/app/views/projects/cycle_analytics/show.html.haml
@@ -83,5 +83,5 @@
= icon("spinner spin", "v-show" => "isLoadingStage")
%template{ "v-if" => "isEmptyStage" }
= render partial: "empty_stage"
- %template{ "v-if" => "state.items.length && !isLoadingStage && !isEmptyStage" }
- %component{ ":is" => "currentStage.component", ":stage" => "currentStage", ":items" => "state.items" }
+ %template{ "v-if" => "state.events.length && !isLoadingStage && !isEmptyStage" }
+ %component{ ":is" => "currentStage.component", ":stage" => "currentStage", ":items" => "state.events" }