实训配置页面

dev_bj
daiao 5 years ago
parent 5a4907eee2
commit fc921d37b0

@ -1060,6 +1060,7 @@ class ShixunsController < ApplicationController
mirror_ids = (@shixun.shixun_mirror_repositories.blank? ? [] : @shixun.shixun_mirror_repositories.map(&:id)) mirror_ids = (@shixun.shixun_mirror_repositories.blank? ? [] : @shixun.shixun_mirror_repositories.map(&:id))
update_miiror_id = [] update_miiror_id = []
@shixun.shixun_mirror_repositories.destroy_all @shixun.shixun_mirror_repositories.destroy_all
if params[:main_type].present? if params[:main_type].present?
update_miiror_id << params[:main_type].to_i update_miiror_id << params[:main_type].to_i
ShixunMirrorRepository.create(:shixun_id => @shixun.id, :mirror_repository_id => params[:main_type]) ShixunMirrorRepository.create(:shixun_id => @shixun.id, :mirror_repository_id => params[:main_type])
@ -1071,21 +1072,18 @@ class ShixunsController < ApplicationController
ShixunMirrorRepository.create(:shixun_id => @shixun.id, :mirror_repository_id => mirror) ShixunMirrorRepository.create(:shixun_id => @shixun.id, :mirror_repository_id => mirror)
end end
end end
# 超级管理员才能保存 中间层服务器pod信息的配置 # 超级管理员才能保存 中间层服务器pod信息的配置
if User.current.admin? || User.current.business? @shixun.shixun_service_configs.destroy_all
@shixun.shixun_service_configs.each_with_index do |config, index| params[:mirror_id].each_with_index do |mirror_id, index|
config.update_attributes(:cpu_limit => params[:cpu_limit][index], ShixunServiceConfig.create!(:shixun_id => @shixun.id,
:lower_cpu_limit => params[:lower_cpu_limit][index], :cpu_limit => params[:cpu_limit][index],
:memory_limit => params[:memory_limit][index], :lower_cpu_limit => params[:lower_cpu_limit][index],
# :resource_limit => params[:resource_limit][index], :memory_limit => params[:memory_limit][index],
:request_limit => params[:request_limit][index], # :resource_limit => params[:resource_limit][index],
:mirror_repository_id => params[:mirror_id][index]) :request_limit => params[:request_limit][index],
end :mirror_repository_id => mirror_id)
end end
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
begin begin
@shixun.save! @shixun.save!

@ -33,19 +33,19 @@
</div> </div>
</div> </div>
<div class="mb10 edu-back-white padding40-20"> <!-- <div class="mb10 edu-back-white padding40-20">-->
<p class="color-grey-6 font-16 mb30">简介</p> <!-- <p class="color-grey-6 font-16 mb30">简介</p>-->
<div class="df mb20"> <!-- <div class="df mb20">-->
<div class="flex1 mr20"> <!-- <div class="flex1 mr20">-->
<div id="setting_introduction" class="fl"> <!-- <div id="setting_introduction" class="fl">-->
<textarea name="shixun[description]"><%= @shixun.description %></textarea> <!-- <textarea name="shixun[description]"><%#= @shixun.description %></textarea>-->
</div> <!-- </div>-->
<p id="e_tip_in" class="edu-txt-right color-grey-cd font-12"></p> <!-- <p id="e_tip_in" class="edu-txt-right color-grey-cd font-12"></p>-->
<p id="e_tips_in" class="edu-txt-right color-grey-cd font-12"></p> <!-- <p id="e_tips_in" class="edu-txt-right color-grey-cd font-12"></p>-->
</div> <!-- </div>-->
<div style="width: 57px;">&nbsp;</div> <!-- <div style="width: 57px;">&nbsp;</div>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
<div class="mb10 edu-back-white padding40-20"> <div class="mb10 edu-back-white padding40-20">
<div class="clearfix mb20"> <div class="clearfix mb20">

Loading…
Cancel
Save