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
a555b53c
Commit
a555b53c
authored
Apr 04, 2017
by
Kamil Trzciński
Committed by
Rémy Coutable
Apr 04, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to edit build minutes per user ee
parent
8a426306
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
78 additions
and
11 deletions
+78
-11
app/controllers/admin/users_controller.rb
app/controllers/admin/users_controller.rb
+2
-1
app/models/user.rb
app/models/user.rb
+2
-0
app/views/admin/groups/_form.html.haml
app/views/admin/groups/_form.html.haml
+1
-1
app/views/admin/groups/show.html.haml
app/views/admin/groups/show.html.haml
+1
-1
app/views/admin/users/_form.html.haml
app/views/admin/users/_form.html.haml
+2
-0
app/views/admin/users/_limits.html.haml
app/views/admin/users/_limits.html.haml
+5
-0
app/views/admin/users/show.html.haml
app/views/admin/users/show.html.haml
+2
-0
app/views/namespaces/_shared_runner_status.html.haml
app/views/namespaces/_shared_runner_status.html.haml
+3
-2
app/views/namespaces/_shared_runners_minutes_setting.html.haml
...iews/namespaces/_shared_runners_minutes_setting.html.haml
+0
-0
changelogs/unreleased-ee/allow-to-edit-pipelines-quota-for-user.yml
.../unreleased-ee/allow-to-edit-pipelines-quota-for-user.yml
+4
-0
spec/features/admin/admin_users_spec.rb
spec/features/admin/admin_users_spec.rb
+47
-0
spec/models/forked_project_link_spec.rb
spec/models/forked_project_link_spec.rb
+1
-2
spec/models/user_spec.rb
spec/models/user_spec.rb
+4
-0
spec/services/projects/fork_service_spec.rb
spec/services/projects/fork_service_spec.rb
+4
-4
No files found.
app/controllers/admin/users_controller.rb
View file @
a555b53c
...
@@ -205,7 +205,8 @@ class Admin::UsersController < Admin::ApplicationController
...
@@ -205,7 +205,8 @@ class Admin::UsersController < Admin::ApplicationController
def
user_params_ee
def
user_params_ee
[
[
:note
:note
,
namespace_attributes:
[
:id
,
:shared_runners_minutes_limit
]
]
]
end
end
end
end
app/models/user.rb
View file @
a555b53c
...
@@ -169,6 +169,8 @@ class User < ActiveRecord::Base
...
@@ -169,6 +169,8 @@ class User < ActiveRecord::Base
delegate
:path
,
to: :namespace
,
allow_nil:
true
,
prefix:
true
delegate
:path
,
to: :namespace
,
allow_nil:
true
,
prefix:
true
accepts_nested_attributes_for
:namespace
state_machine
:state
,
initial: :active
do
state_machine
:state
,
initial: :active
do
event
:block
do
event
:block
do
transition
active: :blocked
transition
active: :blocked
...
...
app/views/admin/groups/_form.html.haml
View file @
a555b53c
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
=
render
'groups/group_lfs_settings'
,
f:
f
=
render
'groups/group_lfs_settings'
,
f:
f
=
render
'
group
s/shared_runners_minutes_setting'
,
f:
f
=
render
'
namespace
s/shared_runners_minutes_setting'
,
f:
f
-
if
@group
.
new_record?
-
if
@group
.
new_record?
.form-group
.form-group
...
...
app/views/admin/groups/show.html.haml
View file @
a555b53c
...
@@ -56,7 +56,7 @@
...
@@ -56,7 +56,7 @@
=
group_lfs_status
(
@group
)
=
group_lfs_status
(
@group
)
=
link_to
icon
(
'question-circle'
),
help_page_path
(
'workflow/lfs/manage_large_binaries_with_git_lfs'
)
=
link_to
icon
(
'question-circle'
),
help_page_path
(
'workflow/lfs/manage_large_binaries_with_git_lfs'
)
=
render
"shared_runner_status"
,
group:
@group
=
render
partial:
"namespaces/shared_runner_status"
,
locals:
{
namespace:
@group
}
.panel.panel-default
.panel.panel-default
.panel-heading
Linked LDAP groups
.panel-heading
Linked LDAP groups
...
...
app/views/admin/users/_form.html.haml
View file @
a555b53c
...
@@ -42,6 +42,8 @@
...
@@ -42,6 +42,8 @@
=
render
partial:
'access_levels'
,
locals:
{
f:
f
}
=
render
partial:
'access_levels'
,
locals:
{
f:
f
}
=
render
partial:
'limits'
,
locals:
{
f:
f
}
%fieldset
%fieldset
%legend
Profile
%legend
Profile
.form-group
.form-group
...
...
app/views/admin/users/_limits.html.haml
0 → 100644
View file @
a555b53c
=
f
.
fields_for
:namespace
do
|
namespace_form
|
=
namespace_form
.
hidden_field
:id
%fieldset
%legend
Limits
=
render
"namespaces/shared_runners_minutes_setting"
,
f:
namespace_form
app/views/admin/users/show.html.haml
View file @
a555b53c
...
@@ -123,6 +123,8 @@
...
@@ -123,6 +123,8 @@
%strong
%strong
=
link_to
@user
.
created_by
.
name
,
[
:admin
,
@user
.
created_by
]
=
link_to
@user
.
created_by
.
name
,
[
:admin
,
@user
.
created_by
]
=
render
partial:
"namespaces/shared_runner_status"
,
locals:
{
namespace:
@user
.
namespace
}
.col-md-6
.col-md-6
-
unless
@user
==
current_user
-
unless
@user
==
current_user
-
unless
@user
.
confirmed?
-
unless
@user
.
confirmed?
...
...
app/views/
admin/group
s/_shared_runner_status.html.haml
→
app/views/
namespace
s/_shared_runner_status.html.haml
View file @
a555b53c
-
if
group
.
shared_runners_enabled?
-
namespace
=
local_assigns
.
fetch
(
:namespace
)
-
if
namespace
.
shared_runners_enabled?
%li
%li
%span
.light
Build minutes quota:
%span
.light
Build minutes quota:
%strong
%strong
=
group_shared_runner_limits_quota
(
group
)
=
group_shared_runner_limits_quota
(
namespace
)
=
link_to
icon
(
'question-circle'
),
help_page_path
(
"user/admin_area/settings/continuous_integration"
,
anchor:
"shared-runners-build-minutes-quota"
),
target:
'_blank'
=
link_to
icon
(
'question-circle'
),
help_page_path
(
"user/admin_area/settings/continuous_integration"
,
anchor:
"shared-runners-build-minutes-quota"
),
target:
'_blank'
app/views/
group
s/_shared_runners_minutes_setting.html.haml
→
app/views/
namespace
s/_shared_runners_minutes_setting.html.haml
View file @
a555b53c
File moved
changelogs/unreleased-ee/allow-to-edit-pipelines-quota-for-user.yml
0 → 100644
View file @
a555b53c
---
title
:
Allow to edit pipelines quota for user
merge_request
:
author
:
spec/features/admin/admin_users_spec.rb
View file @
a555b53c
...
@@ -192,6 +192,40 @@ describe "Admin::Users", feature: true do
...
@@ -192,6 +192,40 @@ describe "Admin::Users", feature: true do
end
end
end
end
end
end
describe
'Shared runners quota status'
do
before
do
user
.
namespace
.
update
(
shared_runners_minutes_limit:
500
)
end
context
'with projects with shared runners enabled'
do
before
do
create
(
:empty_project
,
namespace:
user
.
namespace
,
shared_runners_enabled:
true
)
end
it
'shows quota'
do
visit
admin_users_path
click_link
user
.
name
expect
(
page
).
to
have_content
(
'Build minutes quota: 0 / 500'
)
end
end
context
'without projects with shared runners enabled'
do
before
do
create
(
:empty_project
,
namespace:
user
.
namespace
,
shared_runners_enabled:
false
)
end
it
'does not show quota'
do
visit
admin_users_path
click_link
user
.
name
expect
(
page
).
not_to
have_content
(
'Build minutes quota:'
)
end
end
end
end
end
describe
"GET /admin/users/:id/edit"
do
describe
"GET /admin/users/:id/edit"
do
...
@@ -255,6 +289,19 @@ describe "Admin::Users", feature: true do
...
@@ -255,6 +289,19 @@ describe "Admin::Users", feature: true do
expect
(
page
).
to
have_selector
(
%(form[action="/admin/users/#{user.username}"])
)
expect
(
page
).
to
have_selector
(
%(form[action="/admin/users/#{user.username}"])
)
end
end
end
end
describe
'Update shared runners quota'
do
let!
(
:project
)
{
create
(
:empty_project
,
namespace:
user
.
namespace
,
shared_runners_enabled:
true
)
}
before
do
fill_in
"user_namespace_attributes_shared_runners_minutes_limit"
,
with:
"500"
click_button
"Save changes"
end
it
"shows page with new data"
do
expect
(
page
).
to
have_content
(
'Build minutes quota: 0 / 500'
)
end
end
end
end
describe
"GET /admin/users/:id/projects"
do
describe
"GET /admin/users/:id/projects"
do
...
...
spec/models/forked_project_link_spec.rb
View file @
a555b53c
...
@@ -2,8 +2,7 @@ require 'spec_helper'
...
@@ -2,8 +2,7 @@ require 'spec_helper'
describe
ForkedProjectLink
,
"add link on fork"
do
describe
ForkedProjectLink
,
"add link on fork"
do
let
(
:project_from
)
{
create
(
:project
,
:repository
)
}
let
(
:project_from
)
{
create
(
:project
,
:repository
)
}
let
(
:namespace
)
{
create
(
:namespace
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
,
namespace:
namespace
)
}
before
do
before
do
create
(
:project_member
,
:reporter
,
user:
user
,
project:
project_from
)
create
(
:project_member
,
:reporter
,
user:
user
,
project:
project_from
)
...
...
spec/models/user_spec.rb
View file @
a555b53c
...
@@ -60,6 +60,10 @@ describe User, models: true do
...
@@ -60,6 +60,10 @@ describe User, models: true do
end
end
end
end
describe
'nested attributes'
do
it
{
is_expected
.
to
respond_to
(
:namespace_attributes
=
)
}
end
describe
'validations'
do
describe
'validations'
do
describe
'username'
do
describe
'username'
do
it
'validates presence'
do
it
'validates presence'
do
...
...
spec/services/projects/fork_service_spec.rb
View file @
a555b53c
...
@@ -3,8 +3,8 @@ require 'spec_helper'
...
@@ -3,8 +3,8 @@ require 'spec_helper'
describe
Projects
::
ForkService
,
services:
true
do
describe
Projects
::
ForkService
,
services:
true
do
describe
'fork by user'
do
describe
'fork by user'
do
before
do
before
do
@from_
namespace
=
create
(
:namespace
)
@from_
user
=
create
(
:user
)
@from_
user
=
create
(
:user
,
namespace:
@from_namespace
)
@from_
namespace
=
@from_user
.
namespace
avatar
=
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
,
"image/png"
)
avatar
=
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
,
"image/png"
)
@from_project
=
create
(
:project
,
@from_project
=
create
(
:project
,
:repository
,
:repository
,
...
@@ -13,8 +13,8 @@ describe Projects::ForkService, services: true do
...
@@ -13,8 +13,8 @@ describe Projects::ForkService, services: true do
star_count:
107
,
star_count:
107
,
avatar:
avatar
,
avatar:
avatar
,
description:
'wow such project'
)
description:
'wow such project'
)
@to_
namespace
=
create
(
:namespace
)
@to_
user
=
create
(
:user
)
@to_
user
=
create
(
:user
,
namespace:
@to_namespace
)
@to_
namespace
=
@to_user
.
namespace
@from_project
.
add_user
(
@to_user
,
:developer
)
@from_project
.
add_user
(
@to_user
,
:developer
)
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