Class: Kube::Station::ListController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Kube::Station::ListController
- Defined in:
- app/controllers/kube/station/list_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/kube/station/list_controller.rb', line 28 def create resource_hash = build_resource_hash(params[:resource]) resource = ::Kube::Schema[@kind_name].new(resource_hash) @cluster.apply_resource(resource.to_h) redirect_to cluster_group_version_kind_list_index_path(@cluster, params[:group_id], params[:version_id], @kind_name) rescue => e @error = e. @data = resource_hash || {} @fields = SchemaFields.call(resolve_schema(@kind_name), @data) render :new, status: :unprocessable_entity end |
#edit ⇒ Object
24 25 26 |
# File 'app/controllers/kube/station/list_controller.rb', line 24 def edit @fields = SchemaFields.call(resolve_schema(@kind_name), @data) end |
#index ⇒ Object
9 10 11 12 13 14 |
# File 'app/controllers/kube/station/list_controller.rb', line 9 def index @items = list_items rescue => e @error = e. @items = [] end |
#new ⇒ Object
19 20 21 22 |
# File 'app/controllers/kube/station/list_controller.rb', line 19 def new @data = ::Kube::Schema[@kind_name].defaults.merge({}) @fields = SchemaFields.call(resolve_schema(@kind_name), @data) end |
#show ⇒ Object
16 17 |
# File 'app/controllers/kube/station/list_controller.rb', line 16 def show end |
#update ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/kube/station/list_controller.rb', line 40 def update resource_hash = build_resource_hash(params[:resource]) resource = ::Kube::Schema[@kind_name].new(resource_hash) @cluster.apply_resource(resource.to_h) redirect_to cluster_group_version_kind_list_path(@cluster, params[:group_id], params[:version_id], @kind_name, resource.to_h[:metadata][:name]) rescue => e @error = e. @data = resource_hash || @data @fields = SchemaFields.call(resolve_schema(@kind_name), @data) render :edit, status: :unprocessable_entity end |