Move 'clear checks' button to applicatoin settings

This commit is contained in:
Jacob Vosmaer 2016-04-12 17:32:58 +02:00
parent 97f4ffff1e
commit ea787165b3
6 changed files with 32 additions and 43 deletions

View file

@ -19,6 +19,19 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
redirect_to admin_runners_path
end
def clear_repository_check_states
Project.update_all(
last_repository_check_failed: false,
last_repository_check_at: nil
)
redirect_to(
admin_application_settings_path,
notice: 'All repository check states were cleared'
)
end
private
def set_application_setting
@ -82,6 +95,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
:akismet_enabled,
:akismet_api_key,
:email_author_in_body,
:repository_checks_enabled,
restricted_visibility_levels: [],
import_sources: []
)

View file

@ -40,18 +40,6 @@ class Admin::ProjectsController < Admin::ApplicationController
)
end
def clear_repository_check_states
Project.update_all(
last_repository_check_failed: false,
last_repository_check_at: nil
)
redirect_to(
admin_namespaces_projects_path,
notice: 'All project states were cleared'
)
end
protected
def project

View file

@ -287,6 +287,12 @@
GitLab will periodically run
%a{ href: 'https://www.kernel.org/pub/software/scm/git/docs/git-fsck.html', target: 'blank' } 'git fsck'
in all project and wiki repositories to look for silent disk corruption issues.
.form-group
.col-sm-offset-2.col-sm-10
= link_to 'Clear all repository checks', clear_repository_check_states_admin_application_settings_path, data: { confirm: 'This will clear repository check states for ALL projects in the database. This cannot be undone. Are you sure?' }, method: :put, class: "btn btn-sm btn-remove"
.help-block
If you got a lot of false alarms from repository checks (maybe your fileserver was temporarily unavailable) you can choose to clear all repository check information from the database.
.form-actions
= f.submit 'Save', class: 'btn btn-save'

View file

@ -49,11 +49,6 @@
= button_tag "Search", class: "btn submit btn-primary"
= link_to "Reset", admin_namespaces_projects_path, class: "btn btn-cancel"
.panel.panel-default.repository-check-states
.panel-heading
Repository check states
.panel-body
= link_to 'Clear all', clear_repository_check_states_admin_namespace_projects_path(0), data: { confirm: 'This will clear repository check states for ALL projects in the database. This cannot be undone. Are you sure?' }, method: :put, class: "btn btn-sm btn-remove"
%section.col-md-9
.panel.panel-default
.panel-heading

View file

@ -267,10 +267,6 @@ Rails.application.routes.draw do
post :repository_check
end
collection do
put :clear_repository_check_states
end
resources :runner_projects
end
end
@ -286,6 +282,7 @@ Rails.application.routes.draw do
resource :application_settings, only: [:show, :update] do
resources :services
put :reset_runners_token
put :clear_repository_check_states
end
resources :labels

View file

@ -4,12 +4,13 @@ _**Note:** This feature was [introduced][ce-3232] in GitLab 8.7_
---
Git has a built-in mechanism [git fsck][git-fsck] to verify the
integrity of all data commited to a repository. GitLab administrators can
trigger such a check for a project via the admin panel. The checks run
asynchronously so it may take a few minutes before the check result is
visible on the project admin page. If the checks failed you can see their
output on the admin log page under 'repocheck.log'.
Git has a built-in mechanism \[git fsck\]\[git-fsck\] to verify the
integrity of all data commited to a repository. GitLab administrators
can trigger such a check for a project via the project page under the
admin panel. The checks run asynchronously so it may take a few minutes
before the check result is visible on the project admin page. If the
checks failed you can see their output on the admin log page under
'repocheck.log'.
## Periodical checks
@ -22,20 +23,8 @@ than once a day.
## Disabling periodic checks
You can disable the periodic checks by giving them an empty cron
schedule in gitlab.yml.
```
# For omnibus installations, in /etc/gitlab/gitlab.rb:
gitlab_rails['cron_jobs_repository_check_worker_cron'] = ''
```
```
# For installations from source, in config/gitlab.yml:
cron_jobs:
repository_check_worker:
cron: ""
```
You can disable the periodic checks on the 'Settings' page of the admin
panel.
## What to do if a check failed
@ -47,8 +36,8 @@ resolved the issue use the admin panel to trigger a new repository check on
the project. This will clear the 'check failed' state.
If for some reason the periodical repository check caused a lot of false
alarms you can choose to clear ALL repository check states from the admin
project index page.
alarms you can choose to clear ALL repository check states from the
'Settings' page of the admin panel.
---
[ce-3232]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3232 "Auto git fsck"