plesk_kit 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (157) hide show
  1. data/app/assets/javascripts/plesk_kit/application.js +15 -0
  2. data/app/assets/javascripts/plesk_kit/customer_accounts.js +2 -0
  3. data/app/assets/javascripts/plesk_kit/customers.js +2 -0
  4. data/app/assets/javascripts/plesk_kit/reseller_accounts.js +2 -0
  5. data/app/assets/javascripts/plesk_kit/servers.js +2 -0
  6. data/app/assets/javascripts/plesk_kit/subscriptions.js +2 -0
  7. data/app/assets/stylesheets/plesk_kit/application.css +13 -0
  8. data/app/assets/stylesheets/plesk_kit/customer_accounts.css +4 -0
  9. data/app/assets/stylesheets/plesk_kit/customers.css +4 -0
  10. data/app/assets/stylesheets/plesk_kit/reseller_accounts.css +4 -0
  11. data/app/assets/stylesheets/plesk_kit/servers.css +4 -0
  12. data/app/assets/stylesheets/plesk_kit/subscriptions.css +4 -0
  13. data/app/assets/stylesheets/scaffold.css +56 -0
  14. data/app/controllers/plesk_kit/application_controller.rb +4 -0
  15. data/app/controllers/plesk_kit/customer_accounts_controller.rb +87 -0
  16. data/app/controllers/plesk_kit/reseller_accounts_controller.rb +87 -0
  17. data/app/controllers/plesk_kit/servers_controller.rb +87 -0
  18. data/app/controllers/plesk_kit/subscriptions_controller.rb +87 -0
  19. data/app/helpers/plesk_kit/application_helper.rb +4 -0
  20. data/app/helpers/plesk_kit/customer_accounts_helper.rb +4 -0
  21. data/app/helpers/plesk_kit/reseller_accounts_helper.rb +4 -0
  22. data/app/helpers/plesk_kit/servers_helper.rb +4 -0
  23. data/app/helpers/plesk_kit/subscriptions_helper.rb +4 -0
  24. data/app/models/plesk_kit/client.rb +25 -0
  25. data/app/models/plesk_kit/communicator.rb +45 -0
  26. data/app/models/plesk_kit/customer_account.rb +69 -0
  27. data/app/models/plesk_kit/reseller_account.rb +72 -0
  28. data/app/models/plesk_kit/server.rb +30 -0
  29. data/app/models/plesk_kit/subscription.rb +86 -0
  30. data/app/views/layouts/plesk_kit/application.html.erb +14 -0
  31. data/app/views/plesk_kit/customer_accounts/_form.html.erb +33 -0
  32. data/app/views/plesk_kit/customer_accounts/edit.html.erb +6 -0
  33. data/app/views/plesk_kit/customer_accounts/index.html.erb +29 -0
  34. data/app/views/plesk_kit/customer_accounts/new.html.erb +5 -0
  35. data/app/views/plesk_kit/customer_accounts/show.html.erb +25 -0
  36. data/app/views/plesk_kit/reseller_accounts/_form.html.erb +33 -0
  37. data/app/views/plesk_kit/reseller_accounts/edit.html.erb +6 -0
  38. data/app/views/plesk_kit/reseller_accounts/index.html.erb +29 -0
  39. data/app/views/plesk_kit/reseller_accounts/new.html.erb +5 -0
  40. data/app/views/plesk_kit/reseller_accounts/show.html.erb +25 -0
  41. data/app/views/plesk_kit/servers/_form.html.erb +37 -0
  42. data/app/views/plesk_kit/servers/edit.html.erb +6 -0
  43. data/app/views/plesk_kit/servers/index.html.erb +31 -0
  44. data/app/views/plesk_kit/servers/new.html.erb +5 -0
  45. data/app/views/plesk_kit/servers/show.html.erb +30 -0
  46. data/app/views/plesk_kit/subscriptions/_form.html.erb +49 -0
  47. data/app/views/plesk_kit/subscriptions/edit.html.erb +6 -0
  48. data/app/views/plesk_kit/subscriptions/index.html.erb +33 -0
  49. data/app/views/plesk_kit/subscriptions/new.html.erb +5 -0
  50. data/app/views/plesk_kit/subscriptions/show.html.erb +35 -0
  51. data/config/routes.rb +8 -0
  52. data/db/migrate/20130906033658_create_plesk_kit_customer_accounts.rb +14 -0
  53. data/db/migrate/20130906033745_create_plesk_kit_reseller_accounts.rb +15 -0
  54. data/db/migrate/20130906034225_create_plesk_kit_subscriptions.rb +16 -0
  55. data/db/migrate/20130906040817_create_plesk_kit_servers.rb +13 -0
  56. data/lib/plesk_kit/engine.rb +23 -0
  57. data/lib/plesk_kit/version.rb +3 -0
  58. data/lib/plesk_kit.rb +4 -0
  59. data/lib/tasks/plesk_kit_tasks.rake +4 -0
  60. data/test/dummy/README.rdoc +261 -0
  61. data/test/dummy/Rakefile +7 -0
  62. data/test/dummy/app/assets/javascripts/application.js +15 -0
  63. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  64. data/test/dummy/app/controllers/application_controller.rb +3 -0
  65. data/test/dummy/app/helpers/application_helper.rb +2 -0
  66. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  67. data/test/dummy/config/application.rb +59 -0
  68. data/test/dummy/config/boot.rb +10 -0
  69. data/test/dummy/config/database.yml +25 -0
  70. data/test/dummy/config/environment.rb +5 -0
  71. data/test/dummy/config/environments/development.rb +37 -0
  72. data/test/dummy/config/environments/production.rb +67 -0
  73. data/test/dummy/config/environments/test.rb +37 -0
  74. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  75. data/test/dummy/config/initializers/inflections.rb +15 -0
  76. data/test/dummy/config/initializers/mime_types.rb +5 -0
  77. data/test/dummy/config/initializers/secret_token.rb +7 -0
  78. data/test/dummy/config/initializers/session_store.rb +8 -0
  79. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  80. data/test/dummy/config/locales/en.yml +5 -0
  81. data/test/dummy/config/routes.rb +4 -0
  82. data/test/dummy/config.ru +4 -0
  83. data/test/dummy/db/development.sqlite3 +0 -0
  84. data/test/dummy/db/migrate/20130906035255_create_plesk_kit_customer_accounts.plesk_kit.rb +13 -0
  85. data/test/dummy/db/migrate/20130906035256_create_plesk_kit_reseller_accounts.plesk_kit.rb +13 -0
  86. data/test/dummy/db/migrate/20130906035257_create_plesk_kit_subscriptions.plesk_kit.rb +17 -0
  87. data/test/dummy/db/migrate/20130906040830_create_plesk_kit_servers.plesk_kit.rb +14 -0
  88. data/test/dummy/db/schema.rb +72 -0
  89. data/test/dummy/db/test.sqlite3 +0 -0
  90. data/test/dummy/log/development.log +9379 -0
  91. data/test/dummy/public/404.html +26 -0
  92. data/test/dummy/public/422.html +26 -0
  93. data/test/dummy/public/500.html +25 -0
  94. data/test/dummy/public/favicon.ico +0 -0
  95. data/test/dummy/script/rails +6 -0
  96. data/test/dummy/tmp/cache/assets/C5D/AF0/sprockets%2Faa100860897bd469c74972020e9d6966 +0 -0
  97. data/test/dummy/tmp/cache/assets/C83/800/sprockets%2F0892f1bdb69d260331b7b414298969c1 +0 -0
  98. data/test/dummy/tmp/cache/assets/C8A/850/sprockets%2F8729404d8f18dcc24e0523d37801589e +0 -0
  99. data/test/dummy/tmp/cache/assets/CC2/EF0/sprockets%2F756af5df20241589c464741d971fd7d8 +0 -0
  100. data/test/dummy/tmp/cache/assets/CC4/B50/sprockets%2F34e848818d05961fdc8c6c275e16629b +0 -0
  101. data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  102. data/test/dummy/tmp/cache/assets/CE0/340/sprockets%2F4b6f8f760b2a1789f60289271d20c0be +0 -0
  103. data/test/dummy/tmp/cache/assets/CED/DE0/sprockets%2F18595c4734c4d7582dee3ae35b079a49 +0 -0
  104. data/test/dummy/tmp/cache/assets/CEE/F00/sprockets%2F891ac2c44b3be23865e990924a995fe2 +0 -0
  105. data/test/dummy/tmp/cache/assets/D10/EC0/sprockets%2F73e40114523e8419fcd0efa71d597c5d +0 -0
  106. data/test/dummy/tmp/cache/assets/D11/AE0/sprockets%2Fa1a95d724723a8f11e9037e8d2b28a8f +0 -0
  107. data/test/dummy/tmp/cache/assets/D13/380/sprockets%2F354af7b9709615f6f10e77d7e1b2da15 +0 -0
  108. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  109. data/test/dummy/tmp/cache/assets/D33/4D0/sprockets%2F14f2359cdf393c5e0b6401e233bb2ef5 +0 -0
  110. data/test/dummy/tmp/cache/assets/D3B/BF0/sprockets%2F3b7fb545a51edee1b772b818b2424d56 +0 -0
  111. data/test/dummy/tmp/cache/assets/D3C/B20/sprockets%2F1927fcaeaf1d200dab53e55b86526939 +0 -0
  112. data/test/dummy/tmp/cache/assets/D3F/2C0/sprockets%2F1ada6cc19aa84bf00164875127ef689e +0 -0
  113. data/test/dummy/tmp/cache/assets/D44/140/sprockets%2F341e589bb22dea2848665b989b2ba3ea +0 -0
  114. data/test/dummy/tmp/cache/assets/D4A/700/sprockets%2Fd56d83b8bbc98f0ce23f6263ff796020 +0 -0
  115. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  116. data/test/dummy/tmp/cache/assets/D51/190/sprockets%2F2a28b96857a9e16a74ee9dde52903dc7 +0 -0
  117. data/test/dummy/tmp/cache/assets/D51/610/sprockets%2F34de6f511191ffa00431d50cb5b31eac +0 -0
  118. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  119. data/test/dummy/tmp/cache/assets/D62/7B0/sprockets%2F39cdc1f2f8021136f2034ac5a9dab7f6 +0 -0
  120. data/test/dummy/tmp/cache/assets/D78/5D0/sprockets%2Feb7a1f999039a6136d9cfe25222fdcd5 +0 -0
  121. data/test/dummy/tmp/cache/assets/D7A/A30/sprockets%2F7e54a37cfb268f56b4c49b9f02029bff +0 -0
  122. data/test/dummy/tmp/cache/assets/D98/A30/sprockets%2Fd3cd57a8fade5aef376036123c5e11d6 +0 -0
  123. data/test/dummy/tmp/cache/assets/DA6/B80/sprockets%2F3fea63c0c7e19aae37d6037cd9d987e0 +0 -0
  124. data/test/dummy/tmp/cache/assets/DBA/730/sprockets%2F182cd97bf96da9ad7f037dcda77e8965 +0 -0
  125. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  126. data/test/dummy/tmp/cache/assets/DF9/B80/sprockets%2Fe87d27fca0c65097c5b652becc1eec0b +0 -0
  127. data/test/dummy/tmp/cache/assets/DFA/E90/sprockets%2F1fc47d21f6a426ae1e5d7b1dc9b39dbf +0 -0
  128. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  129. data/test/dummy/tmp/cache/assets/E28/3B0/sprockets%2Fce7fac4e9b4c46afa942e091b54c6aab +0 -0
  130. data/test/dummy/tmp/cache/assets/E3D/360/sprockets%2F19c6fbcf6aaed23dce100b1c1b2b0b8c +0 -0
  131. data/test/dummy/tmp/cache/assets/E89/270/sprockets%2F1bf1ee2ecfe1c679faf4002f4ea8bece +0 -0
  132. data/test/fixtures/plesk_kit/customer_accounts.yml +13 -0
  133. data/test/fixtures/plesk_kit/customers.yml +7 -0
  134. data/test/fixtures/plesk_kit/reseller_accounts.yml +13 -0
  135. data/test/fixtures/plesk_kit/servers.yml +15 -0
  136. data/test/fixtures/plesk_kit/subscriptions.yml +17 -0
  137. data/test/fixtures/plesk_kit/webspaces.yml +11 -0
  138. data/test/functional/plesk_kit/customer_accounts_controller_test.rb +51 -0
  139. data/test/functional/plesk_kit/customers_controller_test.rb +51 -0
  140. data/test/functional/plesk_kit/reseller_accounts_controller_test.rb +51 -0
  141. data/test/functional/plesk_kit/servers_controller_test.rb +51 -0
  142. data/test/functional/plesk_kit/subscriptions_controller_test.rb +51 -0
  143. data/test/integration/navigation_test.rb +10 -0
  144. data/test/plesk_kit_test.rb +7 -0
  145. data/test/test_helper.rb +15 -0
  146. data/test/unit/helpers/plesk_kit/customer_accounts_helper_test.rb +6 -0
  147. data/test/unit/helpers/plesk_kit/customers_helper_test.rb +6 -0
  148. data/test/unit/helpers/plesk_kit/reseller_accounts_helper_test.rb +6 -0
  149. data/test/unit/helpers/plesk_kit/servers_helper_test.rb +6 -0
  150. data/test/unit/helpers/plesk_kit/subscriptions_helper_test.rb +6 -0
  151. data/test/unit/plesk_kit/customer_account_test.rb +9 -0
  152. data/test/unit/plesk_kit/customer_test.rb +9 -0
  153. data/test/unit/plesk_kit/reseller_account_test.rb +9 -0
  154. data/test/unit/plesk_kit/server_test.rb +9 -0
  155. data/test/unit/plesk_kit/subscription_test.rb +9 -0
  156. data/test/unit/plesk_kit/webspace_test.rb +9 -0
  157. metadata +331 -0
@@ -0,0 +1,72 @@
1
+ module PleskKit
2
+ class ResellerAccount < ActiveRecord::Base
3
+ attr_accessible :cname, :login, :passwd, :pname, :plan_name, :service_plan_id, :server_id
4
+ validate :uniqueness_of_login_across_accounts
5
+
6
+
7
+ has_many :subscriptions
8
+ belongs_to :server
9
+ before_create :provision_in_plesk
10
+
11
+ def provision_in_plesk
12
+ PleskKit::Communicator.pack_and_play_with self
13
+ end
14
+
15
+ # # #
16
+ # Methods for sending brand new customer account to Plesk
17
+ # # #
18
+
19
+ # Creates Object & Packet
20
+ def pack_this shell
21
+ xml = shell
22
+ xml.instruct!
23
+ xml.packet(:version => '1.6.3.5') {
24
+ xml.reseller {
25
+ xml.add{
26
+ xml.send(:'gen-info') {
27
+ xml.cname(self.cname)
28
+ xml.pname(self.pname)
29
+ xml.login(self.login)
30
+ xml.passwd(self.passwd)
31
+ #xml.status(status ? 0 : 1)
32
+ #xml.phone(phone)
33
+ #xml.fax(fax)
34
+ #xml.address(address)
35
+ #xml.city(city)
36
+ #xml.state(state)
37
+ #xml.pcode(pcode)
38
+ #xml.country(country)
39
+ }
40
+ xml.tag!('plan-name', self.plan_name)
41
+ }
42
+ }
43
+ }
44
+ return xml.target!
45
+ end
46
+
47
+ def analyse response_string, server_id
48
+ xml = REXML::Document.new(response_string)
49
+ status = xml.root.elements['//status'].text if xml.root.elements['//status'].present?
50
+ if status == "error"
51
+ code = xml.root.elements['//errcode'].text
52
+ message = xml.root.elements['//errtext'].text
53
+ raise "#{code}: #{message}"
54
+ else
55
+ plesk_id = xml.root.elements['//id'].text if xml.root.elements['//id'].present?
56
+ self.server_id = server_id
57
+ end
58
+
59
+ return plesk_id # TODO save plesk_id
60
+ end
61
+
62
+
63
+ private
64
+ def uniqueness_of_login_across_accounts
65
+ if PleskKit::CustomerAccount.find_by_login(self.login).present?
66
+ errors.add(:base, "Login is not unique across Uber Plesk accounts")
67
+ elsif PleskKit::ResellerAccount.find_by_login(self.login).present?
68
+ errors.add(:base, "Login is not unique across Uber Plesk accounts")
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,30 @@
1
+ module PleskKit
2
+ class Server < ActiveRecord::Base
3
+ attr_accessible :environment, :ghostname, :host, :password, :username
4
+
5
+ has_many :customer_accounts
6
+ has_many :reseller_accounts
7
+
8
+ validates :environment, :host, :username, :password, :presence => {:message => 'Cannot be blank! Requires, at minimum, environment (dev,staging,production), host without a port, username, and password'}
9
+
10
+
11
+ def self.most_suitable_for_new_customer
12
+ servers = 'collect_ram_info_for_servers'
13
+ servers = 'sort_by_available_ram_descending(servers)'
14
+ until servers.blank?
15
+ if servers.first.starved_of_resources?
16
+ 'remove from array of servers'
17
+ 'throw error'
18
+ else
19
+ return s
20
+ end
21
+ end
22
+ end
23
+
24
+ def starved_of_resources?
25
+ # TODO Check CPU, Diskspace, RAM. Return false if all met satisfactorily.
26
+ false
27
+ end
28
+
29
+ end
30
+ end
@@ -0,0 +1,86 @@
1
+ module PleskKit
2
+ class Subscription < ActiveRecord::Base
3
+ attr_accessible :ip_address, :name, :owner_id, :owner_login, :plan_name, :service_plan_id, :customer_account_id, :reseller_account_id
4
+
5
+ belongs_to :customer_account
6
+ belongs_to :reseller_account
7
+ #belongs_to :service_plan
8
+ before_create :provision_in_plesk
9
+
10
+ def provision_in_plesk
11
+ account = (customer_account_id.present? ? customer_account : (reseller_account_id.present? ? reseller_account : raise(msg="no accounts?")))
12
+ self.plan_name = self.plan_name
13
+ self.ip_address = '117.55.235.27'
14
+ self.owner_login = account.login
15
+ self.name = self.name
16
+ if account.class.to_s == 'PleskKit::ResellerAccount'
17
+ self.reseller_account_id = account.id
18
+ elsif account.class.to_s == 'PleskKit::CustomerAccount'
19
+ self.customer_account_id = account.id
20
+ end
21
+ guid = PleskKit::Communicator.pack_and_play_with self, account
22
+ PleskKit::Communicator.sync_subscription self, guid
23
+ self.id
24
+ end
25
+
26
+ def pack_this shell, customer
27
+ xml = shell
28
+ xml.instruct!
29
+ xml.packet(:version => '1.6.3.5') {
30
+ xml.webspace {
31
+ xml.add{
32
+ xml.gen_setup{
33
+ xml.name(self.name)
34
+ xml.tag! 'owner-login', self.owner_login
35
+ xml.ip_address(self.ip_address)
36
+ }
37
+ xml.hosting{
38
+ xml.vrt_hst{
39
+ xml.property{
40
+ xml.name('ftp_login')
41
+ xml.value("#{customer.login}#{(0...4).map{ ('a'..'z').to_a[rand(26)] }.join}")
42
+ }
43
+ xml.property{
44
+ xml.name('ftp_password')
45
+ xml.value(customer.passwd)
46
+ }
47
+ xml.ip_address(self.ip_address)
48
+ }
49
+ }
50
+ xml.tag! 'plan-name', self.plan_name
51
+ }
52
+ }
53
+ }
54
+ puts xml.target!
55
+ return xml.target!
56
+ end
57
+
58
+ def sync_pack shell, sub_guid
59
+ xml = shell
60
+ xml.instruct!
61
+ xml.packet(:version => '1.6.3.5') {
62
+ xml.webspace{
63
+ xml.send(:"sync-subscription") {
64
+ xml.filter{
65
+ xml.guid(sub_guid)
66
+ }
67
+ }
68
+ }
69
+ }
70
+ end
71
+
72
+ def analyse response_string, customer = nil
73
+ xml = REXML::Document.new(response_string)
74
+ status = xml.root.elements['//status'].text if xml.root.elements['//status'].present?
75
+ if status == "error"
76
+ code = xml.root.elements['//errcode'].text
77
+ message = xml.root.elements['//errtext'].text
78
+ raise "#{code}: #{message}"
79
+ else
80
+ sub_guid = xml.root.elements['//guid'].text if xml.root.elements['//guid'].present?
81
+ end
82
+ return sub_guid || true # TODO save plesk_id? Probably not necessary as we have the customer login
83
+ end
84
+
85
+ end
86
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>PleskKit</title>
5
+ <%= stylesheet_link_tag "plesk_kit/application", :media => "all" %>
6
+ <%= javascript_include_tag "plesk_kit/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,33 @@
1
+ <%= form_for(@customer_account) do |f| %>
2
+ <% if @customer_account.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@customer_account.errors.count, "error") %> prohibited this customer_account from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @customer_account.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :cname %><br />
16
+ <%= f.text_field :cname %>
17
+ </div>
18
+ <div class="field">
19
+ <%= f.label :pname %><br />
20
+ <%= f.text_field :pname %>
21
+ </div>
22
+ <div class="field">
23
+ <%= f.label :login %><br />
24
+ <%= f.text_field :login %>
25
+ </div>
26
+ <div class="field">
27
+ <%= f.label :passwd %><br />
28
+ <%= f.text_field :passwd %>
29
+ </div>
30
+ <div class="actions">
31
+ <%= f.submit %>
32
+ </div>
33
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing customer_account</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @customer_account %> |
6
+ <%= link_to 'Back', customer_accounts_path %>
@@ -0,0 +1,29 @@
1
+ <h1>Listing customer_accounts</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Cname</th>
6
+ <th>Pname</th>
7
+ <th>Login</th>
8
+ <th>Passwd</th>
9
+ <th></th>
10
+ <th></th>
11
+ <th></th>
12
+ </tr>
13
+
14
+ <% @customer_accounts.each do |customer_account| %>
15
+ <tr>
16
+ <td><%= customer_account.cname %></td>
17
+ <td><%= customer_account.pname %></td>
18
+ <td><%= customer_account.login %></td>
19
+ <td><%= customer_account.passwd %></td>
20
+ <td><%= link_to 'Show', customer_account %></td>
21
+ <td><%= link_to 'Edit', edit_customer_account_path(customer_account) %></td>
22
+ <td><%= link_to 'Destroy', customer_account, method: :delete, data: { confirm: 'Are you sure?' } %></td>
23
+ </tr>
24
+ <% end %>
25
+ </table>
26
+
27
+ <br />
28
+
29
+ <%= link_to 'New Customer account', new_customer_account_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New customer_account</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', customer_accounts_path %>
@@ -0,0 +1,25 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <b>Cname:</b>
5
+ <%= @customer_account.cname %>
6
+ </p>
7
+
8
+ <p>
9
+ <b>Pname:</b>
10
+ <%= @customer_account.pname %>
11
+ </p>
12
+
13
+ <p>
14
+ <b>Login:</b>
15
+ <%= @customer_account.login %>
16
+ </p>
17
+
18
+ <p>
19
+ <b>Passwd:</b>
20
+ <%= @customer_account.passwd %>
21
+ </p>
22
+
23
+
24
+ <%= link_to 'Edit', edit_customer_account_path(@customer_account) %> |
25
+ <%= link_to 'Back', customer_accounts_path %>
@@ -0,0 +1,33 @@
1
+ <%= form_for(@reseller_account) do |f| %>
2
+ <% if @reseller_account.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@reseller_account.errors.count, "error") %> prohibited this reseller_account from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @reseller_account.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :cname %><br />
16
+ <%= f.text_field :cname %>
17
+ </div>
18
+ <div class="field">
19
+ <%= f.label :pname %><br />
20
+ <%= f.text_field :pname %>
21
+ </div>
22
+ <div class="field">
23
+ <%= f.label :login %><br />
24
+ <%= f.text_field :login %>
25
+ </div>
26
+ <div class="field">
27
+ <%= f.label :passwd %><br />
28
+ <%= f.text_field :passwd %>
29
+ </div>
30
+ <div class="actions">
31
+ <%= f.submit %>
32
+ </div>
33
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing reseller_account</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @reseller_account %> |
6
+ <%= link_to 'Back', reseller_accounts_path %>
@@ -0,0 +1,29 @@
1
+ <h1>Listing reseller_accounts</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Cname</th>
6
+ <th>Pname</th>
7
+ <th>Login</th>
8
+ <th>Passwd</th>
9
+ <th></th>
10
+ <th></th>
11
+ <th></th>
12
+ </tr>
13
+
14
+ <% @reseller_accounts.each do |reseller_account| %>
15
+ <tr>
16
+ <td><%= reseller_account.cname %></td>
17
+ <td><%= reseller_account.pname %></td>
18
+ <td><%= reseller_account.login %></td>
19
+ <td><%= reseller_account.passwd %></td>
20
+ <td><%= link_to 'Show', reseller_account %></td>
21
+ <td><%= link_to 'Edit', edit_reseller_account_path(reseller_account) %></td>
22
+ <td><%= link_to 'Destroy', reseller_account, method: :delete, data: { confirm: 'Are you sure?' } %></td>
23
+ </tr>
24
+ <% end %>
25
+ </table>
26
+
27
+ <br />
28
+
29
+ <%= link_to 'New Reseller account', new_reseller_account_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New reseller_account</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', reseller_accounts_path %>
@@ -0,0 +1,25 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <b>Cname:</b>
5
+ <%= @reseller_account.cname %>
6
+ </p>
7
+
8
+ <p>
9
+ <b>Pname:</b>
10
+ <%= @reseller_account.pname %>
11
+ </p>
12
+
13
+ <p>
14
+ <b>Login:</b>
15
+ <%= @reseller_account.login %>
16
+ </p>
17
+
18
+ <p>
19
+ <b>Passwd:</b>
20
+ <%= @reseller_account.passwd %>
21
+ </p>
22
+
23
+
24
+ <%= link_to 'Edit', edit_reseller_account_path(@reseller_account) %> |
25
+ <%= link_to 'Back', reseller_accounts_path %>
@@ -0,0 +1,37 @@
1
+ <%= form_for(@server) do |f| %>
2
+ <% if @server.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@server.errors.count, "error") %> prohibited this server from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @server.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :environment %><br />
16
+ <%= f.text_field :environment %>
17
+ </div>
18
+ <div class="field">
19
+ <%= f.label :host %><br />
20
+ <%= f.text_field :host %>
21
+ </div>
22
+ <div class="field">
23
+ <%= f.label :username %><br />
24
+ <%= f.text_field :username %>
25
+ </div>
26
+ <div class="field">
27
+ <%= f.label :password %><br />
28
+ <%= f.text_field :password %>
29
+ </div>
30
+ <div class="field">
31
+ <%= f.label :ghostname %><br />
32
+ <%= f.text_field :ghostname %>
33
+ </div>
34
+ <div class="actions">
35
+ <%= f.submit %>
36
+ </div>
37
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing server</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @server %> |
6
+ <%= link_to 'Back', servers_path %>
@@ -0,0 +1,31 @@
1
+ <h1>Listing servers</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Environment</th>
6
+ <th>Host</th>
7
+ <th>Username</th>
8
+ <th>Password</th>
9
+ <th>Ghostname</th>
10
+ <th></th>
11
+ <th></th>
12
+ <th></th>
13
+ </tr>
14
+
15
+ <% @servers.each do |server| %>
16
+ <tr>
17
+ <td><%= server.environment %></td>
18
+ <td><%= server.host %></td>
19
+ <td><%= server.username %></td>
20
+ <td><%= server.password %></td>
21
+ <td><%= server.ghostname %></td>
22
+ <td><%= link_to 'Show', server %></td>
23
+ <td><%= link_to 'Edit', edit_server_path(server) %></td>
24
+ <td><%= link_to 'Destroy', server, method: :delete, data: { confirm: 'Are you sure?' } %></td>
25
+ </tr>
26
+ <% end %>
27
+ </table>
28
+
29
+ <br />
30
+
31
+ <%= link_to 'New Server', new_server_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New server</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', servers_path %>
@@ -0,0 +1,30 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <b>Environment:</b>
5
+ <%= @server.environment %>
6
+ </p>
7
+
8
+ <p>
9
+ <b>Host:</b>
10
+ <%= @server.host %>
11
+ </p>
12
+
13
+ <p>
14
+ <b>Username:</b>
15
+ <%= @server.username %>
16
+ </p>
17
+
18
+ <p>
19
+ <b>Password:</b>
20
+ <%= @server.password %>
21
+ </p>
22
+
23
+ <p>
24
+ <b>Ghostname:</b>
25
+ <%= @server.ghostname %>
26
+ </p>
27
+
28
+
29
+ <%= link_to 'Edit', edit_server_path(@server) %> |
30
+ <%= link_to 'Back', servers_path %>
@@ -0,0 +1,49 @@
1
+ <%= form_for(@subscription) do |f| %>
2
+ <% if @subscription.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@subscription.errors.count, "error") %> prohibited this subscription from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @subscription.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :name %><br />
16
+ <%= f.text_field :name %>
17
+ </div>
18
+ <div class="field">
19
+ <%= f.label :owner_id %><br />
20
+ <%= f.text_field :owner_id %>
21
+ </div>
22
+ <div class="field">
23
+ <%= f.label :owner_login %><br />
24
+ <%= f.text_field :owner_login %>
25
+ </div>
26
+ <div class="field">
27
+ <%= f.label :ip_address %><br />
28
+ <%= f.text_field :ip_address %>
29
+ </div>
30
+ <div class="field">
31
+ <%= f.label :plan_name %><br />
32
+ <%= f.text_field :plan_name %>
33
+ </div>
34
+ <div class="field">
35
+ <%= f.label :service_plan_id %><br />
36
+ <%= f.number_field :service_plan_id %>
37
+ </div>
38
+ <div class="field">
39
+ <%= f.label :reseller_account_id %><br />
40
+ <%= f.number_field :reseller_account_id %>
41
+ </div>
42
+ <div class="field">
43
+ <%= f.label :customer_account_id %><br />
44
+ <%= f.number_field :customer_account_id %>
45
+ </div>
46
+ <div class="actions">
47
+ <%= f.submit %>
48
+ </div>
49
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing subscription</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @subscription %> |
6
+ <%= link_to 'Back', subscriptions_path %>
@@ -0,0 +1,33 @@
1
+ <h1>Listing subscriptions</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Name</th>
6
+ <th>Owner_id</th>
7
+ <th>Owner_login</th>
8
+ <th>Ip address</th>
9
+ <th>Plan_name</th>
10
+ <th>Service plan</th>
11
+ <th></th>
12
+ <th></th>
13
+ <th></th>
14
+ </tr>
15
+
16
+ <% @subscriptions.each do |subscription| %>
17
+ <tr>
18
+ <td><%= subscription.name %></td>
19
+ <td><%= subscription.owner_id %></td>
20
+ <td><%= subscription.owner_login %></td>
21
+ <td><%= subscription.ip_address %></td>
22
+ <td><%= subscription.plan_name %></td>
23
+ <td><%= subscription.service_plan_id %></td>
24
+ <td><%= link_to 'Show', subscription %></td>
25
+ <td><%= link_to 'Edit', edit_subscription_path(subscription) %></td>
26
+ <td><%= link_to 'Destroy', subscription, method: :delete, data: { confirm: 'Are you sure?' } %></td>
27
+ </tr>
28
+ <% end %>
29
+ </table>
30
+
31
+ <br />
32
+
33
+ <%= link_to 'New Subscription', new_subscription_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New subscription</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', subscriptions_path %>
@@ -0,0 +1,35 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <b>Name:</b>
5
+ <%= @subscription.name %>
6
+ </p>
7
+
8
+ <p>
9
+ <b>Owner_id:</b>
10
+ <%= @subscription.owner_id %>
11
+ </p>
12
+
13
+ <p>
14
+ <b>Owner_login:</b>
15
+ <%= @subscription.owner_login %>
16
+ </p>
17
+
18
+ <p>
19
+ <b>Ip address:</b>
20
+ <%= @subscription.ip_address %>
21
+ </p>
22
+
23
+ <p>
24
+ <b>Plan_name:</b>
25
+ <%= @subscription.plan_name %>
26
+ </p>
27
+
28
+ <p>
29
+ <b>Service plan:</b>
30
+ <%= @subscription.service_plan_id %>
31
+ </p>
32
+
33
+
34
+ <%= link_to 'Edit', edit_subscription_path(@subscription) %> |
35
+ <%= link_to 'Back', subscriptions_path %>
data/config/routes.rb ADDED
@@ -0,0 +1,8 @@
1
+ PleskKit::Engine.routes.draw do
2
+ resources :servers
3
+
4
+
5
+ resources :subscriptions
6
+ resources :reseller_accounts
7
+ resources :customer_accounts
8
+ end