Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
01122b77
Commit
01122b77
authored
Jun 17, 2020
by
Emily Ring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjusted styles and test for mr_widget_terraform
parent
e8da2a7b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
16 deletions
+22
-16
app/assets/javascripts/vue_merge_request_widget/components/terraform/mr_widget_terraform_container.vue
...et/components/terraform/mr_widget_terraform_container.vue
+8
-4
app/assets/javascripts/vue_merge_request_widget/components/terraform/terraform_plan.vue
...ge_request_widget/components/terraform/terraform_plan.vue
+4
-3
spec/frontend/vue_mr_widget/components/terraform/mr_widget_terraform_container_spec.js
...omponents/terraform/mr_widget_terraform_container_spec.js
+5
-7
spec/frontend/vue_mr_widget/components/terraform/terraform_plan_spec.js
...vue_mr_widget/components/terraform/terraform_plan_spec.js
+5
-2
No files found.
app/assets/javascripts/vue_merge_request_widget/components/terraform/mr_widget_terraform_container.vue
View file @
01122b77
...
...
@@ -20,16 +20,20 @@ export default {
return
{
loading
:
true
,
plans
:
{},
poll
:
null
,
};
},
created
()
{
this
.
fetchPlans
();
},
beforeDestroy
()
{
this
.
poll
.
stop
();
},
methods
:
{
fetchPlans
()
{
this
.
loading
=
true
;
const
poll
=
new
Poll
({
this
.
poll
=
new
Poll
({
resource
:
{
fetchPlans
:
()
=>
axios
.
get
(
this
.
endpoint
),
},
...
...
@@ -40,17 +44,17 @@ export default {
if
(
Object
.
keys
(
this
.
plans
).
length
)
{
this
.
loading
=
false
;
poll
.
stop
();
this
.
poll
.
stop
();
}
},
errorCallback
:
()
=>
{
this
.
plans
=
{
bad_plan
:
{}
};
this
.
loading
=
false
;
poll
.
stop
();
this
.
poll
.
stop
();
},
});
poll
.
makeRequest
();
this
.
poll
.
makeRequest
();
},
},
};
...
...
app/assets/javascripts/vue_merge_request_widget/components/terraform/terraform_plan.vue
View file @
01122b77
...
...
@@ -12,7 +12,6 @@ export default {
props
:
{
plan
:
{
required
:
true
,
default
:
()
=>
{},
type
:
Object
,
},
},
...
...
@@ -51,7 +50,9 @@ export default {
<
template
>
<div
class=
"gl-display-flex"
>
<span
class=
"append-right-default gl-align-self-start gl-mt-3"
>
<span
class=
"gl-display-flex gl-align-items-center gl-justify-content-center append-right-default gl-align-self-start gl-mt-1"
>
<gl-icon
name=
"status_warning"
:size=
"24"
/>
</span>
...
...
@@ -82,7 +83,7 @@ export default {
</p>
</div>
<div
class=
"terraform-mr-plan-actions"
>
<div>
<gl-link
v-if=
"plan.job_path"
:href=
"plan.job_path"
...
...
spec/frontend/vue_mr_widget/components/terraform/mr_widget_terraform_container_spec.js
View file @
01122b77
...
...
@@ -13,6 +13,8 @@ describe('MrWidgetTerraformConainer', () => {
const
propsData
=
{
endpoint
:
'
/path/to/terraform/report.json
'
};
const
findPlans
=
()
=>
wrapper
.
findAll
(
TerraformPlan
).
wrappers
.
map
(
x
=>
x
.
props
(
'
plan
'
));
const
mockPollingApi
=
(
response
,
body
,
header
)
=>
{
mock
.
onGet
(
propsData
.
endpoint
).
reply
(
response
,
body
,
header
);
};
...
...
@@ -44,7 +46,7 @@ describe('MrWidgetTerraformConainer', () => {
it
(
'
diplays loading skeleton
'
,
()
=>
{
expect
(
wrapper
.
find
(
GlSkeletonLoading
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
(
TerraformPlan
).
exists
()).
toBe
(
false
);
expect
(
findPlans
()).
toEqual
([]
);
});
});
...
...
@@ -72,7 +74,7 @@ describe('MrWidgetTerraformConainer', () => {
it
(
'
diplays terraform components and stops loading
'
,
()
=>
{
expect
(
wrapper
.
find
(
GlSkeletonLoading
).
exists
()).
toBe
(
false
);
expect
(
wrapper
.
findAll
(
TerraformPlan
).
length
).
toEqual
(
Object
.
keys
(
plans
).
length
);
expect
(
findPlans
(
).
length
).
toEqual
(
Object
.
keys
(
plans
).
length
);
});
it
(
'
does not make additional requests after poll is successful
'
,
()
=>
{
...
...
@@ -92,11 +94,7 @@ describe('MrWidgetTerraformConainer', () => {
});
it
(
'
generates one broken plan
'
,
()
=>
{
const
displayPlans
=
wrapper
.
findAll
(
TerraformPlan
);
expect
(
displayPlans
.
length
).
toEqual
(
1
);
expect
(
displayPlans
.
at
(
0
).
props
(
'
plan
'
)).
toEqual
({});
expect
(
findPlans
()).
toEqual
([{}]);
});
it
(
'
does not make additional requests after poll is unsuccessful
'
,
()
=>
{
...
...
spec/frontend/vue_mr_widget/components/terraform/terraform_plan_spec.js
View file @
01122b77
...
...
@@ -6,6 +6,8 @@ import TerraformPlan from '~/vue_merge_request_widget/components/terraform/terra
describe
(
'
TerraformPlan
'
,
()
=>
{
let
wrapper
;
const
findLogButton
=
()
=>
wrapper
.
find
(
'
.js-terraform-report-link
'
);
const
mountWrapper
=
propsData
=>
{
wrapper
=
shallowMount
(
TerraformPlan
,
{
stubs
:
{
GlLink
,
GlSprintf
},
propsData
});
};
...
...
@@ -32,7 +34,8 @@ describe('TerraformPlan', () => {
});
it
(
'
renders button when url is found
'
,
()
=>
{
expect
(
wrapper
.
text
()).
toContain
(
'
View full log
'
);
expect
(
findLogButton
().
exists
()).
toBe
(
true
);
expect
(
findLogButton
().
text
()).
toEqual
(
'
View full log
'
);
});
});
...
...
@@ -50,7 +53,7 @@ describe('TerraformPlan', () => {
});
it
(
'
does not render button because url is missing
'
,
()
=>
{
expect
(
wrapper
.
text
()).
not
.
toContain
(
'
View full log
'
);
expect
(
findLogButton
().
exists
()).
toBe
(
false
);
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment