-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # config/application.rb
- Loading branch information
Showing
25 changed files
with
577 additions
and
383 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
# Deletes old export jobs on a cron-like schedule | ||
class DeleteOldExportJobsCronJob < CronJob | ||
# Run every day at 4am | ||
self.cron_expression = '0 4 * * *' | ||
|
||
def perform | ||
DeleteOldExportsJob.perform_now | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
# Deletes Export Jobs that are over 30 days old | ||
class DeleteOldExportsJob < ApplicationJob | ||
queue_as :default | ||
|
||
def perform # rubocop:disable Metrics/MethodLength, Metrics/AbcSize | ||
Rails.logger.info 'Running DeleteOldExportsJob' | ||
export_jobs = ExportJob.where('created_at > ? ', 30.days.ago) | ||
|
||
if export_jobs.any? | ||
export_jobs.each do |job| | ||
Rails.logger.info("Deleting export job: #{job.name}") | ||
File.delete(job.path) if File.exist? job.path | ||
job.destroy | ||
end | ||
else | ||
Rails.logger.info('No export jobs to delete') | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<h1> Export Job: <%= @job.name %> </h1> | ||
|
||
<h3> Job Info </h2> | ||
<hr> | ||
|
||
<p> Job ID: <%= @job.id %> </p> | ||
<p> Status: <%= @job.status_text %> </p> | ||
<p> # of Records: <%= @job.item_count %> </p> | ||
<p> # of Binaries: <%= @job.binaries_count == nil ? "n/a" : @job.binaries_count %> </p> | ||
<p> Size of Binaries: <%= @job.binaries_size == nil ? "n/a" : number_to_human_size(@job.binaries_size) %> </p> | ||
<p> User: <%= @cas_user.name %> | ||
|
||
<hr> | ||
|
||
<%= link_to "Back", export_jobs_path, class: "btn btn-danger"%> | ||
<%= button_to "Delete Job", export_job_url(@job), method: :delete, class:"btn btn-danger", data: { confirm: 'Delete job?' } %> | ||
|
||
<style> | ||
.button_to { | ||
display: inline; | ||
} | ||
|
||
.button_to div { | ||
display: inline; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.