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
86bc36c5
Commit
86bc36c5
authored
Jan 18, 2018
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move mr_widget_auto_merge_failed component into a vue file
parent
e56bcf92
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
92 additions
and
69 deletions
+92
-69
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_failed.js
...t_widget/components/states/mr_widget_auto_merge_failed.js
+0
-47
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_failed.vue
..._widget/components/states/mr_widget_auto_merge_failed.vue
+52
-0
app/assets/javascripts/vue_merge_request_widget/dependencies.js
...sets/javascripts/vue_merge_request_widget/dependencies.js
+1
-1
app/assets/javascripts/vue_merge_request_widget/index.js
app/assets/javascripts/vue_merge_request_widget/index.js
+3
-0
spec/javascripts/vue_mr_widget/components/states/mr_widget_auto_merge_failed_spec.js
...get/components/states/mr_widget_auto_merge_failed_spec.js
+36
-21
No files found.
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_failed.js
deleted
100644 → 0
View file @
e56bcf92
import
eventHub
from
'
../../event_hub
'
;
import
statusIcon
from
'
../mr_widget_status_icon
'
;
export
default
{
name
:
'
MRWidgetAutoMergeFailed
'
,
props
:
{
mr
:
{
type
:
Object
,
required
:
true
},
},
data
()
{
return
{
isRefreshing
:
false
,
};
},
components
:
{
statusIcon
,
},
methods
:
{
refreshWidget
()
{
this
.
isRefreshing
=
true
;
eventHub
.
$emit
(
'
MRWidgetUpdateRequested
'
,
()
=>
{
this
.
isRefreshing
=
false
;
});
},
},
template
:
`
<div class="mr-widget-body media">
<status-icon status="failed" />
<div class="media-body space-children">
<span class="bold">
<template v-if="mr.mergeError">{{mr.mergeError}}.</template>
This merge request failed to be merged automatically
</span>
<button
@click="refreshWidget"
:disabled="isRefreshing"
type="button"
class="btn btn-xs btn-default">
<i
v-if="isRefreshing"
class="fa fa-spinner fa-spin"
aria-hidden="true" />
Refresh
</button>
</div>
</div>
`
,
};
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_failed.vue
0 → 100644
View file @
86bc36c5
<
script
>
import
loadingIcon
from
'
~/vue_shared/components/loading_icon.vue
'
;
import
eventHub
from
'
../../event_hub
'
;
import
statusIcon
from
'
../mr_widget_status_icon
'
;
export
default
{
name
:
'
MRWidgetAutoMergeFailed
'
,
components
:
{
statusIcon
,
loadingIcon
,
},
props
:
{
mr
:
{
type
:
Object
,
required
:
true
,
},
},
data
()
{
return
{
isRefreshing
:
false
,
};
},
methods
:
{
refreshWidget
()
{
this
.
isRefreshing
=
true
;
eventHub
.
$emit
(
'
MRWidgetUpdateRequested
'
,
()
=>
{
this
.
isRefreshing
=
false
;
});
},
},
};
</
script
>
<
template
>
<div
class=
"mr-widget-body media"
>
<status-icon
status=
"failed"
/>
<div
class=
"media-body space-children"
>
<span
class=
"bold"
>
<template
v-if=
"mr.mergeError"
>
{{
mr
.
mergeError
}}
.
</
template
>
{{ s__("mrWidget|This merge request failed to be merged automatically") }}
</span>
<button
@
click=
"refreshWidget"
:disabled=
"isRefreshing"
type=
"button"
class=
"btn btn-xs btn-default"
>
<loading-icon
v-if=
"isRefreshing"
/>
{{ s__("mrWidget|Refresh") }}
</button>
</div>
</div>
</template>
app/assets/javascripts/vue_merge_request_widget/dependencies.js
View file @
86bc36c5
...
...
@@ -33,7 +33,7 @@ export { default as PipelineBlockedState } from './components/states/mr_widget_p
export
{
default
as
PipelineFailedState
}
from
'
./components/states/mr_widget_pipeline_failed
'
;
export
{
default
as
MergeWhenPipelineSucceedsState
}
from
'
./components/states/mr_widget_merge_when_pipeline_succeeds
'
;
export
{
default
as
RebaseState
}
from
'
./components/states/mr_widget_rebase.vue
'
;
export
{
default
as
AutoMergeFailed
}
from
'
./components/states/mr_widget_auto_merge_failed
'
;
export
{
default
as
AutoMergeFailed
}
from
'
./components/states/mr_widget_auto_merge_failed
.vue
'
;
export
{
default
as
CheckingState
}
from
'
./components/states/mr_widget_checking
'
;
export
{
default
as
MRWidgetStore
}
from
'
./stores/mr_widget_store
'
;
export
{
default
as
MRWidgetService
}
from
'
./services/mr_widget_service
'
;
...
...
app/assets/javascripts/vue_merge_request_widget/index.js
View file @
86bc36c5
...
...
@@ -2,6 +2,9 @@ import {
Vue
,
mrWidgetOptions
,
}
from
'
./dependencies
'
;
import
Translate
from
'
../vue_shared/translate
'
;
Vue
.
use
(
Translate
);
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
gl
.
mrWidgetData
.
gitlabLogo
=
gon
.
gitlab_logo
;
...
...
spec/javascripts/vue_mr_widget/components/states/mr_widget_auto_merge_failed_spec.js
View file @
86bc36c5
import
Vue
from
'
vue
'
;
import
autoMergeFailedComponent
from
'
~/vue_merge_request_widget/components/states/mr_widget_auto_merge_failed
'
;
const
mergeError
=
'
This is the merge erro
r
'
;
import
autoMergeFailedComponent
from
'
~/vue_merge_request_widget/components/states/mr_widget_auto_merge_failed
.vue
'
;
import
eventHub
from
'
~/vue_merge_request_widget/event_hub
'
;
import
mountComponent
from
'
../../../helpers/vue_mount_component_helpe
r
'
;
describe
(
'
MRWidgetAutoMergeFailed
'
,
()
=>
{
describe
(
'
props
'
,
()
=>
{
it
(
'
should have props
'
,
()
=>
{
const
mrProp
=
autoMergeFailedComponent
.
props
.
mr
;
let
vm
;
const
mergeError
=
'
This is the merge error
'
;
expect
(
mrProp
.
type
instanceof
Object
).
toBeTruthy
();
expect
(
mrProp
.
required
).
toBeTruthy
();
beforeEach
(()
=>
{
const
Component
=
Vue
.
extend
(
autoMergeFailedComponent
);
vm
=
mountComponent
(
Component
,
{
mr
:
{
mergeError
},
});
});
describe
(
'
template
'
,
()
=>
{
const
Component
=
Vue
.
extend
(
autoMergeFailedComponent
);
const
vm
=
new
Component
({
el
:
document
.
createElement
(
'
div
'
),
propsData
:
{
mr
:
{
mergeError
},
},
});
afterEach
(()
=>
{
vm
.
$destroy
();
});
it
(
'
renders failed message
'
,
()
=>
{
expect
(
vm
.
$el
.
textContent
).
toContain
(
'
This merge request failed to be merged automatically
'
);
});
it
(
'
renders merge error provided
'
,
()
=>
{
expect
(
vm
.
$el
.
innerText
).
toContain
(
mergeError
);
});
it
(
'
render refresh button
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
button
'
).
textContent
.
trim
()).
toEqual
(
'
Refresh
'
);
});
it
(
'
emits event and shows loading icon when button is clicked
'
,
(
done
)
=>
{
spyOn
(
eventHub
,
'
$emit
'
);
vm
.
$el
.
querySelector
(
'
button
'
).
click
();
expect
(
eventHub
.
$emit
.
calls
.
argsFor
(
0
)[
0
]).
toEqual
(
'
MRWidgetUpdateRequested
'
);
it
(
'
should have correct elements
'
,
()
=>
{
expect
(
vm
.
$el
.
classList
.
contains
(
'
mr-widget-body
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
querySelector
(
'
button
'
).
getAttribute
(
'
disabled
'
)).
toBeFalsy
();
expect
(
vm
.
$el
.
innerText
).
toContain
(
'
This merge request failed to be merged automatically
'
);
expect
(
vm
.
$el
.
innerText
).
toContain
(
mergeError
);
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
button
'
).
getAttribute
(
'
disabled
'
)).
toEqual
(
'
disabled
'
);
expect
(
vm
.
$el
.
querySelector
(
'
button i
'
).
classList
,
).
toContain
(
'
fa-spinner
'
);
done
();
});
});
});
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