Commit 384c4741 authored by Fernando Arias's avatar Fernando Arias Committed by Savas Vedova

Update column width

* Adjust response styles

Tweak alignment for solution text
parent a8d09910
<script> <script>
import { GlIcon } from '@gitlab/ui'; import { GlIcon, GlCard } from '@gitlab/ui';
export default { export default {
name: 'SolutionCard', name: 'SolutionCard',
components: { GlIcon }, components: { GlIcon, GlCard },
props: { props: {
solution: { solution: {
type: String, type: String,
...@@ -42,29 +42,33 @@ export default { ...@@ -42,29 +42,33 @@ export default {
}; };
</script> </script>
<template> <template>
<div class="card my-4"> <gl-card
<div v-if="solutionText" class="card-body d-flex align-items-center"> class="gl-my-6"
<div :body-class="{ 'gl-p-0': !solutionText }"
class="col-auto d-flex align-items-center pl-0" :footer-class="{ 'gl-border-0': !solutionText }"
:class="{ 'col-md-2': !isStandaloneVulnerability }" >
> <template v-if="solutionText" #default>
<div class="circle-icon-container pr-3" aria-hidden="true"><gl-icon name="bulb" /></div> <div class="gl-display-flex gl-align-items-center">
<strong class="text-right flex-grow-1">{{ s__('ciReport|Solution') }}:</strong> <div
</div> class="col-auto gl-display-flex gl-align-items-center gl-justify-content-end gl-pl-0"
<span class="flex-shrink-1 pl-0" :class="{ 'col-md-10': !isStandaloneVulnerability }">{{ :class="{ 'col-md-2': !isStandaloneVulnerability }"
solutionText >
}}</span> <gl-icon class="gl-mr-5" name="bulb" />
</div> <strong>{{ s__('ciReport|Solution') }}:</strong>
<template v-if="showCreateMergeRequestMsg"> </div>
<div class="card-footer" :class="{ 'border-0': !solutionText }"> <span class="flex-shrink-1 gl-pl-0" :class="{ 'col-md-10': !isStandaloneVulnerability }">{{
<em class="text-secondary"> solutionText
{{ }}</span>
s__(
'ciReport|Create a merge request to implement this solution, or download and apply the patch manually.',
)
}}
</em>
</div> </div>
</template> </template>
</div> <template v-if="showCreateMergeRequestMsg" #footer>
<em class="gl-text-gray-500" data-testid="merge-request-solution">
{{
s__(
'ciReport|Create a merge request to implement this solution, or download and apply the patch manually.',
)
}}
</em>
</template>
</gl-card>
</template> </template>
...@@ -12,8 +12,8 @@ export default { ...@@ -12,8 +12,8 @@ export default {
<template functional> <template functional>
<div class="d-sm-flex my-sm-2 my-4"> <div class="d-sm-flex my-sm-2 my-4">
<label class="col-sm-4 text-sm-right font-weight-bold pl-0">{{ props.label }}:</label> <label class="col-sm-2 text-sm-right gl-font-weight-bold gl-pl-0">{{ props.label }}:</label>
<div class="col-sm-8 pl-0 text-secondary"> <div class="col-sm-10 gl-pl-0 gl-text-gray-500">
<slot></slot> <slot></slot>
</div> </div>
</div> </div>
......
---
title: Fix alignment issues in vulnerability modals
merge_request: 55716
author:
type: fixed
...@@ -5,13 +5,13 @@ exports[`VulnerabilityDetail component renders the label prop and default slot 1 ...@@ -5,13 +5,13 @@ exports[`VulnerabilityDetail component renders the label prop and default slot 1
class="d-sm-flex my-sm-2 my-4" class="d-sm-flex my-sm-2 my-4"
> >
<label <label
class="col-sm-4 text-sm-right font-weight-bold pl-0" class="col-sm-2 text-sm-right gl-font-weight-bold gl-pl-0"
> >
foo: foo:
</label> </label>
<div <div
class="col-sm-8 pl-0 text-secondary" class="col-sm-10 gl-pl-0 gl-text-gray-500"
> >
<p> <p>
bar bar
......
import { GlCard } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import Vue from 'vue'; import Vue from 'vue';
import component from 'ee/vue_shared/security_reports/components/solution_card_vuex.vue'; import component from 'ee/vue_shared/security_reports/components/solution_card_vuex.vue';
...@@ -19,13 +20,15 @@ describe('Solution Card', () => { ...@@ -19,13 +20,15 @@ describe('Solution Card', () => {
it('takes the value of solution', () => { it('takes the value of solution', () => {
const propsData = { solution }; const propsData = { solution };
wrapper = shallowMount(Component, { propsData }); wrapper = shallowMount(Component, { propsData });
expect(wrapper.find('.card-body').text()).toMatchInterpolatedText(`Solution: ${solution}`); expect(wrapper.findComponent(GlCard).text()).toMatchInterpolatedText(
`Solution: ${solution}`,
);
}); });
it('takes the summary from a remediation', () => { it('takes the summary from a remediation', () => {
const propsData = { remediation }; const propsData = { remediation };
wrapper = shallowMount(Component, { propsData }); wrapper = shallowMount(Component, { propsData });
expect(wrapper.find('.card-body').text()).toMatchInterpolatedText( expect(wrapper.findComponent(GlCard).text()).toMatchInterpolatedText(
`Solution: ${remediation.summary}`, `Solution: ${remediation.summary}`,
); );
}); });
...@@ -33,7 +36,9 @@ describe('Solution Card', () => { ...@@ -33,7 +36,9 @@ describe('Solution Card', () => {
it('takes the value of solution, if both are defined', () => { it('takes the value of solution, if both are defined', () => {
const propsData = { remediation, solution }; const propsData = { remediation, solution };
wrapper = shallowMount(Component, { propsData }); wrapper = shallowMount(Component, { propsData });
expect(wrapper.find('.card-body').text()).toMatchInterpolatedText(`Solution: ${solution}`); expect(wrapper.findComponent(GlCard).text()).toMatchInterpolatedText(
`Solution: ${solution}`,
);
}); });
}); });
}); });
...@@ -46,7 +51,9 @@ describe('Solution Card', () => { ...@@ -46,7 +51,9 @@ describe('Solution Card', () => {
}); });
it('renders the solution text and label', () => { it('renders the solution text and label', () => {
expect(wrapper.find('.card-body').text()).toMatchInterpolatedText(`Solution: ${solution}`); expect(wrapper.findComponent(GlCard).text()).toMatchInterpolatedText(
`Solution: ${solution}`,
);
}); });
it('does not render the card footer', () => { it('does not render the card footer', () => {
...@@ -65,7 +72,7 @@ describe('Solution Card', () => { ...@@ -65,7 +72,7 @@ describe('Solution Card', () => {
}); });
it('renders the solution text and label', () => { it('renders the solution text and label', () => {
expect(wrapper.find('.card-body').text()).toMatchInterpolatedText( expect(wrapper.findComponent(GlCard).text()).toMatchInterpolatedText(
`Solution: ${remediation.summary}`, `Solution: ${remediation.summary}`,
); );
}); });
...@@ -84,7 +91,7 @@ describe('Solution Card', () => { ...@@ -84,7 +91,7 @@ describe('Solution Card', () => {
}); });
it('renders the create a merge request to implement this solution message', () => { it('renders the create a merge request to implement this solution message', () => {
expect(wrapper.find('.card-footer').text()).toMatch( expect(wrapper.find('[data-testid="merge-request-solution"]').text()).toMatch(
s__( s__(
'ciReport|Create a merge request to implement this solution, or download and apply the patch manually.', 'ciReport|Create a merge request to implement this solution, or download and apply the patch manually.',
), ),
...@@ -94,7 +101,7 @@ describe('Solution Card', () => { ...@@ -94,7 +101,7 @@ describe('Solution Card', () => {
describe('without download patch', () => { describe('without download patch', () => {
it('does not render the card footer', () => { it('does not render the card footer', () => {
expect(wrapper.find('.card-footer').exists()).toBe(false); expect(wrapper.find('[data-testid="merge-request-solution"]').exists()).toBe(false);
}); });
}); });
}); });
......
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