wco_hosting 0.0.0.24 → 0.0.0.27

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: f47cf4cc2b388bb3c0caefb58c8f8e54168c1ebddd4a73ecdbce9d2eb8c73b48
4
- data.tar.gz: 872ec182cffa5ad7978cc4baa0fd001048664449afc058b14080a361b7bffe45
3
+ metadata.gz: c74e9e69e8a2eaf81fbfa0397841aa0c26dc8e3e99508889d3d236fbd9752700
4
+ data.tar.gz: d22fe31571e487240b613b4b8a9ace297db9eca9a29d7cbdecba55db491832a2
5
5
  SHA512:
6
- metadata.gz: f6338b4e27f91b846c2deb7e4465099ee616412f27e8e2c75735ffc4eb42e19ecc9150769a9d96114505f27ce759d4e435cb29337a4114574642a149bff8271e
7
- data.tar.gz: 31819e3656572ef71c9af024a1767de03fe86151a584f61df9e49e69948bf51fedec9fa9a44df9a89c6f7326c62c2e17e095352d5962e2e3ccb8e22493b612f4
6
+ metadata.gz: '099f34448ff3e40d9f56d0f0a006fe2377dfa2cbf4c1318ec0877aeaf44a029d6ad7375e1b50248f77a57d915fad962a3126ea9d1fc368c3a68c209b4384ba52'
7
+ data.tar.gz: d304e57b0bdfe790189e012cfaf5e2b7df46de9169cd2f4630330f788616b850e8abd35e68acca2cfecbbf1f5174c1189f9010d6de9381e91521e8294657445e
@@ -28,3 +28,9 @@ table.bordered {
28
28
  }
29
29
  }
30
30
 
31
+
32
+ .appliance-tmpls--form {
33
+ textarea {
34
+ font-family: monospace;
35
+ }
36
+ }
@@ -12,7 +12,6 @@ class WcoHosting::AppliancesController < WcoHosting::ApplicationController
12
12
  end
13
13
 
14
14
  def new
15
-
16
15
  authorize! :new, @new_appliance
17
16
  end
18
17
 
@@ -21,16 +20,16 @@ class WcoHosting::AppliancesController < WcoHosting::ApplicationController
21
20
  authorize! :show, @appliance
22
21
  end
23
22
 
24
- # def update
25
- # @serverhost = WcoHosting::Serverhost.find params[:id]
26
- # authorize! :update, @serverhost
27
- # if @serverhost.update_attributes( params[:serverhost].permit! )
28
- # flash_notice @serverhost
29
- # else
30
- # flash_alert @serverhost
31
- # end
32
- # redirect_to action: :index
33
- # end
23
+ def update
24
+ @appliance = WcoHosting::Appliance.find params[:id]
25
+ authorize! :update, @appliance
26
+ if @appliance.update_attributes( params[:appliance].permit! )
27
+ flash_notice @appliance
28
+ else
29
+ flash_alert @appliance
30
+ end
31
+ redirect_to action: :index
32
+ end
34
33
 
35
34
  ##
36
35
  ## private
@@ -1,9 +1,17 @@
1
1
 
2
2
  class WcoHosting::DomainsController < WcoHosting::ApplicationController
3
3
 
4
- def index
5
- authorize! :index, WcoHosting::Domain
6
- @domains = WcoHosting::Domain.all
4
+ def create
5
+ @domain = WcoHosting::Domain.new params[:domain].permit!
6
+ authorize! :create, @domain
7
+
8
+ if @domain.save
9
+ flash_notice @domain
10
+ else
11
+ flash_alert @domain
12
+ end
13
+
14
+ redirect_to action: :index
7
15
  end
8
16
 
9
17
  def edit
@@ -11,12 +19,28 @@ class WcoHosting::DomainsController < WcoHosting::ApplicationController
11
19
  authorize! :edit, @domain
12
20
  end
13
21
 
22
+ def index
23
+ authorize! :index, WcoHosting::Domain
24
+ @domains = WcoHosting::Domain.all
25
+ end
26
+
27
+
28
+ def new
29
+ @domain = WcoHosting::Domain.new
30
+ authorize! :new, @domain
31
+ end
32
+
14
33
  def show
15
34
  @domain = WcoHosting::Domain.find params[:id]
16
35
  authorize! :show, @domain
17
36
  @subdomains = WcoHosting::Appliance.where( domain: @domain.name ).map( &:subdomain )
18
37
  end
19
38
 
39
+ def new
40
+ @domain = WcoHosting::Domain.new
41
+ authorize! :new, @domain
42
+ end
43
+
20
44
  def update
21
45
  @domain = WcoHosting::Domain.find params[:id]
22
46
  authorize! :update, @domain
@@ -1,9 +1,17 @@
1
1
 
2
2
  class WcoHosting::EnvironmentsController < WcoHosting::ApplicationController
3
3
 
4
- def index
5
- authorize! :index, WcoHosting::Environment
6
- @environments = WcoHosting::Environment.all
4
+ def create
5
+ @environment = WcoHosting::Environment.new params[:environment].permit!
6
+ authorize! :create, @environment
7
+
8
+ if @environment.save
9
+ flash_notice 'success'
10
+ else
11
+ flash_alert @environment
12
+ end
13
+
14
+ redirect_to action: :index
7
15
  end
8
16
 
9
17
  def edit
@@ -11,6 +19,17 @@ class WcoHosting::EnvironmentsController < WcoHosting::ApplicationController
11
19
  authorize! :edit, @environment
12
20
  end
13
21
 
22
+ def index
23
+ authorize! :index, WcoHosting::Environment
24
+ @environments = WcoHosting::Environment.all
25
+ end
26
+
27
+
28
+ def new
29
+ authorize! :new, WcoHosting::Environment
30
+ @environment = WcoHosting::Environment.new
31
+ end
32
+
14
33
  def show
15
34
  @environment = WcoHosting::Environment.find params[:id]
16
35
  authorize! :show, @environment
@@ -28,5 +47,10 @@ class WcoHosting::EnvironmentsController < WcoHosting::ApplicationController
28
47
  redirect_to action: :index
29
48
  end
30
49
 
50
+ private
51
+
52
+ def set_lists
53
+ @leadsets_list = Wco::Leadset.list
54
+ end
31
55
 
32
56
  end
@@ -5,6 +5,8 @@ class WcoHosting::ServerhostsController < WcoHosting::ApplicationController
5
5
  @serverhost = WcoHosting::Serverhost.new params[:serverhost].permit!
6
6
  authorize! :create, @serverhost
7
7
 
8
+ @serverhost.do_create_server! unless params[:skip_do_resource]
9
+
8
10
  flag = @serverhost.save
9
11
  if flag
10
12
  flash[:notice] = 'Success.'
@@ -15,6 +17,23 @@ class WcoHosting::ServerhostsController < WcoHosting::ApplicationController
15
17
  end
16
18
  end
17
19
 
20
+ def destroy
21
+ @serverhost = WcoHosting::Serverhost.find params[:id]
22
+ authorize! :destroy, @serverhost
23
+ out = HTTParty.delete( "https://api.digitalocean.com/v2/droplets/#{@serverhost.do_id}",
24
+ headers: { 'Authorization' => "Bearer #{DO_READER_TOKEN}" },
25
+ :debug_output => $stdout,
26
+ );
27
+ puts! out, 'out'
28
+ flag = @serverhost.destroy!
29
+ if flag
30
+ flash_notice @serverhost
31
+ else
32
+ flash_alert @serverhost
33
+ end
34
+ redirect_to action: :index
35
+ end
36
+
18
37
  def edit
19
38
  @serverhost = WcoHosting::Serverhost.find params[:id]
20
39
  authorize! :edit, @serverhost
@@ -22,7 +41,7 @@ class WcoHosting::ServerhostsController < WcoHosting::ApplicationController
22
41
 
23
42
  def index
24
43
  authorize! :index, WcoHosting::Serverhost
25
- @serverhosts = WcoHosting::Serverhost.all
44
+ @serverhosts = WcoHosting::Serverhost.all.order_by name: :asc
26
45
  @new_serverhost = WcoHosting::Serverhost.new
27
46
  end
28
47
 
@@ -20,6 +20,11 @@
20
20
  = link_to 'Tasks/Agents', tasks_path
21
21
  &nbsp;
22
22
  = link_to '[+]', new_task_path
23
- %li= link_to 'Domains', domains_path
24
- %li= link_to 'Serverhosts', serverhosts_path
23
+ %li
24
+ = link_to 'Domains', domains_path
25
+ = link_to '[+]', new_domain_path
26
+ %li
27
+ = link_to 'Serverhosts', serverhosts_path
28
+ = link_to '[+]', new_serverhost_path
29
+
25
30
 
@@ -22,7 +22,7 @@
22
22
  .actions
23
23
  = f.submit 'Go'
24
24
  .d-flex
25
- %label kind (name)
25
+ %label kind
26
26
  = f.text_field :kind, style: 'flex-grow: 1'
27
27
  %label version
28
28
  = f.text_field :version
@@ -31,24 +31,35 @@
31
31
  .field
32
32
  = f.label :descr
33
33
  = f.text_area :descr
34
- .field
34
+ .a
35
35
  %label :ecs_task_definition_erb
36
36
  = f.text_area :ecs_task_definition_erb
37
37
 
38
+ .a
39
+ %label :docker_compose_erb
40
+ .comment
41
+ Available variables: @appliance ,
42
+ = f.text_area :docker_compose_erb
43
+
38
44
 
39
45
  .field
40
- = f.label :image
46
+ %label :image
41
47
  = f.text_field :image, class: 'w-100'
42
48
 
43
49
  .field
44
50
  %label volume_zip_url
45
51
  = f.text_field :volume_zip_url, class: 'w-100'
52
+
46
53
  .field
47
54
  %label volume_zip_exe
48
55
  = f.text_field :volume_zip_exe, class: 'w-100'
49
56
 
50
57
  .field
51
- %label deleted_at
58
+ %label :deleted_at
52
59
  = f.text_field :deleted_at
60
+
53
61
  .actions
54
- = f.submit 'Go'
62
+ = f.submit 'Go'
63
+
64
+ %hr
65
+ = appliance_tmpl.inspect
@@ -1,4 +1,4 @@
1
1
 
2
- .appliance-tmpls-new
2
+ .appliance-tmpls-new.maxwidth
3
3
  %h5 New ApplianceTmpl `#{@appliance_tmpl}`
4
4
  = render 'form', appliance_tmpl: @appliance_tmpl
@@ -7,5 +7,11 @@
7
7
  .d-flex
8
8
  %label environment
9
9
  = f.select :environment_id, options_for_select( @environments_list, selected: appliance.environment_id ), {}, { class: 'select2' }
10
+ .field
11
+ %label slug
12
+ = f.text_field :slug
13
+ .field
14
+ %label port
15
+ = f.text_field :port
10
16
  .actions
11
17
  = f.submit 'Go'
@@ -1,32 +1,6 @@
1
1
 
2
2
  .appliances-edit.maxwidth
3
- %h5 Appliance `#{@appliance}`
4
-
5
- = form_for @appliance do |f|
6
- .actions
7
- = f.submit
8
- .field
9
- %label.bold Leadset:
10
- = link_to @appliance.leadset, wco.leadset_path(@appliance.leadset)
11
- .field
12
- %label.bold Env:
13
- = @appliance.environment
14
- .field
15
- %label.bold Tmpl:
16
- = @appliance.appliance_tmpl
17
-
18
- .actions
19
- = f.submit
20
-
21
- .logs
22
- %h5 Logs
23
- %ul
24
- - @appliance.logs.each do |log|
25
- %li
26
- = log.created_at
27
- %b= log.label
28
- %pre.descr= log.message
29
-
30
- = @appliance.inspect
3
+ %h5 Edit Appliance `#{@appliance}`
4
+ = render 'form', appliance: @appliance
31
5
 
32
6
 
@@ -4,7 +4,7 @@
4
4
  Appliances
5
5
  = link_to '[+]', new_appliance_path
6
6
 
7
- %table.bordered.data-table
7
+ %table.bordered
8
8
  %thead
9
9
  %td &nbsp;
10
10
  %td created_at
@@ -12,6 +12,7 @@
12
12
  %td host
13
13
  -# %td service_name
14
14
  %td port
15
+ %td slug
15
16
 
16
17
  - @appliances.each do |app|
17
18
  %tr
@@ -25,5 +26,5 @@
25
26
  %td= app.host
26
27
  -# %td= app.service_name
27
28
  %td= app.port
28
-
29
+ %td= app.slug
29
30
 
@@ -0,0 +1,4 @@
1
+
2
+ .domains-new.maxwidth
3
+ %h5 New Domain
4
+ = render 'form', domain: @domain
@@ -0,0 +1,12 @@
1
+
2
+ .environments--form
3
+ = form_for environment do |f|
4
+ .field
5
+ %label for
6
+ = f.select :leadset_id, options_for_select(@leadsets_list, selected: environment.leadset_id || params[:leadset_id])
7
+ .field
8
+ %label Name
9
+ = f.text_field :name
10
+
11
+ .actions
12
+ = f.submit 'Submit'
@@ -0,0 +1,7 @@
1
+
2
+ .environments-index.maxwidth
3
+ %h5 Environments
4
+ %ul
5
+ - @environments.each do |env|
6
+
7
+ %li= env.inspect
@@ -0,0 +1,4 @@
1
+
2
+ .enrivonments-new.maxwidth
3
+ %h5 New Environment
4
+ = render 'form', environment: @environment
@@ -18,5 +18,9 @@
18
18
  = f.label :ssh_host
19
19
  = f.text_field :ssh_host
20
20
 
21
+ .field
22
+ %label skip do resource?
23
+ = check_box_tag :skip_do_resource
24
+
21
25
  .actions
22
26
  = f.submit
@@ -1,2 +1,4 @@
1
1
 
2
- = render 'form', serverhost: @serverhost
2
+ .maxwidth
3
+
4
+ = render 'form', serverhost: @serverhost
@@ -10,14 +10,15 @@
10
10
  %th ssh_host
11
11
  %th public_ip
12
12
  %th next_port
13
- -# %td &nbsp;
13
+ %th do id
14
14
  - @serverhosts.each do |ser|
15
15
  %tr
16
16
  %td
17
17
  = link_to '[~]', edit_serverhost_path(ser)
18
18
  = link_to ser.name, serverhost_path(ser)
19
+ .d-inline-block= button_to 'x', serverhost_path(ser), method: :delete, data: { confirm: 'Are you sure?' }
19
20
  %td= ser.ssh_host
20
21
  %td= ser.public_ip
21
22
  %td= ser.next_port
22
- -# %td= ser.inspect
23
+ %td= ser.do_id
23
24
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wco_hosting
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0.24
4
+ version: 0.0.0.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-29 00:00:00.000000000 Z
11
+ date: 2025-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cancancan
@@ -262,16 +262,20 @@ files:
262
262
  - app/views/wco_hosting/domains/_form.haml
263
263
  - app/views/wco_hosting/domains/edit.haml
264
264
  - app/views/wco_hosting/domains/index.haml
265
+ - app/views/wco_hosting/domains/new.haml
265
266
  - app/views/wco_hosting/domains/show.haml
267
+ - app/views/wco_hosting/environments/_form.haml
268
+ - app/views/wco_hosting/environments/index.haml
269
+ - app/views/wco_hosting/environments/new.haml
266
270
  - app/views/wco_hosting/files/_form.haml
267
271
  - app/views/wco_hosting/files/_table.haml
268
272
  - app/views/wco_hosting/files/edit.haml
269
273
  - app/views/wco_hosting/files/index.haml
270
274
  - app/views/wco_hosting/files/new.haml
271
275
  - app/views/wco_hosting/files/show.haml
272
- - app/views/wco_hosting/leadsets/_form.haml
273
- - app/views/wco_hosting/leadsets/index.haml
274
- - app/views/wco_hosting/leadsets/show.haml
276
+ - app/views/wco_hosting/leadsets-bk/_form.haml
277
+ - app/views/wco_hosting/leadsets-bk/index.haml-bk
278
+ - app/views/wco_hosting/leadsets-bk/show.haml-bk
275
279
  - app/views/wco_hosting/serverhosts/_form.haml
276
280
  - app/views/wco_hosting/serverhosts/edit.haml
277
281
  - app/views/wco_hosting/serverhosts/index.haml