|
|
|
@ -24,6 +24,10 @@ class ShixunsController < ApplicationController
|
|
|
|
|
|
|
|
|
|
before_action :special_allowed, only: [:send_to_course, :search_user_courses]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
helper_method :jupyter_url
|
|
|
|
|
|
|
|
|
|
## 获取课程列表
|
|
|
|
|
def index
|
|
|
|
|
@shixuns = current_laboratory.shixuns.unhidden
|
|
|
|
@ -528,6 +532,23 @@ class ShixunsController < ApplicationController
|
|
|
|
|
# @evaluate_scirpt = @shixun.evaluate_script || "无"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def jupyter_url(shixun)
|
|
|
|
|
#打开tpm - juypter接口
|
|
|
|
|
if shixun.is_jupyter?
|
|
|
|
|
shixun_tomcat = edu_setting('cloud_bridge')
|
|
|
|
|
uri = "#{shixun_tomcat}/bridge/jupyter/get"
|
|
|
|
|
tpiID = "tpm#{shixun.id}"
|
|
|
|
|
params = {tpiID: tpiID, :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"}
|
|
|
|
|
|
|
|
|
|
logger.info "test_juypter: uri->#{uri}, params->#{params}"
|
|
|
|
|
res = uri_post uri, params
|
|
|
|
|
logger.info "test_juypter: #{res}"
|
|
|
|
|
|
|
|
|
|
return "https://#{res['port']}.jupyter.educoder.net/notebooks/data/workspace/myshixun_#{tpiID}/01.ipynb"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 获取脚本内容
|
|
|
|
|
def get_script_contents
|
|
|
|
|
mirrir_script = MirrorScript.find(params[:script_id])
|
|
|
|
|