Commit cf37d623 authored by Patricio Cano's avatar Patricio Cano

Renamed `enable_lfs` to `lfs_enabled` for the Project field, and related fixes.

parent 63a97c11
...@@ -311,6 +311,14 @@ a.deploy-project-label { ...@@ -311,6 +311,14 @@ a.deploy-project-label {
color: $gl-success; color: $gl-success;
} }
.lfs-enabled {
color: $gl-success;
}
.lfs-disabled {
color: $gl-warning;
}
.breadcrumb.repo-breadcrumb { .breadcrumb.repo-breadcrumb {
padding: 0; padding: 0;
background: transparent; background: transparent;
......
...@@ -309,7 +309,7 @@ class ProjectsController < Projects::ApplicationController ...@@ -309,7 +309,7 @@ class ProjectsController < Projects::ApplicationController
:issues_tracker_id, :default_branch, :issues_tracker_id, :default_branch,
:wiki_enabled, :visibility_level, :import_url, :last_activity_at, :namespace_id, :avatar, :wiki_enabled, :visibility_level, :import_url, :last_activity_at, :namespace_id, :avatar,
:builds_enabled, :build_allow_git_fetch, :build_timeout_in_minutes, :build_coverage_regex, :builds_enabled, :build_allow_git_fetch, :build_timeout_in_minutes, :build_coverage_regex,
:public_builds, :only_allow_merge_if_build_succeeds, :request_access_enabled, :enable_lfs :public_builds, :only_allow_merge_if_build_succeeds, :request_access_enabled, :lfs_enabled
) )
end end
......
...@@ -189,11 +189,11 @@ module ProjectsHelper ...@@ -189,11 +189,11 @@ module ProjectsHelper
def project_lfs_status(project) def project_lfs_status(project)
if project.lfs_enabled? if project.lfs_enabled?
content_tag(:span, class: 'vs-private') do content_tag(:span, class: 'lfs-enabled') do
'Enabled' 'Enabled'
end end
else else
content_tag(:span, class: 'vs-internal') do content_tag(:span, class: 'lfs-disabled') do
'Disabled' 'Disabled'
end end
end end
......
...@@ -392,9 +392,9 @@ class Project < ActiveRecord::Base ...@@ -392,9 +392,9 @@ class Project < ActiveRecord::Base
def lfs_enabled? def lfs_enabled?
return false unless Gitlab.config.lfs.enabled return false unless Gitlab.config.lfs.enabled
return Gitlab.config.lfs.enabled if enable_lfs.nil? return Gitlab.config.lfs.enabled if self[:lfs_enabled].nil?
enable_lfs self[:lfs_enabled]
end end
def repository_storage_path def repository_storage_path
......
...@@ -75,9 +75,10 @@ ...@@ -75,9 +75,10 @@
= last_commit(@project) = last_commit(@project)
%li %li
%span.light LFS status: %span.light Git LFS status:
%strong %strong
= project_lfs_status(@project) = project_lfs_status(@project)
= link_to icon('question-circle'), help_page_path('workflow/lfs/manage_large_binaries_with_git_lfs')
- else - else
%li %li
%span.light repository: %span.light repository:
......
...@@ -83,11 +83,13 @@ ...@@ -83,11 +83,13 @@
- if Gitlab.config.lfs.enabled && current_user.admin? - if Gitlab.config.lfs.enabled && current_user.admin?
.form-group .form-group
.checkbox .checkbox
= f.label :enable_lfs do = f.label :lfs_enabled do
= f.check_box :enable_lfs, checked: @project.lfs_enabled? = f.check_box :lfs_enabled, checked: @project.lfs_enabled?
%strong LFS %strong LFS
%br %br
%span.descr Git Large File Storage %span.descr
Git Large File Storage
= link_to icon('question-circle'), help_page_path('workflow/lfs/manage_large_binaries_with_git_lfs')
- if Gitlab.config.registry.enabled - if Gitlab.config.registry.enabled
.form-group .form-group
.checkbox .checkbox
......
# See http://doc.gitlab.com/ce/development/migration_style_guide.html # See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab. # for more information on how to write migrations for GitLab.
class AddEnableLfsToProjects < ActiveRecord::Migration class AddLfsEnabledToProjects < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
# Set this constant to true if this migration requires downtime. # Set this constant to true if this migration requires downtime.
...@@ -24,6 +24,6 @@ class AddEnableLfsToProjects < ActiveRecord::Migration ...@@ -24,6 +24,6 @@ class AddEnableLfsToProjects < ActiveRecord::Migration
# disable_ddl_transaction! # disable_ddl_transaction!
def change def change
add_column :projects, :enable_lfs, :boolean add_column :projects, :lfs_enabled, :boolean
end end
end end
...@@ -825,7 +825,7 @@ ActiveRecord::Schema.define(version: 20160824103857) do ...@@ -825,7 +825,7 @@ ActiveRecord::Schema.define(version: 20160824103857) do
t.string "repository_storage", default: "default", null: false t.string "repository_storage", default: "default", null: false
t.boolean "request_access_enabled", default: true, null: false t.boolean "request_access_enabled", default: true, null: false
t.boolean "has_external_wiki" t.boolean "has_external_wiki"
t.boolean "enable_lfs" t.boolean "lfs_enabled"
end end
add_index "projects", ["ci_id"], name: "index_projects_on_ci_id", using: :btree add_index "projects", ["ci_id"], name: "index_projects_on_ci_id", using: :btree
......
...@@ -452,7 +452,7 @@ Parameters: ...@@ -452,7 +452,7 @@ Parameters:
- `import_url` (optional) - `import_url` (optional)
- `public_builds` (optional) - `public_builds` (optional)
- `only_allow_merge_if_build_succeeds` (optional) - `only_allow_merge_if_build_succeeds` (optional)
- `enable_lfs` (optional) - `lfs_enabled` (optional)
### Create project for user ### Create project for user
...@@ -479,7 +479,7 @@ Parameters: ...@@ -479,7 +479,7 @@ Parameters:
- `import_url` (optional) - `import_url` (optional)
- `public_builds` (optional) - `public_builds` (optional)
- `only_allow_merge_if_build_succeeds` (optional) - `only_allow_merge_if_build_succeeds` (optional)
- `enable_lfs` (optional) - `lfs_enabled` (optional)
### Edit project ### Edit project
...@@ -507,7 +507,7 @@ Parameters: ...@@ -507,7 +507,7 @@ Parameters:
- `visibility_level` (optional) - `visibility_level` (optional)
- `public_builds` (optional) - `public_builds` (optional)
- `only_allow_merge_if_build_succeeds` (optional) - `only_allow_merge_if_build_succeeds` (optional)
- `enable_lfs` (optional) - `lfs_enabled` (optional)
On success, method returns 200 with the updated project. If parameters are On success, method returns 200 with the updated project. If parameters are
invalid, 400 is returned. invalid, 400 is returned.
......
...@@ -32,12 +32,12 @@ Snippets are little bits of code or text. ...@@ -32,12 +32,12 @@ Snippets are little bits of code or text.
This is a nice place to put code or text that is used semi-regularly within the project, but does not belong in source control. This is a nice place to put code or text that is used semi-regularly within the project, but does not belong in source control.
For example, a specific config file that is used by > the team that is only valid for the people that work on the code. For example, a specific config file that is used by the team that is only valid for the people that work on the code.
## LFS ## Git LFS
>**Note:** Project specific LFS setting was added on 8.12 and is available only to admins. >**Note:** Project-specific LFS setting was added on 8.12 and is available only to admins.
Git Large File Storage allows you to easily manage large binary files with Git. Git Large File Storage allows you to easily manage large binary files with Git.
With this setting admins can keep better control of which projects are allowed With this setting admins can better control which projects are allowed to use
to use LFS, thus allowing for better storage usage control. LFS.
...@@ -78,7 +78,7 @@ module API ...@@ -78,7 +78,7 @@ module API
expose :path, :path_with_namespace expose :path, :path_with_namespace
expose :issues_enabled, :merge_requests_enabled, :wiki_enabled, :builds_enabled, :snippets_enabled, :container_registry_enabled expose :issues_enabled, :merge_requests_enabled, :wiki_enabled, :builds_enabled, :snippets_enabled, :container_registry_enabled
expose :created_at, :last_activity_at expose :created_at, :last_activity_at
expose :shared_runners_enabled, :enable_lfs expose :shared_runners_enabled, :lfs_enabled
expose :creator_id expose :creator_id
expose :namespace expose :namespace
expose :forked_from_project, using: Entities::BasicProjectDetails, if: lambda{ |project, options| project.forked? } expose :forked_from_project, using: Entities::BasicProjectDetails, if: lambda{ |project, options| project.forked? }
......
...@@ -105,7 +105,7 @@ module API ...@@ -105,7 +105,7 @@ module API
# visibility_level (optional) - 0 by default # visibility_level (optional) - 0 by default
# import_url (optional) # import_url (optional)
# public_builds (optional) # public_builds (optional)
# enable_lfs (optional) # lfs_enabled (optional)
# Example Request # Example Request
# POST /projects # POST /projects
post do post do
...@@ -126,7 +126,7 @@ module API ...@@ -126,7 +126,7 @@ module API
:import_url, :import_url,
:public_builds, :public_builds,
:only_allow_merge_if_build_succeeds, :only_allow_merge_if_build_succeeds,
:enable_lfs] :lfs_enabled]
attrs = map_public_to_visibility_level(attrs) attrs = map_public_to_visibility_level(attrs)
@project = ::Projects::CreateService.new(current_user, attrs).execute @project = ::Projects::CreateService.new(current_user, attrs).execute
if @project.saved? if @project.saved?
...@@ -158,6 +158,7 @@ module API ...@@ -158,6 +158,7 @@ module API
# visibility_level (optional) # visibility_level (optional)
# import_url (optional) # import_url (optional)
# public_builds (optional) # public_builds (optional)
# lfs_enabled (optional)
# Example Request # Example Request
# POST /projects/user/:user_id # POST /projects/user/:user_id
post "user/:user_id" do post "user/:user_id" do
...@@ -176,7 +177,8 @@ module API ...@@ -176,7 +177,8 @@ module API
:visibility_level, :visibility_level,
:import_url, :import_url,
:public_builds, :public_builds,
:only_allow_merge_if_build_succeeds] :only_allow_merge_if_build_succeeds,
:lfs_enabled]
attrs = map_public_to_visibility_level(attrs) attrs = map_public_to_visibility_level(attrs)
@project = ::Projects::CreateService.new(user, attrs).execute @project = ::Projects::CreateService.new(user, attrs).execute
if @project.saved? if @project.saved?
...@@ -222,7 +224,7 @@ module API ...@@ -222,7 +224,7 @@ module API
# public (optional) - if true same as setting visibility_level = 20 # public (optional) - if true same as setting visibility_level = 20
# visibility_level (optional) - visibility level of a project # visibility_level (optional) - visibility level of a project
# public_builds (optional) # public_builds (optional)
# enable_lfs (optional) # lfs_enabled (optional)
# Example Request # Example Request
# PUT /projects/:id # PUT /projects/:id
put ':id' do put ':id' do
...@@ -241,7 +243,7 @@ module API ...@@ -241,7 +243,7 @@ module API
:visibility_level, :visibility_level,
:public_builds, :public_builds,
:only_allow_merge_if_build_succeeds, :only_allow_merge_if_build_succeeds,
:enable_lfs] :lfs_enabled]
attrs = map_public_to_visibility_level(attrs) attrs = map_public_to_visibility_level(attrs)
authorize_admin_project authorize_admin_project
authorize! :rename_project, user_project if attrs[:name].present? authorize! :rename_project, user_project if attrs[:name].present?
......
...@@ -69,7 +69,7 @@ describe 'Git LFS API and storage' do ...@@ -69,7 +69,7 @@ describe 'Git LFS API and storage' do
describe 'LFS disabled in project' do describe 'LFS disabled in project' do
before do before do
project.update_attribute(:enable_lfs, false) project.update_attribute(:lfs_enabled, false)
end end
it 'responds with a 501 message on upload' do it 'responds with a 501 message on upload' do
...@@ -87,7 +87,7 @@ describe 'Git LFS API and storage' do ...@@ -87,7 +87,7 @@ describe 'Git LFS API and storage' do
describe 'LFS enabled in project' do describe 'LFS enabled in project' do
before do before do
project.update_attribute(:enable_lfs, true) project.update_attribute(:lfs_enabled, true)
end end
it 'responds with a 501 message on upload' do it 'responds with a 501 message on upload' do
...@@ -112,7 +112,7 @@ describe 'Git LFS API and storage' do ...@@ -112,7 +112,7 @@ describe 'Git LFS API and storage' do
describe 'LFS disabled in project' do describe 'LFS disabled in project' do
before do before do
project.update_attribute(:enable_lfs, false) project.update_attribute(:lfs_enabled, false)
end end
it 'responds with a 403 message on upload' do it 'responds with a 403 message on upload' do
...@@ -132,7 +132,7 @@ describe 'Git LFS API and storage' do ...@@ -132,7 +132,7 @@ describe 'Git LFS API and storage' do
describe 'LFS enabled in project' do describe 'LFS enabled in project' do
before do before do
project.update_attribute(:enable_lfs, true) project.update_attribute(:lfs_enabled, true)
end end
it 'responds with a 200 message on upload' do it 'responds with a 200 message on upload' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment