Add lots of chinese translations.
Add switch to development and production mode button.
This commit is contained in:
parent
a6f82e58d3
commit
645d945ccb
|
@ -148,7 +148,7 @@ class Admin::SitePanelController < OrbitAdminController
|
||||||
end
|
end
|
||||||
elsif params[:type] == 'open'
|
elsif params[:type] == 'open'
|
||||||
Thread.new do
|
Thread.new do
|
||||||
system("bundle exec rake exec_commands:exec_commands[#{params[:id]},,open_site]")
|
system("bundle exec rake exec_commands:exec_commands[#{params[:id]},,open_site,,#{params[:env]}]")
|
||||||
end
|
end
|
||||||
elsif params[:type] == 'detail'
|
elsif params[:type] == 'detail'
|
||||||
@site = SiteConstruct.find(params[:id])
|
@site = SiteConstruct.find(params[:id])
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<table class="table main-list default footable-loaded">
|
<table class="table main-list default footable-loaded">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Server name</th>
|
<th><%=t('client_management.server_name')%></th>
|
||||||
<th>Domain name</th>
|
<th><%=t('client_management.domain_name')%></th>
|
||||||
<th>Port</th>
|
<th>Port</th>
|
||||||
<th>Status</th>
|
<th><%=t('client_management.status')%></th>
|
||||||
<th>Action</th>
|
<th><%=t('client_management.action')%></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -26,23 +26,27 @@
|
||||||
<td><%=site.port%></td>
|
<td><%=site.port%></td>
|
||||||
<td class="site_status"><%= (site.status.blank? ? "not yet create" : status_relation[site.status]) %></td>
|
<td class="site_status"><%= (site.status.blank? ? "not yet create" : status_relation[site.status]) %></td>
|
||||||
<td>
|
<td>
|
||||||
<a href="#" title="see infos for <%=site.domain_name%>" class="btn btn-primary see_infos" data-id="<%=site.id.to_s%>">See infos</a>
|
<a href="#" title="<%=t("client_management.see_logs_for_site",{:site=>site.domain_name})%>" class="btn btn-primary see_infos" data-id="<%=site.id.to_s%>"><%=t('client_management.see_logs')%></a>
|
||||||
<% if site.status.blank? %>
|
<% if site.status.blank? %>
|
||||||
<a href="#" title="create <%=site.domain_name%>" class="btn btn-primary create_site" data-id="<%=site.id.to_s%>">Create site</a>
|
<a href="#" title="create <%=site.domain_name%>" class="btn btn-primary create_site" data-id="<%=site.id.to_s%>"><%=t('client_management.create_site')%></a>
|
||||||
<% elsif site.status == "error" || site.status == "finish" %>
|
<% elsif site.status == "error" || site.status == "finish" %>
|
||||||
<a href="#" title="recreate <%=site.domain_name%>" class="btn btn-primary create_site" data-id="<%=site.id.to_s%>">Recreate site</a>
|
<a href="#" title="recreate <%=site.domain_name%>" class="btn btn-primary create_site" data-id="<%=site.id.to_s%>"><%=t('client_management.recreate_site')%></a>
|
||||||
<a href="#" title="Delete <%=site.domain_name%>" class="btn btn-primary delete_site" data-id="<%=site.id.to_s%>">Delete site</a>
|
<a href="#" title="<%=t("client_management.delete_site_for_site",{:site=>site.domain_name})%>" class="btn btn-primary delete_site" data-id="<%=site.id.to_s%>"><%=t('client_management.delete_site')%></a>
|
||||||
<a href="#" title="Close <%=site.domain_name%>" class="btn btn-primary close_site" data-id="<%=site.id.to_s%>">Close site</a>
|
<a href="#" title="<%=t("client_management.close_site_for_site",{:site=>site.domain_name})%>" class="btn btn-primary close_site" data-id="<%=site.id.to_s%>"><%=t('client_management.close_site')%></a>
|
||||||
<a href="#" title="Restart <%=site.domain_name%>" class="btn btn-primary open_site" data-id="<%=site.id.to_s%>">Restart site</a>
|
<a href="#" title="Restart <%=site.domain_name%>" class="btn btn-primary open_site" data-id="<%=site.id.to_s%>"><%=t('client_management.restart_site')%></a>
|
||||||
<% elsif site.status == "closed" %>
|
<% elsif site.status == "closed" %>
|
||||||
<a href="#" title="Start <%=site.domain_name%>" class="btn btn-primary open_site" data-id="<%=site.id.to_s%>">Start site</a>
|
<a href="#" title="<%=t("client_management.start_site_for_site",{:site=>site.domain_name})%>" class="btn btn-primary open_site" data-id="<%=site.id.to_s%>"><%=t('client_management.start_site')%></a>
|
||||||
<% end%>
|
<% end%>
|
||||||
<a href="#" title="Exec commands on <%=site.domain_name%>" class="btn btn-primary exec_commands" data-id="<%=site.id.to_s%>">Exec commands</a>
|
<% if site.status.present? %>
|
||||||
<a href="<%=admin_site_panel_edit_site_path+"?id=#{site.id}&type=detail"%>" title="See <%=site.domain_name%> detail" class="btn btn-primary see_detail" data-id="<%=site.id.to_s%>">Detail</a>
|
<a href="#" title="<%=t("client_management.switch_to_development")%>" class="btn btn-primary open_site" data-id="<%=site.id.to_s%>" data-env="development"><%=t('client_management.switch_to_development')%></a>
|
||||||
<a href="<%=admin_site_panel_edit_site_path+"?id=#{site.id}&type=delete_from_list"%>" title="Delete <%=site.domain_name%> from list" class="btn btn-primary" data-id="<%=site.id.to_s%>">Delete from list</a>
|
<a href="#" title="<%=t("client_management.switch_to_production")%>" class="btn btn-primary open_site" data-id="<%=site.id.to_s%>" data-env="production"><%=t('client_management.switch_to_production')%></a>
|
||||||
|
<% end %>
|
||||||
|
<a href="#" title="<%=t("client_management.exec_commands_on_site",{:site=>site.domain_name})%>" class="btn btn-primary exec_commands" data-id="<%=site.id.to_s%>"><%=t('client_management.exec_commands')%></a>
|
||||||
|
<a href="<%=admin_site_panel_edit_site_path+"?id=#{site.id}&type=detail"%>" title="<%=t("client_management.see_detail_for_site",{:site=>site.domain_name})%>" class="btn btn-primary see_detail" data-id="<%=site.id.to_s%>"><%=t('client_management.detail')%></a>
|
||||||
|
<a href="<%=admin_site_panel_edit_site_path+"?id=#{site.id}&type=delete_from_list"%>" title="<%=t("client_management.delete_from_list_for_site",{:site=>site.domain_name})%>" class="btn btn-primary" data-id="<%=site.id.to_s%>"><%=t('client_management.delete_from_list')%></a>
|
||||||
<% if site.status == "finish" || site.status == "closed" %>
|
<% if site.status == "finish" || site.status == "closed" %>
|
||||||
<a href="<%=admin_site_panel_path+"?copy_id=#{site.id}"%>" title="Copy site to another site." class="btn btn-primary">Copy site</a>
|
<a href="<%=admin_site_panel_path+"?copy_id=#{site.id}"%>" title="<%=t('client_management.copy_site_hint')%>" class="btn btn-primary"><%=t('client_management.copy_site')%></a>
|
||||||
<a data-id="<%= site.id %>" title="edit cert setting." class="btn btn-primary open-cert-form">Edit cert Setting</a>
|
<a data-id="<%= site.id %>" title="<%=t('client_management.edit_cert_setting')%>" class="btn btn-primary open-cert-form"><%=t('client_management.edit_cert_setting')%></a>
|
||||||
<div id="<%= "cert-form-#{site.id}" %>" class="cert-form" style="display: none;">
|
<div id="<%= "cert-form-#{site.id}" %>" class="cert-form" style="display: none;">
|
||||||
<%= form_for site, as: 'site', url: "/#{I18n.locale}/admin/site_panel/update_cert_setting",method: "post" do |f| %>
|
<%= form_for site, as: 'site', url: "/#{I18n.locale}/admin/site_panel/update_cert_setting",method: "post" do |f| %>
|
||||||
<div>
|
<div>
|
||||||
|
@ -212,7 +216,10 @@
|
||||||
});
|
});
|
||||||
$('.open_site').click(function(){
|
$('.open_site').click(function(){
|
||||||
var item = this;
|
var item = this;
|
||||||
$.post("<%=admin_site_panel_edit_site_path%>",{'id':$(this).attr("data-id"),'type':'open'}).done(function(){
|
var env = $(this).data("env");
|
||||||
|
if( env == undefined )
|
||||||
|
env = "";
|
||||||
|
$.post("<%=admin_site_panel_edit_site_path%>",{'id':$(this).attr("data-id"),'type':'open','env': env}).done(function(){
|
||||||
show_infos_dialog(item);
|
show_infos_dialog(item);
|
||||||
item.remove();
|
item.remove();
|
||||||
});
|
});
|
||||||
|
@ -278,4 +285,9 @@
|
||||||
$('#cert-form-'+$(this).data('id')).dialog('open')
|
$('#cert-form-'+$(this).data('id')).dialog('open')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
<style type="text/css">
|
||||||
|
.delete_site{
|
||||||
|
background: #7d1a23;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -61,4 +61,30 @@ en:
|
||||||
confirm: Confirm
|
confirm: Confirm
|
||||||
cancel: Cancel
|
cancel: Cancel
|
||||||
please_input_confirm_delete: "Please input 'Confirm delete' to here."
|
please_input_confirm_delete: "Please input 'Confirm delete' to here."
|
||||||
confirm_delete: Confirm delete
|
confirm_delete: Confirm delete
|
||||||
|
action: Action
|
||||||
|
see_logs: See logs
|
||||||
|
see_logs_for_site: "see infos for %{site}"
|
||||||
|
start_site: Start site
|
||||||
|
start_site_for_site: "Start %{site}"
|
||||||
|
restart_site: Restart site
|
||||||
|
create_site: Create site
|
||||||
|
recreate_site: Recreate site
|
||||||
|
close_site: Close site
|
||||||
|
close_site_for_site: "Close %{site}"
|
||||||
|
delete_site: Delete site
|
||||||
|
delete_site_for_site: "Delete %{site}"
|
||||||
|
exec_commands: Exec commands
|
||||||
|
exec_commands_on_site: "Exec commands on %{site}"
|
||||||
|
copy_site: Copy site
|
||||||
|
copy_site_hint: Copy site to another site.
|
||||||
|
edit_cert_setting: Edit cert Setting
|
||||||
|
delete_from_list: Delete from list
|
||||||
|
delete_from_list_for_site: "Delete %{site} from list"
|
||||||
|
detail: See details
|
||||||
|
see_detail_for_site: "See details for %{site}"
|
||||||
|
status: Status
|
||||||
|
server_name: Server name
|
||||||
|
domain_name: Domain name
|
||||||
|
switch_to_development: Switch to development
|
||||||
|
switch_to_production: Switch to production
|
|
@ -2,11 +2,11 @@ zh_tw:
|
||||||
client_management:
|
client_management:
|
||||||
copy_source: 複製來源
|
copy_source: 複製來源
|
||||||
see_sites: 查看主機上的網站
|
see_sites: 查看主機上的網站
|
||||||
client_management: Client Management
|
client_management: 網站管理系統
|
||||||
my_sites: My Sites
|
my_sites: My Sites
|
||||||
help_and_faq: Help and FAQ
|
help_and_faq: Help and FAQ
|
||||||
get_in_contact: Contact CS
|
get_in_contact: Contact CS
|
||||||
site_list: Site List
|
site_list: 網站列表
|
||||||
add_site: Add Site
|
add_site: Add Site
|
||||||
please_wait: Please wait while we gather your sites.
|
please_wait: Please wait while we gather your sites.
|
||||||
tickets: Tickets
|
tickets: Tickets
|
||||||
|
@ -56,9 +56,35 @@ zh_tw:
|
||||||
receipt_status: Receipt Status
|
receipt_status: Receipt Status
|
||||||
loading_purchases: Loading Purchases
|
loading_purchases: Loading Purchases
|
||||||
create_site: Create Site
|
create_site: Create Site
|
||||||
sites_list: Site list
|
sites_list: 網站列表
|
||||||
server_manager: Server Manager
|
server_manager: 伺服器管理
|
||||||
confirm: Confirm
|
confirm: Confirm
|
||||||
cancel: Cancel
|
cancel: Cancel
|
||||||
please_input_confirm_delete: "請輸入'確認刪除'。"
|
please_input_confirm_delete: "請輸入'確認刪除'。"
|
||||||
confirm_delete: 確認刪除
|
confirm_delete: 確認刪除
|
||||||
|
action: 動作
|
||||||
|
see_logs: 查看log
|
||||||
|
see_logs_for_site: "查看%{site}的log"
|
||||||
|
start_site: 啟動網站
|
||||||
|
start_site_for_site: "啟動%{site}"
|
||||||
|
restart_site: 重啟網站
|
||||||
|
create_site: 架站
|
||||||
|
recreate_site: 重新架站
|
||||||
|
close_site: 關閉網站
|
||||||
|
close_site_for_site: "關閉%{site}"
|
||||||
|
delete_site: 永久刪除網站
|
||||||
|
delete_site_for_site: "永久刪除%{site}"
|
||||||
|
exec_commands: 執行指令
|
||||||
|
exec_commands_on_site: "在%{site}上執行指令"
|
||||||
|
copy_site: 複製網站
|
||||||
|
copy_site_hint: 將該網站的資料複製到新的網站
|
||||||
|
edit_cert_setting: 更改憑證設定
|
||||||
|
delete_from_list: 從列表上刪除
|
||||||
|
delete_from_list_for_site: "將%{site}從列表上移除(暫時隱藏)"
|
||||||
|
detail: 查看設定
|
||||||
|
see_detail_for_site: "查看%{site}的設定"
|
||||||
|
status: 狀態
|
||||||
|
server_name: 伺服器名稱
|
||||||
|
domain_name: 網域名稱
|
||||||
|
switch_to_development: 切換到development模式
|
||||||
|
switch_to_production: 切換到production模式
|
|
@ -13,8 +13,8 @@ module ClientManagement
|
||||||
side_bar do
|
side_bar do
|
||||||
head_label_i18n 'client_management.client_management', icon_class: "icons-users"
|
head_label_i18n 'client_management.client_management', icon_class: "icons-users"
|
||||||
available_for "users"
|
available_for "users"
|
||||||
active_for_controllers (['admin/client_managements'])
|
active_for_controllers (['admin/site_panels'])
|
||||||
head_link_path "admin_client_managements_path"
|
head_link_path "admin_site_panel_server_manager_path"
|
||||||
|
|
||||||
context_link 'client_management.new_requests',
|
context_link 'client_management.new_requests',
|
||||||
:link_path=>"admin_client_managements_path" ,
|
:link_path=>"admin_client_managements_path" ,
|
||||||
|
|
|
@ -2,7 +2,7 @@ require 'net/ssh'
|
||||||
require 'pathname'
|
require 'pathname'
|
||||||
namespace :exec_commands do
|
namespace :exec_commands do
|
||||||
desc "Exec commands Script"
|
desc "Exec commands Script"
|
||||||
task :exec_commands,[:site_construct_id,:commands,:type,:server_name] => :environment do |task,args|
|
task :exec_commands,[:site_construct_id,:commands,:type,:server_name,:rails_env] => :environment do |task,args|
|
||||||
@type = args.type
|
@type = args.type
|
||||||
if !args.site_construct_id.blank?
|
if !args.site_construct_id.blank?
|
||||||
@site_construct = SiteConstruct.find(args.site_construct_id)
|
@site_construct = SiteConstruct.find(args.site_construct_id)
|
||||||
|
@ -54,6 +54,9 @@ namespace :exec_commands do
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if args.rails_env.present?
|
||||||
|
rails_env = args.rails_env
|
||||||
|
end
|
||||||
update_infos_for_exec("starting site to #{rails_env}")
|
update_infos_for_exec("starting site to #{rails_env}")
|
||||||
outputs = exec_ssh_command_by_sudo_and_see_output(ssh,"sudo -p 'sudo password:' chmod 777 #{@site_construct.path}/#{@site_construct.site_name} -R",false)
|
outputs = exec_ssh_command_by_sudo_and_see_output(ssh,"sudo -p 'sudo password:' chmod 777 #{@site_construct.path}/#{@site_construct.site_name} -R",false)
|
||||||
output = exec_ssh_command_by_sudo_and_see_output(ssh,"bash -l -c 'cd #{@site_construct.path}/#{@site_construct.site_name}\nkill -s TERM `fuser tmp/unicorn.sock`\nsudo -p \"sudo password:\" kill -s TERM `sudo -p \"sudo password:\" fuser tmp/unicorn.sock`\nsudo -p \"sudo password:\" rm -f tmp/pids/unicorn.pid\nbundle exec unicorn_rails -c config/unicorn.rb -D -E #{rails_env}\n'",false)
|
output = exec_ssh_command_by_sudo_and_see_output(ssh,"bash -l -c 'cd #{@site_construct.path}/#{@site_construct.site_name}\nkill -s TERM `fuser tmp/unicorn.sock`\nsudo -p \"sudo password:\" kill -s TERM `sudo -p \"sudo password:\" fuser tmp/unicorn.sock`\nsudo -p \"sudo password:\" rm -f tmp/pids/unicorn.pid\nbundle exec unicorn_rails -c config/unicorn.rb -D -E #{rails_env}\n'",false)
|
||||||
|
|
Loading…
Reference in New Issue