• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / tigerdata-app / 22e75f83-d84d-4c7e-8073-7c4ca3cf2353

07 Nov 2025 03:24PM UTC coverage: 91.075% (-0.1%) from 91.201%
22e75f83-d84d-4c7e-8073-7c4ca3cf2353

push

circleci

web-flow
Java plugin proof of concept (#2160)

Ref #2100

0 of 19 new or added lines in 1 file covered. (0.0%)

647 existing lines in 33 files now uncovered.

2847 of 3126 relevant lines covered (91.07%)

540.6 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.25
/app/controllers/projects_controller.rb
1
# frozen_string_literal: true
UNCOV
2
class ProjectsController < ApplicationController
2✔
3

UNCOV
4
  before_action :set_breadcrumbs
2✔
UNCOV
5
  before_action :authenticate_user!
2✔
6

UNCOV
7
  def details
2✔
UNCOV
8
    return if project.blank?
16✔
9

UNCOV
10
    add_breadcrumb(@presenter.title, project_path)
14✔
UNCOV
11
    add_breadcrumb("Details")
14✔
12

UNCOV
13
    @provenance_events = project.provenance_events.where.not(event_type: ProvenanceEvent::STATUS_UPDATE_EVENT_TYPE)
14✔
14

UNCOV
15
    @project_eligible_to_edit = true if project.status == Project::APPROVED_STATUS && eligible_editor?
14✔
16

UNCOV
17
    @project_metadata = @project.metadata
14✔
UNCOV
18
    @storage_capacity = @project_metadata[:storage_capacity]
14✔
UNCOV
19
    @size = @storage_capacity[:size]
14✔
UNCOV
20
    @unit = @storage_capacity[:unit]
14✔
21

UNCOV
22
    @requested_size = @size[:requested]
14✔
UNCOV
23
    @requested_unit = @unit[:requested]
14✔
24

UNCOV
25
    @approved_size = @size[:approved]
14✔
UNCOV
26
    @approved_unit = @unit[:approved]
14✔
27

UNCOV
28
    @storage_expectations = @project_metadata[:storage_performance_expectations]
14✔
UNCOV
29
    @requested_storage_expectations = @storage_expectations[:requested]
14✔
UNCOV
30
    @approved_storage_expectations = @storage_expectations[:approved]
14✔
31

UNCOV
32
    @project_session = "details"
14✔
33

UNCOV
34
    respond_to do |format|
14✔
UNCOV
35
      format.html do
14✔
UNCOV
36
        render
11✔
UNCOV
37
      end
UNCOV
38
      format.json do
14✔
UNCOV
39
        render json: project.to_json
2✔
UNCOV
40
      end
UNCOV
41
      format.xml do
14✔
UNCOV
42
        render xml: @presenter.to_xml
1✔
UNCOV
43
      end
UNCOV
44
    end
UNCOV
45
  end
46

UNCOV
47
  def index
2✔
UNCOV
48
    if current_user.eligible_sysadmin?
10✔
UNCOV
49
      search_projects
6✔
UNCOV
50
    else
UNCOV
51
      flash[:alert] = I18n.t(:access_denied)
4✔
UNCOV
52
      redirect_to dashboard_path
4✔
UNCOV
53
    end
UNCOV
54
  end
55

UNCOV
56
  def show
2✔
UNCOV
57
    return if project.blank?
38✔
58

UNCOV
59
    add_breadcrumb(@presenter.title, project_path)
28✔
UNCOV
60
    add_breadcrumb("Contents")
28✔
61

UNCOV
62
    @latest_completed_download = current_user.user_requests.where(project_id: @project.id, state: "completed").order(:completion_time).last
28✔
UNCOV
63
    @storage_usage = project.storage_usage(session_id: current_user.mediaflux_session)
28✔
UNCOV
64
    @storage_capacity = project.storage_capacity(session_id: current_user.mediaflux_session)
28✔
65

UNCOV
66
    @num_files = project.asset_count(session_id: current_user.mediaflux_session)
28✔
67

UNCOV
68
    @file_list = project.file_list(session_id: current_user.mediaflux_session, size: 100)
28✔
UNCOV
69
    @files = @file_list[:files]
28✔
UNCOV
70
    @files.sort_by!(&:path)
28✔
71

UNCOV
72
    @project_session = "content"
28✔
UNCOV
73
    respond_to do |format|
28✔
UNCOV
74
      format.html { render }
51✔
UNCOV
75
      format.xml { render xml: ProjectShowPresenter.new(project, current_user).to_xml
33✔
UNCOV
76
    }
UNCOV
77
    end
UNCOV
78
  end
79

80
  # GET "projects/:id/:id-mf"
81
  #
82
  # This action is used to render the mediaflux metadata for a project.
UNCOV
83
  def show_mediaflux
2✔
UNCOV
84
    project_id = params[:id]
4✔
UNCOV
85
    project = Project.find(project_id)
4✔
UNCOV
86
    respond_to do |format|
3✔
UNCOV
87
      format.xml do
3✔
UNCOV
88
        render xml: project.mediaflux_meta_xml(user: current_user)
3✔
UNCOV
89
      end
UNCOV
90
    end
UNCOV
91
  rescue => ex
92
    Rails.logger.error "Error getting MediaFlux XML for project #{project_id}, user #{current_user.uid}: #{ex.message}"
1✔
93
    flash[:alert] = "Error fetching Mediaflux XML for this project"
1✔
94
    redirect_to project_path(project_id)
1✔
UNCOV
95
  end
96

UNCOV
97
  def list_contents
2✔
UNCOV
98
    return if project.blank?
4✔
99

UNCOV
100
    project_job_service.list_contents_job(user: current_user)
3✔
101

UNCOV
102
    json_response = {
UNCOV
103
      message: "File list for \"#{project.title}\" is being generated in the background. A link to the downloadable file list will be available in the \"Recent Activity\" section of your dashboard when it is available. You may safely navigate away from this page or close this tab."
3✔
UNCOV
104
    }
UNCOV
105
    render json: json_response
3✔
UNCOV
106
  rescue => ex
107
    message = "Error producing document list (project id: #{project&.id}): #{ex.message}"
×
108
    Rails.logger.error(message)
×
109
    Honeybadger.notify(message)
×
110
    render json: { message: "Document list could not be generated." }
×
UNCOV
111
  end
112

UNCOV
113
  def file_list_download
2✔
114
    job_id = params[:job_id]
×
115
    user_request = FileInventoryRequest.where(job_id:job_id).first
×
116
    if user_request.nil?
×
117
      # TODO: handle error
118
      redirect_to "/"
×
UNCOV
119
    else
120
      filename = user_request.output_file
×
121
      send_data File.read(filename), type: "text/plain", filename: "filelist.csv", disposition: "attachment"
×
UNCOV
122
    end
UNCOV
123
  end
124

UNCOV
125
  private
2✔
126

UNCOV
127
    def project_job_service
2✔
UNCOV
128
      @project_job_service ||= ProjectJobService.new(project:)
3✔
UNCOV
129
    end
130

131

UNCOV
132
    def build_new_project
2✔
133
      @project ||= Project.new
×
UNCOV
134
    end
135

UNCOV
136
    def project
2✔
UNCOV
137
      @project ||= begin
211✔
UNCOV
138
        project = Project.find(params[:id])
58✔
UNCOV
139
        @presenter = ProjectShowPresenter.new(project, current_user)
58✔
UNCOV
140
        if project&.mediaflux_id != nil && @presenter.user_has_access?(user: current_user)
54✔
UNCOV
141
          project
45✔
UNCOV
142
        else
UNCOV
143
          flash[:alert] = I18n.t(:access_denied)
9✔
UNCOV
144
          redirect_to dashboard_path
9✔
UNCOV
145
          nil
9✔
UNCOV
146
        end
UNCOV
147
      end
UNCOV
148
    end
149

UNCOV
150
    def eligible_editor?
2✔
151
      return true if current_user.eligible_sponsor? or current_user.eligible_manager?
3✔
UNCOV
152
    end
153

UNCOV
154
    def set_breadcrumbs
2✔
UNCOV
155
      add_breadcrumb("Dashboard",dashboard_path)
78✔
UNCOV
156
    end
157

UNCOV
158
    def search_projects
2✔
UNCOV
159
      @title_query = params[:title_query]
6✔
UNCOV
160
      if @title_query.blank?
6✔
UNCOV
161
        @projects = Project.all
2✔
UNCOV
162
        flash[:notice] = nil
2✔
UNCOV
163
      else
UNCOV
164
        result =  ProjectSearch.new.call(search_string: @title_query, requestor: current_user)
4✔
UNCOV
165
        if result.success?
4✔
UNCOV
166
          flash[:notice] = "Successful search in Mediaflux for #{@title_query}"
4✔
UNCOV
167
          @projects = result.value!
4✔
UNCOV
168
        else
169
          @projects = []
×
170
          flash[:notice] = "Error searching projects for #{@title_query}.  Error: #{result.failure}"
×
UNCOV
171
        end
UNCOV
172
      end
UNCOV
173
    end
UNCOV
174
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc