Merge branches 'dev_aliyun' and 'dev_jupyter' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_jupyter
commit
d341889aae
@ -0,0 +1,46 @@
|
|||||||
|
|
||||||
|
class JupytersController < ApplicationController
|
||||||
|
include JupyterService
|
||||||
|
|
||||||
|
before_action :shixun, only: [:open, :open1, :test, :save]
|
||||||
|
|
||||||
|
def save_with_tpi
|
||||||
|
myshixun = Myshixun.find_by(identifier: params[:identifier])
|
||||||
|
jupyter_save_with_game(myshixun, params[:jupyter_port])
|
||||||
|
render json: {status: 0}
|
||||||
|
end
|
||||||
|
|
||||||
|
def save_with_tpm
|
||||||
|
shixun = Shixun.find_by(identifier: params[:identifier])
|
||||||
|
jupyter_save_with_shixun(shixun, params[:jupyter_port])
|
||||||
|
render json: {status: 0}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_info_with_tpi
|
||||||
|
myshixun = Myshixun.find_by(identifier: params[:identifier])
|
||||||
|
url = jupyter_url_with_game(myshixun)
|
||||||
|
port = jupyter_port_with_game(myshixun)
|
||||||
|
render json: {status: 0, url: url, port: port}
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_info_with_tpm
|
||||||
|
shixun = Shixun.find_by(identifier: params[:identifier])
|
||||||
|
url = jupyter_url_with_shixun(shixun)
|
||||||
|
port = jupyter_port_with_shixun(shixun)
|
||||||
|
render json: {status: 0, url: url, port: port}
|
||||||
|
end
|
||||||
|
|
||||||
|
def reset_with_tpi
|
||||||
|
myshixun = Myshixun.find_by(identifier: params[:identifier])
|
||||||
|
info = jupyter_tpi_reset(myshixun)
|
||||||
|
render json: {status: 0, url: info[:url], port: info[:port]}
|
||||||
|
end
|
||||||
|
|
||||||
|
def reset_with_tpm
|
||||||
|
shixun = Shixun.find_by(identifier: params[:identifier])
|
||||||
|
info = jupyter_tpm_reset(shixun)
|
||||||
|
render json: {status: 0, url: info[:url], port: info[:port]}
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
@ -1,4 +1,6 @@
|
|||||||
class ShixunServiceConfig < ApplicationRecord
|
class ShixunServiceConfig < ApplicationRecord
|
||||||
belongs_to :shixun
|
belongs_to :shixun
|
||||||
belongs_to :mirror_repository
|
belongs_to :mirror_repository
|
||||||
|
|
||||||
|
validates_presence_of :shixun_id, :mirror_repository_id
|
||||||
end
|
end
|
||||||
|
@ -0,0 +1,109 @@
|
|||||||
|
class CreateShixunService < ApplicationService
|
||||||
|
attr_reader :user, :params, :permit_params
|
||||||
|
|
||||||
|
def initialize(user, permit_params, params)
|
||||||
|
@user = user
|
||||||
|
@params = params
|
||||||
|
@permit_params = permit_params
|
||||||
|
end
|
||||||
|
|
||||||
|
def call
|
||||||
|
shixun = Shixun.new(permit_params)
|
||||||
|
identifier = Util::UUID.generate_identifier(Shixun, 8)
|
||||||
|
shixun.identifier= identifier
|
||||||
|
shixun.user_id = user.id
|
||||||
|
main_mirror = MirrorRepository.find params[:main_type]
|
||||||
|
sub_mirrors = MirrorRepository.where(id: params[:sub_type])
|
||||||
|
begin
|
||||||
|
ActiveRecord::Base.transaction do
|
||||||
|
shixun.save!
|
||||||
|
# 获取脚本内容
|
||||||
|
shixun_script = get_shixun_script(shixun, main_mirror, sub_mirrors)
|
||||||
|
# 创建额外信息
|
||||||
|
ShixunInfo.create!(shixun_id: shixun.id, evaluate_script: shixun_script, description: params[:description])
|
||||||
|
# 创建合作者
|
||||||
|
shixun.shixun_members.create!(user_id: user.id, role: 1)
|
||||||
|
# 创建镜像
|
||||||
|
ShixunMirrorRepository.create!(:shixun_id => shixun.id, :mirror_repository_id => main_mirror.id)
|
||||||
|
# 创建主服务配置
|
||||||
|
ShixunServiceConfig.create!(:shixun_id => shixun.id, :mirror_repository_id => main_mirror.id)
|
||||||
|
# 创建子镜像相关数据(实训镜像关联表,子镜像服务配置)
|
||||||
|
sub_mirrors.each do |sub|
|
||||||
|
ShixunMirrorRepository.create!(:shixun_id => shixun.id, :mirror_repository_id => sub.id)
|
||||||
|
# 实训子镜像服务配置
|
||||||
|
name = sub.name #查看镜像是否有名称,如果没有名称就不用服务配置
|
||||||
|
ShixunServiceConfig.create!(:shixun_id => shixun.id, :mirror_repository_id => sub.id) if name.present?
|
||||||
|
end
|
||||||
|
# 创建版本库
|
||||||
|
repo_path = repo_namespace(user.login, shixun.identifier)
|
||||||
|
GitService.add_repository(repo_path: repo_path)
|
||||||
|
shixun.update_column(:repo_name, repo_path.split(".")[0])
|
||||||
|
# 如果是云上实验室,创建相关记录
|
||||||
|
if !Laboratory.current.main_site?
|
||||||
|
Laboratory.current.laboratory_shixuns.create!(shixun: shixun, ownership: true)
|
||||||
|
end
|
||||||
|
return shixun
|
||||||
|
end
|
||||||
|
rescue => e
|
||||||
|
Rails.logger.error("shixun_create_error: #{e.message}")
|
||||||
|
raise("创建实训失败!")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def get_shixun_script shixun, main_mirror, sub_mirrors
|
||||||
|
if !shixun.is_jupyter?
|
||||||
|
mirror = main_mirror.mirror_scripts
|
||||||
|
if main_mirror.blank?
|
||||||
|
modify_shixun_script shixun, mirror.first&.(:script)
|
||||||
|
else
|
||||||
|
sub_name = sub_mirrors.pluck(:type_name)
|
||||||
|
if main_mirror.type_name == "Java" && sub_name.include?("Mysql")
|
||||||
|
mirror.last.try(:script)
|
||||||
|
else
|
||||||
|
shixun_script = mirror.first&.script
|
||||||
|
modify_shixun_script shixun, shixun_script
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def modify_shixun_script shixun, script
|
||||||
|
if script.present?
|
||||||
|
source_class_name = []
|
||||||
|
challenge_program_name = []
|
||||||
|
shixun.challenges.map(&:exec_path).each do |exec_path|
|
||||||
|
challenge_program_name << "\"#{exec_path}\""
|
||||||
|
if shixun.main_mirror_name == "Java"
|
||||||
|
if exec_path.nil? || exec_path.split("src/")[1].nil?
|
||||||
|
source = "\"\""
|
||||||
|
else
|
||||||
|
source = "\"#{exec_path.split("src/")[1].split(".java")[0]}\""
|
||||||
|
end
|
||||||
|
logger.info("----source: #{source}")
|
||||||
|
source_class_name << source.gsub("/", ".") if source.present?
|
||||||
|
elsif shixun.main_mirror_name.try(:first) == "C#"
|
||||||
|
if exec_path.nil? || exec_path.split(".")[1].nil?
|
||||||
|
source = "\"\""
|
||||||
|
else
|
||||||
|
source = "\"#{exec_path.split(".")[0]}.exe\""
|
||||||
|
end
|
||||||
|
source_class_name << source if source.present?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
script = if script.include?("sourceClassName") && script.include?("challengeProgramName")
|
||||||
|
script.gsub(/challengeProgramNames=\(.*\)/,"challengeProgramNames=\(#{challenge_program_name.reject(&:blank?).join(" ")}\)").gsub(/sourceClassNames=\(.*\)/, "sourceClassNames=\(#{source_class_name.reject(&:blank?).join(" ")}\)")
|
||||||
|
else
|
||||||
|
script.gsub(/challengeProgramNames=\(.*\)/,"challengeProgramNames=\(#{challenge_program_name.reject(&:blank?).join(" ")}\)").gsub(/sourceClassNames=\(.*\)/, "sourceClassNames=\(#{challenge_program_name.reject(&:blank?).join(" ")}\)")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return script
|
||||||
|
end
|
||||||
|
|
||||||
|
# 版本库目录空间
|
||||||
|
def repo_namespace(user, shixun_identifier)
|
||||||
|
"#{user}/#{shixun_identifier}.git"
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -0,0 +1,7 @@
|
|||||||
|
json.user do
|
||||||
|
json.partial! 'users/user', user: current_user
|
||||||
|
end
|
||||||
|
|
||||||
|
json.(@shixun, :id, :identifier, :status, :name)
|
||||||
|
json.myshixun_identifier @myshixun.identifier
|
||||||
|
json.tpm_modified @tpm_modified
|
@ -0,0 +1,11 @@
|
|||||||
|
json.data_sets do
|
||||||
|
json.array! @data_sets do |set|
|
||||||
|
json.id set.id
|
||||||
|
json.title set.title
|
||||||
|
json.author set.author.real_name
|
||||||
|
json.created_on set.created_on
|
||||||
|
json.filesize number_to_human_size(set.filesize)
|
||||||
|
json.file_path "#{@absolute_folder}/#{set.relative_path_filename}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
json.data_sets_count @data_count
|
@ -0,0 +1 @@
|
|||||||
|
json.identifier @myshixun.identifier
|
@ -1,4 +1,6 @@
|
|||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
require_relative '../config/boot'
|
require_relative '../config/boot'
|
||||||
|
|
||||||
|
|
||||||
require 'rake'
|
require 'rake'
|
||||||
Rake.application.run
|
Rake.application.run
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
class AddIsJupyterForShixuns < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
add_column :shixuns, :is_jupyter, :boolean, :default => false
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,17 @@
|
|||||||
|
class AddIndexForShixunSecretRepositories < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
shixun_ids = ShixunSecretRepository.pluck(:shixun_id).uniq
|
||||||
|
shixuns = Shixun.where(id: shixun_ids)
|
||||||
|
shixuns.find_each do |shixun|
|
||||||
|
id = shixun.shixun_secret_repository.id
|
||||||
|
shixun_secret_repositories = ShixunSecretRepository.where(shixun_id: shixun.id).where.not(id: id)
|
||||||
|
shixun_secret_repositories.destroy_all
|
||||||
|
end
|
||||||
|
|
||||||
|
remove_index :shixun_secret_repositories, :shixun_id
|
||||||
|
add_index :shixun_secret_repositories, :shixun_id, unique: true
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,35 @@
|
|||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
mysql:
|
||||||
|
image: mysql:5.7.17
|
||||||
|
command: --sql-mode=""
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- ./mysql_data/:/var/lib/mysql
|
||||||
|
ports:
|
||||||
|
- "3306:3306"
|
||||||
|
environment:
|
||||||
|
MYSQL_ROOT_PASSWORD: 123456789
|
||||||
|
MYSQL_DATABASE: educoder
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis:3.2
|
||||||
|
container_name: redis
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "6379:6379"
|
||||||
|
volumes:
|
||||||
|
- ./redis_data:/data
|
||||||
|
|
||||||
|
web:
|
||||||
|
image: guange/educoder:latest
|
||||||
|
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 4000 -b '0.0.0.0'"
|
||||||
|
stdin_open: true
|
||||||
|
tty: true
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
ports:
|
||||||
|
- "4000:4000"
|
||||||
|
depends_on:
|
||||||
|
- mysql
|
||||||
|
- redis
|
Binary file not shown.
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 112 KiB |
@ -0,0 +1,54 @@
|
|||||||
|
import React, {Component} from 'react';
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
} from 'antd';
|
||||||
|
|
||||||
|
class Bottomsubmit extends Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props)
|
||||||
|
|
||||||
|
this.state = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
cannelfun = () => {
|
||||||
|
// window.location.href=
|
||||||
|
this.props.history.replace(this.props.url);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
render() {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<style>
|
||||||
|
{
|
||||||
|
`
|
||||||
|
.newFooter{
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
`
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div className="clearfix bor-bottom-greyE edu-back-white orderingbox newshixunbottombtn">
|
||||||
|
<div className=" edu-txt-center padding13-30">
|
||||||
|
<button type="button" className="ant-btn mr20 newshixunmode backgroundFFF" onClick={() => this.cannelfun()}>
|
||||||
|
<span>取 消</span></button>
|
||||||
|
<Button type="button" className="ant-btn newshixunmode mr40 ant-btn-primary" type="primary"
|
||||||
|
htmlType="submit" onClick={() => this.props.onSubmits()}
|
||||||
|
loading={this.props.loadings}><span>{this.props.bottomvalue===undefined?"确 定":this.props.bottomvalue}</span></Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export default Bottomsubmit;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,593 @@
|
|||||||
|
import React, {Component} from 'react';
|
||||||
|
import {Redirect} from 'react-router';
|
||||||
|
import {List, Typography, Tag, Modal, Radio, Checkbox, Table, Pagination,Upload,notification} from 'antd';
|
||||||
|
import { NoneData } from 'educoder'
|
||||||
|
|
||||||
|
import TPMRightSection from './component/TPMRightSection';
|
||||||
|
import TPMNav from './component/TPMNav';
|
||||||
|
import axios from 'axios';
|
||||||
|
import './tpmmodel/tpmmodel.css'
|
||||||
|
import {getUploadActionUrltwo,appendFileSizeToUploadFileAll} from 'educoder';
|
||||||
|
import moment from 'moment';
|
||||||
|
|
||||||
|
const confirm = Modal.confirm;
|
||||||
|
|
||||||
|
class TPMDataset extends Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props)
|
||||||
|
this.state = {
|
||||||
|
value: undefined,
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
title: '文件',
|
||||||
|
dataIndex: 'title',
|
||||||
|
key: 'title',
|
||||||
|
align: 'left',
|
||||||
|
className: " font-14 wenjiantit",
|
||||||
|
width: '220px',
|
||||||
|
render: (text, record) => (
|
||||||
|
<div>
|
||||||
|
{record.title}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '最后修改时间',
|
||||||
|
dataIndex: 'timedata',
|
||||||
|
key: 'timedata',
|
||||||
|
align: 'center',
|
||||||
|
className: "edu-txt-center font-14 zuihoushijian",
|
||||||
|
width: '150px',
|
||||||
|
render: (text, record) => (
|
||||||
|
<div>
|
||||||
|
{record.timedata}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '最后修改人',
|
||||||
|
dataIndex: 'author',
|
||||||
|
key: 'author',
|
||||||
|
align: 'center',
|
||||||
|
className: "edu-txt-center font-14 ",
|
||||||
|
render: (text, record) => (
|
||||||
|
<div>
|
||||||
|
{record.author}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '文件大小',
|
||||||
|
dataIndex: 'filesize',
|
||||||
|
key: 'filesize',
|
||||||
|
align: 'center',
|
||||||
|
className: "edu-txt-center font-14 ",
|
||||||
|
render: (text, record) => (
|
||||||
|
<div>
|
||||||
|
{record.filesize}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
],
|
||||||
|
page: 1,
|
||||||
|
limit: 10,
|
||||||
|
selectedRowKeys: [],
|
||||||
|
mylistansum:30,
|
||||||
|
collaboratorList:[],
|
||||||
|
fileList:[],
|
||||||
|
fileListimgs:[],
|
||||||
|
file:null,
|
||||||
|
datalist:[],
|
||||||
|
data_sets_count:0,
|
||||||
|
selectedRowKeysdata:[],
|
||||||
|
loadingstate:false,
|
||||||
|
checked: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.setState({
|
||||||
|
loadingstate:true,
|
||||||
|
})
|
||||||
|
this.getdatas()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
mysonChange = (e) => {
|
||||||
|
// console.log(`全选checked = ${e.target.checked}`);
|
||||||
|
if (e.target.checked === true) {
|
||||||
|
let mydata=[];
|
||||||
|
let datas=[];
|
||||||
|
for(let i=0;i<this.state.collaboratorList.data_sets.length;i++){
|
||||||
|
mydata.push(this.state.collaboratorList.data_sets[i].id);
|
||||||
|
datas.push(i);
|
||||||
|
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
|
selectedRowKeysdata:mydata,
|
||||||
|
selectedRowKeys: datas,
|
||||||
|
checked:true,
|
||||||
|
})
|
||||||
|
// console.log(mydata);
|
||||||
|
// console.log(datas);
|
||||||
|
} else {
|
||||||
|
this.setState({
|
||||||
|
selectedRowKeysdata:[],
|
||||||
|
selectedRowKeys: [],
|
||||||
|
checked:false,
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getdatas = () => {
|
||||||
|
let id=this.props.match.params.shixunId;
|
||||||
|
|
||||||
|
let collaborators=`/shixuns/${id}/get_data_sets.json`;
|
||||||
|
axios.get(collaborators,{params:{
|
||||||
|
page:1,
|
||||||
|
limit:10,
|
||||||
|
}}).then((response)=> {
|
||||||
|
if(response.status===200){
|
||||||
|
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
|
||||||
|
|
||||||
|
}else{
|
||||||
|
let datalists=[];
|
||||||
|
for(let i=0;i<response.data.data_sets.length;i++){
|
||||||
|
const datas=response.data.data_sets;
|
||||||
|
var timedata = moment(datas[i].created_on).format('YYYY-MM-DD HH:mm');
|
||||||
|
datalists.push({
|
||||||
|
timedata:timedata,
|
||||||
|
author:datas[i].author,
|
||||||
|
filesize:datas[i].filesize,
|
||||||
|
id:datas[i].id,
|
||||||
|
title:datas[i].title,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
|
collaboratorList: response.data,
|
||||||
|
data_sets_count:response.data.data_sets_count,
|
||||||
|
datalist:datalists,
|
||||||
|
selectedRowKeysdata:[],
|
||||||
|
selectedRowKeys: [],
|
||||||
|
checked:false,
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
this.setState({
|
||||||
|
loadingstate:false,
|
||||||
|
})
|
||||||
|
}, 500)
|
||||||
|
|
||||||
|
}).catch((error)=>{
|
||||||
|
setTimeout(() => {
|
||||||
|
this.setState({
|
||||||
|
loadingstate:false,
|
||||||
|
})
|
||||||
|
}, 500)
|
||||||
|
console.log(error)
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
getdatastwo = (page,limit) => {
|
||||||
|
let id=this.props.match.params.shixunId;
|
||||||
|
|
||||||
|
let collaborators=`/shixuns/${id}/jupyter_data_sets.json`;
|
||||||
|
axios.get(collaborators,{params:{
|
||||||
|
page:page,
|
||||||
|
limit:limit,
|
||||||
|
}}).then((response)=> {
|
||||||
|
if(response.status===200){
|
||||||
|
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
|
||||||
|
|
||||||
|
}else{
|
||||||
|
let datalists=[];
|
||||||
|
for(let i=0;i<response.data.data_sets.length;i++){
|
||||||
|
const datas=response.data.data_sets;
|
||||||
|
var timedata = moment(datas[i].created_on).format('YYYY-MM-DD HH:mm');
|
||||||
|
datalists.push({
|
||||||
|
timedata:timedata,
|
||||||
|
author:datas[i].author,
|
||||||
|
filesize:datas[i].filesize,
|
||||||
|
id:datas[i].id,
|
||||||
|
title:datas[i].title,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
|
collaboratorList: response.data,
|
||||||
|
data_sets_count:response.data.data_sets_count,
|
||||||
|
datalist:datalists,
|
||||||
|
selectedRowKeysdata:[],
|
||||||
|
selectedRowKeys: [],
|
||||||
|
checked:false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
this.setState({
|
||||||
|
loadingstate:false,
|
||||||
|
})
|
||||||
|
}, 500)
|
||||||
|
}).catch((error)=>{
|
||||||
|
setTimeout(() => {
|
||||||
|
this.setState({
|
||||||
|
loadingstate:false,
|
||||||
|
})
|
||||||
|
}, 500)
|
||||||
|
console.log(error)
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getdatasthree = (page,limit) => {
|
||||||
|
let id=this.props.match.params.shixunId;
|
||||||
|
|
||||||
|
let collaborators=`/shixuns/${id}/jupyter_data_sets.json`;
|
||||||
|
axios.get(collaborators,{params:{
|
||||||
|
page:page,
|
||||||
|
limit:limit,
|
||||||
|
}}).then((response)=> {
|
||||||
|
if(response.status===200){
|
||||||
|
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}).catch((error)=>{
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
paginationonChanges = (pageNumber) => {
|
||||||
|
// //console.log('Page: ');
|
||||||
|
this.setState({
|
||||||
|
page: pageNumber,
|
||||||
|
loadingstate:true,
|
||||||
|
})
|
||||||
|
|
||||||
|
this.getdatastwo(pageNumber,10);
|
||||||
|
}
|
||||||
|
|
||||||
|
onSelectChange = (selectedRowKeys, selectedRows) => {
|
||||||
|
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
|
||||||
|
this.setState(
|
||||||
|
{
|
||||||
|
selectedRowKeys
|
||||||
|
}
|
||||||
|
);
|
||||||
|
let mydata=[];
|
||||||
|
for(let i=0;i<selectedRows.length;i++){
|
||||||
|
mydata.push(selectedRows[i].id);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
selectedRowKeysdata:mydata,
|
||||||
|
})
|
||||||
|
console.log(mydata);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
rowClassName = (record, index) => {
|
||||||
|
let className = 'light-row';
|
||||||
|
if (index % 2 === 1) className = 'dark-row';
|
||||||
|
return className;
|
||||||
|
}
|
||||||
|
handleChange = (info) => {
|
||||||
|
if(info.file.status == "done" || info.file.status == "uploading" || info.file.status === 'removed'){
|
||||||
|
let fileList = info.fileList;
|
||||||
|
this.setState({
|
||||||
|
fileList: appendFileSizeToUploadFileAll(fileList),
|
||||||
|
});
|
||||||
|
if(info.file.status === 'done'){
|
||||||
|
//done 成功就会调用这个方法
|
||||||
|
this.getdatas();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
onAttachmentRemove = (file) => {
|
||||||
|
// debugger
|
||||||
|
if(!file.percent || file.percent == 100){
|
||||||
|
confirm({
|
||||||
|
title: '确定要删除这个附件吗?',
|
||||||
|
okText: '确定',
|
||||||
|
cancelText: '取消',
|
||||||
|
// content: 'Some descriptions',
|
||||||
|
onOk: () => {
|
||||||
|
console.log("665")
|
||||||
|
this.deleteAttachment(file)
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
console.log('Cancel');
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteRemovedata(){
|
||||||
|
|
||||||
|
if(this.state.selectedRowKeysdata===undefined || this.state.selectedRowKeysdata===null ||this.state.selectedRowKeysdata.length===0){
|
||||||
|
|
||||||
|
this.props.showNotification(`请选择要删除的文件`);
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let id=this.props.match.params.shixunId;
|
||||||
|
|
||||||
|
confirm({
|
||||||
|
title: '确定要删除文件吗?',
|
||||||
|
okText: '确定',
|
||||||
|
cancelText: '取消',
|
||||||
|
// content: 'Some descriptions',
|
||||||
|
onOk: () => {
|
||||||
|
const url = `/shixuns/${id}/destroy_data_sets.json`;
|
||||||
|
axios.delete(url,
|
||||||
|
{ params: {
|
||||||
|
id:this.state.selectedRowKeysdata,
|
||||||
|
}}
|
||||||
|
)
|
||||||
|
.then((response) => {
|
||||||
|
if (response.data) {
|
||||||
|
const { status } = response.data;
|
||||||
|
if (status == 0) {
|
||||||
|
this.props.showNotification(`删除成功`);
|
||||||
|
|
||||||
|
this.getdatas()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
console.log('Cancel');
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
deleteAttachment = (file) => {
|
||||||
|
// console.log(file);
|
||||||
|
let id=file.response ==undefined ? file.id : file.response.id
|
||||||
|
const url = `/attachements/destroy_files.json`
|
||||||
|
axios.delete(url, {
|
||||||
|
id:[id],
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
if (response.data) {
|
||||||
|
const { status } = response.data;
|
||||||
|
if (status == 0) {
|
||||||
|
// console.log('--- success')
|
||||||
|
|
||||||
|
this.setState((state) => {
|
||||||
|
|
||||||
|
const index = state.fileList.indexOf(file);
|
||||||
|
const newFileList = state.fileList.slice();
|
||||||
|
newFileList.splice(index, 1);
|
||||||
|
return {
|
||||||
|
fileList: newFileList,
|
||||||
|
deleteisnot:true
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {tpmLoading, shixun, user, match} = this.props;
|
||||||
|
const {columns, page, limit, selectedRowKeys,mylistansum,fileList,datalist,data_sets_count,loadingstate} = this.state;
|
||||||
|
const rowSelection = {
|
||||||
|
selectedRowKeys,
|
||||||
|
onChange: this.onSelectChange,
|
||||||
|
};
|
||||||
|
// getCheckboxProps: record => ({
|
||||||
|
// disabled: record.name === 'Disabled User', // Column configuration not to be checked
|
||||||
|
// name: record.name,
|
||||||
|
// }),
|
||||||
|
let id=this.props.match.params.shixunId;
|
||||||
|
const uploadProps = {
|
||||||
|
width: 600,
|
||||||
|
fileList,
|
||||||
|
data:{
|
||||||
|
attachtype: 2,
|
||||||
|
container_id:this.props.match.params.shixunId,
|
||||||
|
container_type: "Shixun",
|
||||||
|
},
|
||||||
|
multiple: false,
|
||||||
|
//multiple 是否支持多选 查重的时候不能多选 不然弹许多框出来
|
||||||
|
// https://github.com/ant-design/ant-design/issues/15505
|
||||||
|
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
|
||||||
|
// showUploadList: false,
|
||||||
|
action: `${getUploadActionUrltwo(id)}`,
|
||||||
|
showUploadList:false,
|
||||||
|
onChange: this.handleChange,
|
||||||
|
onRemove: this.onAttachmentRemove,
|
||||||
|
beforeUpload: (file) => {
|
||||||
|
//上传前的操作
|
||||||
|
console.log('beforeUpload', file.name);
|
||||||
|
const isLt150M = file.size / 1024 / 1024 < 150;
|
||||||
|
if (!isLt150M) {
|
||||||
|
this.props.showNotification('文件大小必须小于150MB!');
|
||||||
|
}
|
||||||
|
return isLt150M;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<React.Fragment>
|
||||||
|
<div className="tpmComment educontent clearfix mt30 mb80">
|
||||||
|
|
||||||
|
<div className="with65 fl edu-back-white commentsDelegateParent">
|
||||||
|
|
||||||
|
<TPMNav
|
||||||
|
match={match}
|
||||||
|
user={user}
|
||||||
|
shixun={shixun}
|
||||||
|
{...this.props}
|
||||||
|
is_jupyter={this.props.is_jupyter}
|
||||||
|
></TPMNav>
|
||||||
|
|
||||||
|
<div className="padding20 edu-back-white mt20 " style={{minHeight: '463px'}}>
|
||||||
|
<div className="sortinxdirection">
|
||||||
|
|
||||||
|
<div className="tpmwidth">
|
||||||
|
<Checkbox checked={this.state.checked} onChange={this.mysonChange}>全选</Checkbox>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="tpmwidth xaxisreverseorder">
|
||||||
|
<style>
|
||||||
|
{
|
||||||
|
`
|
||||||
|
.ant-upload-list{
|
||||||
|
display:none
|
||||||
|
}
|
||||||
|
`
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div className="deletebuttom intermediatecenter "> <Upload {...uploadProps}><p className="deletebuttomtest" type="upload">
|
||||||
|
|
||||||
|
上传文件</p> </Upload></div>
|
||||||
|
{
|
||||||
|
data_sets_count>0?
|
||||||
|
<div
|
||||||
|
className={selectedRowKeys.length > 0 ? "deletebutomtextcode intermediatecenter mr21" : "deletebutom intermediatecenter mr21"} onClick={()=>this.deleteRemovedata()}>
|
||||||
|
<p className="deletebutomtext" >删除</p></div>
|
||||||
|
:""
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="mt24">
|
||||||
|
<style>{`
|
||||||
|
.ant-spin-nested-loading > div > .ant-spin .ant-spin-dot {
|
||||||
|
top: 72%;}
|
||||||
|
}
|
||||||
|
.edu-table .ant-table-tbody > tr > td {
|
||||||
|
height: 42px;
|
||||||
|
}
|
||||||
|
.edu-table .ant-table-thead > tr > th{
|
||||||
|
height: 42px;
|
||||||
|
}
|
||||||
|
.ysltableowss .ant-table-thead > tr > th{
|
||||||
|
height: 42px;
|
||||||
|
}
|
||||||
|
.ysltableowss .ant-table-tbody > tr > td{
|
||||||
|
height: 42px;
|
||||||
|
}
|
||||||
|
.ysltableowss .ant-table-thead > tr > th, .ant-table-tbody > tr > td {
|
||||||
|
padding: 9px;
|
||||||
|
}
|
||||||
|
.mysjysltable4 .ant-table-thead > tr > th, .ant-table-tbody > tr > td {
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
.ant-table-thead .ant-table-selection-column span{
|
||||||
|
visibility:hidden;
|
||||||
|
}
|
||||||
|
.ant-table-thead > tr > th {
|
||||||
|
background:#FFFFFF !important;
|
||||||
|
}
|
||||||
|
.ant-table table {
|
||||||
|
width: 100%;
|
||||||
|
text-align: left;
|
||||||
|
border-radius: 4px 4px 0 0;
|
||||||
|
border-collapse: separate;
|
||||||
|
border-spacing: 0;
|
||||||
|
border-left: 1px solid #eeeeee;
|
||||||
|
border-top: 1px solid #eeeeee;
|
||||||
|
border-right: 1px solid #eeeeee;
|
||||||
|
}
|
||||||
|
`}</style>
|
||||||
|
{data_sets_count===0?
|
||||||
|
<div className="edu-table edu-back-white ysltableowss">
|
||||||
|
<style>
|
||||||
|
{
|
||||||
|
`
|
||||||
|
.ant-table-tbody{
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
.ant-table-placeholder{
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
.ant-table table {
|
||||||
|
border-bottom: 1px solid #eeeeee !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
`
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<Table
|
||||||
|
columns={columns}
|
||||||
|
pagination={false}
|
||||||
|
className="mysjysltable4"
|
||||||
|
rowSelection={rowSelection}
|
||||||
|
rowClassName={this.rowClassName}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
:
|
||||||
|
<div className="edu-table edu-back-white ysltableowss">
|
||||||
|
<Table
|
||||||
|
dataSource={datalist}
|
||||||
|
columns={columns}
|
||||||
|
pagination={false}
|
||||||
|
className="mysjysltable4"
|
||||||
|
rowSelection={rowSelection}
|
||||||
|
rowClassName={this.rowClassName}
|
||||||
|
loading={loadingstate}
|
||||||
|
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
data_sets_count>=11?
|
||||||
|
<div className="edu-txt-center mt40 mb20">
|
||||||
|
<Pagination showQuickJumper current={page}
|
||||||
|
onChange={this.paginationonChanges} pageSize={limit}
|
||||||
|
total={data_sets_count}
|
||||||
|
></Pagination>
|
||||||
|
</div>
|
||||||
|
:""
|
||||||
|
}
|
||||||
|
|
||||||
|
{ data_sets_count===0?
|
||||||
|
<NoneData style={{width: '100%'}}></NoneData>:""
|
||||||
|
}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="with35 fr pl20">
|
||||||
|
<TPMRightSection
|
||||||
|
{...this.props}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</React.Fragment>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default TPMDataset;
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,105 @@
|
|||||||
|
.Resizer {
|
||||||
|
background: #000;
|
||||||
|
opacity: 0.2;
|
||||||
|
z-index: 1;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
-moz-background-clip: padding;
|
||||||
|
-webkit-background-clip: padding;
|
||||||
|
background-clip: padding-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.Resizer:hover {
|
||||||
|
-webkit-transition: all 2s ease;
|
||||||
|
transition: all 2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.Resizer.horizontal {
|
||||||
|
height: 11px;
|
||||||
|
margin: -5px 0;
|
||||||
|
border-top: 5px solid rgba(255, 255, 255, 0);
|
||||||
|
border-bottom: 5px solid rgba(255, 255, 255, 0);
|
||||||
|
cursor: row-resize;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.Resizer.horizontal:hover {
|
||||||
|
border-top: 5px solid rgba(0, 0, 0, 0.5);
|
||||||
|
border-bottom: 5px solid rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.Resizer.vertical {
|
||||||
|
width: 11px;
|
||||||
|
margin: 0 -5px;
|
||||||
|
border-left: 5px solid rgba(255, 255, 255, 0);
|
||||||
|
border-right: 5px solid rgba(255, 255, 255, 0);
|
||||||
|
cursor: col-resize;
|
||||||
|
}
|
||||||
|
|
||||||
|
.Resizer.vertical:hover {
|
||||||
|
border-left: 5px solid rgba(0, 0, 0, 0.5);
|
||||||
|
border-right: 5px solid rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
|
.Resizer.disabled {
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
.Resizer.disabled:hover {
|
||||||
|
border-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jupyter_area{
|
||||||
|
|
||||||
|
.jupyter_header{
|
||||||
|
position: relative;
|
||||||
|
height: 60px;
|
||||||
|
line-height: 60px;
|
||||||
|
background-color: #070F1A;
|
||||||
|
padding-left: 30px;
|
||||||
|
.jupyter_title{
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
// justify-content: space-around;
|
||||||
|
align-items: center;
|
||||||
|
height: 100%;
|
||||||
|
color: #fff;
|
||||||
|
.title_desc{
|
||||||
|
margin-top: 12px;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
.title_time{
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
// text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jupyter_btn{
|
||||||
|
position: absolute;
|
||||||
|
right: 10px;
|
||||||
|
top: 14px;
|
||||||
|
|
||||||
|
.btn_common{
|
||||||
|
color: #888;
|
||||||
|
}
|
||||||
|
.btn_common:hover{
|
||||||
|
// background-color: #29BD8B;
|
||||||
|
// color: #29BD8B;
|
||||||
|
color: #1890ff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.jupyter_ctx{
|
||||||
|
position: relative;
|
||||||
|
height: calc(100vh - 60px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.update_notice{
|
||||||
|
text-align: center;
|
||||||
|
.update_txt{
|
||||||
|
line-height: 18px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,88 @@
|
|||||||
|
/*
|
||||||
|
* @Description:
|
||||||
|
* @Author: tangjiang
|
||||||
|
* @Github:
|
||||||
|
* @Date: 2019-12-12 10:34:03
|
||||||
|
* @LastEditors: tangjiang
|
||||||
|
* @LastEditTime: 2019-12-13 16:28:33
|
||||||
|
*/
|
||||||
|
import './index.scss';
|
||||||
|
import React, { useState, useEffect } from 'react';
|
||||||
|
import {Icon, Empty, Pagination, Tooltip } from 'antd';
|
||||||
|
import MyIcon from '../../../../common/components/MyIcon';
|
||||||
|
|
||||||
|
function LeftPane (props) {
|
||||||
|
|
||||||
|
// 获取数据集
|
||||||
|
const {
|
||||||
|
dataSets = [],
|
||||||
|
total,
|
||||||
|
pagination,
|
||||||
|
onPageChange
|
||||||
|
} = props;
|
||||||
|
|
||||||
|
const emptyCtx = (
|
||||||
|
<div className="jupyter_empty">
|
||||||
|
<Empty />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
// const listCtx = ;
|
||||||
|
const [renderCtx, setRenderCtx] = useState(() => (emptyCtx));
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (dataSets.length > 0) {
|
||||||
|
console.log('数据集的个数: ', dataSets.length);
|
||||||
|
const oList = dataSets.map((item, i) => {
|
||||||
|
return (
|
||||||
|
<li className="jupyter_item" key={`key_${i}`}>
|
||||||
|
<Tooltip
|
||||||
|
placement="right"
|
||||||
|
title={item.file_path}
|
||||||
|
mouseLeaveDelay={0.3}
|
||||||
|
>
|
||||||
|
<Icon type="file-text" className="jupyter_icon"/>
|
||||||
|
<span className="jupyter_name">{item.title}</span>
|
||||||
|
</Tooltip>
|
||||||
|
</li>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
const oUl = (
|
||||||
|
<ul className="jupyter_data_list">
|
||||||
|
{ oList }
|
||||||
|
</ul>
|
||||||
|
);
|
||||||
|
|
||||||
|
setRenderCtx(oUl);
|
||||||
|
}
|
||||||
|
}, [props]);
|
||||||
|
|
||||||
|
// 分页处理
|
||||||
|
const handleChangePage = (page) => {
|
||||||
|
// console.log(page, pageSize);
|
||||||
|
// setCurrent(page);
|
||||||
|
onPageChange && onPageChange(page);
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<div className="jupyter_data_sets_area">
|
||||||
|
<h2 className="jupyter_h2_title">
|
||||||
|
<MyIcon type="iconwenti" className="jupyter_data_icon"/> 数据集
|
||||||
|
{/* <span className="iconfont icon-java jupyter_data_icon"></span>数据集 */}
|
||||||
|
</h2>
|
||||||
|
{ renderCtx }
|
||||||
|
<div className='jupyter_pagination'>
|
||||||
|
<Pagination
|
||||||
|
simple
|
||||||
|
current={pagination.page}
|
||||||
|
pageSize={pagination.limit}
|
||||||
|
total={total}
|
||||||
|
onChange={handleChangePage}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default LeftPane;
|
@ -0,0 +1,72 @@
|
|||||||
|
.jupyter_data_sets_area{
|
||||||
|
height: 100%;
|
||||||
|
background: #fff;
|
||||||
|
.jupyter_h2_title{
|
||||||
|
height: 44px;
|
||||||
|
line-height: 44px;
|
||||||
|
// background-color: #EEEEEE;
|
||||||
|
background: #fff;
|
||||||
|
padding: 0 30px;
|
||||||
|
font-size: 16px;
|
||||||
|
// box-size: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-bottom: 1px solid rgba(238,238,238,1);
|
||||||
|
.jupyter_data_icon{
|
||||||
|
// color: #7286ff;
|
||||||
|
color: #1890ff;
|
||||||
|
font-size: 24px;
|
||||||
|
position: relative;
|
||||||
|
top: 2px;
|
||||||
|
transform: scale(1.5);
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.jupyter_data_list,
|
||||||
|
.jupyter_empty{
|
||||||
|
height: calc(100vh - 160px);
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jupyter_data_list{
|
||||||
|
.jupyter_item{
|
||||||
|
line-height:45px;
|
||||||
|
border-bottom: 1px solid rgba(238,238,238, 1);
|
||||||
|
padding: 0 30px 0 60px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow:ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: .3s;
|
||||||
|
&:hover{
|
||||||
|
background-color: rgba(235, 235, 235, .3);
|
||||||
|
}
|
||||||
|
.jupyter_icon{
|
||||||
|
color: rgb(74, 188, 125);
|
||||||
|
font-size: 16px;
|
||||||
|
transform: scale(1.2);
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
.jupyter_name{
|
||||||
|
color: #000;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.jupyter_empty{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jupyter_pagination{
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 56px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-top: 1px solid rgba(238,238,238,1);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
.jupyter_right_pane_area{
|
||||||
|
position: relative;
|
||||||
|
height: calc(100vh - 60px);
|
||||||
|
// background: pink;
|
||||||
|
|
||||||
|
.jupyter_load_url_error,
|
||||||
|
.jupyter_loading_init{
|
||||||
|
display: flex;
|
||||||
|
position: relative;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
height: 100%;
|
||||||
|
&::before{
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
content: '';
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.jupyter_loading_init{
|
||||||
|
&::before{
|
||||||
|
background-color: rgba(0,0,0,.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.jupyter_load_url_error{
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
// &::before{
|
||||||
|
// background-color: rgba(0,0,0,.2);
|
||||||
|
// }
|
||||||
|
.jupyter_error_txt{
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
font-size: 12px;
|
||||||
|
.jupyter_reload{
|
||||||
|
cursor: pointer;
|
||||||
|
color: #1890ff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-error{
|
||||||
|
position: relative;
|
||||||
|
color: #DCE0E6;
|
||||||
|
transform: scale(5);
|
||||||
|
top: -35px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.jupyter_result{
|
||||||
|
height: 100%;
|
||||||
|
.jupyter_iframe{
|
||||||
|
height: calc(100% - 56px);
|
||||||
|
// background: pink;
|
||||||
|
.jupyter_iframe_style{
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.jupyter_submit{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 56px;
|
||||||
|
justify-content: flex-end;
|
||||||
|
padding-right: 30px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,111 @@
|
|||||||
|
import React, { Component } from 'react';
|
||||||
|
import {Button,Form,Input} from 'antd';
|
||||||
|
import axios from 'axios';
|
||||||
|
import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor';
|
||||||
|
class Osshackathonmd extends Component{
|
||||||
|
constructor(props) {
|
||||||
|
super(props)
|
||||||
|
this.contentMdRef = React.createRef();
|
||||||
|
this.state={
|
||||||
|
title_num: 0,
|
||||||
|
title_value: undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
componentDidUpdate =(prevState)=>{
|
||||||
|
// if(prevState!=this.props){
|
||||||
|
// let url=`/osshackathon/edit_hackathon.json`;
|
||||||
|
// axios.get(url).then((result)=>{
|
||||||
|
// if(result.status==200){
|
||||||
|
// this.setState({
|
||||||
|
// title_value:result.data.name
|
||||||
|
// })
|
||||||
|
// this.contentMdRef.current.setValue(result.data.description);
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
componentDidMount(){
|
||||||
|
let url=`/osshackathon/edit_hackathon.json`;
|
||||||
|
axios.get(url).then((result)=>{
|
||||||
|
if(result.status==200){
|
||||||
|
this.setState({
|
||||||
|
title_value:result.data.name
|
||||||
|
})
|
||||||
|
this.contentMdRef.current.setValue(result.data.description === null ? "" : result.data.description);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 输入title
|
||||||
|
changeTitle = (e) => {
|
||||||
|
// title_num: 60 - parseInt(e.target.value.length),
|
||||||
|
this.setState({
|
||||||
|
title_num: e.target.value.length,
|
||||||
|
title_value: e.target.value
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
handleSubmit = () => {
|
||||||
|
let {title_value}=this.state;
|
||||||
|
const mdContnet = this.contentMdRef.current.getValue().trim();
|
||||||
|
// if(mdContnet.length>10000){
|
||||||
|
// this.props.showNotification("内容超过10000个字");
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
|
||||||
|
let url=`/osshackathon/update_hackathon.json`;
|
||||||
|
axios.post(url,{
|
||||||
|
name:title_value,
|
||||||
|
description:mdContnet,
|
||||||
|
}
|
||||||
|
).then((response) => {
|
||||||
|
if(response.data.status===0){
|
||||||
|
this.props.getosshackathon()
|
||||||
|
this.props.hidehackathonedit()
|
||||||
|
this.props.showNotification(`提交成功`);
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
console.log(error)
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
render() {
|
||||||
|
|
||||||
|
|
||||||
|
// console.log(this.props.tabkey)
|
||||||
|
// console.log(chart_rules)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={"mt20"}>
|
||||||
|
<Form>
|
||||||
|
<Form.Item label="标题">
|
||||||
|
<Input placeholder="请输入标题"
|
||||||
|
value={this.state.title_value}
|
||||||
|
onInput={this.changeTitle}
|
||||||
|
className="searchView searchViewAfter h45input" style={{"width": "100%"}} maxLength="60"
|
||||||
|
addonAfter={String(this.state.title_value === undefined || this.state.title_value === null ? 0 : this.state.title_value.length) + "/60"}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item label="描述">
|
||||||
|
<TPMMDEditor ref={this.contentMdRef} placeholder="请输入描述" mdID={'courseContentMD'} refreshTimeout={1500}
|
||||||
|
className="courseMessageMD"
|
||||||
|
initValue={this.state.description === null ? "" : this.state.description}></TPMMDEditor>
|
||||||
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div className="clearfix mt30 mb30">
|
||||||
|
<div className={"fr"}>
|
||||||
|
<Button type="primary" onClick={this.handleSubmit} className="defalutSubmitbtn fl mr20">提交</Button>
|
||||||
|
<a className="defalutCancelbtn fl" onClick={() => this.props.hidehackathonedit()}>取消</ a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export default Osshackathonmd;
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,129 @@
|
|||||||
|
.tpmborder{
|
||||||
|
border: 1px solid;
|
||||||
|
}
|
||||||
|
/* 中间居中 */
|
||||||
|
.intermediatecenter{
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
/* 简单居中 */
|
||||||
|
.intermediatecenterysls{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.spacearound{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
|
||||||
|
}
|
||||||
|
.spacebetween{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
/* 头顶部居中 */
|
||||||
|
.topcenter{
|
||||||
|
display: -webkit-flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* x轴正方向排序 */
|
||||||
|
/* 一 二 三 四 五 六 七 八 */
|
||||||
|
.sortinxdirection{
|
||||||
|
display: flex;
|
||||||
|
flex-direction:row;
|
||||||
|
}
|
||||||
|
/* x轴反方向排序 */
|
||||||
|
/* 八 七 六 五 四 三 二 一 */
|
||||||
|
.xaxisreverseorder{
|
||||||
|
display: flex;
|
||||||
|
flex-direction:row-reverse;
|
||||||
|
}
|
||||||
|
/* 垂直布局 正方向*/
|
||||||
|
/* 一
|
||||||
|
二
|
||||||
|
三
|
||||||
|
四
|
||||||
|
五
|
||||||
|
六
|
||||||
|
七
|
||||||
|
八 */
|
||||||
|
.verticallayout{
|
||||||
|
display: flex;
|
||||||
|
flex-direction:column;
|
||||||
|
}
|
||||||
|
/* 垂直布局 反方向*/
|
||||||
|
.reversedirection{
|
||||||
|
display: flex;
|
||||||
|
flex-direction:column-reverse;
|
||||||
|
}
|
||||||
|
.deletebutom{
|
||||||
|
width:85px;
|
||||||
|
height:30px;
|
||||||
|
background:#C4C4C4;
|
||||||
|
border-radius:3px;
|
||||||
|
cursor:pointer
|
||||||
|
|
||||||
|
}
|
||||||
|
.deletebutomtext{
|
||||||
|
width:28px;
|
||||||
|
height:19px;
|
||||||
|
font-size:14px;
|
||||||
|
color:#FFFFFF;
|
||||||
|
line-height:19px;
|
||||||
|
cursor:pointer
|
||||||
|
}
|
||||||
|
.deletebuttom{
|
||||||
|
width:85px;
|
||||||
|
height:30px;
|
||||||
|
background:#29BD8B;
|
||||||
|
border-radius:3px;
|
||||||
|
cursor:pointer
|
||||||
|
}
|
||||||
|
.deletebuttomtest{
|
||||||
|
width:56px;
|
||||||
|
height:19px;
|
||||||
|
font-size:14px;
|
||||||
|
color:#FFFFFF;
|
||||||
|
line-height:19px;
|
||||||
|
cursor:pointer
|
||||||
|
|
||||||
|
}
|
||||||
|
.tpmwidth{
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
.mr21{
|
||||||
|
margin-right: 21px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wenjiantit{
|
||||||
|
width: 220px;
|
||||||
|
}
|
||||||
|
.zuihoushijian{
|
||||||
|
width: 125px;
|
||||||
|
}
|
||||||
|
.zuihouxiugairen{
|
||||||
|
width: 70px;
|
||||||
|
}
|
||||||
|
.wenjiandaxiao{
|
||||||
|
width: 56px;
|
||||||
|
}
|
||||||
|
.deletebutomtextcode{
|
||||||
|
width:85px;
|
||||||
|
height:30px;
|
||||||
|
background:#FF5555;
|
||||||
|
border-radius:3px;
|
||||||
|
cursor:pointer
|
||||||
|
|
||||||
|
}
|
||||||
|
.light-row{
|
||||||
|
background: #F7F7F8;
|
||||||
|
}
|
||||||
|
.dark-row{
|
||||||
|
background: #FFFFFF;
|
||||||
|
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue