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 {
...
@@ -62,7 +62,7 @@ export default {
@
click=
"onClickAction"
@
click=
"onClickAction"
v-tooltip
v-tooltip
:title=
"tooltipText"
: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"
:class=
"cssClass"
data-container=
"body"
data-container=
"body"
:disabled=
"isDisabled"
: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
>
<
script
>
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
import
j
obNameComponent
from
'
./job_name_component.vue
'
;
import
J
obNameComponent
from
'
./job_name_component.vue
'
;
import
j
obComponent
from
'
./job_component.vue
'
;
import
J
obComponent
from
'
./job_component.vue
'
;
import
tooltip
from
'
../../../vue_shared/directives/tooltip
'
;
import
tooltip
from
'
../../../vue_shared/directives/tooltip
'
;
/**
/**
...
@@ -33,8 +33,8 @@
...
@@ -33,8 +33,8 @@
},
},
components
:
{
components
:
{
j
obComponent
,
J
obComponent
,
j
obNameComponent
,
J
obNameComponent
,
},
},
props
:
{
props
:
{
...
@@ -56,17 +56,17 @@
...
@@ -56,17 +56,17 @@
methods
:
{
methods
:
{
/**
/**
* When the user right clicks or cmd/ctrl + click in the job name
* When the user right clicks or cmd/ctrl + click in the job name or the action icon
* the dropdown should not be closed and the link should open in another tab,
* the dropdown should not be closed so we stop propagation of the click event inside the dropdown.
* 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
* Since this component is rendered multiple times per page we need to guarantee we only
* target the click event of this component.
* target the click event of this component.
*/
*/
stopDropdownClickPropagation
()
{
stopDropdownClickPropagation
()
{
$
(
this
.
$el
$
(
.
querySelectorAll
(
'
.js-grouped-pipeline-dropdown a.mini-pipeline-graph-dropdown-item
'
))
'
.js-grouped-pipeline-dropdown button, .js-grouped-pipeline-dropdown a.mini-pipeline-graph-dropdown-item
'
,
.
on
(
'
click
'
,
(
e
)
=>
{
this
.
$el
,
).
on
(
'
click
'
,
(
e
)
=>
{
e
.
stopPropagation
();
e
.
stopPropagation
();
});
});
},
},
...
@@ -101,7 +101,6 @@
...
@@ -101,7 +101,6 @@
:key=
"i"
>
:key=
"i"
>
<job-component
<job-component
:job=
"item"
:job=
"item"
:is-dropdown=
"true"
css-class-job-name=
"mini-pipeline-graph-dropdown-item"
css-class-job-name=
"mini-pipeline-graph-dropdown-item"
/>
/>
</li>
</li>
...
...
app/assets/javascripts/pipelines/components/graph/job_component.vue
View file @
44a222ad
<
script
>
<
script
>
import
ActionComponent
from
'
./action_component.vue
'
;
import
ActionComponent
from
'
./action_component.vue
'
;
import
DropdownActionComponent
from
'
./dropdown_action_component.vue
'
;
import
JobNameComponent
from
'
./job_name_component.vue
'
;
import
JobNameComponent
from
'
./job_name_component.vue
'
;
import
tooltip
from
'
../../../vue_shared/directives/tooltip
'
;
import
tooltip
from
'
../../../vue_shared/directives/tooltip
'
;
...
@@ -32,7 +31,6 @@ import tooltip from '../../../vue_shared/directives/tooltip';
...
@@ -32,7 +31,6 @@ import tooltip from '../../../vue_shared/directives/tooltip';
export
default
{
export
default
{
components
:
{
components
:
{
ActionComponent
,
ActionComponent
,
DropdownActionComponent
,
JobNameComponent
,
JobNameComponent
,
},
},
...
@@ -51,12 +49,6 @@ export default {
...
@@ -51,12 +49,6 @@ export default {
default
:
''
,
default
:
''
,
},
},
isDropdown
:
{
type
:
Boolean
,
required
:
false
,
default
:
false
,
},
actionDisabled
:
{
actionDisabled
:
{
type
:
String
,
type
:
String
,
required
:
false
,
required
:
false
,
...
@@ -134,19 +126,11 @@ export default {
...
@@ -134,19 +126,11 @@ export default {
</div>
</div>
<action-component
<action-component
v-if=
"hasAction
&& !isDropdown
"
v-if=
"hasAction"
:tooltip-text=
"status.action.title"
:tooltip-text=
"status.action.title"
:link=
"status.action.path"
:link=
"status.action.path"
:action-icon=
"status.action.icon"
:action-icon=
"status.action.icon"
:button-disabled=
"actionDisabled"
: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>
</div>
</
template
>
</
template
>
app/assets/stylesheets/pages/pipelines.scss
View file @
44a222ad
...
@@ -468,6 +468,14 @@
...
@@ -468,6 +468,14 @@
margin-bottom
:
10px
;
margin-bottom
:
10px
;
white-space
:
normal
;
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
// ensure .build-content has hover style when action-icon is hovered
.ci-job-dropdown-container
:hover
.build-content
{
.ci-job-dropdown-container
:hover
.build-content
{
@extend
.build-content
:hover
;
@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', () => {
...
@@ -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
'
,
()
=>
{
it
(
'
should render provided class name
'
,
()
=>
{
component
=
mountComponent
(
JobComponent
,
{
component
=
mountComponent
(
JobComponent
,
{
job
:
mockJob
,
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