Commit 2748a01a authored by Alfredo Sumaran's avatar Alfredo Sumaran

Use stage description form endpoint response

parent fe5ae3b0
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
*/ */
global.cycleAnalytics.ItemIssueComponent = Vue.extend({ global.cycleAnalytics.ItemIssueComponent = Vue.extend({
template: '#item-issue-component',
props: { props: {
issue: Object, issue: Object,
}, },
...@@ -39,8 +38,8 @@ ...@@ -39,8 +38,8 @@
</span> </span>
<span> <span>
by by
<a href="issue.profile" class="issue-author-link"> <a :href="issue.author.web_url" class="issue-author-link">
{{ issue.author }} {{ issue.author.name }}
</a> </a>
</span> </span>
</div> </div>
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
template: ` template: `
<div> <div>
<div class="events-description"> <div class="events-description">
{{ stage.shortDescription }} {{ stage.description }}
</div> </div>
<ul class="stage-event-list"> <ul class="stage-event-list">
<li class="stage-event-item" v-for="mergeRequest in items"> <li class="stage-event-item" v-for="mergeRequest in items">
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
template: ` template: `
<div> <div>
<div class="events-description"> <div class="events-description">
{{ stage.shortDescription }} {{ stage.description }}
</div> </div>
<ul class="stage-event-list"> <ul class="stage-event-list">
<li class="stage-event-item" v-for="issue in items"> <li class="stage-event-item" v-for="issue in items">
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
template: ` template: `
<div> <div>
<div class="events-description"> <div class="events-description">
{{ stage.shortDescription }} {{ stage.description }}
</div> </div>
<ul class="stage-event-list"> <ul class="stage-event-list">
<li class="stage-event-item" v-for="commit in items"> <li class="stage-event-item" v-for="commit in items">
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
template: ` template: `
<div> <div>
<div class="events-description"> <div class="events-description">
{{ stage.shortDescription }} {{ stage.description }}
</div> </div>
<ul> <ul>
<li v-for="issue in items"> <li v-for="issue in items">
......
...@@ -8,11 +8,12 @@ ...@@ -8,11 +8,12 @@
}, },
props: { props: {
items: Array, items: Array,
stage: Object,
}, },
template: ` template: `
<div> <div>
<div class="events-description"> <div class="events-description">
The time taken to review the code {{ stage.description }}
</div> </div>
<ul class="stage-event-list"> <ul class="stage-event-list">
<li class="stage-event-item" v-for="mergeRequest in items"> <li class="stage-event-item" v-for="mergeRequest in items">
......
...@@ -9,11 +9,12 @@ ...@@ -9,11 +9,12 @@
}, },
props: { props: {
items: Array, items: Array,
stage: Object,
}, },
template: ` template: `
<div> <div>
<div class="events-description"> <div class="events-description">
The time taken in staging {{ stage.description }}
</div> </div>
<ul> <ul>
<li v-for="build in items"> <li v-for="build in items">
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
template: ` template: `
<div> <div>
<div class="events-description"> <div class="events-description">
{{ stage.shortDescription }} {{ stage.description }}
</div> </div>
<ul class="stage-event-list"> <ul class="stage-event-list">
<li class="stage-event-item" v-for="build in items"> <li class="stage-event-item" v-for="build in items">
......
...@@ -86,7 +86,7 @@ $(() => { ...@@ -86,7 +86,7 @@ $(() => {
if (this.currentStage === stage) return; if (this.currentStage === stage) return;
this.isLoadingStage = true; this.isLoadingStage = true;
cycleAnalyticsStore.setStageItems([]); cycleAnalyticsStore.setStageEvents([]);
cycleAnalyticsStore.setActiveStage(stage); cycleAnalyticsStore.setActiveStage(stage);
cycleAnalyticsService cycleAnalyticsService
...@@ -95,8 +95,8 @@ $(() => { ...@@ -95,8 +95,8 @@ $(() => {
startDate: this.startDate, startDate: this.startDate,
}) })
.done((response) => { .done((response) => {
this.isEmptyStage = !response.items.length; this.isEmptyStage = !response.events.length;
cycleAnalyticsStore.setStageItems(response.items); cycleAnalyticsStore.setStageEvents(response.events);
}) })
.error(() => { .error(() => {
this.isEmptyStage = true; this.isEmptyStage = true;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
summary: '', summary: '',
stats: '', stats: '',
analytics: '', analytics: '',
items: [], events: [],
stages:[], stages:[],
}, },
setCycleAnalyticsData(data) { setCycleAnalyticsData(data) {
...@@ -47,8 +47,19 @@ ...@@ -47,8 +47,19 @@
this.deactivateAllStages(); this.deactivateAllStages();
stage.active = true; stage.active = true;
}, },
setStageItems(items) { setStageEvents(events) {
this.state.items = items; 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() { currentActiveStage() {
return this.state.stages.find(stage => stage.active); return this.state.stages.find(stage => stage.active);
......
...@@ -31,11 +31,11 @@ class Projects::CycleAnalyticsController < Projects::ApplicationController ...@@ -31,11 +31,11 @@ class Projects::CycleAnalyticsController < Projects::ApplicationController
cycle_analytics_view_data = [[:issue, "Issue", "Related Issues", "Time before an issue gets scheduled"], cycle_analytics_view_data = [[:issue, "Issue", "Related Issues", "Time before an issue gets scheduled"],
[:plan, "Plan", "Related Commits", "Time before an issue starts implementation"], [:plan, "Plan", "Related Commits", "Time before an issue starts implementation"],
[:code, "Code", "Related Merge Requests", "Time until first merge request"], [:code, "Code", "Related Merge Requests", "Time spent coding"],
[:test, "Test", "Relative Builds Trigger by Commits", "Total test time for all commits/merges"], [:test, "Test", "Relative Builds Trigger by Commits", "The time taken to build and test the application"],
[:review, "Review", "Relative Merged Requests", "Time between merge request creation and merge/close"], [:review, "Review", "Relative Merged Requests", "The time taken to review the code"],
[:staging, "Staging", "Relative Deployed Builds", "From merge request merge until deploy to production"], [:staging, "Staging", "Relative Deployed Builds", "The time taken in staging"],
[:production, "Production", "Related Issues", "From issue creation until deploy to production"]] [: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)| stats = cycle_analytics_view_data.reduce([]) do |stats, (stage_method, stage_text, stage_legend, stage_description)|
value = @cycle_analytics.send(stage_method).presence value = @cycle_analytics.send(stage_method).presence
......
...@@ -83,5 +83,5 @@ ...@@ -83,5 +83,5 @@
= icon("spinner spin", "v-show" => "isLoadingStage") = icon("spinner spin", "v-show" => "isLoadingStage")
%template{ "v-if" => "isEmptyStage" } %template{ "v-if" => "isEmptyStage" }
= render partial: "empty_stage" = render partial: "empty_stage"
%template{ "v-if" => "state.items.length && !isLoadingStage && !isEmptyStage" } %template{ "v-if" => "state.events.length && !isLoadingStage && !isEmptyStage" }
%component{ ":is" => "currentStage.component", ":stage" => "currentStage", ":items" => "state.items" } %component{ ":is" => "currentStage.component", ":stage" => "currentStage", ":items" => "state.events" }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment