wco_hosting 0.0.0.0 → 0.0.0.1

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: 7b3d2d40541dfe6c51d225f2baaf21a5cf3305a77f927cea036b6e57da949a8a
4
- data.tar.gz: ffc82a285159f7148363769416c13de00116940d3848ed0eca9f72a1436b1011
3
+ metadata.gz: ad86ddea646207d16f72d9a01a7b925fa85574641164a874fcb68bba68867722
4
+ data.tar.gz: 48b073865fc07cb5a04ed435f2d870a2e0374dc66280f6bc0a3f5de33e1dcb10
5
5
  SHA512:
6
- metadata.gz: a17f609651ebf2f4b0fce6e6460cd86554569161cb978b3aff055bd18ecf638fce3da987d3ad6577726aba197222570e3b6d3cd95b874fdc6bca5ecbdb38cf3c
7
- data.tar.gz: 97c109c39c09ed65f256e7b72ee872af4cb2afa43ad2b512c438e16b0cf295de39680996563da75085146388243b968a46123c24ed412b3cd22e6181dbdbf4cf
6
+ metadata.gz: 01beb59a4811affdc28437ec87a7c98cbf1bfbf9a1d2d44e10e4816b039e2706492892491b68ce37f5e005b8b71db04c38dab0562b580686d0ccf806afec9fe8
7
+ data.tar.gz: 1005ac9dc93f5626397153768691c3705fc7cc0e7e11bedbad6ec3b5e6247c7c7f5e4db5ed53050707c01a72dd815729bc7f886fd16125c510216db93384943a
@@ -0,0 +1,22 @@
1
+
2
+ table.bordered {
3
+
4
+ border: 1px solid gray;
5
+ border-bottom: 0;
6
+ border-right: 0;
7
+
8
+ th {
9
+ background: #ddd;
10
+ }
11
+
12
+ td {
13
+ border: 1px solid gray;
14
+ border-top: 0;
15
+ border-left: 0;
16
+ }
17
+
18
+ }
19
+
20
+ .flex-row {
21
+ display: flex;
22
+ }
@@ -0,0 +1,7 @@
1
+
2
+ class WcoHosting::ApplianceTmplsController < WcoHosting::ApplicationController
3
+ def index
4
+ authorize! :index, WcoHosting::ApplianceTmpl
5
+ @appliance_tmpls = WcoHosting::ApplianceTmpl.all
6
+ end
7
+ end
@@ -0,0 +1,26 @@
1
+
2
+ class WcoHosting::AppliancesController < WcoHosting::ApplicationController
3
+
4
+ def index
5
+ authorize! :index, WcoHosting::Appliance
6
+ @appliances = WcoHosting::Appliance.all
7
+ end
8
+
9
+ # def edit
10
+ # @serverhost = WcoHosting::Serverhost.find params[:id]
11
+ # authorize! :edit, @serverhost
12
+ # end
13
+
14
+ # def update
15
+ # @serverhost = WcoHosting::Serverhost.find params[:id]
16
+ # authorize! :update, @serverhost
17
+ # if @serverhost.update_attributes( params[:serverhost].permit! )
18
+ # flash_notice @serverhost
19
+ # else
20
+ # flash_alert @serverhost
21
+ # end
22
+ # redirect_to action: :index
23
+ # end
24
+
25
+
26
+ end
@@ -1,12 +1,10 @@
1
1
 
2
- require 'ish_models'
3
-
4
2
  class WcoHosting::ApplicationController < ActionController::Base
5
3
 
6
4
  check_authorization
7
5
 
8
6
  def home
9
- authorize! :index, ::Wco::EmailConversation
7
+ authorize! :index, ::WcoHosting::Appliance
10
8
  end
11
9
 
12
10
  ##
@@ -15,11 +13,35 @@ class WcoHosting::ApplicationController < ActionController::Base
15
13
  private
16
14
 
17
15
  def current_ability
18
- @current_ability ||= ::WcoHosting::Ability.new(current_user)
16
+ @current_ability ||= ::Wco::Ability.new(current_user)
19
17
  end
20
18
 
21
19
  def current_profile
22
20
  @current_profile ||= Wco::Profile.find_by( email: current_user.email )
23
21
  end
24
22
 
23
+ def current_leadset
24
+ @current_leadset ||= current_profile.leadset
25
+ end
26
+
27
+ def flash_alert what
28
+ flash[:alert] ||= []
29
+ if String == what.class
30
+ str = what
31
+ else
32
+ str = "Cannot create/update #{what.class.name}: #{what.errors.full_messages.join(', ')} ."
33
+ end
34
+ flash[:alert] << str
35
+ end
36
+
37
+ def flash_notice what
38
+ flash[:notice] ||= []
39
+ if String == what.class
40
+ str = what
41
+ else
42
+ str = "Created/updated #{what.class.name} ."
43
+ end
44
+ flash[:notice] << str
45
+ end
46
+
25
47
  end
@@ -0,0 +1,44 @@
1
+
2
+ class WcoHosting::LeadsetsController < WcoHosting::ApplicationController
3
+
4
+ before_action :set_lists
5
+
6
+ def index
7
+ authorize! :index, Wco::Leadset
8
+ @leadsets = Wco::Leadset.all
9
+ end
10
+
11
+ def show
12
+ @leadset = Wco::Leadset.find params[:id]
13
+ authorize! :show, @leadset
14
+
15
+ end
16
+
17
+ def update
18
+ @leadset = Wco::Leadset.find params[:id]
19
+ authorize! :update, @leadset
20
+ params[:leadset][:serverhost_ids].delete("")
21
+ puts! params, 'params'
22
+
23
+ flag = @leadset.update_attributes( params.require(:leadset).permit(
24
+ :company_url, :email, serverhost_ids: [] )
25
+ )
26
+ if flag
27
+ flash_notice @leadset
28
+ else
29
+ flash_alert @leadset
30
+ end
31
+ redirect_to action: :index
32
+ end
33
+
34
+ ##
35
+ ## private
36
+ ##
37
+ private
38
+
39
+ def set_lists
40
+ @serverhosts_list = WcoHosting::Serverhost.list
41
+ end
42
+
43
+
44
+ end
@@ -0,0 +1,26 @@
1
+
2
+ class WcoHosting::ServerhostsController < WcoHosting::ApplicationController
3
+
4
+ def index
5
+ authorize! :index, WcoHosting::Serverhost
6
+ @serverhosts = WcoHosting::Serverhost.all
7
+ end
8
+
9
+ def edit
10
+ @serverhost = WcoHosting::Serverhost.find params[:id]
11
+ authorize! :edit, @serverhost
12
+ end
13
+
14
+ def update
15
+ @serverhost = WcoHosting::Serverhost.find params[:id]
16
+ authorize! :update, @serverhost
17
+ if @serverhost.update_attributes( params[:serverhost].permit! )
18
+ flash_notice @serverhost
19
+ else
20
+ flash_alert @serverhost
21
+ end
22
+ redirect_to action: :index
23
+ end
24
+
25
+
26
+ end
@@ -1,5 +1,5 @@
1
1
 
2
- class WcoHosting::SessionsController < ApplicationController
2
+ class WcoHosting::SessionsController < WcoHosting::ApplicationController
3
3
 
4
4
  skip_before_action :verify_authenticity_token, only: :create
5
5
 
@@ -2,7 +2,8 @@
2
2
 
3
3
  require 'cancancan'
4
4
 
5
- class WcoHosting::Ability
5
+ ## v0.0.0
6
+ class Wco::Ability
6
7
  include ::CanCan::Ability
7
8
 
8
9
  def initialize(user)
@@ -7,10 +7,19 @@
7
7
  = csp_meta_tag
8
8
  = stylesheet_link_tag "wco_hosting/application", media: "all"
9
9
  %body
10
+
11
+ %h1 Wco Hosting
10
12
  %nav
11
13
  %ul
12
- %li= link_to 'Email Conversations', email_conversations_path
13
- %li= link_to 'Inbox', email_conversations_in_path('inbox')
14
+ %li= link_to 'Wco::Leadsets', leadsets_path
15
+ %li= link_to 'ApplianceTmpl`s', appliance_tmpls_path
16
+ %li= link_to 'Appliances', appliances_path
17
+ %li= link_to 'Serverhosts', serverhosts_path
14
18
  %hr
19
+
20
+ = render '/wco/application/alerts_notices'
21
+ %hr
22
+
15
23
  = yield
16
- %hr
24
+ %hr
25
+
@@ -0,0 +1,22 @@
1
+
2
+ .row.max-width
3
+ .col-sm-12
4
+ - if notice&.class == String
5
+ .notice
6
+ = notice
7
+ .close [x]
8
+ - if notice&.class == Array
9
+ - notice.each do |i|
10
+ .notice
11
+ = i
12
+ .close [x]
13
+ - if alert&.class == String
14
+ .alert
15
+ = alert
16
+ .close [x]
17
+ - if alert&.class == Array
18
+ - alert.each do |i|
19
+ .alert
20
+ = i
21
+ .close [x]
22
+
@@ -0,0 +1,23 @@
1
+
2
+ .appliance-tmpls-index
3
+ %h5 ApplianceTmpl's
4
+
5
+ %table.bordered
6
+ %tr
7
+ %th id
8
+ %th kind
9
+ %th version
10
+ %th image
11
+ %th volume_zip
12
+ -# %td &nbsp;
13
+
14
+ - @appliance_tmpls.each do |tmpl|
15
+ %tr
16
+ %td= tmpl.id
17
+ %td= tmpl.kind
18
+ %td= tmpl.version
19
+ %td= tmpl.image
20
+ %td= tmpl.volume_zip
21
+ -# %td= tmpl.inspect
22
+
23
+
@@ -0,0 +1,21 @@
1
+
2
+ .appliances-index
3
+ %h5 Appliances
4
+
5
+ %table.bordered
6
+ %tr
7
+ %th id
8
+ %th tmpl
9
+ %th host
10
+ %th service_name
11
+ %td &nbsp;
12
+ - @appliances.each do |app|
13
+ %tr
14
+ %td= app.id
15
+ %td= app.tmpl.inspect
16
+ %td= app.host
17
+ %td= app.service_name
18
+ %td
19
+ = app.inspect
20
+
21
+
@@ -1,4 +1,4 @@
1
1
 
2
- %h5 Welcome home!
2
+ %h5 Welcome to WcoHosting Backend!
3
3
 
4
4
  = current_user.inspect
@@ -0,0 +1,19 @@
1
+
2
+ - url = leadset.new_record? ? leadsets_path : leadset_path(leadset)
3
+ .leadsets--form
4
+ %ul
5
+ %li <b>Next Serverhost:</b> #{leadset.next_serverhost}
6
+
7
+ = form_for leadset, as: :leadset, url: url do |f|
8
+ .field
9
+ = f.label :company_url
10
+ = f.text_field :company_url
11
+ .field
12
+ = f.label :email
13
+ = f.text_field :email
14
+ .field
15
+ = f.label :serverhosts
16
+ = f.select :serverhost_ids, options_for_select(@serverhosts_list, selected: leadset.serverhosts.map(&:id) ), {}, { multiple: true }
17
+
18
+ .actions
19
+ = f.submit
@@ -0,0 +1,13 @@
1
+
2
+ .leadsets-index
3
+ %h5 Leadsets
4
+
5
+ %ul
6
+ - @leadsets.each do |leadset|
7
+ %li.flex-row
8
+ .gray= leadset.id.to_s
9
+ &nbsp;&nbsp;
10
+ = link_to "[view]", leadset_path(leadset)
11
+ %ul
12
+ %li <b>company_url:</b> #{leadset.company_url}
13
+ %li <b>serverhosts:</b> #{leadset.serverhosts.map(&:name).join(",")}
@@ -0,0 +1,5 @@
1
+
2
+ .leadsets-show
3
+ %h5 Leadset #{@leadset.inspect}
4
+
5
+ = render '/wco_hosting/leadsets/form', leadset: @leadset
@@ -0,0 +1,22 @@
1
+
2
+ .serverhosts--form
3
+ = form_for serverhost do |f|
4
+
5
+ .field
6
+ = f.label :name
7
+ = f.text_field :name
8
+
9
+ .field
10
+ = f.label :next_port
11
+ = f.text_field :next_port
12
+
13
+ .field
14
+ = f.label :public_ip
15
+ = f.text_field :public_ip
16
+
17
+ .field
18
+ = f.label :ssh_host
19
+ = f.text_field :ssh_host
20
+
21
+ .actions
22
+ = f.submit
@@ -0,0 +1,2 @@
1
+
2
+ = render 'form', serverhost: @serverhost
@@ -0,0 +1,21 @@
1
+
2
+ .serverhosts-index
3
+ %h5 Serverhosts
4
+
5
+ %table.bordered
6
+ %tr
7
+ %th name
8
+ %th next_port
9
+ %th public_ip
10
+ %th ssh_host
11
+ %td &nbsp;
12
+ - @serverhosts.each do |s|
13
+ %tr
14
+ %td
15
+ = link_to s.name, edit_serverhost_path(s)
16
+ %td= s.ssh_host
17
+ %td= s.next_port
18
+ %td= s.public_ip
19
+ %td
20
+ = s.inspect
21
+
data/config/routes.rb CHANGED
@@ -2,9 +2,14 @@
2
2
  WcoHosting::Engine.routes.draw do
3
3
  root to: '/wco_hosting/application#home'
4
4
 
5
- get 'email_conversations/in/:tagname', to: '/wco/email_conversations#index', as: :email_conversations_in
6
- get 'email_conversations/not-in/:tagname_not', to: '/wco/email_conversations#index', as: :email_conversations_in_not
5
+ resources :appliance_tmpls
6
+ resources :appliances
7
7
 
8
- resources :email_conversations
8
+ # get 'email_conversations/in/:tagname', to: '/wco/email_conversations#index', as: :email_conversations_in
9
+ # get 'email_conversations/not-in/:tagname_not', to: '/wco/email_conversations#index', as: :email_conversations_in_not
10
+ # resources :email_conversations
11
+
12
+ resources :serverhosts
13
+ resources :leadsets
9
14
 
10
15
  end
@@ -1,11 +1,8 @@
1
1
 
2
- module Wco
3
- end
4
-
5
- module WcoHosting
6
- end
2
+ module Wco; end
3
+ module WcoHosting; end
7
4
 
8
5
  class WcoHosting::Engine < ::Rails::Engine
9
6
  isolate_namespace WcoHosting
10
- isolate_namespace Wco
7
+ # isolate_namespace Wco
11
8
  end
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.0
4
+ version: 0.0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-16 00:00:00.000000000 Z
11
+ date: 2023-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -150,6 +150,48 @@ dependencies:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: 1.0.1
153
+ - !ruby/object:Gem::Dependency
154
+ name: net-ssh
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 7.2.0
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 7.2.0
167
+ - !ruby/object:Gem::Dependency
168
+ name: net-scp
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: 4.0.0
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: 4.0.0
181
+ - !ruby/object:Gem::Dependency
182
+ name: sass-rails
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '5.0'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '5.0'
153
195
  description: https://wasya.co
154
196
  email:
155
197
  - victor@wasya.co
@@ -161,17 +203,28 @@ files:
161
203
  - Rakefile
162
204
  - app/assets/config/wco_hosting_manifest.js
163
205
  - app/assets/stylesheets/wco_hosting/application.css
206
+ - app/assets/stylesheets/wco_hosting/main.scss
207
+ - app/controllers/wco_hosting/appliance_tmpls_controller.rb
208
+ - app/controllers/wco_hosting/appliances_controller.rb
164
209
  - app/controllers/wco_hosting/application_controller.rb
165
- - app/controllers/wco_hosting/sessions_controller.rb
210
+ - app/controllers/wco_hosting/leadsets_controller.rb
211
+ - app/controllers/wco_hosting/serverhosts_controller.rb
212
+ - app/controllers/wco_hosting/sessions_controller.rb-trash
166
213
  - app/helpers/wco_hosting/application_helper.rb
167
214
  - app/jobs/wco_hosting/application_job.rb
168
215
  - app/mailers/wco_hosting/application_mailer.rb
169
- - app/models/wco_hosting/ability.rb
216
+ - app/models/wco/ability.rb
170
217
  - app/views/layouts/wco_hosting/application.haml
171
- - app/views/wco/email_conversations/index.haml
218
+ - app/views/wco/application/_alerts_notices.haml
219
+ - app/views/wco_hosting/appliance_tmpls/index.haml
220
+ - app/views/wco_hosting/appliances/index.haml
172
221
  - app/views/wco_hosting/application/home.haml
173
- - app/views/wco_hosting/sessions/new.html.erb
174
- - config/initialisers/misc.rb
222
+ - app/views/wco_hosting/leadsets/_form.haml
223
+ - app/views/wco_hosting/leadsets/index.haml
224
+ - app/views/wco_hosting/leadsets/show.haml
225
+ - app/views/wco_hosting/serverhosts/_form.haml
226
+ - app/views/wco_hosting/serverhosts/edit.haml
227
+ - app/views/wco_hosting/serverhosts/index.haml
175
228
  - config/routes.rb
176
229
  - lib/tasks/wco_hosting_tasks.rake
177
230
  - lib/wco_hosting.rb
@@ -1,6 +0,0 @@
1
-
2
- %h5 Email Conversations (#{@email_conversations.length})
3
-
4
- %ul
5
- - @email_conversations.each do |conv|
6
- %li= conv.subject
@@ -1,4 +0,0 @@
1
-
2
- <%= form_tag('/email/auth/keycloak', method: 'post', data: {turbo: false}) do %>
3
- <button type='submit'>Login with Keycloak</button>
4
- <% end %>
@@ -1,3 +0,0 @@
1
-
2
- Paperclip.options[:log] = false
3
-