Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/serializers/import/github_realtime_repo_entity.rb')
-rw-r--r--app/serializers/import/github_realtime_repo_entity.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/serializers/import/github_realtime_repo_entity.rb b/app/serializers/import/github_realtime_repo_entity.rb
new file mode 100644
index 00000000000..c26ae5f668d
--- /dev/null
+++ b/app/serializers/import/github_realtime_repo_entity.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+module Import
+ class GithubRealtimeRepoEntity < Grape::Entity
+ expose :id, documentation: { type: 'integer', example: 1 }
+ expose :import_status, documentation: { type: 'string', example: 'importing' }
+ expose :stats,
+ documentation: {
+ type: 'object', example: '{"fetched":{"label":10},"imported":{"label":10}}'
+ } do |project|
+ ::Gitlab::GithubImport::ObjectCounter.summary(project)
+ end
+
+ expose :import_error, if: ->(project) { project.import_state&.failed? } do |project|
+ project.import_failures.last&.exception_message
+ end
+ end
+end