Merge branch 'dev_shixun_project' of https://git.trustie.net/jacknudt/trustieforge into dev_shixun_project
This commit is contained in:
commit
20bbfe7d4e
|
@ -67,6 +67,7 @@ class GamesController < ApplicationController
|
|||
gitUrl = Base64.encode64(gitUrl)
|
||||
taskId = params[:id]
|
||||
jobName = "myshixun_#{@myshixun.id}"
|
||||
@game.update_attribute(:status, 1)
|
||||
# input = {}
|
||||
# output = {}
|
||||
# test_sets = @game.test_sets
|
||||
|
@ -78,20 +79,18 @@ class GamesController < ApplicationController
|
|||
# end
|
||||
|
||||
step = @game.stage
|
||||
if @game.status == 0
|
||||
params = {:jobName => "#{jobName}", :taskId => "#{taskId}", :step => "#{step}", :gitUrl => "#{gitUrl}"}
|
||||
uri = URI.parse("http://123.59.135.74:9999/jenkins-exec/api/buildJob")
|
||||
res = uri_exec uri, params
|
||||
@game.update_attribute(:status, 1)
|
||||
@outputs = @game.outputs
|
||||
end
|
||||
params = {:jobName => "#{jobName}", :taskId => "#{taskId}", :step => "#{step}", :gitUrl => "#{gitUrl}"}
|
||||
uri = URI.parse("http://123.59.135.74:9999/jenkins-exec/api/buildJob")
|
||||
res = uri_exec uri, params
|
||||
@outputs = @game.outputs
|
||||
|
||||
end
|
||||
|
||||
|
||||
def game_status
|
||||
@outputs = @game.outputs
|
||||
@latest_output = @game.latest_output.try(:out_put)
|
||||
render :json => {status: @game.status, outputs: @outputs, latest_output:@latest_output}
|
||||
render :json => {status: @game.status}
|
||||
end
|
||||
|
||||
# 自动推送下一个任务
|
||||
|
|
|
@ -68,7 +68,7 @@ class ShixunsController < ApplicationController
|
|||
def create
|
||||
@shixun = Shixun.new(params[:shixun])
|
||||
@shixun.user_id = User.current.id
|
||||
|
||||
params[:shixun][:is_public] == "on" ? @shixun.is_public = 1 : @shixun.is_public = 0
|
||||
respond_to do |format|
|
||||
if @shixun.save
|
||||
m = ShixunMember.new(:user_id => User.current.id, :role => 1)
|
||||
|
|
|
@ -84,19 +84,19 @@
|
|||
});
|
||||
|
||||
function training_task_submmit(){
|
||||
$("#game_commit").html("<a class='task-btn mb10'>评测中..</a>");
|
||||
$.ajax({
|
||||
url: '<%= game_build_myshixun_game_path(@game, @myshixun) %>',
|
||||
url: '<%= game_build_myshixun_game_path(@game, :myshixun_id => @myshixun) %>',
|
||||
success: function (){
|
||||
$("#training_tasl_commit").html("<span class='task-display-span alert-blue mt10'>当前任务正在后台测评中,稍后将显示您的任务完成情况......</span>");
|
||||
|
||||
//循环等1分钟
|
||||
var intId = setInterval(function(){
|
||||
$.ajax({
|
||||
url: '<%= game_status_myshixun_game_path(@game) %>',
|
||||
url: '<%= game_status_myshixun_game_path(@game, :myshixun_id => @myshixun) %>',
|
||||
data:'test',
|
||||
success:function(data){
|
||||
//如果查到了,就退出
|
||||
alert(data.status);
|
||||
if(data.status == 2 || data.status == 1){
|
||||
if(data.status == 2 || data.status == 0){
|
||||
alert("进来了");
|
||||
clearInterval(intId);
|
||||
var html = bt('t:exec_results',{status: data.status});
|
||||
|
@ -105,7 +105,7 @@
|
|||
}
|
||||
}
|
||||
});
|
||||
}, 6000);
|
||||
}, 2000);
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
</div>
|
||||
<% end %>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%= l(:label_projects_new_name)%> :</label>
|
||||
<label><span class="c_red">*</span> 实训名称 :</label>
|
||||
<%= f.text_field :name, :class => "project_new_input project_new_input_project_new", :placeholder => "例如:团队协作方法与机制研究", :onkeyup => "regex_project_name();" %>
|
||||
<p class="c_orange ml70" id="project_name_notice" style="display: none;">项目名称不能为空</p>
|
||||
<p class="c_orange ml70" id="project_name_notice" style="display: none;">实训名称不能为空</p>
|
||||
</li>
|
||||
<li class="ml45 mb10">
|
||||
<label class="fl mr5"> <%= l(:label_tags_project_description) %> :</label>
|
||||
<label class="fl mr5"> 预备知识 :</label>
|
||||
<%= f.kindeditor :description, :editor_id => 'project_create_editor',
|
||||
:owner_id => @project.nil? ? 0: @project.id,
|
||||
:owner_type => OwnerTypeHelper::PROJECT,
|
||||
|
@ -33,7 +33,7 @@
|
|||
</li>
|
||||
<li class="mb5 ml70">
|
||||
<label > 公开 :</label>
|
||||
<%= f.text_field :is_public, :id => "project_is_public", :name => "project[is_public]", :type => "checkbox", :value => "1", :checked => "checked" %>
|
||||
<%= f.text_field :is_public, :id => "project_is_public", :name => "shixun[is_public]", :type => "checkbox", :value => "1", :checked => "checked" %>
|
||||
<span class="c_grey">(打钩为公开项目,不打钩为私有项目;私有项目仅项目成员可见。)</span>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<% end %>
|
||||
<%= error_messages_for 'project' %>
|
||||
<div class="project_r_h02">
|
||||
<h2 class="project_h2"><%= l(:label_project_new)%></h2>
|
||||
<h2 class="project_h2">新建实训</h2>
|
||||
</div>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
|
|
@ -149,7 +149,7 @@ a.rightbar-pause{ color:#29bd8b; font-size: 18px; margin-right:245px; margin-top
|
|||
.panel-form{ width:800px; margin:0 100px; padding:30px 0; line-height: 40px; }
|
||||
.panel-form li{ margin-bottom:20px; font-size: 14px; color:#666;}
|
||||
.panel-form-label{ display:inline-block; width:90px; text-align:right; }
|
||||
.panel-form input,.panel-form textarea{ border:1px solid #e2e2e2;color:#666;line-height: 40px;}
|
||||
.panel-form input,.panel-form textarea{ border:1px solid #e2e2e2;color:#666;line-height: 1.9;}
|
||||
.panel-form-width-690{ width: 690px; padding:5px;}
|
||||
.panel-form-width-670{ width: 670px; padding:5px;}
|
||||
.panel-form-height-150{ height: 150px;}
|
||||
|
|
Loading…
Reference in New Issue