uffizzi_core 2.1.4 → 2.1.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31b523abfb135f26506fe25a9e6a74a90906f8fdb715ed167613d88869c1da7c
4
- data.tar.gz: 387de06335635d9830d4120636100b75042fedd59221c16688c5f219c5a5a396
3
+ metadata.gz: 2fa718cfa69dcdae6e76cb1808c513aa11ed894fdf7afef9bc383cb23c129e00
4
+ data.tar.gz: 28679dfd137f683e33a71b64cfbfd7a5589588aa24f31f2a1a6f5284fa6b71d1
5
5
  SHA512:
6
- metadata.gz: 92172c981d9c5883dd1ab8f6dc6f7c708a6a73e94c6dcba9193dd5f95ef1daf894db88172a1eed229a319baba70c8cb5a1058072209e821f884a6505ee116b69
7
- data.tar.gz: 938c57b21171b791af729fb02eff4e964836329f4ec218a5b0bf00c208a8ac53e016e9a99b9ffbdf1ffcaa58a7b7e8b4345df1dee6113fa053e5a13f1257f032
6
+ metadata.gz: 693edec5e777a1d96df5e3bff4a871091eaf89de12ae94d53d17591dff7e8ec8a61d9cbcf6d8088aafef68cdb434398b4fb3aac1c3c46f07ee10a10585712ac4
7
+ data.tar.gz: 9494c2246be34b70fcbe93f88315df66d08a7b13cb234c1a1552719e66b727093f44ad0f96f11d2b1b24002213fc8c5f00b906f4c7b159c5ad4949bdb4891df1
@@ -1,5 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UffizziCore::Api::Cli::V1::Projects::DeploymentsControllerModule
4
- def check_account_state; end
4
+ private
5
+
6
+ def stop_if_deployment_forbidden; end
7
+
8
+ def update_show_trial_quota_exceeded_warning; end
5
9
  end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UffizziCore::Api::Cli::V1::ProjectsControllerModule
4
+ private
5
+
6
+ def update_show_trial_quota_exceeded_warning; end
7
+ end
@@ -2,4 +2,12 @@
2
2
 
3
3
  class UffizziCore::Api::Cli::V1::ApplicationController < UffizziCore::ApplicationController
4
4
  before_action :authenticate_request!
5
+
6
+ def resource_project
7
+ @resource_project ||= current_user.projects.find_by!(slug: params[:slug])
8
+ end
9
+
10
+ def resource_account
11
+ @resource_account ||= resource_project.account
12
+ end
5
13
  end
@@ -6,7 +6,8 @@ class UffizziCore::Api::Cli::V1::Projects::DeploymentsController < UffizziCore::
6
6
  include UffizziCore::Api::Cli::V1::Projects::DeploymentsControllerModule
7
7
 
8
8
  before_action :authorize_uffizzi_core_api_cli_v1_projects_deployments
9
- before_action :check_account_state, only: [:create, :update]
9
+ before_action :stop_if_deployment_forbidden, only: :create
10
+ after_action :update_show_trial_quota_exceeded_warning, only: :destroy
10
11
 
11
12
  # Get a list of active deployements for a project
12
13
  #
@@ -3,7 +3,10 @@
3
3
  # @resource Project
4
4
 
5
5
  class UffizziCore::Api::Cli::V1::ProjectsController < UffizziCore::Api::Cli::V1::ApplicationController
6
+ include UffizziCore::Api::Cli::V1::ProjectsControllerModule
7
+
6
8
  before_action :authorize_uffizzi_core_api_cli_v1_projects
9
+ after_action :update_show_trial_quota_exceeded_warning, only: :destroy
7
10
 
8
11
  # Get projects of current user
9
12
  #
@@ -48,12 +51,9 @@ class UffizziCore::Api::Cli::V1::ProjectsController < UffizziCore::Api::Cli::V1:
48
51
  params.require(:project)
49
52
  end
50
53
 
51
- def resource_project
52
- @resource_project ||= current_user.projects.find_by(slug: params[:slug])
53
- end
54
-
55
54
  def policy_context
56
- account = resource_project&.account || current_user.default_account
55
+ current_project = current_user.projects.find_by(slug: params[:slug])
56
+ account = current_project&.account || current_user.default_account
57
57
 
58
58
  UffizziCore::AccountContext.new(current_user, user_access_module, account, params)
59
59
  end
@@ -19,14 +19,6 @@ class UffizziCore::ActivityItemService
19
19
  create_item!(activity_item_attributes)
20
20
  end
21
21
 
22
- def disable_deployment!(activity_item)
23
- deployment = activity_item.container.deployment
24
-
25
- activity_item.events.create(state: UffizziCore::Event.state.failed)
26
-
27
- UffizziCore::DeploymentService.disable!(deployment)
28
- end
29
-
30
22
  def fail_deployment!(activity_item)
31
23
  deployment = activity_item.container.deployment
32
24
  last_event = activity_item.events.order_by_id.last
@@ -7,7 +7,7 @@ class UffizziCore::ComposeFile::Parsers::Services::CommandParserService
7
7
 
8
8
  case command_data
9
9
  when String
10
- [command_data]
10
+ command_data.split
11
11
  when Array
12
12
  command_data
13
13
  else
@@ -27,13 +27,13 @@ class UffizziCore::DeploymentService
27
27
  deployment_form
28
28
  end
29
29
 
30
- def update_from_compose(compose_file, project, user, deployment, metadata = {})
30
+ def update_from_compose(compose_file, project, user, deployment, metadata)
31
31
  deployment_attributes = ActionController::Parameters.new(compose_file.template.payload)
32
32
 
33
33
  deployment_form = UffizziCore::Api::Cli::V1::Deployment::UpdateForm.new(deployment_attributes)
34
34
  deployment_form.assign_dependences!(project, user)
35
35
  deployment_form.compose_file = compose_file
36
- deployment_form.metadata = metadata
36
+ deployment_form.metadata = metadata || {}
37
37
 
38
38
  ActiveRecord::Base.transaction do
39
39
  deployment.containers.destroy_all
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UffizziCore
4
- VERSION = '2.1.4'
4
+ VERSION = '2.1.6'
5
5
  end
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.1.4
4
+ version: 2.1.6
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-02-09 00:00:00.000000000 Z
12
+ date: 2023-03-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aasm
@@ -749,6 +749,7 @@ files:
749
749
  - app/contexts/uffizzi_core/project_context.rb
750
750
  - app/contexts/uffizzi_core/webhooks_context.rb
751
751
  - app/controller_modules/uffizzi_core/api/cli/v1/projects/deployments_controller_module.rb
752
+ - app/controller_modules/uffizzi_core/api/cli/v1/projects_controller_module.rb
752
753
  - app/controllers/concerns/uffizzi_core/auth_management.rb
753
754
  - app/controllers/concerns/uffizzi_core/authorization_concern.rb
754
755
  - app/controllers/concerns/uffizzi_core/dependency_injection_concern.rb