BigW Consortium Gitlab

Commit 5343a65b by Jacob Schatz Committed by Felipe Artur

Merge branch 'add-additional-checks-to-ca-data' into 'master'

Small improvements for Cycle Analytics See merge request !9153
parent 3fd818ad
...@@ -97,7 +97,7 @@ $(() => { ...@@ -97,7 +97,7 @@ $(() => {
} }
this.isLoadingStage = true; this.isLoadingStage = true;
cycleAnalyticsStore.setStageEvents([]); cycleAnalyticsStore.setStageEvents([], stage);
cycleAnalyticsStore.setActiveStage(stage); cycleAnalyticsStore.setActiveStage(stage);
cycleAnalyticsService cycleAnalyticsService
...@@ -107,7 +107,7 @@ $(() => { ...@@ -107,7 +107,7 @@ $(() => {
}) })
.done((response) => { .done((response) => {
this.isEmptyStage = !response.events.length; this.isEmptyStage = !response.events.length;
cycleAnalyticsStore.setStageEvents(response.events); cycleAnalyticsStore.setStageEvents(response.events, stage);
}) })
.error(() => { .error(() => {
this.isEmptyStage = true; this.isEmptyStage = true;
......
/* eslint-disable no-param-reassign */ /* eslint-disable no-param-reassign */
require('../lib/utils/text_utility');
const DEFAULT_EVENT_OBJECTS = require('./default_event_objects');
((global) => { ((global) => {
global.cycleAnalytics = global.cycleAnalytics || {}; global.cycleAnalytics = global.cycleAnalytics || {};
...@@ -34,11 +38,12 @@ ...@@ -34,11 +38,12 @@
}); });
newData.stages.forEach((item) => { newData.stages.forEach((item) => {
const stageName = item.title.toLowerCase(); const stageSlug = gl.text.dasherize(item.title.toLowerCase());
item.active = false; item.active = false;
item.isUserAllowed = data.permissions[stageName]; item.isUserAllowed = data.permissions[stageSlug];
item.emptyStageText = EMPTY_STAGE_TEXTS[stageName]; item.emptyStageText = EMPTY_STAGE_TEXTS[stageSlug];
item.component = `stage-${stageName}-component`; item.component = `stage-${stageSlug}-component`;
item.slug = stageSlug;
}); });
newData.analytics = data; newData.analytics = data;
return newData; return newData;
...@@ -58,10 +63,10 @@ ...@@ -58,10 +63,10 @@
this.deactivateAllStages(); this.deactivateAllStages();
stage.active = true; stage.active = true;
}, },
setStageEvents(events) { setStageEvents(events, stage) {
this.state.events = this.decorateEvents(events); this.state.events = this.decorateEvents(events, stage);
}, },
decorateEvents(events) { decorateEvents(events, stage) {
const newEvents = []; const newEvents = [];
events.forEach((item) => { events.forEach((item) => {
...@@ -76,18 +81,18 @@ ...@@ -76,18 +81,18 @@
eventItem.author.avatarUrl = eventItem.author.avatar_url; eventItem.author.avatarUrl = eventItem.author.avatar_url;
} }
if (item.created_at) item.createdAt = item.created_at; if (eventItem.created_at) eventItem.createdAt = eventItem.created_at;
if (item.short_sha) item.shortSha = item.short_sha; if (eventItem.short_sha) eventItem.shortSha = eventItem.short_sha;
if (item.commit_url) item.commitUrl = item.commit_url; if (eventItem.commit_url) eventItem.commitUrl = eventItem.commit_url;
delete item.author.web_url; delete eventItem.author.web_url;
delete item.author.avatar_url; delete eventItem.author.avatar_url;
delete item.total_time; delete eventItem.total_time;
delete item.created_at; delete eventItem.created_at;
delete item.short_sha; delete eventItem.short_sha;
delete item.commit_url; delete eventItem.commit_url;
newEvents.push(item); newEvents.push(eventItem);
}); });
return newEvents; return newEvents;
......
module.exports = {
issue: {
created_at: '',
url: '',
iid: '',
title: '',
total_time: {},
author: {
avatar_url: '',
id: '',
name: '',
web_url: '',
},
},
plan: {
title: '',
commit_url: '',
short_sha: '',
total_time: {},
author: {
name: '',
id: '',
avatar_url: '',
web_url: '',
},
},
code: {
title: '',
iid: '',
created_at: '',
url: '',
total_time: {},
author: {
name: '',
id: '',
avatar_url: '',
web_url: '',
},
},
test: {
name: '',
id: '',
date: '',
url: '',
short_sha: '',
commit_url: '',
total_time: {},
branch: {
name: '',
url: '',
},
},
review: {
title: '',
iid: '',
created_at: '',
url: '',
state: '',
total_time: {},
author: {
name: '',
id: '',
avatar_url: '',
web_url: '',
},
},
staging: {
id: '',
short_sha: '',
date: '',
url: '',
commit_url: '',
total_time: {},
author: {
name: '',
id: '',
avatar_url: '',
web_url: '',
},
branch: {
name: '',
url: '',
},
},
production: {
title: '',
created_at: '',
url: '',
iid: '',
total_time: {},
author: {
name: '',
id: '',
avatar_url: '',
web_url: '',
},
},
};
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-param-reassign, no-cond-assign, quotes, one-var, one-var-declaration-per-line, operator-assignment, no-else-return, prefer-template, prefer-arrow-callback, no-empty, max-len, consistent-return, no-unused-vars, no-return-assign, max-len */ /* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-param-reassign, no-cond-assign, quotes, one-var, one-var-declaration-per-line, operator-assignment, no-else-return, prefer-template, prefer-arrow-callback, no-empty, max-len, consistent-return, no-unused-vars, no-return-assign, max-len */
require('vendor/latinise');
(function() { (function() {
(function(w) { (function(w) {
var base; var base;
...@@ -164,8 +166,14 @@ ...@@ -164,8 +166,14 @@
gl.text.pluralize = function(str, count) { gl.text.pluralize = function(str, count) {
return str + (count > 1 || count === 0 ? 's' : ''); return str + (count > 1 || count === 0 ? 's' : '');
}; };
return gl.text.truncate = function(string, maxLength) { gl.text.truncate = function(string, maxLength) {
return string.substr(0, (maxLength - 3)) + '...'; return string.substr(0, (maxLength - 3)) + '...';
}; };
gl.text.dasherize = function(str) {
return str.replace(/[_\s]+/g, '-');
};
gl.text.slugify = function(str) {
return str.trim().toLowerCase().latinise();
};
})(window); })(window);
}).call(this); }).call(this);
/* eslint-disable no-param-reassign */ /* eslint-disable no-param-reassign */
/* global Breakpoints */ /* global Breakpoints */
require('vendor/latinise');
require('./breakpoints'); require('./breakpoints');
require('vendor/jquery.nicescroll'); require('vendor/jquery.nicescroll');
((global) => { ((global) => {
const dasherize = str => str.replace(/[_\s]+/g, '-');
const slugify = str => dasherize(str.trim().toLowerCase().latinise());
class Wikis { class Wikis {
constructor() { constructor() {
this.bp = Breakpoints.get(); this.bp = Breakpoints.get();
...@@ -34,7 +30,7 @@ require('vendor/jquery.nicescroll'); ...@@ -34,7 +30,7 @@ require('vendor/jquery.nicescroll');
if (!this.newWikiForm) return; if (!this.newWikiForm) return;
const slugInput = this.newWikiForm.querySelector('#new_wiki_path'); const slugInput = this.newWikiForm.querySelector('#new_wiki_path');
const slug = slugify(slugInput.value); const slug = gl.text.slugify(slugInput.value);
if (slug.length > 0) { if (slug.length > 0) {
const wikisPath = slugInput.getAttribute('data-wikis-path'); const wikisPath = slugInput.getAttribute('data-wikis-path');
......
...@@ -2,6 +2,7 @@ class AnalyticsStageEntity < Grape::Entity ...@@ -2,6 +2,7 @@ class AnalyticsStageEntity < Grape::Entity
include EntityDateHelper include EntityDateHelper
expose :title expose :title
expose :legend
expose :description expose :description
expose :median, as: :value do |stage| expose :median, as: :value do |stage|
......
...@@ -13,6 +13,10 @@ module Gitlab ...@@ -13,6 +13,10 @@ module Gitlab
:code :code
end end
def legend
"Related Merge Requests"
end
def description def description
"Time until first merge request" "Time until first merge request"
end end
......
...@@ -14,6 +14,10 @@ module Gitlab ...@@ -14,6 +14,10 @@ module Gitlab
:issue :issue
end end
def legend
"Related Issues"
end
def description def description
"Time before an issue gets scheduled" "Time before an issue gets scheduled"
end end
......
...@@ -14,6 +14,10 @@ module Gitlab ...@@ -14,6 +14,10 @@ module Gitlab
:plan :plan
end end
def legend
"Related Commits"
end
def description def description
"Time before an issue starts implementation" "Time before an issue starts implementation"
end end
......
...@@ -15,6 +15,10 @@ module Gitlab ...@@ -15,6 +15,10 @@ module Gitlab
:production :production
end end
def legend
"Related Issues"
end
def description def description
"From issue creation until deploy to production" "From issue creation until deploy to production"
end end
......
...@@ -13,6 +13,10 @@ module Gitlab ...@@ -13,6 +13,10 @@ module Gitlab
:review :review
end end
def legend
"Relative Merged Requests"
end
def description def description
"Time between merge request creation and merge/close" "Time between merge request creation and merge/close"
end end
......
...@@ -14,6 +14,10 @@ module Gitlab ...@@ -14,6 +14,10 @@ module Gitlab
:staging :staging
end end
def legend
"Relative Deployed Builds"
end
def description def description
"From merge request merge until deploy to production" "From merge request merge until deploy to production"
end end
......
...@@ -13,6 +13,10 @@ module Gitlab ...@@ -13,6 +13,10 @@ module Gitlab
:test :test
end end
def legend
"Relative Builds Trigger by Commits"
end
def description def description
"Total test time for all commits/merges" "Total test time for all commits/merges"
end end
......
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