Browse Source

fix issue

tags/v1.22.3.2^2
zhoupzh 4 years ago
parent
commit
bca8cea156
4 changed files with 145 additions and 104 deletions
  1. +45
    -94
      templates/repo/attachment/edit.tmpl
  2. +28
    -0
      templates/repo/cloudbrain/new.tmpl
  3. +9
    -1
      templates/repo/datasets/index.tmpl
  4. +63
    -9
      web_src/js/index.js

+ 45
- 94
templates/repo/attachment/edit.tmpl View File

@@ -1,98 +1,49 @@
<style>
.active{
color: #0087f5!important;
border: 1px solid #0087f5!important;
/* margin: -1px!important; */
background: #fff!important;
}
</style>
{{template "base/head" .}}
<div class="repository">
{{template "repo/header" .}}
<div class="ui container">
<input type="hidden" id="postPath" value="{{.Link}}">
<div style="width: 80%;margin: auto;">
<h4 class="ui top attached header">
上传数据集文件
</h4>
<div class="ui attached segment" style="padding: 2em 3em;">
<div class="ui form" id="dataset-base">
<el-form label-width="140px">
{{.CsrfTokenHtml}}
<el-form-item label="存储位置:" prop="title">
<el-button :class="{active:type==0}" size="small" style="margin: 0;border-radius: 0.28571429rem 0 0 0.28571429rem;" @click="uploadGpu">CPU/GPU</el-button>
<el-button :class="{active:type==1}" size="small" style="margin: 0 0 0 -4px;border-radius: 0 0.28571429rem 0.28571429rem 0;" @click="uploadNpu">NPU</el-button>
<!-- <span>请输入字母、数字、_和-,最长64个字符,且不能以中划线(-)结尾。</span> -->
</el-form-item>
<el-form-item label="文件描述:" prop="description">
<el-input type="textarea" :rows="3" maxlength="255" v-model="desc"></el-input>
</el-form-item>
<el-form-item label="数据上传:" prop="category">
<minio-uploader :uploadtype="type" :desc="desc"></minio-uploader>
<!-- <obs-uploader v-if="type==1"></obs-uploader> -->
</el-form-item>
<!-- <el-form-item label="研究方向/应用领域" prop="task">
<el-select v-model="ruleForm.task" placeholder="请选择活动区域" style="width: 60%;">
<el-option label="区域一" value="shanghai"></el-option>
<el-option label="区域二" value="beijing"></el-option>
</el-select>
</el-form-item> -->
<!-- <el-form-item>
<el-button style="background-color: #21ba45;" type="success" @click="createDataset('ruleForm')">确定</el-button>
<el-button type="info" @click="cancelDataset">取消</el-button>
</el-form-item> -->
<div style='display:none;'
id="minioUploader-params"
data-uuid="{{.uuid}}"
data-add-url="{{.Repo.OwnerName}}/attachments/add"
data-accepts="{{.AttachmentAllowedTypes}}"
data-remove-url="{{AppSubUrl}}/attachments/delete"
data-csrf="{{.CsrfToken}}"
dataset-id={{.dataset.ID}}
data-max-file="100"
data-dataset-id="{{.dataset.ID}}"
data-max-size="{{.AttachmentMaxSize}}"
data-default-message="{{.i18n.Tr "dropzone.default_message"}}"
data-invalid-input-type="{{.i18n.Tr "dropzone.invalid_input_type"}}"
data-file-too-big="{{.i18n.Tr "dropzone.file_too_big"}}"
data-remove-file="{{.i18n.Tr "dropzone.remove_file"}}"
data-file-status='{{.i18n.Tr "dropzone.file_status"}}'
data-file-init-status='{{.i18n.Tr "dropzone.file_init_status"}}'
data-waitting-uploading='{{.i18n.Tr "dropzone.waitting_uploading"}}'
data-md5-computing='{{.i18n.Tr "dropzone.md5_computing"}}'
data-obs-connecting='{{.i18n.Tr "dropzone.obs-connecting"}}'
data-loading-file='{{.i18n.Tr "dropzone.loading_file"}}'
data-upload-complete='{{.i18n.Tr "dropzone.upload_complete"}}'
data-uploading='{{.i18n.Tr "dropzone.uploading"}}'
data-failed='{{.i18n.Tr "dropzone.failed"}}'
data-repopath='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/datasets'
>
</div>
<div id="datasetId" datasetId="{{.datasetId}}"></div>
</el-form>
</div>
</div>
</div>
<div style="width: 80%;margin: auto;padding-top: 2em;">
<!-- <p>说明:<br>
- 只有<span class="text blue">zip格式</span>zip格式的数据集才能发起云脑任务;<br>
- 云脑1提供 <span class="text blue">CPU / GPU</span> 资源,云脑2提供 <span class="text blue">Ascend NPU</span> 资源;调试使用的数据集也需要上传到对应的环境。
</p> -->
<p style="color: 505559;">说明:</p>
<p style="line-height: 1.5;color: #101010;">只有<span class="text red">zip格式</span>的数据集才能发起云脑任务;</br>
云脑1提供CPU / GPU资源,云脑2提供Ascend NPU资源;调试使用的数据集也需要上传到对应的环境;</p>
<div id="mask">
<div id="loadingPage">
<div class="rect1"></div>
<div class="rect2"></div>
<div class="rect3"></div>
<div class="rect4"></div>
<div class="rect5"></div>
</div>
</div>
{{template "base/head" .}}
<div class="repository">
{{template "repo/header" .}}
<div class="ui container">
<input type="hidden" id="dataset-file-desc" value="{{.Attachment.Description}}">
<div style="width: 80%;margin: auto;">
<h4 class="ui top attached header">
修改数据集文件描述
</h4>
<div class="ui attached segment" style="padding: 2em 3em;">
<div class="ui form" id="dataset-base">
<el-form label-width="140px">
{{.CsrfTokenHtml}}
<el-form-item label="存储位置:" prop="title">
<span style="display: flex;color: #3291F8;"><i class="ri-archive-drawer-line" style="margin-right: 10px;"></i>NPU</span>
<!-- <span>请输入字母、数字、_和-,最长64个字符,且不能以中划线(-)结尾。</span> -->
</el-form-item>
<el-form-item label="数据集文件:" prop="description">
<span>{{.Attachment.Name}}</span>
</el-form-item>
<el-form-item label="文件描述:" prop="description">
<el-input type="textarea" :rows="3" maxlength="255" v-model="descfile"></el-input>
</el-form-item>
<el-form-item>
<el-button style="background-color: #21ba45;" type="success" @click="editDatasetFile({{.Attachment.ID}})">确定</el-button>
<el-button type="info" @click="cancelDataset">取消</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</div>
{{template "base/footer" .}}
<script>
console.log({{.datasetId}})
console.log({{.Repo}})
</div>
{{template "base/footer" .}}
<script>
console.log({{.Attachment}})

