wco_hosting 0.0.0.2 → 0.0.0.4

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: beb77daf73609eecd8757c3f1f8a19b2ba71e03820d5bb1dbafb065f3d4ad839
4
- data.tar.gz: da6e5c4106e559345df1926ba8a3158136eb8c0f7126dfb14fb8ee27675f5006
3
+ metadata.gz: 8f0b58b867b5892b387e86f64a985030cafcf66e4f69249ba1489f1fd6b156ce
4
+ data.tar.gz: 97e32482d3c0283241f1b179b8c0e07544e6d3c3b9588a8c30a76613a4e18d59
5
5
  SHA512:
6
- metadata.gz: 2b8b1d37e70e5a7f9b520945303ba96abe02a5a97ad0afef2b1ed8c1713f473b49099300fc2f87572ad41f242bc809c152406eafbf952ed44c69aa8fa327e35f
7
- data.tar.gz: 1bf76b9cd431ad9a37789b60d95796c12665d487652e250a36ebe64f1d8b5b999fa1213d25e23a1f7fa0918a27d1ade48677482f0667a06d4be136271002ef00
6
+ metadata.gz: 3ad9e34cbb40487eb7f1ead61e62c46702e2462778774109d953b3d91dcdbd658d1f3e86ab5d5ded31e3697529e02d85b2cb73049ca13819ebbd7ac256a0a76b
7
+ data.tar.gz: 9888d34d89214a5e735ea43427f498d87dc716ee25ce14e1380a6922054f1e9d17bdd847233bacce784f28bde77c4f5e2178f2a5f3b3039acf95ad8999f923d3
@@ -1,7 +1,57 @@
1
1
 
2
2
  class WcoHosting::ApplianceTmplsController < WcoHosting::ApplicationController
3
+
4
+ before_action :set_lists
5
+
6
+ def create
7
+ @appliance_tmpl = WcoHosting::ApplianceTmpl.new params[:appliance].permit!
8
+ authorize! :create, @appliance_tmpl
9
+
10
+ flag = @appliance_tmpl.save
11
+ if flag
12
+ flash[:notice] = 'Success.'
13
+ redirect_to action: :index
14
+ else
15
+ flash[:alert] = "Cannot create appliance tmplate: #{@appliance_tmpl.errors.full_messages.join(', ')}."
16
+ redirect_to action: :index
17
+ end
18
+ end
19
+
20
+ def edit
21
+ @appliance_tmpl = WcoHosting::ApplianceTmpl.find params[:id]
22
+ authorize! :edit, @appliance_tmpl
23
+ end
24
+
3
25
  def index
4
26
  authorize! :index, WcoHosting::ApplianceTmpl
5
27
  @appliance_tmpls = WcoHosting::ApplianceTmpl.all
6
28
  end
29
+
30
+ def new
31
+ authorize! :index, WcoHosting::ApplianceTmpl
32
+ @appliance_tmpl = WcoHosting::ApplianceTmpl.new
33
+ end
34
+
35
+ def update
36
+ @appliance_tmpl = WcoHosting::ApplianceTmpl.find params[:id]
37
+ authorize! :update, @appliance_tmpl
38
+ flag = @appliance_tmpl.update params[:appliance].permit!
39
+ if flag
40
+ flash_notice 'success'
41
+ else
42
+ flash_alert "Cannot update appliance template: #{@appliance_tmpl.errors.full_messages.join(', ')}."
43
+ end
44
+ redirect_to action: :index
45
+ end
46
+
47
+ ##
48
+ ## private
49
+ ##
50
+ private
51
+
52
+ def set_lists
53
+ @new_appliance_tmpl = WcoHosting::ApplianceTmpl.new
54
+ end
55
+
7
56
  end
57
+
@@ -1,9 +1,18 @@
1
1
 
2
2
  class WcoHosting::ServerhostsController < WcoHosting::ApplicationController
3
3
 
4
- def index
5
- authorize! :index, WcoHosting::Serverhost
6
- @serverhosts = WcoHosting::Serverhost.all
4
+ def create
5
+ @serverhost = WcoHosting::Serverhost.new params[:serverhost].permit!
6
+ authorize! :create, @serverhost
7
+
8
+ flag = @serverhost.save
9
+ if flag
10
+ flash[:notice] = 'Success.'
11
+ redirect_to action: :index
12
+ else
13
+ flash[:alert] = "Cannot create serverhost: #{@serverhost.errors.full_messages.join(', ')}."
14
+ render action: :index
15
+ end
7
16
  end
8
17
 
9
18
  def edit
