uffizzi_core 2.2.17 → 2.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/concerns/uffizzi_core/dependency_injection_concern.rb +6 -6
- data/app/controllers/uffizzi_core/api/cli/v1/accounts/clusters_controller.rb +41 -0
- data/app/policies/uffizzi_core/api/cli/v1/accounts/clusters_policy.rb +7 -0
- data/app/repositories/uffizzi_core/cluster_repo.rb +1 -0
- data/app/serializers/uffizzi_core/api/cli/v1/accounts/cluster_serializer/project_serializer.rb +7 -0
- data/app/serializers/uffizzi_core/api/cli/v1/accounts/cluster_serializer.rb +9 -0
- data/config/routes.rb +1 -0
- data/lib/uffizzi_core/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac821f837d64d420f64d0820763c1936a5729e58949aec8b7806f5ed6aa30805
|
4
|
+
data.tar.gz: 7b47949da56f4d7416d17ec4e628d0104cbdbd210db37c7a4d25802e96a2614e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ceeec356d175119ca83f7da7642ab5607788fefd180a97d0dbbbcc40466e7668de0a70b9982053809b5c701499993648bf13c29a078ce1278e950d6e0931442d
|
7
|
+
data.tar.gz: 4c924c77d4201c61548797f2273b5325caec1bdddb9e89eb5f5bc9cafbcdc3173387e38cb825113a5cc1708f30e9f51ac82343f36d987167f502992968b98589
|
@@ -27,6 +27,12 @@ module UffizziCore::DependencyInjectionConcern
|
|
27
27
|
module_class(:volume_parser)
|
28
28
|
end
|
29
29
|
|
30
|
+
def ci_module
|
31
|
+
return unless module_exists?(:ci_module)
|
32
|
+
|
33
|
+
module_class(:ci_module)
|
34
|
+
end
|
35
|
+
|
30
36
|
def ci_session
|
31
37
|
return unless module_exists?(:ci_session)
|
32
38
|
|
@@ -73,12 +79,6 @@ module UffizziCore::DependencyInjectionConcern
|
|
73
79
|
module_class(:controller_settings)
|
74
80
|
end
|
75
81
|
|
76
|
-
def ci_module
|
77
|
-
return unless module_exists?(:ci_module)
|
78
|
-
|
79
|
-
module_class(:ci_module)
|
80
|
-
end
|
81
|
-
|
82
82
|
private
|
83
83
|
|
84
84
|
def module_exists?(module_name)
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class UffizziCore::Api::Cli::V1::Accounts::ClustersController < UffizziCore::Api::Cli::V1::Accounts::ApplicationController
|
4
|
+
include UffizziCore::DependencyInjectionConcern
|
5
|
+
before_action :authorize_uffizzi_core_api_cli_v1_accounts_clusters
|
6
|
+
|
7
|
+
def index
|
8
|
+
return respond_with(clusters_by_account.includes(:project)) if valid_request_from_ci_workflow?
|
9
|
+
|
10
|
+
clusters = clusters_by_user.or(clusters_by_admin_projects)
|
11
|
+
respond_with(clusters.includes(:project))
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def valid_request_from_ci_workflow?
|
17
|
+
ci_module.valid_request_from_ci_workflow?(params)
|
18
|
+
end
|
19
|
+
|
20
|
+
def clusters_by_admin_projects
|
21
|
+
projects = UffizziCore::Project
|
22
|
+
.active
|
23
|
+
.joins(:user_projects)
|
24
|
+
.where(account: resource_account)
|
25
|
+
.where(user_projects: { role: UffizziCore::UserProject.role.admin, user: current_user })
|
26
|
+
|
27
|
+
UffizziCore::Cluster.enabled.where(project_id: projects.select(:id))
|
28
|
+
end
|
29
|
+
|
30
|
+
def clusters_by_user
|
31
|
+
UffizziCore::Cluster.enabled.by_projects(account_projects).deployed_by_user(current_user)
|
32
|
+
end
|
33
|
+
|
34
|
+
def clusters_by_account
|
35
|
+
UffizziCore::Cluster.enabled.by_projects(account_projects)
|
36
|
+
end
|
37
|
+
|
38
|
+
def account_projects
|
39
|
+
UffizziCore::Project.active.where(account: resource_account)
|
40
|
+
end
|
41
|
+
end
|
@@ -7,5 +7,6 @@ module UffizziCore::ClusterRepo
|
|
7
7
|
scope :deployed, -> { where(state: UffizziCore::Cluster::STATE_DEPLOYED) }
|
8
8
|
scope :enabled, -> { where.not(state: UffizziCore::Cluster::STATE_DISABLED) }
|
9
9
|
scope :deployed_by_user, ->(user) { where(deployed_by: user) }
|
10
|
+
scope :by_projects, ->(projects) { where(project_id: projects.select(:id)) }
|
10
11
|
end
|
11
12
|
end
|
data/config/routes.rb
CHANGED
@@ -47,6 +47,7 @@ UffizziCore::Engine.routes.draw do
|
|
47
47
|
resources :accounts, only: ['index'] do
|
48
48
|
scope module: :accounts do
|
49
49
|
resources :projects, only: ['index', 'create']
|
50
|
+
resources :clusters, only: ['index']
|
50
51
|
resources :credentials, only: ['index', 'create', 'update', 'destroy'], param: :type do
|
51
52
|
member do
|
52
53
|
get :check_credential
|
data/lib/uffizzi_core/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uffizzi_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Thurman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-08-
|
12
|
+
date: 2023-08-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aasm
|
@@ -783,6 +783,7 @@ files:
|
|
783
783
|
- app/controllers/concerns/uffizzi_core/authorization_concern.rb
|
784
784
|
- app/controllers/concerns/uffizzi_core/dependency_injection_concern.rb
|
785
785
|
- app/controllers/uffizzi_core/api/cli/v1/accounts/application_controller.rb
|
786
|
+
- app/controllers/uffizzi_core/api/cli/v1/accounts/clusters_controller.rb
|
786
787
|
- app/controllers/uffizzi_core/api/cli/v1/accounts/credentials_controller.rb
|
787
788
|
- app/controllers/uffizzi_core/api/cli/v1/accounts/projects_controller.rb
|
788
789
|
- app/controllers/uffizzi_core/api/cli/v1/accounts_controller.rb
|
@@ -926,6 +927,7 @@ files:
|
|
926
927
|
- app/models/uffizzi_core/template.rb
|
927
928
|
- app/models/uffizzi_core/user.rb
|
928
929
|
- app/models/uffizzi_core/user_project.rb
|
930
|
+
- app/policies/uffizzi_core/api/cli/v1/accounts/clusters_policy.rb
|
929
931
|
- app/policies/uffizzi_core/api/cli/v1/accounts/credentials_policy.rb
|
930
932
|
- app/policies/uffizzi_core/api/cli/v1/accounts/projects_policy.rb
|
931
933
|
- app/policies/uffizzi_core/api/cli/v1/accounts_policy.rb
|
@@ -960,6 +962,8 @@ files:
|
|
960
962
|
- app/repositories/uffizzi_core/user_repo.rb
|
961
963
|
- app/responders/uffizzi_core/json_responder.rb
|
962
964
|
- app/serializers/uffizzi_core/api/cli/v1/account_serializer.rb
|
965
|
+
- app/serializers/uffizzi_core/api/cli/v1/accounts/cluster_serializer.rb
|
966
|
+
- app/serializers/uffizzi_core/api/cli/v1/accounts/cluster_serializer/project_serializer.rb
|
963
967
|
- app/serializers/uffizzi_core/api/cli/v1/accounts/credential_serializer.rb
|
964
968
|
- app/serializers/uffizzi_core/api/cli/v1/accounts/project_serializer.rb
|
965
969
|
- app/serializers/uffizzi_core/api/cli/v1/project_serializer.rb
|