Use stage description form endpoint response
This commit is contained in:
parent
fe5ae3b0af
commit
2748a01a3a
|
@ -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>
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
template: `
|
||||
<div>
|
||||
<div class="events-description">
|
||||
{{ stage.shortDescription }}
|
||||
{{ stage.description }}
|
||||
</div>
|
||||
<ul>
|
||||
<li v-for="issue in items">
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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" }
|
||||
|
|
Loading…
Reference in New Issue