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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
f4aced6f
Commit
f4aced6f
authored
May 16, 2018
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reloads pipeline table when dropdown action is clicked and closes the dropdown in the MR widget
parent
a55da0a9
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
51 deletions
+14
-51
app/assets/javascripts/pipelines/components/graph/action_component.vue
...vascripts/pipelines/components/graph/action_component.vue
+6
-12
app/assets/javascripts/pipelines/components/stage.vue
app/assets/javascripts/pipelines/components/stage.vue
+4
-3
app/assets/javascripts/pipelines/mixins/pipelines.js
app/assets/javascripts/pipelines/mixins/pipelines.js
+2
-0
spec/javascripts/pipelines/graph/action_component_spec.js
spec/javascripts/pipelines/graph/action_component_spec.js
+0
-12
spec/javascripts/pipelines/stage_spec.js
spec/javascripts/pipelines/stage_spec.js
+2
-24
No files found.
app/assets/javascripts/pipelines/components/graph/action_component.vue
View file @
f4aced6f
...
@@ -5,7 +5,6 @@ import { dasherize } from '~/lib/utils/text_utility';
...
@@ -5,7 +5,6 @@ import { dasherize } from '~/lib/utils/text_utility';
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
import
createFlash
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
tooltip
from
'
~/vue_shared/directives/tooltip
'
;
import
tooltip
from
'
~/vue_shared/directives/tooltip
'
;
import
LoadingIcon
from
'
~/vue_shared/components/loading_icon.vue
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
/**
/**
...
@@ -21,7 +20,6 @@ import Icon from '~/vue_shared/components/icon.vue';
...
@@ -21,7 +20,6 @@ import Icon from '~/vue_shared/components/icon.vue';
export
default
{
export
default
{
components
:
{
components
:
{
Icon
,
Icon
,
LoadingIcon
,
},
},
directives
:
{
directives
:
{
...
@@ -47,7 +45,7 @@ export default {
...
@@ -47,7 +45,7 @@ export default {
},
},
data
()
{
data
()
{
return
{
return
{
is
Loading
:
false
,
is
Disabled
:
false
,
};
};
},
},
...
@@ -67,15 +65,15 @@ export default {
...
@@ -67,15 +65,15 @@ export default {
onClickAction
()
{
onClickAction
()
{
$
(
this
.
$el
).
tooltip
(
'
hide
'
);
$
(
this
.
$el
).
tooltip
(
'
hide
'
);
this
.
is
Loading
=
true
;
this
.
is
Disabled
=
true
;
axios
.
post
(
`
${
this
.
link
}
.json`
)
axios
.
post
(
`
${
this
.
link
}
.json`
)
.
then
(()
=>
{
.
then
(()
=>
{
this
.
is
Loading
=
false
;
this
.
is
Disabled
=
false
;
this
.
$emit
(
'
pipelineActionRequestComplete
'
);
this
.
$emit
(
'
pipelineActionRequestComplete
'
);
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
this
.
is
Loading
=
false
;
this
.
is
Disabled
=
false
;
createFlash
(
__
(
'
An error occurred while making the request.
'
));
createFlash
(
__
(
'
An error occurred while making the request.
'
));
});
});
...
@@ -93,12 +91,8 @@ export default {
...
@@ -93,12 +91,8 @@ export default {
btn-transparent ci-action-icon-container ci-action-icon-wrapper"
btn-transparent ci-action-icon-container ci-action-icon-wrapper"
:class=
"cssClass"
:class=
"cssClass"
data-container=
"body"
data-container=
"body"
:disabled=
"is
Loading
"
:disabled=
"is
Disabled
"
>
>
<icon
<icon
:name=
"actionIcon"
/>
v-if=
"!isLoading"
:name=
"actionIcon"
/>
<loading-icon
v-else
/>
</button>
</button>
</
template
>
</
template
>
app/assets/javascripts/pipelines/components/stage.vue
View file @
f4aced6f
...
@@ -143,10 +143,10 @@ export default {
...
@@ -143,10 +143,10 @@ export default {
pipelineActionRequestComplete
()
{
pipelineActionRequestComplete
()
{
if
(
this
.
type
===
'
PIPELINES_TABLE
'
)
{
if
(
this
.
type
===
'
PIPELINES_TABLE
'
)
{
// warn the table to update
// warn the table to update
eventHub
.
$emit
(
'
clickedDropdown
'
);
eventHub
.
$emit
(
'
refreshPipelinesTable
'
);
}
else
{
}
else
{
//
refresh the conten
t
//
close the dropdown in mr widge
t
this
.
fetchJobs
(
);
$
(
this
.
$refs
.
dropdown
).
dropdown
(
'
toggle
'
);
}
}
},
},
},
},
...
@@ -167,6 +167,7 @@ export default {
...
@@ -167,6 +167,7 @@ export default {
id=
"stageDropdown"
id=
"stageDropdown"
aria-haspopup=
"true"
aria-haspopup=
"true"
aria-expanded=
"false"
aria-expanded=
"false"
ref=
"dropdown"
>
>
<span
<span
...
...
app/assets/javascripts/pipelines/mixins/pipelines.js
View file @
f4aced6f
...
@@ -55,11 +55,13 @@ export default {
...
@@ -55,11 +55,13 @@ export default {
eventHub
.
$on
(
'
postAction
'
,
this
.
postAction
);
eventHub
.
$on
(
'
postAction
'
,
this
.
postAction
);
eventHub
.
$on
(
'
retryPipeline
'
,
this
.
postAction
);
eventHub
.
$on
(
'
retryPipeline
'
,
this
.
postAction
);
eventHub
.
$on
(
'
clickedDropdown
'
,
this
.
updateTable
);
eventHub
.
$on
(
'
clickedDropdown
'
,
this
.
updateTable
);
eventHub
.
$on
(
'
refreshPipelinesTable
'
,
this
.
fetchPipelines
);
},
},
beforeDestroy
()
{
beforeDestroy
()
{
eventHub
.
$off
(
'
postAction
'
,
this
.
postAction
);
eventHub
.
$off
(
'
postAction
'
,
this
.
postAction
);
eventHub
.
$off
(
'
retryPipeline
'
,
this
.
postAction
);
eventHub
.
$off
(
'
retryPipeline
'
,
this
.
postAction
);
eventHub
.
$off
(
'
clickedDropdown
'
,
this
.
updateTable
);
eventHub
.
$off
(
'
clickedDropdown
'
,
this
.
updateTable
);
eventHub
.
$off
(
'
refreshPipelinesTable
'
,
this
.
fetchPipelines
);
},
},
destroyed
()
{
destroyed
()
{
this
.
poll
.
stop
();
this
.
poll
.
stop
();
...
...
spec/javascripts/pipelines/graph/action_component_spec.js
View file @
f4aced6f
...
@@ -48,23 +48,11 @@ describe('pipeline graph action component', () => {
...
@@ -48,23 +48,11 @@ describe('pipeline graph action component', () => {
expect
(
component
.
$el
.
querySelector
(
'
svg
'
)).
toBeDefined
();
expect
(
component
.
$el
.
querySelector
(
'
svg
'
)).
toBeDefined
();
});
});
it
(
'
renders a loading icon while component is loading
'
,
done
=>
{
component
.
isLoading
=
true
;
component
.
$nextTick
()
.
then
(()
=>
{
expect
(
component
.
$el
.
querySelector
(
'
.fa-spin
'
)).
not
.
toBeNull
();
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
describe
(
'
on click
'
,
()
=>
{
describe
(
'
on click
'
,
()
=>
{
it
(
'
emits `pipelineActionRequestComplete` after a successfull request
'
,
done
=>
{
it
(
'
emits `pipelineActionRequestComplete` after a successfull request
'
,
done
=>
{
spyOn
(
component
,
'
$emit
'
);
spyOn
(
component
,
'
$emit
'
);
component
.
$el
.
click
();
component
.
$el
.
click
();
expect
(
component
.
isLoading
).
toEqual
(
true
);
component
.
$nextTick
()
component
.
$nextTick
()
.
then
(()
=>
{
.
then
(()
=>
{
...
...
spec/javascripts/pipelines/stage_spec.js
View file @
f4aced6f
...
@@ -111,7 +111,7 @@ describe('Pipelines stage component', () => {
...
@@ -111,7 +111,7 @@ describe('Pipelines stage component', () => {
});
});
describe
(
'
within pipeline table
'
,
()
=>
{
describe
(
'
within pipeline table
'
,
()
=>
{
it
(
'
emits `
clickedDropdown
` event when `pipelineActionRequestComplete` is triggered
'
,
done
=>
{
it
(
'
emits `
refreshPipelinesTable
` event when `pipelineActionRequestComplete` is triggered
'
,
done
=>
{
spyOn
(
eventHub
,
'
$emit
'
);
spyOn
(
eventHub
,
'
$emit
'
);
component
.
type
=
'
PIPELINES_TABLE
'
;
component
.
type
=
'
PIPELINES_TABLE
'
;
...
@@ -121,29 +121,7 @@ describe('Pipelines stage component', () => {
...
@@ -121,29 +121,7 @@ describe('Pipelines stage component', () => {
component
.
$el
.
querySelector
(
'
.js-ci-action
'
).
click
();
component
.
$el
.
querySelector
(
'
.js-ci-action
'
).
click
();
component
.
$nextTick
()
component
.
$nextTick
()
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
'
clickedDropdown
'
);
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
'
refreshPipelinesTable
'
);
expect
(
eventHub
.
$emit
).
toHaveBeenCalledTimes
(
2
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
},
0
);
});
});
describe
(
'
without a type
'
,
()
=>
{
it
(
'
fetches dropdown content again
'
,
done
=>
{
spyOn
(
component
,
'
fetchJobs
'
).
and
.
callThrough
();
component
.
$el
.
querySelector
(
'
button
'
).
click
();
expect
(
component
.
fetchJobs
).
toHaveBeenCalledTimes
(
1
);
setTimeout
(()
=>
{
component
.
$el
.
querySelector
(
'
.js-ci-action
'
).
click
();
component
.
$nextTick
()
.
then
(()
=>
{
expect
(
component
.
fetchJobs
).
toHaveBeenCalledTimes
(
2
);
})
})
.
then
(
done
)
.
then
(
done
)
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
...
...
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