@@ -11,6 +20,17 @@ class WcoHosting::ServerhostsController < WcoHosting::ApplicationController
11
20
  authorize! :edit, @serverhost
12
21
  end
13
22
 
23
+ def index
24
+ authorize! :index, WcoHosting::Serverhost
25
+ @serverhosts = WcoHosting::Serverhost.all
26
+ @new_serverhost = WcoHosting::Serverhost.new
27
+ end
28
+
29
+ def new
30
+ authorize! :index, WcoHosting::Serverhost
31
+ @new_serverhost = WcoHosting::Serverhost.new
32
+ end
33
+
14
34
  def update
15
35
  @serverhost = WcoHosting::Serverhost.find params[:id]
16
36
  authorize! :update, @serverhost
@@ -0,0 +1,23 @@
1
+
2
+ - url = appliance_tmpl.new_record? ? appliance_tmpls_path : appliance_tmpl_path( appliance_tmpl )
3
+
4
+ .appliance-tmpls--form
5
+ = form_for appliance_tmpl, as: :appliance, url: url do |f|
6
+ .field
7
+ = f.label :kind
8
+ = f.text_field :kind
9
+ .field
10
+ = f.label :version
11
+ = f.text_field :version
12
+ .field
13
+ = f.label :descr
14
+ = f.text_area :descr
15
+ .field
16
+ = f.label :image
17
+ = f.text_field :image, class: 'w-100'
18
+ .field
19
+ %label volume_zip
20
+ = f.text_field :volume_zip, class: 'w-100'
21
+
22
+ .actions
23
+ = f.submit 'Submit'
@@ -0,0 +1,4 @@
1
+
2
+ .appliance-tmpls-edit.maxwidth
3
+ %h5 Edit ApplianceTmpl `#{@appliance_tmpl}`
4
+ = render 'form', appliance_tmpl: @appliance_tmpl
@@ -1,6 +1,8 @@
1
1
 
2
2
  .appliance-tmpls-index
3
- %h5 ApplianceTmpl's
3
+ %h5
4
+ ApplianceTmpl's
5
+ = link_to '[+]', new_appliance_tmpl_path
4
6
 
5
7
  %table.bordered
6
8
  %tr
@@ -0,0 +1,4 @@
1
+
2
+ .appliance-tmpls-new
3
+ %h5 New ApplianceTmpl `#{@appliance_tmpl}`
4
+ = render 'form', appliance_tmpl: @appliance_tmpl
@@ -1,6 +1,8 @@
1
1
 
2
2
  .serverhosts-index
3
- %h5 Serverhosts
3
+ %h5
4
+ Serverhosts
5
+ = link_to '[+]', new_serverhost_path
4
6
 
5
7
  %table.bordered
6
8
  %tr
@@ -8,7 +10,7 @@
8
10
  %th next_port
9
11
  %th public_ip
10
12
  %th ssh_host
11
- %td &nbsp;
13
+ -# %td &nbsp;
12
14
  - @serverhosts.each do |s|
13
15
  %tr
14
16
  %td
@@ -16,6 +18,5 @@
16
18
  %td= s.ssh_host
17
19
  %td= s.next_port
18
20
  %td= s.public_ip
19
- %td
20
- = s.inspect
21
+ -# %td= s.inspect
21
22
 
@@ -0,0 +1,2 @@
1
+
2
+ = render 'form', serverhost: @new_serverhost
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wco_hosting
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0.2
4
+ version: 0.0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev
@@ -216,7 +216,10 @@ files:
216
216
  - app/models/wco/ability.rb
217
217
  - app/views/layouts/wco_hosting/application.haml
218
218
  - app/views/wco/application/_alerts_notices.haml
219
+ - app/views/wco_hosting/appliance_tmpls/_form.haml
220
+ - app/views/wco_hosting/appliance_tmpls/edit.haml
219
221
  - app/views/wco_hosting/appliance_tmpls/index.haml
222
+ - app/views/wco_hosting/appliance_tmpls/new.haml
220
223
  - app/views/wco_hosting/appliances/index.haml
221
224
  - app/views/wco_hosting/application/home.haml
222
225
  - app/views/wco_hosting/leadsets/_form.haml
@@ -225,6 +228,7 @@ files:
225
228
  - app/views/wco_hosting/serverhosts/_form.haml
226
229
  - app/views/wco_hosting/serverhosts/edit.haml
227
230
  - app/views/wco_hosting/serverhosts/index.haml
231
+ - app/views/wco_hosting/serverhosts/new.haml
228
232
  - config/routes.rb
229
233
  - lib/tasks/wco_hosting_tasks.rake
230
234
  - lib/wco_hosting.rb