2020-03-13 15:44:24 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module API
|
|
|
|
module Entities
|
|
|
|
class ProjectImportStatus < ProjectIdentity
|
2023-01-13 00:05:48 +05:30
|
|
|
expose :import_status, documentation: { type: 'string', example: 'scheduled' }
|
|
|
|
expose :import_type, documentation: { type: 'string', example: 'gitlab_project' }
|
|
|
|
expose :correlation_id, documentation: {
|
|
|
|
type: 'string', example: 'dfcf583058ed4508e4c7c617bd7f0edd'
|
|
|
|
} do |project, _options|
|
2020-04-22 19:07:51 +05:30
|
|
|
project.import_state&.correlation_id
|
|
|
|
end
|
|
|
|
|
2023-01-13 00:05:48 +05:30
|
|
|
expose :failed_relations, using: Entities::ProjectImportFailedRelation, documentation: {
|
|
|
|
is_array: true
|
|
|
|
} do |project, _options|
|
2020-04-25 10:58:03 +05:30
|
|
|
project.import_state&.relation_hard_failures(limit: 100) || []
|
2020-04-22 19:07:51 +05:30
|
|
|
end
|
2020-03-13 15:44:24 +05:30
|
|
|
|
2023-01-13 00:05:48 +05:30
|
|
|
expose :import_error, documentation: { type: 'string', example: 'Error message' } do |project, _options|
|
2021-02-22 17:27:13 +05:30
|
|
|
project.import_state&.last_error
|
2020-03-13 15:44:24 +05:30
|
|
|
end
|
2022-01-26 12:08:38 +05:30
|
|
|
|
2023-01-13 00:05:48 +05:30
|
|
|
expose :stats, documentation: { type: 'object' } do |project, _options|
|
2022-01-26 12:08:38 +05:30
|
|
|
if project.github_import?
|
|
|
|
::Gitlab::GithubImport::ObjectCounter.summary(project)
|
|
|
|
end
|
|
|
|
end
|
2020-03-13 15:44:24 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|