</script>

+ 28
- 0
templates/repo/cloudbrain/new.tmpl View File

@@ -216,7 +216,34 @@
:visible.sync="dialogVisible"
width="50%"
>
<div class="ui icon input" style="z-index: 9999;position: absolute;right: 50px;height:30px;">
<i class="search icon"></i>
<input type="text" placeholder="Search...">
</div>
</el-input>
<el-tabs v-model="activeName" @tab-click="handleClick('{{.RepoLink}}',activeName)">
<el-tab-pane label="用户管理" name="first">
<div style="display: flex;align-items: center;justify-content: space-between;">
<div>
<div>asdasd</div>
<div>asdasdsd</div>
</div>
<div>
<button class="ui primary basic button">使用</button>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="配置管理" name="second">

</el-tab-pane>
<el-tab-pane label="角色管理" name="third">

</el-tab-pane>
<el-tab-pane label="定时任务补偿" name="fourth">

</el-tab-pane>
</el-tabs>
</el-dialog>
</div>

@@ -362,5 +389,6 @@
selected_value = $("#cloudbrain_benchmark_category").val()
$('#store_category').attr("value", selected_value)
})
console.log({{.RepoLink}})

</script>

+ 9
- 1
templates/repo/datasets/index.tmpl View File

@@ -190,9 +190,17 @@
<!-- 数据集名称 -->

