wco_models 3.1.0.210 → 3.1.0.213
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 +4 -4
- data/README.txt +13 -1
- data/app/assets/stylesheets/wco/main.scss +6 -1
- data/app/controllers/wco/leadsets_controller.rb +1 -1
- data/app/controllers/wco/office_action_templates_controller.rb +7 -2
- data/app/controllers/wco/office_actions_controller.rb +11 -0
- data/app/mailers/wco_email/application_mailer.rb +23 -24
- data/app/models/wco/office_action_template.rb +1 -0
- data/app/models/wco/price.rb +5 -1
- data/app/models/wco_hosting/appliance.rb +2 -2
- data/app/models/wco_hosting/appliance_tmpl.rb +35 -20
- data/app/models/wco_hosting/serverhost.rb +8 -2
- data/app/views/wco/office_action_templates/_form.haml +4 -1
- data/app/views/wco/office_action_templates/index.haml +9 -4
- data/app/views/wco/office_action_templates/show.haml +1 -1
- data/app/views/wco/office_actions/_actions.haml +1 -1
- data/app/views/wco/office_actions/_index.haml +2 -0
- data/app/views/wco_email/application_mailer/test_email.html.erb +1 -0
- data/config/routes.rb +3 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e065101cb33dbeaf417ea5aedc2cf588d291430d40cb19521efe4daad2e1016
|
4
|
+
data.tar.gz: 3e58043aa47eb24a005985e97e0d6ed0a12eb0f5f04360391f2f81052207440a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72e5731bf2e25209eb6f0b7cf9dd9df06cf0770dea002ca9b5af4a560bb3700c657556546c5bc0b4903e23042477ecce3b27565d44099f02b4cd8463a86822e4
|
7
|
+
data.tar.gz: 867125c0a713c9b5e9489091ee85abd60ab5893938dbb74d18073746748ae567357e1ed4a8c1a41cbf29a4f3b25dbacb7d37b3d74fb8f7b73f97aa42c469185a
|
data/README.txt
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
WasyaCo Models. The functionality shared across all (most) projects, including:
|
3
|
+
* The ActiveRecord models
|
4
|
+
* some stylesheets,
|
5
|
+
* some javascript.
|
6
|
+
|
7
|
+
== Setup ==
|
8
|
+
|
9
|
+
Docker is reqiured for development. It is used for mongo, and localstack.
|
10
|
+
|
11
|
+
Some infrastructure is driven by ansible - therefore, local python is required:
|
12
|
+
|
13
|
+
python3 -m venv zenv
|
14
|
+
. zenv/bin/activate
|
3
15
|
|
4
16
|
== Test ==
|
5
17
|
|
@@ -46,15 +46,20 @@ table.bordered {
|
|
46
46
|
// border-right: 0;
|
47
47
|
|
48
48
|
|
49
|
-
th
|
49
|
+
th {
|
50
50
|
background: #ddd;
|
51
|
+
border: 1px solid gray;
|
51
52
|
font-weight: bold;
|
53
|
+
padding: 0.5em;
|
52
54
|
}
|
53
55
|
|
54
56
|
td {
|
55
57
|
border: 1px solid gray;
|
56
58
|
border-top: 0;
|
57
59
|
border-left: 0;
|
60
|
+
|
61
|
+
padding: 0.5em;
|
62
|
+
vertical-align: top;
|
58
63
|
}
|
59
64
|
.latest-at {
|
60
65
|
width: 100px;
|
@@ -70,7 +70,7 @@ class Wco::LeadsetsController < Wco::ApplicationController
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def update
|
73
|
-
params[:leadset][:serverhost_ids].delete
|
73
|
+
params[:leadset][:serverhost_ids].present? && params[:leadset][:serverhost_ids].delete('')
|
74
74
|
@leadset = Leadset.find params[:id]
|
75
75
|
authorize! :update, @leadset
|
76
76
|
if @leadset.update_attributes params[:leadset].permit!
|
@@ -25,9 +25,14 @@ class Wco::OfficeActionTemplatesController < Wco::ApplicationController
|
|
25
25
|
def perform
|
26
26
|
@oat = OAT.find params[:id]
|
27
27
|
authorize! :run, @oat
|
28
|
-
@conversations = WcoEmail::Conversation.find( params[:conversation_ids] )
|
29
|
-
|
28
|
+
@conversations = WcoEmail::Conversation.find( params[:conversation_ids] ) if params[:conversation_ids].present?
|
29
|
+
if 'rb' == @oat.action_type
|
30
|
+
out = eval( @oat.action_exe )
|
31
|
+
elsif 'sh' == @oat.action_type
|
32
|
+
out = `#{@oat.action_exe}`
|
33
|
+
end
|
30
34
|
flash_notice out
|
35
|
+
redirect_to action: :index
|
31
36
|
end
|
32
37
|
|
33
38
|
def show
|
@@ -15,6 +15,17 @@ class Wco::OfficeActionsController < Wco::ApplicationController
|
|
15
15
|
redirect_to action: :index
|
16
16
|
end
|
17
17
|
|
18
|
+
def destroy
|
19
|
+
@oa = OA.find params[:id]
|
20
|
+
authorize! :destroy, @oa
|
21
|
+
if @oa.delete
|
22
|
+
flash_notice @oa
|
23
|
+
else
|
24
|
+
flash_alert @oa
|
25
|
+
end
|
26
|
+
redirect_to action: :index
|
27
|
+
end
|
28
|
+
|
18
29
|
def edit
|
19
30
|
@oa = OA.find params[:id]
|
20
31
|
authorize! :edit, @oa
|
@@ -14,17 +14,6 @@ class WcoEmail::ApplicationMailer < ActionMailer::Base
|
|
14
14
|
subject: "POX::#{@msg.subject}" )
|
15
15
|
end
|
16
16
|
|
17
|
-
def shared_galleries profiles, gallery
|
18
|
-
return if profiles.count == 0
|
19
|
-
@gallery = gallery
|
20
|
-
@domain = Rails.application.config.action_mailer.default_url_options[:host]
|
21
|
-
@galleries_path = IshManager::Engine.routes.url_helpers.galleries_path
|
22
|
-
@gallery_path = IshManager::Engine.routes.url_helpers.gallery_path(@gallery.slug)
|
23
|
-
mail( :to => '314658@gmail.com',
|
24
|
-
:bcc => profiles.map { |p| p.email },
|
25
|
-
:subject => 'You got new shared galleries on pi manager' )
|
26
|
-
end
|
27
|
-
|
28
17
|
def option_alert option
|
29
18
|
@option = option
|
30
19
|
mail({
|
@@ -33,19 +22,6 @@ class WcoEmail::ApplicationMailer < ActionMailer::Base
|
|
33
22
|
})
|
34
23
|
end
|
35
24
|
|
36
|
-
def stock_alert watch_id
|
37
|
-
@watch = Iro::OptionWatch.find watch_id
|
38
|
-
mail({
|
39
|
-
to: @watch.profile.email,
|
40
|
-
subject: "Iro Watch Alert :: #{@watch.ticker} is #{@watch.direction} #{@watch.mark}."
|
41
|
-
})
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_email
|
45
|
-
mail( to: DEFAULT_RECIPIENT, subject: "Test email at #{Time.now}" )
|
46
|
-
end
|
47
|
-
|
48
|
-
|
49
25
|
def send_context_email ctx_id
|
50
26
|
@ctx = Ctx.find ctx_id
|
51
27
|
@renderer = self.class.renderer ctx: @ctx
|
@@ -85,6 +61,29 @@ class WcoEmail::ApplicationMailer < ActionMailer::Base
|
|
85
61
|
content_type: "text/html" )
|
86
62
|
end
|
87
63
|
|
64
|
+
def shared_galleries profiles, gallery
|
65
|
+
return if profiles.count == 0
|
66
|
+
@gallery = gallery
|
67
|
+
@domain = Rails.application.config.action_mailer.default_url_options[:host]
|
68
|
+
@galleries_path = IshManager::Engine.routes.url_helpers.galleries_path
|
69
|
+
@gallery_path = IshManager::Engine.routes.url_helpers.gallery_path(@gallery.slug)
|
70
|
+
mail( :to => '314658@gmail.com',
|
71
|
+
:bcc => profiles.map { |p| p.email },
|
72
|
+
:subject => 'You got new shared galleries on pi manager' )
|
73
|
+
end
|
74
|
+
|
75
|
+
def stock_alert watch_id
|
76
|
+
@watch = Iro::OptionWatch.find watch_id
|
77
|
+
mail({
|
78
|
+
to: @watch.profile.email,
|
79
|
+
subject: "Iro Watch Alert :: #{@watch.ticker} is #{@watch.direction} #{@watch.mark}."
|
80
|
+
})
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_email
|
84
|
+
mail( to: DEFAULT_RECIPIENT, subject: "Test email at #{Time.now}" )
|
85
|
+
end
|
86
|
+
|
88
87
|
|
89
88
|
def self.renderer ctx:
|
90
89
|
out = self.new
|
@@ -16,6 +16,7 @@ class Wco::OfficeActionTemplate
|
|
16
16
|
belongs_to :from, polymorphic: true, optional: true
|
17
17
|
belongs_to :publisher, class_name: 'Wco::Publisher', optional: true
|
18
18
|
|
19
|
+
field :action_type, type: :string, default: 'rb' # 'js', 'rb', 'sh'
|
19
20
|
field :action_exe, type: :string
|
20
21
|
validates :action_exe, presence: true
|
21
22
|
def do_run
|
data/app/models/wco/price.rb
CHANGED
@@ -8,7 +8,11 @@ class Wco::Price
|
|
8
8
|
## Wco::Product, WcoHosting::ApplianceTmpl
|
9
9
|
belongs_to :product, polymorphic: true
|
10
10
|
|
11
|
-
|
11
|
+
## 2025-09-12 This used to be required - but I think it's unreasonable...
|
12
|
+
## all leadsets can have the same price.
|
13
|
+
## but I'll keep this around - to be able to override per-leadset.
|
14
|
+
## something else may be broken b/c I made this optional.
|
15
|
+
belongs_to :leadset, class_name: 'Wco::Leadset', optional: true
|
12
16
|
|
13
17
|
has_many :subscriptions, class_name: 'Wco::Subscription', inverse_of: :price, foreign_key: :wco_price_id
|
14
18
|
|
@@ -41,11 +41,11 @@ class WcoHosting::Appliance
|
|
41
41
|
def tmpl
|
42
42
|
appliance_tmpl
|
43
43
|
end
|
44
|
-
delegate :kind,
|
44
|
+
delegate :kind, to: :appliance_tmpl
|
45
|
+
delegate :playbook_name, to: :appliance_tmpl
|
45
46
|
|
46
47
|
belongs_to :serverhost, class_name: 'WcoHosting::Serverhost', optional: true
|
47
48
|
|
48
|
-
|
49
49
|
STATE_PENDING = 'pending'
|
50
50
|
STATE_LIVE = 'live'
|
51
51
|
STATE_TERMINATED = 'terminated'
|
@@ -7,6 +7,27 @@ class WcoHosting::ApplianceTmpl
|
|
7
7
|
include Wco::Utils
|
8
8
|
store_in collection: 'wco_appliance_tmpls'
|
9
9
|
|
10
|
+
## 2023-12-08 :: These names are impossible to change already.
|
11
|
+
KIND_CRM = 'crm' # trash
|
12
|
+
KIND_DRUPAL = 'drupal' # drupal
|
13
|
+
KIND_HELLOWORLD = 'helloworld' # static
|
14
|
+
KIND_IROWOR = 'irowor' # ror
|
15
|
+
KIND_JENKINS = 'jenkins' # jenkins
|
16
|
+
KIND_MATOMO = 'matomo' # docker
|
17
|
+
KIND_MOODLE = 'moodle' # docker
|
18
|
+
KIND_PRESTASHOP = 'prestashop' # docker
|
19
|
+
KIND_REACT = 'react' # static
|
20
|
+
KIND_SMT = 'smt' # ror
|
21
|
+
KIND_WORDPRESS = 'wordpress' # docker
|
22
|
+
KIND_TRASH = 'trash' # trash
|
23
|
+
KIND_TMP = 'tmp' # static
|
24
|
+
|
25
|
+
KINDS = [ nil, KIND_CRM, KIND_DRUPAL, KIND_HELLOWORLD, KIND_IROWOR,
|
26
|
+
KIND_JENKINS, KIND_MATOMO, KIND_MOODLE, KIND_PRESTASHOP,
|
27
|
+
KIND_REACT,
|
28
|
+
KIND_SMT,
|
29
|
+
KIND_WORDPRESS, KIND_TRASH, KIND_TMP ]
|
30
|
+
|
10
31
|
field :kind, type: :string
|
11
32
|
validates :kind, uniqueness: { scope: :version }, presence: true
|
12
33
|
|
@@ -17,6 +38,20 @@ class WcoHosting::ApplianceTmpl
|
|
17
38
|
def name
|
18
39
|
"#{kind} #{version}"
|
19
40
|
end
|
41
|
+
|
42
|
+
def playbook_name
|
43
|
+
case kind
|
44
|
+
when KIND_SMT
|
45
|
+
return 'hosted-packagedapp'
|
46
|
+
when KIND_DRUPAL
|
47
|
+
return 'hosted-drupal'
|
48
|
+
when KIND_HELLOWORLD
|
49
|
+
return 'hosted-static'
|
50
|
+
else
|
51
|
+
throw '0ip - not implemented'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
20
55
|
field :descr, type: :string
|
21
56
|
|
22
57
|
field :ecs_task_definition_erb, type: :string
|
@@ -48,26 +83,6 @@ class WcoHosting::ApplianceTmpl
|
|
48
83
|
end
|
49
84
|
end
|
50
85
|
|
51
|
-
## 2023-12-08 :: These names are impossible to change already.
|
52
|
-
KIND_CRM = 'crm'
|
53
|
-
KIND_DRUPAL = 'drupal'
|
54
|
-
KIND_HELLOWORLD = 'helloworld'
|
55
|
-
KIND_IROWOR = 'irowor'
|
56
|
-
KIND_JENKINS = 'jenkins'
|
57
|
-
KIND_MATOMO = 'matomo'
|
58
|
-
KIND_MOODLE = 'moodle'
|
59
|
-
KIND_PRESTASHOP = 'prestashop'
|
60
|
-
KIND_REACT = 'react'
|
61
|
-
KIND_SMT = 'smt'
|
62
|
-
KIND_WORDPRESS = 'wordpress'
|
63
|
-
KIND_TRASH = 'trash'
|
64
|
-
KIND_TMP = 'tmp'
|
65
|
-
|
66
|
-
KINDS = [ nil, KIND_CRM, KIND_DRUPAL, KIND_HELLOWORLD, KIND_IROWOR,
|
67
|
-
KIND_JENKINS, KIND_MATOMO, KIND_MOODLE, KIND_PRESTASHOP,
|
68
|
-
KIND_REACT,
|
69
|
-
KIND_SMT,
|
70
|
-
KIND_WORDPRESS, KIND_TRASH, KIND_TMP ]
|
71
86
|
|
72
87
|
|
73
88
|
|
@@ -44,12 +44,18 @@ class WcoHosting::Serverhost
|
|
44
44
|
# all.map { |s| [s.name, s.id] }
|
45
45
|
end
|
46
46
|
|
47
|
+
##
|
48
|
+
## @TODO: this can be very different, depending on kindset.
|
49
|
+
##
|
47
50
|
def add_docker_service app
|
48
51
|
@obj = app
|
49
52
|
cmd =<<~AOL
|
50
53
|
cd #{ANSIBLE_ROOT}
|
51
54
|
. zenv/bin/activate
|
52
|
-
ansible-playbook -i inventory/do.yml --limit #{self.name} playbooks
|
55
|
+
ansible-playbook -i inventory/do.yml --limit #{self.name} playbooks/#{app.playbook_name}.yml --extra-vars '{
|
56
|
+
"appliance_slug": "#{app.slug}",
|
57
|
+
"codebase_zip": "#{app.tmpl.volume_zip_url}",
|
58
|
+
"app_port": "#{app.port}"}'
|
53
59
|
AOL
|
54
60
|
do_exec cmd
|
55
61
|
end
|
@@ -78,7 +84,7 @@ class WcoHosting::Serverhost
|
|
78
84
|
def create_subdomain app
|
79
85
|
@obj = app
|
80
86
|
Wco::Log.puts! @obj, 'Creating subdomain...', obj: @obj
|
81
|
-
client = DropletKit::Client.new(access_token: DO_DOMAIN_TOKEN)
|
87
|
+
client = DropletKit::Client.new(access_token: ::DO_DOMAIN_TOKEN)
|
82
88
|
record = DropletKit::DomainRecord.new(
|
83
89
|
type: 'A',
|
84
90
|
name: app.subdomain,
|
@@ -9,8 +9,11 @@
|
|
9
9
|
%label Slug
|
10
10
|
= f.text_field :slug, class: 'w-100'
|
11
11
|
|
12
|
+
.field
|
13
|
+
%label action_type
|
14
|
+
= f.select :action_type, options_for_select( [ nil, 'js', 'rb', 'sh' ], selected: oat.action_type )
|
12
15
|
.descr
|
13
|
-
available vars: @conversations , @oat ,
|
16
|
+
rb available vars: @conversations , @oat ,
|
14
17
|
.field
|
15
18
|
%label action_exe
|
16
19
|
= f.text_area :action_exe, class: :monospace
|
@@ -6,10 +6,15 @@
|
|
6
6
|
%ul
|
7
7
|
- @oats.each do |oat|
|
8
8
|
%li
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
.d-flex
|
10
|
+
= link_to '[~]', edit_office_action_template_path(oat)
|
11
|
+
|
12
|
+
= button_to 'x', office_action_template_path(oat), method: :delete, data: { confirm: 'Are you sure?' }
|
13
|
+
|
14
|
+
= link_to oat.slug, office_action_template_path(oat)
|
15
|
+
|
16
|
+
= button_to 'Run', office_action_templates_perform_path(oat), data: { confirm: 'Are you sure?' }
|
17
|
+
|
13
18
|
= render '/wco/office_action_templates/ties', ties: oat.ties, oat: oat
|
14
19
|
-# = oat.inspect
|
15
20
|
|
@@ -3,5 +3,5 @@
|
|
3
3
|
%h5 Office Action
|
4
4
|
.d-inline-block
|
5
5
|
= select_tag :office_action_template, options_for_select(@office_action_templates_list), class: 'select2'
|
6
|
-
%a.btn.office-action-templates-perform-btn{ href: "javascript: void(0)", data: { url: wco.
|
6
|
+
%a.btn.office-action-templates-perform-btn{ href: "javascript: void(0)", data: { url: wco.oat_perform_with_conversations_path } }
|
7
7
|
Perform
|
@@ -0,0 +1 @@
|
|
1
|
+
<p>This is a test email.</p>
|
data/config/routes.rb
CHANGED
@@ -44,7 +44,9 @@ Wco::Engine.routes.draw do
|
|
44
44
|
resources :obfuscated_redirects
|
45
45
|
|
46
46
|
post 'office_action_templates', to: 'office_action_templates#update'
|
47
|
-
post 'office_action_templates/perform', to: 'office_action_templates#perform', as: :
|
47
|
+
post 'office_action_templates/perform', to: 'office_action_templates#perform', as: :oat_perform_with_conversations ## from the mailbox, the oat_id is passed as a body param.
|
48
|
+
post 'office_action_templates/:id/perform', to: 'office_action_templates#perform', as: :oat_perform
|
49
|
+
get 'office_action_templates/:id/perform', to: 'office_action_templates#perform'
|
48
50
|
resources :office_action_templates
|
49
51
|
resources :office_actions
|
50
52
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wco_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.0.
|
4
|
+
version: 3.1.0.213
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Pudeyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ahoy_matey
|
@@ -686,6 +686,7 @@ files:
|
|
686
686
|
- app/views/wco_email/application_mailer/_footer_unsubscribe.html.erb
|
687
687
|
- app/views/wco_email/application_mailer/_header_logo.html.erb
|
688
688
|
- app/views/wco_email/application_mailer/forwarder_notify.html.erb
|
689
|
+
- app/views/wco_email/application_mailer/test_email.html.erb
|
689
690
|
- app/views/wco_email/contexts/_form_reply_mini.haml
|
690
691
|
- app/views/wco_email/conversations/_table.haml
|
691
692
|
- app/views/wco_email/email_layouts/_m20221201react.html.erb
|