fix error

This commit is contained in:
BOYA,CHIU 2021-07-21 14:56:48 +08:00
parent 038603dd32
commit 065bf51290
2 changed files with 5 additions and 4 deletions

View File

@ -1,5 +1,5 @@
class Admin::SitePanelController < OrbitAdminController
before_action :check_server_ability, only: [:index]
before_action :check_server_ability, only: [:index,:server_manager]
def initialize
super
@app_title = "client_management"
@ -141,6 +141,7 @@ class Admin::SitePanelController < OrbitAdminController
site_construct.user_id = current_user.id.to_s
site_construct.status = "creating"
site_construct.save
check_server_ability(1)
git_url = "http://ruling.digital/git"#"http://gitlab.tp.rulingcom.com/orbit_chiu1/orbit4-5.git"
git_template_url = "http://gitlab.tp.rulingcom.com/themes/default-theme.git"
git_extension_url = "http://gitlab.tp.rulingcom.com/core/default-modules.git"
@ -281,10 +282,10 @@ class Admin::SitePanelController < OrbitAdminController
def site_server_params
params.require(:site_server).permit! rescue {}
end
def check_server_ability
def check_server_ability(site_num_add=0)
store_token = current_site.store_token
network = ONetwork.new(OrbitStore::URL,"post")
site_num = SiteConstruct.where(:hidden.ne=> true,:status => 'finish').count
site_num = SiteConstruct.where(:hidden.ne=> true,:status => 'finish',:server_type.in => SiteServer.all.collect(&:server_name)).count + site_num_add
response = network.request("/xhr/check_server_ability",
{"store_token" => store_token,
"site_num" => site_num,

View File

@ -13,7 +13,7 @@
<td>
<p>
Active: <%=SiteConstruct.where(:hidden.ne=> true,:server_type => site_server.server_name,:status=>"finish").count %><br>
Closed: <%=SiteConstruct.where(::hidden.ne=> true,server_type => site_server.server_name,:status=>"closed").count %><br>
Closed: <%=SiteConstruct.where(:hidden.ne=> true,server_type => site_server.server_name,:status=>"closed").count %><br>
Not yet installed: <%=SiteConstruct.where(:hidden.ne=> true,:server_type => site_server.server_name,:status=>"").count %><br>
Production: <%=SiteConstruct.where(:hidden.ne=> true,:server_type => site_server.server_name,:rails_env=>"production",:status=>"finish").count %><br>
Development: <%=SiteConstruct.where(:hidden.ne=> true,:server_type => site_server.server_name,:rails_env.in=>["development",nil],:status=>"finish").count %><br>