diff options
| author | cedricnjanga | 2018-02-06 21:52:02 -0800 |
|---|---|---|
| committer | Zog | 2018-02-13 08:53:59 +0100 |
| commit | 7e7371087b61aaf8a128d5f5f5ec6c43c06fd4ca (patch) | |
| tree | 0cff9685542528291192f748348f3ab6eb8e3d39 /app/controllers/statuses_controller.rb | |
| parent | 54414ddb8970ee6133817777290153a713834285 (diff) | |
| download | chouette-core-7e7371087b61aaf8a128d5f5f5ec6c43c06fd4ca.tar.bz2 | |
Refs #5707 Add status to the application to track 'blocked objects'
Diffstat (limited to 'app/controllers/statuses_controller.rb')
| -rw-r--r-- | app/controllers/statuses_controller.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/app/controllers/statuses_controller.rb b/app/controllers/statuses_controller.rb new file mode 100644 index 000000000..81e668ad4 --- /dev/null +++ b/app/controllers/statuses_controller.rb @@ -0,0 +1,21 @@ +class StatusesController < ChouetteController + respond_to :json + + def index + + status = { + status: global_status, + referentials_blocked: Referential.blocked.count, + imports_blocked: Import.blocked.count, + compliance_check_sets_blocked: ComplianceCheckSet.blocked.count + } + render json: status.to_json + end + + private + + def global_status + blocked_items = Referential.blocked.count + Import.blocked.count + ComplianceCheckSet.blocked.count + blocked_items > 0 ? 'ko' : 'ok' + end +end
\ No newline at end of file |
