Commit 9b4b79ff authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'performance-bar-position-fix' into 'master'

Fix performance bar spacing

See merge request gitlab-org/gitlab-ce!17912
parents e86b2b23 4d1bae70
...@@ -27,12 +27,21 @@ export default { ...@@ -27,12 +27,21 @@ export default {
required: true, required: true,
}, },
}, },
computed: {
metricDetails() {
return this.currentRequest.details[this.metric];
},
detailsList() {
return this.metricDetails[this.details];
},
},
}; };
</script> </script>
<template> <template>
<div <div
:id="`peek-view-${metric}`" :id="`peek-view-${metric}`"
class="view" class="view"
v-if="currentRequest.details"
> >
<button <button
:data-target="`#modal-peek-${metric}-details`" :data-target="`#modal-peek-${metric}-details`"
...@@ -40,24 +49,21 @@ export default { ...@@ -40,24 +49,21 @@ export default {
type="button" type="button"
data-toggle="modal" data-toggle="modal"
> >
<span {{ metricDetails.duration }}
v-if="currentRequest.details"
class="bold"
>
{{ currentRequest.details[metric].duration }}
/ /
{{ currentRequest.details[metric].calls }} {{ metricDetails.calls }}
</span>
</button> </button>
<gl-modal <gl-modal
v-if="currentRequest.details"
:id="`modal-peek-${metric}-details`" :id="`modal-peek-${metric}-details`"
:header-title-text="header" :header-title-text="header"
class="performance-bar-modal" class="performance-bar-modal"
> >
<table class="table"> <table
class="table"
>
<template v-if="detailsList.length">
<tr <tr
v-for="(item, index) in currentRequest.details[metric][details]" v-for="(item, index) in detailsList"
:key="index" :key="index"
> >
<td><strong>{{ item.duration }}ms</strong></td> <td><strong>{{ item.duration }}ms</strong></td>
...@@ -68,6 +74,14 @@ export default { ...@@ -68,6 +74,14 @@ export default {
{{ item[key] }} {{ item[key] }}
</td> </td>
</tr> </tr>
</template>
<template v-else>
<tr>
<td>
No {{ header.toLowerCase() }} for this request.
</td>
</tr>
</template>
</table> </table>
<div slot="footer"> <div slot="footer">
......
...@@ -113,27 +113,21 @@ export default { ...@@ -113,27 +113,21 @@ export default {
id="js-peek" id="js-peek"
:class="env" :class="env"
> >
<request-selector <div
v-if="currentRequest" v-if="currentRequest"
:current-request="currentRequest" class="container-fluid container-limited"
:requests="requests" >
@change-current-request="changeCurrentRequest"
/>
<div <div
id="peek-view-host" id="peek-view-host"
class="view prepend-left-5" class="view"
> >
<span <span
v-if="currentRequest && currentRequest.details" v-if="currentRequest.details"
class="current-host" class="current-host"
> >
{{ currentRequest.details.host.hostname }} {{ currentRequest.details.host.hostname }}
</span> </span>
</div> </div>
<div
v-if="currentRequest"
class="wrapper"
>
<upstream-performance-bar <upstream-performance-bar
v-if="initialRequest && currentRequest.details" v-if="initialRequest && currentRequest.details"
/> />
...@@ -186,6 +180,12 @@ export default { ...@@ -186,6 +180,12 @@ export default {
gc gc
</span> </span>
</div> </div>
<request-selector
v-if="currentRequest"
:current-request="currentRequest"
:requests="requests"
@change-current-request="changeCurrentRequest"
/>
</div> </div>
</div> </div>
</template> </template>
...@@ -37,7 +37,7 @@ export default { ...@@ -37,7 +37,7 @@ export default {
<template> <template>
<div <div
id="peek-request-selector" id="peek-request-selector"
class="append-right-5 pull-right" class="pull-right"
> >
<select v-model="currentRequestId"> <select v-model="currentRequestId">
<option <option
......
...@@ -5,6 +5,8 @@ export default { ...@@ -5,6 +5,8 @@ export default {
.getElementById('peek-view-performance-bar') .getElementById('peek-view-performance-bar')
.cloneNode(true); .cloneNode(true);
upstreamPerformanceBar.classList.remove('hidden');
this.$refs.wrapper.appendChild(upstreamPerformanceBar); this.$refs.wrapper.appendChild(upstreamPerformanceBar);
}, },
}; };
......
...@@ -4,9 +4,9 @@ import Vue from 'vue'; ...@@ -4,9 +4,9 @@ import Vue from 'vue';
import performanceBarApp from './components/performance_bar_app.vue'; import performanceBarApp from './components/performance_bar_app.vue';
import PerformanceBarStore from './stores/performance_bar_store'; import PerformanceBarStore from './stores/performance_bar_store';
export default () => export default ({ container }) =>
new Vue({ new Vue({
el: '#js-peek', el: container,
components: { components: {
performanceBarApp, performanceBarApp,
}, },
......
...@@ -43,12 +43,6 @@ ...@@ -43,12 +43,6 @@
} }
} }
.wrapper {
width: 80%;
height: $performance-bar-height;
margin: 0 auto;
}
// UI Elements // UI Elements
.bucket { .bucket {
background: $perf-bar-bucket-bg; background: $perf-bar-bucket-bg;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
profile_url: url_for(params.merge(lineprofiler: 'true')) }, profile_url: url_for(params.merge(lineprofiler: 'true')) },
class: Peek.env } class: Peek.env }
#peek-view-performance-bar #peek-view-performance-bar.hidden
= render_server_response_time = render_server_response_time
%span#serverstats %span#serverstats
%ul.performance-bar %ul.performance-bar
...@@ -20,16 +20,8 @@ describe('detailedMetric', () => { ...@@ -20,16 +20,8 @@ describe('detailedMetric', () => {
}); });
}); });
it('does not display details', () => { it('does not render the element', () => {
expect(vm.$el.innerText).not.toContain('/'); expect(vm.$el.innerHTML).toEqual(undefined);
});
it('does not display the modal', () => {
expect(vm.$el.querySelector('.performance-bar-modal')).toBeNull();
});
it('displays the metric name', () => {
expect(vm.$el.innerText).toContain('gitaly');
}); });
}); });
......
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