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
Jérome Perrin
gitlab-ce
Commits
694cfeb7
Commit
694cfeb7
authored
Nov 03, 2017
by
Eric Eastwood
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into refactor-clusters
parents
600d5f4f
f580e497
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
85 additions
and
34 deletions
+85
-34
app/assets/javascripts/clusters.js
app/assets/javascripts/clusters.js
+2
-0
app/assets/javascripts/lib/utils/axios_utils.js
app/assets/javascripts/lib/utils/axios_utils.js
+6
-0
app/assets/stylesheets/pages/boards.scss
app/assets/stylesheets/pages/boards.scss
+7
-3
app/controllers/admin/applications_controller.rb
app/controllers/admin/applications_controller.rb
+5
-10
app/controllers/oauth/applications_controller.rb
app/controllers/oauth/applications_controller.rb
+10
-11
app/controllers/profiles/keys_controller.rb
app/controllers/profiles/keys_controller.rb
+2
-8
app/models/environment.rb
app/models/environment.rb
+5
-1
app/services/applications/create_service.rb
app/services/applications/create_service.rb
+13
-0
app/services/keys/base_service.rb
app/services/keys/base_service.rb
+1
-0
changelogs/unreleased/sh-fix-environment-slug-generation.yml
changelogs/unreleased/sh-fix-environment-slug-generation.yml
+5
-0
config/gitlab.yml.example
config/gitlab.yml.example
+1
-1
spec/models/environment_spec.rb
spec/models/environment_spec.rb
+15
-0
spec/services/applications/create_service_spec.rb
spec/services/applications/create_service_spec.rb
+13
-0
No files found.
app/assets/javascripts/clusters.js
View file @
694cfeb7
/* globals Flash */
import
Visibility
from
'
visibilityjs
'
;
import
axios
from
'
axios
'
;
import
setAxiosCsrfToken
from
'
./lib/utils/axios_utils
'
;
import
Poll
from
'
./lib/utils/poll
'
;
import
{
s__
}
from
'
./locale
'
;
import
initSettingsPanels
from
'
./settings_panels
'
;
...
...
@@ -17,6 +18,7 @@ import Flash from './flash';
class
ClusterService
{
constructor
(
options
=
{})
{
this
.
options
=
options
;
setAxiosCsrfToken
();
}
fetchData
()
{
return
axios
.
get
(
this
.
options
.
endpoint
);
...
...
app/assets/javascripts/lib/utils/axios_utils.js
0 → 100644
View file @
694cfeb7
import
axios
from
'
axios
'
;
import
csrf
from
'
./csrf
'
;
export
default
function
setAxiosCsrfToken
()
{
axios
.
defaults
.
headers
.
common
[
csrf
.
headerKey
]
=
csrf
.
token
;
}
app/assets/stylesheets/pages/boards.scss
View file @
694cfeb7
...
...
@@ -72,7 +72,7 @@
}
.boards-list
{
height
:
calc
(
100vh
-
1
52
px
);
height
:
calc
(
100vh
-
1
05
px
);
width
:
100%
;
padding-top
:
25px
;
padding-bottom
:
25px
;
...
...
@@ -81,10 +81,14 @@
overflow-x
:
scroll
;
white-space
:
nowrap
;
@media
(
min-width
:
$screen-sm-min
)
{
@media
(
min-width
:
$screen-sm-min
)
and
(
max-width
:
$screen-sm-max
)
{
height
:
calc
(
100vh
-
90px
);
}
@media
(
min-width
:
$screen-md-min
)
{
height
:
475px
;
// Needed for PhantomJS
// scss-lint:disable DuplicateProperty
height
:
calc
(
100vh
-
222
px
);
height
:
calc
(
100vh
-
160
px
);
// scss-lint:enable DuplicateProperty
min-height
:
475px
;
}
...
...
app/controllers/admin/applications_controller.rb
View file @
694cfeb7
...
...
@@ -19,10 +19,12 @@ class Admin::ApplicationsController < Admin::ApplicationController
end
def
create
@application
=
Doorkeeper
::
Application
.
new
(
application_params
)
@application
=
Applications
::
CreateService
.
new
(
current_user
,
application_params
).
execute
(
request
)
if
@application
.
save
redirect_to_admin_page
if
@application
.
persisted?
flash
[
:notice
]
=
I18n
.
t
(
:notice
,
scope:
[
:doorkeeper
,
:flash
,
:applications
,
:create
])
redirect_to
admin_application_url
(
@application
)
else
render
:new
end
...
...
@@ -41,13 +43,6 @@ class Admin::ApplicationsController < Admin::ApplicationController
redirect_to
admin_applications_url
,
status:
302
,
notice:
'Application was successfully destroyed.'
end
protected
def
redirect_to_admin_page
flash
[
:notice
]
=
I18n
.
t
(
:notice
,
scope:
[
:doorkeeper
,
:flash
,
:applications
,
:create
])
redirect_to
admin_application_url
(
@application
)
end
private
def
set_application
...
...
app/controllers/oauth/applications_controller.rb
View file @
694cfeb7
...
...
@@ -16,25 +16,18 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
end
def
create
@application
=
Doorkeeper
::
Application
.
new
(
application_params
)
@application
=
Applications
::
CreateService
.
new
(
current_user
,
create_application_params
).
execute
(
request
)
@application
.
owner
=
current_user
if
@application
.
persisted?
flash
[
:notice
]
=
I18n
.
t
(
:notice
,
scope:
[
:doorkeeper
,
:flash
,
:applications
,
:create
])
if
@application
.
save
redirect_to_oauth_application_page
redirect_to
oauth_application_url
(
@application
)
else
set_index_vars
render
:index
end
end
protected
def
redirect_to_oauth_application_page
flash
[
:notice
]
=
I18n
.
t
(
:notice
,
scope:
[
:doorkeeper
,
:flash
,
:applications
,
:create
])
redirect_to
oauth_application_url
(
@application
)
end
private
def
verify_user_oauth_applications_enabled
...
...
@@ -61,4 +54,10 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
rescue_from
ActiveRecord
::
RecordNotFound
do
|
exception
|
render
"errors/not_found"
,
layout:
"errors"
,
status:
404
end
def
create_application_params
application_params
.
tap
do
|
params
|
params
[
:owner
]
=
current_user
end
end
end
app/controllers/profiles/keys_controller.rb
View file @
694cfeb7
...
...
@@ -11,10 +11,10 @@ class Profiles::KeysController < Profiles::ApplicationController
end
def
create
@key
=
Keys
::
CreateService
.
new
(
current_user
,
key_params
).
execute
@key
=
Keys
::
CreateService
.
new
(
current_user
,
key_params
.
merge
(
ip_address:
request
.
remote_ip
)
).
execute
if
@key
.
persisted?
redirect_to
_profile_key_path
redirect_to
profile_key_path
(
@key
)
else
@keys
=
current_user
.
keys
.
select
(
&
:persisted?
)
render
:index
...
...
@@ -50,12 +50,6 @@ class Profiles::KeysController < Profiles::ApplicationController
end
end
protected
def
redirect_to_profile_key_path
redirect_to
profile_key_path
(
@key
)
end
private
def
key_params
...
...
app/models/environment.rb
View file @
694cfeb7
...
...
@@ -110,7 +110,7 @@ class Environment < ActiveRecord::Base
end
def
ref_path
"refs/
#{
Repository
::
REF_ENVIRONMENTS
}
/
#{
generate_
slug
}
"
"refs/
#{
Repository
::
REF_ENVIRONMENTS
}
/
#{
slug
}
"
end
def
formatted_external_url
...
...
@@ -164,6 +164,10 @@ class Environment < ActiveRecord::Base
end
end
def
slug
super
.
presence
||
generate_slug
end
# An environment name is not necessarily suitable for use in URLs, DNS
# or other third-party contexts, so provide a slugified version. A slug has
# the following properties:
...
...
app/services/applications/create_service.rb
0 → 100644
View file @
694cfeb7
module
Applications
class
CreateService
def
initialize
(
current_user
,
params
)
@current_user
=
current_user
@params
=
params
@ip_address
=
@params
.
delete
(
:ip_address
)
end
def
execute
(
request
=
nil
)
Doorkeeper
::
Application
.
create
(
@params
)
end
end
end
app/services/keys/base_service.rb
View file @
694cfeb7
...
...
@@ -4,6 +4,7 @@ module Keys
def
initialize
(
user
,
params
)
@user
,
@params
=
user
,
params
@ip_address
=
@params
.
delete
(
:ip_address
)
end
def
notification_service
...
...
changelogs/unreleased/sh-fix-environment-slug-generation.yml
0 → 100644
View file @
694cfeb7
---
title
:
Avoid regenerating the ref path for the environment
merge_request
:
author
:
type
:
fixed
config/gitlab.yml.example
View file @
694cfeb7
...
...
@@ -501,7 +501,7 @@ production: &base
# Gitaly settings
gitaly:
# Path to the directory containing Gitaly client executables.
client_path: /home/git/gitaly
client_path: /home/git/gitaly
/bin
# Default Gitaly authentication token. Can be overriden per storage. Can
# be left blank when Gitaly is running locally on a Unix socket, which
# is the normal way to deploy Gitaly.
...
...
spec/models/environment_spec.rb
View file @
694cfeb7
...
...
@@ -547,6 +547,15 @@ describe Environment do
expect
(
environment
.
slug
).
to
eq
(
original_slug
)
end
it
"regenerates the slug if nil"
do
environment
=
build
(
:environment
,
slug:
nil
)
new_slug
=
environment
.
slug
expect
(
new_slug
).
not_to
be_nil
expect
(
environment
.
slug
).
to
eq
(
new_slug
)
end
end
describe
'#generate_slug'
do
...
...
@@ -583,6 +592,12 @@ describe Environment do
it
'returns a path that uses the slug and does not have spaces'
do
expect
(
environment
.
ref_path
).
to
start_with
(
'refs/environments/staging-review-1-'
)
end
it
"doesn't change when the slug is nil initially"
do
environment
.
slug
=
nil
expect
(
environment
.
ref_path
).
to
eq
(
environment
.
ref_path
)
end
end
describe
'#external_url_for'
do
...
...
spec/services/applications/create_service_spec.rb
0 → 100644
View file @
694cfeb7
require
'spec_helper'
describe
::
Applications
::
CreateService
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:params
)
{
attributes_for
(
:application
)
}
let
(
:request
)
{
ActionController
::
TestRequest
.
new
(
remote_ip:
'127.0.0.1'
)
}
subject
{
described_class
.
new
(
user
,
params
)
}
it
'creates an application'
do
expect
{
subject
.
execute
(
request
)
}.
to
change
{
Doorkeeper
::
Application
.
count
}.
by
(
1
)
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