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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
4cb27763
Commit
4cb27763
authored
Apr 03, 2020
by
Jarka Košanová
Committed by
Michael Kozono
Apr 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show error when Jira did not return any projects
parent
5617531d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
5 deletions
+27
-5
app/controllers/projects/import/jira_controller.rb
app/controllers/projects/import/jira_controller.rb
+7
-1
app/views/projects/import/jira/show.html.haml
app/views/projects/import/jira/show.html.haml
+1
-1
spec/controllers/projects/import/jira_controller_spec.rb
spec/controllers/projects/import/jira_controller_spec.rb
+19
-3
No files found.
app/controllers/projects/import/jira_controller.rb
View file @
4cb27763
...
...
@@ -9,7 +9,13 @@ module Projects
def
show
unless
@project
.
import_state
&
.
in_progress?
jira_client
=
@project
.
jira_service
.
client
@jira_projects
=
jira_client
.
Project
.
all
.
map
{
|
p
|
[
"
#{
p
.
name
}
(
#{
p
.
key
}
)"
,
p
.
key
]
}
jira_projects
=
jira_client
.
Project
.
all
if
jira_projects
.
present?
@jira_projects
=
jira_projects
.
map
{
|
p
|
[
"
#{
p
.
name
}
(
#{
p
.
key
}
)"
,
p
.
key
]
}
else
flash
[
:alert
]
=
'No projects have been returned from Jira. Please check your Jira configuration.'
end
end
flash
[
:notice
]
=
_
(
"Import %{status}"
)
%
{
status:
@project
.
import_state
.
status
}
if
@project
.
import_state
.
present?
&&
!
@project
.
import_state
.
none?
...
...
app/views/projects/import/jira/show.html.haml
View file @
4cb27763
...
...
@@ -9,7 +9,7 @@
%h3
.page-title.d-flex.align-items-center
=
sprite_icon
(
'issues'
,
size:
16
,
css_class:
'mr-1'
)
=
_
(
'Import in progress'
)
-
els
e
-
els
if
@jira_projects
.
present?
%h3
.page-title.d-flex.align-items-center
=
sprite_icon
(
'issues'
,
size:
16
,
css_class:
'mr-1'
)
=
_
(
'Import issues from Jira'
)
...
...
spec/controllers/projects/import/jira_controller_spec.rb
View file @
4cb27763
...
...
@@ -66,13 +66,29 @@ describe Projects::Import::JiraController do
context
'when running jira import first time'
do
context
'get show'
do
it
'renders show template'
do
allow
(
JIRA
::
Resource
::
Project
).
to
receive
(
:all
).
and_return
([])
before
do
allow
(
JIRA
::
Resource
::
Project
).
to
receive
(
:all
).
and_return
(
jira_projects
)
expect
(
project
.
import_state
).
to
be_nil
get
:show
,
params:
{
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
}
end
context
'when no projects have been retrieved from Jira'
do
let
(
:jira_projects
)
{
[]
}
it
'render an error message'
do
expect
(
flash
[
:alert
]).
to
eq
(
'No projects have been returned from Jira. Please check your Jira configuration.'
)
expect
(
response
).
to
render_template
(
:show
)
end
end
context
'when everything is ok'
do
let
(
:jira_projects
)
{
[
double
(
name:
'FOO project'
,
key:
'FOO'
)]
}
expect
(
response
).
to
render_template
:show
it
'renders show template'
do
expect
(
response
).
to
render_template
(
:show
)
end
end
end
...
...
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