This commit is contained in:
BoHung Chiu 2021-04-01 17:53:05 +08:00
parent 645d945ccb
commit bc631ffd59
2 changed files with 17 additions and 3 deletions

View File

@ -30,7 +30,7 @@
<% 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%>"><%=t('client_management.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%>"><%=t('client_management.recreate_site')%></a> <a href="#" title="recreate <%=site.domain_name%>" class="btn btn-primary recreate_site" data-id="<%=site.id.to_s%>"><%=t('client_management.recreate_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="<%=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="<%=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="<%=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%>"><%=t('client_management.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>
@ -159,6 +159,20 @@
show_infos_dialog(item); show_infos_dialog(item);
}) })
}); });
$('.recreate_site').click(function(){
if(window.confirm("Do you really want to recreate this site?")){
if(window.confirm("Do you really want to recreate this site?")){
close_info = true;
window.clearTimeout(timeout_id);
close_info = false;
var id = $(this).attr("data-id");
var item = this;
$.post("<%= admin_site_panel_create_site_path %>",{'id': id}).done(function(){
show_infos_dialog(item);
})
}
}
});
$('.delete_site').click(function(){ $('.delete_site').click(function(){
var item = this; var item = this;
if(window.confirm("Do you really want to delete this site?")){ if(window.confirm("Do you really want to delete this site?")){
@ -248,7 +262,7 @@
}); });
} }
function exec_commands(){ function exec_commands(){
var commands = $('#commands_area').val().replace("\r\n","////"); var commands = $('#commands_area').val().replace(/(\r\n|\n)/,"////");
var id = $('#commands_area').attr('data-id'); var id = $('#commands_area').attr('data-id');
console.log(id); console.log(id);
console.log(commands); console.log(commands);

View File

@ -73,7 +73,7 @@ namespace :exec_commands do
update_infos_for_exec("finish starting #{@site_construct.site_name}") update_infos_for_exec("finish starting #{@site_construct.site_name}")
@site_construct.update(:status =>"finish") @site_construct.update(:status =>"finish")
elsif args.type == 'exec_all' elsif args.type == 'exec_all'
sites = SiteConstruct.where(:server_type=>args.server_name).to_a sites = SiteConstruct.where(:server_type=>site_server.server_name).to_a
commands = args.commands.split("////").select{|c| c != ""} rescue [args.commands] commands = args.commands.split("////").select{|c| c != ""} rescue [args.commands]
sites.each do |site_construct| sites.each do |site_construct|
@site_construct = site_construct @site_construct = site_construct