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
44a222ad
Commit
44a222ad
authored
Apr 20, 2018
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use axios request to interact with API instead of UJS
parent
eb1cb7be
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
24 additions
and
129 deletions
+24
-129
app/assets/javascripts/pipelines/components/graph/action_component.vue
...vascripts/pipelines/components/graph/action_component.vue
+1
-1
app/assets/javascripts/pipelines/components/graph/dropdown_action_component.vue
.../pipelines/components/graph/dropdown_action_component.vue
+0
-53
app/assets/javascripts/pipelines/components/graph/dropdown_job_component.vue
...pts/pipelines/components/graph/dropdown_job_component.vue
+14
-15
app/assets/javascripts/pipelines/components/graph/job_component.vue
.../javascripts/pipelines/components/graph/job_component.vue
+1
-17
app/assets/stylesheets/pages/pipelines.scss
app/assets/stylesheets/pages/pipelines.scss
+8
-0
spec/javascripts/pipelines/graph/dropdown_action_component_spec.js
...scripts/pipelines/graph/dropdown_action_component_spec.js
+0
-32
spec/javascripts/pipelines/graph/job_component_spec.js
spec/javascripts/pipelines/graph/job_component_spec.js
+0
-11
No files found.
app/assets/javascripts/pipelines/components/graph/action_component.vue
View file @
44a222ad
...
...
@@ -62,7 +62,7 @@ export default {
@
click=
"onClickAction"
v-tooltip
:title=
"tooltipText"
class=
"btn btn-blank btn-transparent ci-action-icon-container ci-action-icon-wrapper"
class=
"
js-ci-action
btn btn-blank btn-transparent ci-action-icon-container ci-action-icon-wrapper"
:class=
"cssClass"
data-container=
"body"
:disabled=
"isDisabled"
...
...
app/assets/javascripts/pipelines/components/graph/dropdown_action_component.vue
deleted
100644 → 0
View file @
eb1cb7be
<
script
>
import
icon
from
'
../../../vue_shared/components/icon.vue
'
;
import
tooltip
from
'
../../../vue_shared/directives/tooltip
'
;
/**
* Renders either a cancel, retry or play icon pointing to the given path.
* TODO: Remove UJS from here and use an async request instead.
*/
export
default
{
components
:
{
icon
,
},
directives
:
{
tooltip
,
},
props
:
{
tooltipText
:
{
type
:
String
,
required
:
true
,
},
link
:
{
type
:
String
,
required
:
true
,
},
actionMethod
:
{
type
:
String
,
required
:
true
,
},
actionIcon
:
{
type
:
String
,
required
:
true
,
},
},
};
</
script
>
<
template
>
<a
v-tooltip
:data-method=
"actionMethod"
:title=
"tooltipText"
:href=
"link"
rel=
"nofollow"
class=
"ci-action-icon-wrapper js-ci-status-icon"
data-container=
"body"
aria-label=
"Job's action"
>
<icon
:name=
"actionIcon"
/>
</a>
</
template
>
app/assets/javascripts/pipelines/components/graph/dropdown_job_component.vue
View file @
44a222ad
<
script
>
import
$
from
'
jquery
'
;
import
j
obNameComponent
from
'
./job_name_component.vue
'
;
import
j
obComponent
from
'
./job_component.vue
'
;
import
J
obNameComponent
from
'
./job_name_component.vue
'
;
import
J
obComponent
from
'
./job_component.vue
'
;
import
tooltip
from
'
../../../vue_shared/directives/tooltip
'
;
/**
...
...
@@ -33,8 +33,8 @@
},
components
:
{
j
obComponent
,
j
obNameComponent
,
J
obComponent
,
J
obNameComponent
,
},
props
:
{
...
...
@@ -56,17 +56,17 @@
methods
:
{
/**
* When the user right clicks or cmd/ctrl + click in the job name
* the dropdown should not be closed and the link should open in another tab,
* so we stop propagation of the click event inside the dropdown.
* When the user right clicks or cmd/ctrl + click in the job name or the action icon
* the dropdown should not be closed so we stop propagation of the click event inside the dropdown.
*
* Since this component is rendered multiple times per page we need to guarantee we only
* target the click event of this component.
*/
stopDropdownClickPropagation
()
{
$
(
this
.
$el
.
querySelectorAll
(
'
.js-grouped-pipeline-dropdown a.mini-pipeline-graph-dropdown-item
'
))
.
on
(
'
click
'
,
(
e
)
=>
{
$
(
'
.js-grouped-pipeline-dropdown button, .js-grouped-pipeline-dropdown a.mini-pipeline-graph-dropdown-item
'
,
this
.
$el
,
).
on
(
'
click
'
,
(
e
)
=>
{
e
.
stopPropagation
();
});
},
...
...
@@ -101,7 +101,6 @@
:key=
"i"
>
<job-component
:job=
"item"
:is-dropdown=
"true"
css-class-job-name=
"mini-pipeline-graph-dropdown-item"
/>
</li>
...
...
app/assets/javascripts/pipelines/components/graph/job_component.vue
View file @
44a222ad
<
script
>
import
ActionComponent
from
'
./action_component.vue
'
;
import
DropdownActionComponent
from
'
./dropdown_action_component.vue
'
;
import
JobNameComponent
from
'
./job_name_component.vue
'
;
import
tooltip
from
'
../../../vue_shared/directives/tooltip
'
;
...
...
@@ -32,7 +31,6 @@ import tooltip from '../../../vue_shared/directives/tooltip';
export
default
{
components
:
{
ActionComponent
,
DropdownActionComponent
,
JobNameComponent
,
},
...
...
@@ -51,12 +49,6 @@ export default {
default
:
''
,
},
isDropdown
:
{
type
:
Boolean
,
required
:
false
,
default
:
false
,
},
actionDisabled
:
{
type
:
String
,
required
:
false
,
...
...
@@ -134,19 +126,11 @@ export default {
</div>
<action-component
v-if=
"hasAction
&& !isDropdown
"
v-if=
"hasAction"
:tooltip-text=
"status.action.title"
:link=
"status.action.path"
:action-icon=
"status.action.icon"
:button-disabled=
"actionDisabled"
/>
<dropdown-action-component
v-if=
"hasAction && isDropdown"
:tooltip-text=
"status.action.title"
:link=
"status.action.path"
:action-icon=
"status.action.icon"
:action-method=
"status.action.method"
/>
</div>
</
template
>
app/assets/stylesheets/pages/pipelines.scss
View file @
44a222ad
...
...
@@ -468,6 +468,14 @@
margin-bottom
:
10px
;
white-space
:
normal
;
.ci-job-dropdown-container
{
// override dropdown.scss
.dropdown-menu
li
button
{
padding
:
0
;
text-align
:
center
;
}
}
// ensure .build-content has hover style when action-icon is hovered
.ci-job-dropdown-container
:hover
.build-content
{
@extend
.build-content
:hover
;
...
...
spec/javascripts/pipelines/graph/dropdown_action_component_spec.js
deleted
100644 → 0
View file @
eb1cb7be
import
Vue
from
'
vue
'
;
import
dropdownActionComponent
from
'
~/pipelines/components/graph/dropdown_action_component.vue
'
;
describe
(
'
action component
'
,
()
=>
{
let
component
;
beforeEach
((
done
)
=>
{
const
DropdownActionComponent
=
Vue
.
extend
(
dropdownActionComponent
);
component
=
new
DropdownActionComponent
({
propsData
:
{
tooltipText
:
'
bar
'
,
link
:
'
foo
'
,
actionMethod
:
'
post
'
,
actionIcon
:
'
cancel
'
,
},
}).
$mount
();
Vue
.
nextTick
(
done
);
});
it
(
'
should render a link
'
,
()
=>
{
expect
(
component
.
$el
.
getAttribute
(
'
href
'
)).
toEqual
(
'
foo
'
);
});
it
(
'
should render the provided title as a bootstrap tooltip
'
,
()
=>
{
expect
(
component
.
$el
.
getAttribute
(
'
data-original-title
'
)).
toEqual
(
'
bar
'
);
});
it
(
'
should render an svg
'
,
()
=>
{
expect
(
component
.
$el
.
querySelector
(
'
svg
'
)).
toBeDefined
();
});
});
spec/javascripts/pipelines/graph/job_component_spec.js
View file @
44a222ad
...
...
@@ -93,17 +93,6 @@ describe('pipeline graph job component', () => {
});
});
describe
(
'
dropdown
'
,
()
=>
{
it
(
'
should render the dropdown action icon
'
,
()
=>
{
component
=
mountComponent
(
JobComponent
,
{
job
:
mockJob
,
isDropdown
:
true
,
});
expect
(
component
.
$el
.
querySelector
(
'
a.ci-action-icon-wrapper
'
)).
toBeDefined
();
});
});
it
(
'
should render provided class name
'
,
()
=>
{
component
=
mountComponent
(
JobComponent
,
{
job
:
mockJob
,
...
...
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