<div class="four wide column" style="display: flex;align-items: center;">
<a class="dataset_title title" href="{{.DownloadURL}}" title="{{.Name}}">
{{if .Description}}
<el-tooltip class="item" effect="dark" content="{{.Description}}" placement="top">
<a class="dataset_title title" href="{{.DownloadURL}}" title="{{.Name}}" style="border: none;">
{{.Name}}
</a>
</el-tooltip>
{{else}}
<a class="dataset_title title" href="{{.DownloadURL}}" title="{{.Name}}" style="border: none;">
{{.Name}}
</a>
{{end}}
<i class="ri-lock-2-line" style="color: #fa8c16;" v-if="privates[{{$k}}]"></i>
</div>
<div class="one wide column text center">


+ 63
- 9
web_src/js/index.js View File

@@ -3696,7 +3696,10 @@ function initVueDataset() {
$('#task-square-range-value').find('.item').each(function(){
licenseLists.push($(this).data('license'))
})

let dataset_file_desc
if(document.getElementById('dataset-file-desc')){
dataset_file_desc = document.getElementById('dataset-file-desc').value
}

// getEditInit(){
// if($('#dataset-edit-value')){
@@ -3717,6 +3720,7 @@ function initVueDataset() {
url:'',
type:0,
desc:'',
descfile:'',
datasetType:'',
privates:[],
starItems:[],
@@ -3731,6 +3735,7 @@ function initVueDataset() {
num_stars:0,
dialogVisible:false,
activeName: 'first',
currentRepoDataset:[],
ruleForm:{
title:'',
description:'',
@@ -3791,6 +3796,7 @@ function initVueDataset() {
// // this.getEditInit()
// this.getTypeList()
this.getTypeList()
},
created(){
@@ -3802,11 +3808,12 @@ function initVueDataset() {
this.star_active = star_active
this.ruleForm1 = ruleForm
// this.getEditInit()
this.getTypeList()
this.starItems = starItems
this.starActives = starActives
this.taskLists = taskLists
this.licenseLists = licenseLists
this.descfile = dataset_file_desc
},
methods:{
createDataset(formName){
@@ -3917,6 +3924,15 @@ function initVueDataset() {
})

},
editDatasetFile(id){
console.log(id)
let url = '/attachments/edit'
const params={id:id,description:this.descfile,_csrf:csrf}
// document.getElementById("mask").style.display = "block"
this.$axios.post(url,params).then((res)=>{
console.log(res)
})
},
postStar(id,link){
console.log(id,link)
if(this.star_active){
@@ -3968,10 +3984,15 @@ function initVueDataset() {
console.log("init---",window.location.search && params.has('type'))
if( window.location.search && params.has('type')){
if(params.get('type')==0){
console.log(0)
this.datasetType = '0'
} else if(params.get('type')==1){
}
if(params.get('type')==1){
console.log(1)
this.datasetType = '1'
}else{
}
if(params.get('type')==-1){
console.log(-1)
this.datasetType = '-1'
}
}else {
@@ -3985,7 +4006,8 @@ function initVueDataset() {
if (!window.location.search) {
window.location.href = window.location.href + '?type='+val
} else if (searchParams.has('type')) {
window.location.href = window.location.href.replace(/type=[0-9]/g,'type='+val)
console.log("=========",window.location.href.replace(/type=([0-9]|-[0-9])/g,'type='+val))
window.location.href = window.location.href.replace(/type=([0-9]|-[0-9])/g,'type='+val)
} else {
window.location.href=window.location.href+'&type='+val
}
@@ -3996,9 +4018,41 @@ function initVueDataset() {
location.href = `/attachments/edit/${id}`

},
handleClick(tab, event) {
console.log(tab, event);
}
handleClick(repoLink, tabName,type) {
if(tabName=="first"){
this.getCurrentRepoDataset(repoLink,type)
}
if(tabName=="second"){
this.getMyDataset(repoLink,type)
}
if(tabName=="third"){
this.getPublicDataset(repoLink,type)
}
if(tabName=="fourth"){
this.getStarDataset(repoLink),type
}
},
getCurrentRepoDataset(repoLink,type){
let url = repoLink + '/datasets/current_repo'
this.$axios.get(url,{
params:{
type:type
}
}).then((res)=>{
console.log(res)
console.log(JSON.parse(res.data.data))
})
},
getMyDataset(){

},
getPublicDataset(){

},
getStarDataset(){

},



@@ -4612,4 +4666,4 @@ function initcreateRepo(){
});
}

initcreateRepo()
initcr

Loading…
Cancel
Save