Commit 5ad4418b authored by Sean McGivern's avatar Sean McGivern

Only pass warnings to RequestWarning

It doesn't need the whole of the request details as it only uses the
warnings.
parent 07911535
...@@ -42,6 +42,9 @@ export default { ...@@ -42,6 +42,9 @@ export default {
detailsList() { detailsList() {
return this.metricDetails.details; return this.metricDetails.details;
}, },
warnings() {
return this.metricDetails.warnings || [];
},
htmlId() { htmlId() {
if (this.currentRequest) { if (this.currentRequest) {
return `performance-bar-warning-${this.currentRequest.id}-${this.metric}`; return `performance-bar-warning-${this.currentRequest.id}-${this.metric}`;
...@@ -115,6 +118,6 @@ export default { ...@@ -115,6 +118,6 @@ export default {
<div slot="footer"></div> <div slot="footer"></div>
</gl-modal> </gl-modal>
{{ title }} {{ title }}
<request-warning :html-id="htmlId" :details="metricDetails" /> <request-warning :html-id="htmlId" :warnings="warnings" />
</div> </div>
</template> </template>
...@@ -11,21 +11,17 @@ export default { ...@@ -11,21 +11,17 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
details: { warnings: {
type: Object, type: Array,
required: true, required: true,
}, },
}, },
computed: { computed: {
warnings() { hasWarnings() {
const { return this.warnings && this.warnings.length;
details: { warnings },
} = this;
return warnings && warnings.length ? warnings : null;
}, },
warningMessage() { warningMessage() {
if (!this.warnings) { if (!this.hasWarnings) {
return ''; return '';
} }
...@@ -38,7 +34,7 @@ export default { ...@@ -38,7 +34,7 @@ export default {
}; };
</script> </script>
<template> <template>
<span v-if="warnings"> <span v-if="hasWarnings">
<span :id="htmlId" v-html="glEmojiTag('warning')"></span> <span :id="htmlId" v-html="glEmojiTag('warning')"></span>
<gl-popover :target="htmlId" :content="warningMessage" triggers="hover focus" /> <gl-popover :target="htmlId" :content="warningMessage" triggers="hover focus" />
</span> </span>
......
...@@ -8,9 +8,7 @@ describe('request warning', () => { ...@@ -8,9 +8,7 @@ describe('request warning', () => {
const wrapper = shallowMount(RequestWarning, { const wrapper = shallowMount(RequestWarning, {
propsData: { propsData: {
htmlId, htmlId,
details: { warnings: ['gitaly calls: 30 over 10', 'gitaly duration: 1500 over 1000'],
warnings: ['gitaly calls: 30 over 10', 'gitaly duration: 1500 over 1000'],
},
}, },
}); });
...@@ -24,9 +22,7 @@ describe('request warning', () => { ...@@ -24,9 +22,7 @@ describe('request warning', () => {
const wrapper = shallowMount(RequestWarning, { const wrapper = shallowMount(RequestWarning, {
propsData: { propsData: {
htmlId, htmlId,
details: { warnings: [],
warnings: [],
},
}, },
}); });
......
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