diff options
-rw-r--r-- | app/assets/stylesheets/pages/projects.scss | 8 | ||||
-rw-r--r-- | app/controllers/projects_controller.rb | 2 | ||||
-rw-r--r-- | app/helpers/projects_helper.rb | 4 | ||||
-rw-r--r-- | app/models/project.rb | 4 | ||||
-rw-r--r-- | app/views/admin/projects/show.html.haml | 3 | ||||
-rw-r--r-- | app/views/projects/edit.html.haml | 8 | ||||
-rw-r--r-- | db/migrate/20160823213309_add_lfs_enabled_to_projects.rb (renamed from db/migrate/20160823213309_add_enable_lfs_to_projects.rb) | 4 | ||||
-rw-r--r-- | db/schema.rb | 2 | ||||
-rw-r--r-- | doc/api/projects.md | 6 | ||||
-rw-r--r-- | doc/workflow/project_features.md | 10 | ||||
-rw-r--r-- | lib/api/entities.rb | 2 | ||||
-rw-r--r-- | lib/api/projects.rb | 12 | ||||
-rw-r--r-- | spec/requests/lfs_http_spec.rb | 8 |
13 files changed, 43 insertions, 30 deletions
diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss index 83500a687bb..f2db373da52 100644 --- a/app/assets/stylesheets/pages/projects.scss +++ b/app/assets/stylesheets/pages/projects.scss @@ -311,6 +311,14 @@ a.deploy-project-label { color: $gl-success; } +.lfs-enabled { + color: $gl-success; +} + +.lfs-disabled { + color: $gl-warning; +} + .breadcrumb.repo-breadcrumb { padding: 0; background: transparent; diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 678b56b5d9b..84d6b106cd7 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -309,7 +309,7 @@ class ProjectsController < Projects::ApplicationController :issues_tracker_id, :default_branch, :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, - :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 diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index a5ae9f8668e..f07077bd133 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -189,11 +189,11 @@ module ProjectsHelper def project_lfs_status(project) if project.lfs_enabled? - content_tag(:span, class: 'vs-private') do + content_tag(:span, class: 'lfs-enabled') do 'Enabled' end else - content_tag(:span, class: 'vs-internal') do + content_tag(:span, class: 'lfs-disabled') do 'Disabled' end end diff --git a/app/models/project.rb b/app/models/project.rb index 7a5933bfe5e..e5027af4a0e 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -392,9 +392,9 @@ class Project < ActiveRecord::Base def 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 def repository_storage_path diff --git a/app/views/admin/projects/show.html.haml b/app/views/admin/projects/show.html.haml index f65322cc12f..6c7c3c48604 100644 --- a/app/views/admin/projects/show.html.haml +++ b/app/views/admin/projects/show.html.haml @@ -75,9 +75,10 @@ = last_commit(@project) %li - %span.light LFS status: + %span.light Git LFS status: %strong = project_lfs_status(@project) + = link_to icon('question-circle'), help_page_path('workflow/lfs/manage_large_binaries_with_git_lfs') - else %li %span.light repository: diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index 0c5ce193240..836c6d7b83f 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -83,11 +83,13 @@ - if Gitlab.config.lfs.enabled && current_user.admin? .form-group .checkbox - = f.label :enable_lfs do - = f.check_box :enable_lfs, checked: @project.lfs_enabled? + = f.label :lfs_enabled do + = f.check_box :lfs_enabled, checked: @project.lfs_enabled? %strong LFS %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 .form-group .checkbox diff --git a/db/migrate/20160823213309_add_enable_lfs_to_projects.rb b/db/migrate/20160823213309_add_lfs_enabled_to_projects.rb index 9df1a5078fa..c169084e976 100644 --- a/db/migrate/20160823213309_add_enable_lfs_to_projects.rb +++ b/db/migrate/20160823213309_add_lfs_enabled_to_projects.rb @@ -1,7 +1,7 @@ # See http://doc.gitlab.com/ce/development/migration_style_guide.html # for more information on how to write migrations for GitLab. -class AddEnableLfsToProjects < ActiveRecord::Migration +class AddLfsEnabledToProjects < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers # Set this constant to true if this migration requires downtime. @@ -24,6 +24,6 @@ class AddEnableLfsToProjects < ActiveRecord::Migration # disable_ddl_transaction! def change - add_column :projects, :enable_lfs, :boolean + add_column :projects, :lfs_enabled, :boolean end end diff --git a/db/schema.rb b/db/schema.rb index 28711294746..bacc134a98d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -825,7 +825,7 @@ ActiveRecord::Schema.define(version: 20160824103857) do t.string "repository_storage", default: "default", null: false t.boolean "request_access_enabled", default: true, null: false t.boolean "has_external_wiki" - t.boolean "enable_lfs" + t.boolean "lfs_enabled" end add_index "projects", ["ci_id"], name: "index_projects_on_ci_id", using: :btree diff --git a/doc/api/projects.md b/doc/api/projects.md index 671b4ba7a7a..0d5aa61aa74 100644 --- a/doc/api/projects.md +++ b/doc/api/projects.md @@ -452,7 +452,7 @@ Parameters: - `import_url` (optional) - `public_builds` (optional) - `only_allow_merge_if_build_succeeds` (optional) -- `enable_lfs` (optional) +- `lfs_enabled` (optional) ### Create project for user @@ -479,7 +479,7 @@ Parameters: - `import_url` (optional) - `public_builds` (optional) - `only_allow_merge_if_build_succeeds` (optional) -- `enable_lfs` (optional) +- `lfs_enabled` (optional) ### Edit project @@ -507,7 +507,7 @@ Parameters: - `visibility_level` (optional) - `public_builds` (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 invalid, 400 is returned. diff --git a/doc/workflow/project_features.md b/doc/workflow/project_features.md index 6790c06f325..f19e7df8c9a 100644 --- a/doc/workflow/project_features.md +++ b/doc/workflow/project_features.md @@ -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. -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. -With this setting admins can keep better control of which projects are allowed -to use LFS, thus allowing for better storage usage control. +With this setting admins can better control which projects are allowed to use +LFS. diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 61fcccf2959..4335e3055ef 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -78,7 +78,7 @@ module API expose :path, :path_with_namespace expose :issues_enabled, :merge_requests_enabled, :wiki_enabled, :builds_enabled, :snippets_enabled, :container_registry_enabled expose :created_at, :last_activity_at - expose :shared_runners_enabled, :enable_lfs + expose :shared_runners_enabled, :lfs_enabled expose :creator_id expose :namespace expose :forked_from_project, using: Entities::BasicProjectDetails, if: lambda{ |project, options| project.forked? } diff --git a/lib/api/projects.rb b/lib/api/projects.rb index d98fb2611ff..f8979a1cc29 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -105,7 +105,7 @@ module API # visibility_level (optional) - 0 by default # import_url (optional) # public_builds (optional) - # enable_lfs (optional) + # lfs_enabled (optional) # Example Request # POST /projects post do @@ -126,7 +126,7 @@ module API :import_url, :public_builds, :only_allow_merge_if_build_succeeds, - :enable_lfs] + :lfs_enabled] attrs = map_public_to_visibility_level(attrs) @project = ::Projects::CreateService.new(current_user, attrs).execute if @project.saved? @@ -158,6 +158,7 @@ module API # visibility_level (optional) # import_url (optional) # public_builds (optional) + # lfs_enabled (optional) # Example Request # POST /projects/user/:user_id post "user/:user_id" do @@ -176,7 +177,8 @@ module API :visibility_level, :import_url, :public_builds, - :only_allow_merge_if_build_succeeds] + :only_allow_merge_if_build_succeeds, + :lfs_enabled] attrs = map_public_to_visibility_level(attrs) @project = ::Projects::CreateService.new(user, attrs).execute if @project.saved? @@ -222,7 +224,7 @@ module API # public (optional) - if true same as setting visibility_level = 20 # visibility_level (optional) - visibility level of a project # public_builds (optional) - # enable_lfs (optional) + # lfs_enabled (optional) # Example Request # PUT /projects/:id put ':id' do @@ -241,7 +243,7 @@ module API :visibility_level, :public_builds, :only_allow_merge_if_build_succeeds, - :enable_lfs] + :lfs_enabled] attrs = map_public_to_visibility_level(attrs) authorize_admin_project authorize! :rename_project, user_project if attrs[:name].present? diff --git a/spec/requests/lfs_http_spec.rb b/spec/requests/lfs_http_spec.rb index 2d39f3808d5..fcd6521317a 100644 --- a/spec/requests/lfs_http_spec.rb +++ b/spec/requests/lfs_http_spec.rb @@ -69,7 +69,7 @@ describe 'Git LFS API and storage' do describe 'LFS disabled in project' do before do - project.update_attribute(:enable_lfs, false) + project.update_attribute(:lfs_enabled, false) end it 'responds with a 501 message on upload' do @@ -87,7 +87,7 @@ describe 'Git LFS API and storage' do describe 'LFS enabled in project' do before do - project.update_attribute(:enable_lfs, true) + project.update_attribute(:lfs_enabled, true) end it 'responds with a 501 message on upload' do @@ -112,7 +112,7 @@ describe 'Git LFS API and storage' do describe 'LFS disabled in project' do before do - project.update_attribute(:enable_lfs, false) + project.update_attribute(:lfs_enabled, false) end it 'responds with a 403 message on upload' do @@ -132,7 +132,7 @@ describe 'Git LFS API and storage' do describe 'LFS enabled in project' do before do - project.update_attribute(:enable_lfs, true) + project.update_attribute(:lfs_enabled, true) end it 'responds with a 200 message on upload' do |