Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
0c8e4aca
Commit
0c8e4aca
authored
Mar 09, 2020
by
Rajendra Kadam
Committed by
Mayra Cabrera
Mar 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate geo_node and license entities into own class files
parent
89cc37a4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
113 additions
and
80 deletions
+113
-80
ee/changelogs/unreleased/refactoring-ee-entities-7.yml
ee/changelogs/unreleased/refactoring-ee-entities-7.yml
+5
-0
ee/lib/ee/api/entities.rb
ee/lib/ee/api/entities.rb
+0
-80
ee/lib/ee/api/entities/geo_node.rb
ee/lib/ee/api/entities/geo_node.rb
+55
-0
ee/lib/ee/api/entities/gitlab_license.rb
ee/lib/ee/api/entities/gitlab_license.rb
+29
-0
ee/lib/ee/api/entities/gitlab_license_with_active_users.rb
ee/lib/ee/api/entities/gitlab_license_with_active_users.rb
+13
-0
ee/lib/ee/api/entities/ldap_group.rb
ee/lib/ee/api/entities/ldap_group.rb
+11
-0
No files found.
ee/changelogs/unreleased/refactoring-ee-entities-7.yml
0 → 100644
View file @
0c8e4aca
---
title
:
Separate geo_node and license entities into own class file
merge_request
:
26685
author
:
Rajendra Kadam
type
:
added
ee/lib/ee/api/entities.rb
View file @
0c8e4aca
...
...
@@ -412,86 +412,6 @@ module EE
end
end
class
LdapGroup
<
Grape
::
Entity
expose
:cn
end
class
GitlabLicense
<
Grape
::
Entity
expose
:id
,
:plan
,
:created_at
,
:starts_at
,
:expires_at
,
:historical_max
,
:maximum_user_count
,
:licensee
,
:add_ons
expose
:expired?
,
as: :expired
expose
:overage
do
|
license
,
options
|
license
.
expired?
?
license
.
overage_with_historical_max
:
license
.
overage
(
options
[
:current_active_users_count
])
end
expose
:user_limit
do
|
license
,
options
|
license
.
restricted?
(
:active_user_count
)
?
license
.
restrictions
[
:active_user_count
]
:
0
end
end
class
GitlabLicenseWithActiveUsers
<
GitlabLicense
expose
:active_users
do
|
license
,
options
|
::
User
.
active
.
count
end
end
class
GeoNode
<
Grape
::
Entity
include
::
API
::
Helpers
::
RelatedResourcesHelpers
expose
:id
expose
:name
expose
:url
expose
:internal_url
expose
:primary?
,
as: :primary
expose
:enabled
expose
:current?
,
as: :current
expose
:files_max_capacity
expose
:repos_max_capacity
expose
:verification_max_capacity
expose
:container_repositories_max_capacity
expose
:selective_sync_type
expose
:selective_sync_shards
expose
:namespace_ids
,
as: :selective_sync_namespace_ids
expose
:minimum_reverification_interval
expose
:sync_object_storage
,
if:
->
(
geo_node
,
_
)
{
geo_node
.
secondary?
}
# Retained for backwards compatibility. Remove in API v5
expose
:clone_protocol
do
|
_record
,
_options
|
'http'
end
expose
:web_edit_url
do
|
geo_node
|
::
Gitlab
::
Routing
.
url_helpers
.
edit_admin_geo_node_url
(
geo_node
)
end
expose
:web_geo_projects_url
,
if:
->
(
geo_node
,
_
)
{
geo_node
.
secondary?
}
do
|
geo_node
|
geo_node
.
geo_projects_url
end
expose
:_links
do
expose
:self
do
|
geo_node
|
expose_url
api_v4_geo_nodes_path
(
id:
geo_node
.
id
)
end
expose
:status
do
|
geo_node
|
expose_url
api_v4_geo_nodes_status_path
(
id:
geo_node
.
id
)
end
expose
:repair
do
|
geo_node
|
expose_url
api_v4_geo_nodes_repair_path
(
id:
geo_node
.
id
)
end
end
end
module
ConanPackage
class
ConanPackageManifest
<
Grape
::
Entity
expose
:package_urls
,
merge:
true
...
...
ee/lib/ee/api/entities/geo_node.rb
0 → 100644
View file @
0c8e4aca
# frozen_string_literal: true
module
EE
module
API
module
Entities
class
GeoNode
<
Grape
::
Entity
include
::
API
::
Helpers
::
RelatedResourcesHelpers
expose
:id
expose
:name
expose
:url
expose
:internal_url
expose
:primary?
,
as: :primary
expose
:enabled
expose
:current?
,
as: :current
expose
:files_max_capacity
expose
:repos_max_capacity
expose
:verification_max_capacity
expose
:container_repositories_max_capacity
expose
:selective_sync_type
expose
:selective_sync_shards
expose
:namespace_ids
,
as: :selective_sync_namespace_ids
expose
:minimum_reverification_interval
expose
:sync_object_storage
,
if:
->
(
geo_node
,
_
)
{
geo_node
.
secondary?
}
# Retained for backwards compatibility. Remove in API v5
expose
:clone_protocol
do
|
_record
,
_options
|
'http'
end
expose
:web_edit_url
do
|
geo_node
|
::
Gitlab
::
Routing
.
url_helpers
.
edit_admin_geo_node_url
(
geo_node
)
end
expose
:web_geo_projects_url
,
if:
->
(
geo_node
,
_
)
{
geo_node
.
secondary?
}
do
|
geo_node
|
geo_node
.
geo_projects_url
end
expose
:_links
do
expose
:self
do
|
geo_node
|
expose_url
api_v4_geo_nodes_path
(
id:
geo_node
.
id
)
end
expose
:status
do
|
geo_node
|
expose_url
api_v4_geo_nodes_status_path
(
id:
geo_node
.
id
)
end
expose
:repair
do
|
geo_node
|
expose_url
api_v4_geo_nodes_repair_path
(
id:
geo_node
.
id
)
end
end
end
end
end
end
ee/lib/ee/api/entities/gitlab_license.rb
0 → 100644
View file @
0c8e4aca
# frozen_string_literal: true
module
EE
module
API
module
Entities
class
GitlabLicense
<
Grape
::
Entity
expose
:id
,
:plan
,
:created_at
,
:starts_at
,
:expires_at
,
:historical_max
,
:maximum_user_count
,
:licensee
,
:add_ons
expose
:expired?
,
as: :expired
expose
:overage
do
|
license
,
options
|
license
.
expired?
?
license
.
overage_with_historical_max
:
license
.
overage
(
options
[
:current_active_users_count
])
end
expose
:user_limit
do
|
license
,
options
|
license
.
restricted?
(
:active_user_count
)
?
license
.
restrictions
[
:active_user_count
]
:
0
end
end
end
end
end
ee/lib/ee/api/entities/gitlab_license_with_active_users.rb
0 → 100644
View file @
0c8e4aca
# frozen_string_literal: true
module
EE
module
API
module
Entities
class
GitlabLicenseWithActiveUsers
<
GitlabLicense
expose
:active_users
do
|
license
,
options
|
::
User
.
active
.
count
end
end
end
end
end
ee/lib/ee/api/entities/ldap_group.rb
0 → 100644
View file @
0c8e4aca
# frozen_string_literal: true
module
EE
module
API
module
Entities
class
LdapGroup
<
Grape
::
Entity
expose
:cn
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment