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 {
color: $gl-success;
}
.lfs-enabled {
color: $gl-success;
}
.lfs-disabled {
color: $gl-warning;
}
.breadcrumb.repo-breadcrumb {
padding: 0;
background: transparent;
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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:
......
......@@ -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
......
# 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
......@@ -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
......
......@@ -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.
......
......@@ -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.
......@@ -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? }
......
......@@ -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?
......
......@@ -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
......
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