BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
0a0a62c9
Commit
0a0a62c9
authored
Dec 19, 2017
by
Clement Ho
Committed by
Jacob Schatz
Dec 19, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove related links in MR widget when empty state
parent
bd875692
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
84 additions
and
14 deletions
+84
-14
mr_widget_options.js
...javascripts/vue_merge_request_widget/mr_widget_options.js
+1
-1
get_state_key.js
...ascripts/vue_merge_request_widget/stores/get_state_key.js
+15
-13
mr_widget_store.js
...cripts/vue_merge_request_widget/stores/mr_widget_store.js
+5
-0
state_maps.js
...javascripts/vue_merge_request_widget/stores/state_maps.js
+17
-0
remove-links-mr-empty-state.yml
changelogs/unreleased/remove-links-mr-empty-state.yml
+5
-0
mr_widget_options_spec.js
spec/javascripts/vue_mr_widget/mr_widget_options_spec.js
+28
-0
mr_widget_store_spec.js
.../javascripts/vue_mr_widget/stores/mr_widget_store_spec.js
+13
-0
No files found.
app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js
View file @
0a0a62c9
...
...
@@ -62,7 +62,7 @@ export default {
return
this
.
mr
.
hasCI
;
},
shouldRenderRelatedLinks
()
{
return
!!
this
.
mr
.
relatedLinks
;
return
!!
this
.
mr
.
relatedLinks
&&
!
this
.
mr
.
isNothingToMergeState
;
},
shouldRenderDeployments
()
{
return
this
.
mr
.
deployments
.
length
;
...
...
app/assets/javascripts/vue_merge_request_widget/stores/get_state_key.js
View file @
0a0a62c9
import
{
stateKey
}
from
'./state_maps'
;
export
default
function
deviseState
(
data
)
{
if
(
data
.
project_archived
)
{
return
'archived'
;
return
stateKey
.
archived
;
}
else
if
(
data
.
branch_missing
)
{
return
'missingBranch'
;
return
stateKey
.
missingBranch
;
}
else
if
(
!
data
.
commits_count
)
{
return
'nothingToMerge'
;
return
stateKey
.
nothingToMerge
;
}
else
if
(
this
.
mergeStatus
===
'unchecked'
)
{
return
'checking'
;
return
stateKey
.
checking
;
}
else
if
(
data
.
has_conflicts
)
{
return
'conflicts'
;
return
stateKey
.
conflicts
;
}
else
if
(
data
.
work_in_progress
)
{
return
'workInProgress'
;
return
stateKey
.
workInProgress
;
}
else
if
(
this
.
onlyAllowMergeIfPipelineSucceeds
&&
this
.
isPipelineFailed
)
{
return
'pipelineFailed'
;
return
stateKey
.
pipelineFailed
;
}
else
if
(
this
.
hasMergeableDiscussionsState
)
{
return
'unresolvedDiscussions'
;
return
stateKey
.
unresolvedDiscussions
;
}
else
if
(
this
.
isPipelineBlocked
)
{
return
'pipelineBlocked'
;
return
stateKey
.
pipelineBlocked
;
}
else
if
(
this
.
hasSHAChanged
)
{
return
'shaMismatch'
;
return
stateKey
.
shaMismatch
;
}
else
if
(
this
.
mergeWhenPipelineSucceeds
)
{
return
this
.
mergeError
?
'autoMergeFailed'
:
'mergeWhenPipelineSucceeds'
;
return
this
.
mergeError
?
stateKey
.
autoMergeFailed
:
stateKey
.
mergeWhenPipelineSucceeds
;
}
else
if
(
!
this
.
canMerge
)
{
return
'notAllowedToMerge'
;
return
stateKey
.
notAllowedToMerge
;
}
else
if
(
this
.
canBeMerged
)
{
return
'readyToMerge'
;
return
stateKey
.
readyToMerge
;
}
return
null
;
}
app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
View file @
0a0a62c9
import
Timeago
from
'timeago.js'
;
import
{
getStateKey
}
from
'../dependencies'
;
import
{
stateKey
}
from
'./state_maps'
;
import
{
formatDate
}
from
'../../lib/utils/datetime_utility'
;
export
default
class
MergeRequestStore
{
...
...
@@ -120,6 +121,10 @@ export default class MergeRequestStore {
}
}
get
isNothingToMergeState
()
{
return
this
.
state
===
stateKey
.
nothingToMerge
;
}
static
getEventObject
(
event
)
{
return
{
author
:
MergeRequestStore
.
getAuthorObject
(
event
),
...
...
app/assets/javascripts/vue_merge_request_widget/stores/state_maps.js
View file @
0a0a62c9
...
...
@@ -31,6 +31,23 @@ const statesToShowHelpWidget = [
'autoMergeFailed'
,
];
export
const
stateKey
=
{
archived
:
'archived'
,
missingBranch
:
'missingBranch'
,
nothingToMerge
:
'nothingToMerge'
,
checking
:
'checking'
,
conflicts
:
'conflicts'
,
workInProgress
:
'workInProgress'
,
pipelineFailed
:
'pipelineFailed'
,
unresolvedDiscussions
:
'unresolvedDiscussions'
,
pipelineBlocked
:
'pipelineBlocked'
,
shaMismatch
:
'shaMismatch'
,
autoMergeFailed
:
'autoMergeFailed'
,
mergeWhenPipelineSucceeds
:
'mergeWhenPipelineSucceeds'
,
notAllowedToMerge
:
'notAllowedToMerge'
,
readyToMerge
:
'readyToMerge'
,
};
export
default
{
stateToComponentMap
,
statesToShowHelpWidget
,
...
...
changelogs/unreleased/remove-links-mr-empty-state.yml
0 → 100644
View file @
0a0a62c9
---
title
:
Remove related links in MR widget when empty state
merge_request
:
author
:
type
:
fixed
spec/javascripts/vue_mr_widget/mr_widget_options_spec.js
View file @
0a0a62c9
...
...
@@ -2,6 +2,7 @@ import Vue from 'vue';
import
mrWidgetOptions
from
'~/vue_merge_request_widget/mr_widget_options'
;
import
eventHub
from
'~/vue_merge_request_widget/event_hub'
;
import
notify
from
'~/lib/utils/notify'
;
import
{
stateKey
}
from
'~/vue_merge_request_widget/stores/state_maps'
;
import
mockData
from
'./mock_data'
;
import
mountComponent
from
'../helpers/vue_mount_component_helper'
;
...
...
@@ -344,4 +345,31 @@ describe('mrWidgetOptions', () => {
expect
(
comps
[
'mr-widget-merge-when-pipeline-succeeds'
]).
toBeDefined
();
});
});
describe
(
'rendering relatedLinks'
,
()
=>
{
beforeEach
((
done
)
=>
{
vm
.
mr
.
relatedLinks
=
{
assignToMe
:
null
,
closing
:
`
<a class="close-related-link" href="#'>
Close
</a>
`
,
mentioned
:
''
,
};
Vue
.
nextTick
(
done
);
});
it
(
'renders if there are relatedLinks'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'.close-related-link'
)).
toBeDefined
();
});
it
(
'does not render if state is nothingToMerge'
,
(
done
)
=>
{
vm
.
mr
.
state
=
stateKey
.
nothingToMerge
;
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'.close-related-link'
)).
toBeNull
();
done
();
});
});
});
});
spec/javascripts/vue_mr_widget/stores/mr_widget_store_spec.js
View file @
0a0a62c9
import
MergeRequestStore
from
'~/vue_merge_request_widget/stores/mr_widget_store'
;
import
{
stateKey
}
from
'~/vue_merge_request_widget/stores/state_maps'
;
import
mockData
from
'../mock_data'
;
describe
(
'MergeRequestStore'
,
()
=>
{
...
...
@@ -52,5 +53,17 @@ describe('MergeRequestStore', () => {
expect
(
store
.
isPipelineSkipped
).
toBe
(
false
);
});
});
describe
(
'isNothingToMergeState'
,
()
=>
{
it
(
'returns true when nothingToMerge'
,
()
=>
{
store
.
state
=
stateKey
.
nothingToMerge
;
expect
(
store
.
isNothingToMergeState
).
toEqual
(
true
);
});
it
(
'returns false when not nothingToMerge'
,
()
=>
{
store
.
state
=
'state'
;
expect
(
store
.
isNothingToMergeState
).
toEqual
(
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