Browse Source

fix issue

tags/v1.22.3.2^2
Gitea 4 years ago
parent
commit
6b85192feb
11 changed files with 295 additions and 78 deletions
  1. +107
    -0
      templates/custom/select_dataset.tmpl
  2. +2
    -2
      templates/explore/datasets.tmpl
  3. +30
    -47
      templates/repo/cloudbrain/new.tmpl
  4. +0
    -3
      templates/repo/datasets/edit.tmpl
  5. +12
    -5
      templates/repo/datasets/index.tmpl
  6. +1
    -0
      templates/repo/debugjob/index.tmpl
  7. +1
    -1
      templates/repo/editor/upload.tmpl
  8. +1
    -1
      templates/repo/header.tmpl
  9. +1
    -11
      templates/repo/modelarts/notebook/new.tmpl
  10. +3
    -0
      web_src/js/components/MinioUploader.vue
  11. +137
    -8
      web_src/js/index.js

+ 107
- 0
templates/custom/select_dataset.tmpl View File

@@ -0,0 +1,107 @@
<div class="dataset-repolink" id="dataset-repolink-init" style="display: none;" data-repolink="{{.RepoLink}}" data-cloudranin-type="{{.cloudbraintype}}"></div>
<div class="inline required field" id="dataset-base">
<label>数据集</label>
<!-- <select id="cloudbrain_dataset" class="ui search dropdown" placeholder="选择数据集" style='width:385px' name="attachment" required>

{{range .attachments}}
<option name="attachment" value="{{.UUID}}">{{.Attachment.Name}}</option>
{{end}}
</select> -->
<input type="hidden" name="attachment" :value="dataset_uuid">
<input type="text" :value="dataset_name">
<el-button type="text" @click="dialogVisible = true" icon="el-icon-plus"> 选择数据集</el-button>
<el-dialog
title="选择数据集"
:visible.sync="dialogVisible"
width="50%"
>
<div class="ui icon input" style="z-index: 9999;position: absolute;right: 50px;height:30px;">
<i class="search icon" style="cursor: pointer;pointer-events:auto" @click="searchDataset()"></i>
<input type="text" placeholder="Search..." v-model="searchDataItem" @keyup.enter="searchDataset()">
</div>
<el-tabs v-model="activeName" @tab-click="handleClick('{{.RepoLink}}',activeName,{{.cloudbraintype}})">
<el-tab-pane label="当前项目" name="first">
<div style="display: flex;align-items: center;justify-content: space-between;padding: 1rem 0;border-bottom:1px solid #F5F5F5" v-for="(dataset,index) in currentRepoDataset" :key="index">
<div style="width: 90%;">
<div style="display: flex;align-items: center;"><span class="panel_creator_reponam">${dataset.Repo.OwnerName}/${dataset.Repo.Alias} </span><span class="panel_dataset_name">${dataset.Name} </span></div>
<div style="margin-top: 8px;display: flex;">
<a :title="dataset.Repo.OwnerName">
<img class="ui avatar mini image" style="width: 20px;height: 20px;" :src="dataset.RelAvatarLink">
</a>
<span class="panel_datset_desc">${dataset.Description}</span>
</div>
</div>
<div>
<button class="ui primary basic button mini" @click.stop.prevent="selectDataset(dataset.UUID,dataset.Name)">使用</button>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="我的数据集" name="second">
<div style="display: flex;align-items: center;justify-content: space-between;padding: 1rem 0;border-bottom:1px solid #F5F5F5" v-for="(dataset,index) in myDataset" :key="index">
<div style="width: 90%;">
<div style="display: flex;align-items: center;"><span class="panel_creator_reponam">${dataset.Repo.OwnerName}/${dataset.Repo.Alias}</span><span class="panel_dataset_name">${dataset.Name}</span></div>
<div style="margin-top: 8px;display: flex;">
<a :title="dataset.Repo.OwnerName">
<img class="ui avatar mini image" style="width: 20px;height: 20px;" :src="dataset.RelAvatarLink">
</a>
<span class="panel_datset_desc">${dataset.Description}</span>
</div>
</div>
<div>
<button class="ui primary basic button mini" @click.stop.prevent="selectDataset(dataset.UUID,dataset.Name)">使用</button>
</div>
</div>

</el-tab-pane>
<el-tab-pane label="公开数据集" name="third">
<div style="display: flex;align-items: center;justify-content: space-between;padding: 1rem 0;border-bottom:1px solid #F5F5F5" v-for="(dataset,index) in publicDataset" :key="index">
<div style="width: 90%;">
<div style="display: flex;align-items: center;"><span class="panel_creator_reponam">${dataset.Repo.OwnerName}/${dataset.Repo.Alias}</span><span class="panel_dataset_name">${dataset.Name}</span></div>
<div style="margin-top: 8px;display: flex;">
<a :title="dataset.Repo.OwnerName">
<img class="ui avatar mini image" style="width: 20px;height: 20px;" :src="dataset.RelAvatarLink">
</a>
<span class="panel_datset_desc">${dataset.Description}</span>
</div>
</div>
<div>
<button class="ui primary basic button mini" @click.stop.prevent="selectDataset(dataset.UUID,dataset.Name)">使用</button>
</div>
</div>

</el-tab-pane>
<el-tab-pane label="我点赞的" name="fourth">
<div style="display: flex;align-items: center;justify-content: space-between;padding: 1rem 0;border-bottom:1px solid #F5F5F5" v-for="(dataset,index) in myFavoriteDataset" :key="index">
<div style="width: 90%;">
<div style="display: flex;align-items: center;"><span class="panel_creator_reponam">${dataset.Repo.OwnerName}/${dataset.Repo.Alias}</span><span class="panel_dataset_name">${dataset.Name}</span></div>
<div style="margin-top: 8px;display: flex;">
<a :title="dataset.Repo.OwnerName">
<img class="ui avatar mini image" style="width: 20px;height: 20px;" :src="dataset.RelAvatarLink">
</a>
<span class="panel_datset_desc">${dataset.Description}</span>
</div>
</div>
<div>
<button class="ui primary basic button mini" @click.stop.prevent="selectDataset(dataset.UUID,dataset.Name)">使用</button>
</div>
</div>

</el-tab-pane>
</el-tabs>
<div class="center">
<el-pagination
background
@current-change="handleCurrentChange"
:current-page="page"
:page-size="5"
layout="total,prev, pager, next"
:total="totalnums">
</el-pagination>
</div>
</el-dialog>


</div>

+ 2
- 2
templates/explore/datasets.tmpl View File

@@ -181,7 +181,7 @@
</div>
</div>
{{end}}
{{.Page.Paginater.Total}}

</div>
</div>
@@ -206,5 +206,5 @@
</div>
{{template "base/footer" .}}
<script>
console.log({{.Datasets}})
console.log({{.Total}})
</script>

+ 30
- 47
templates/repo/cloudbrain/new.tmpl View File

@@ -101,6 +101,32 @@
}


.panel_creator_reponam{
display: inline-block;
border-radius: 4px;
padding: 4px;
font-size: 12px;
text-align: center;
background-color: rgba(161, 220, 255, 0.2);
color: #101010;
}
.panel_dataset_name{
font-size: 15px;
color: #0366D6;
text-align: center;
margin-left: 1rem;
}
.panel_datset_desc{
white-space: nowrap;
display: inline-block;
overflow: hidden;
width: 90%;
text-overflow: ellipsis;
}
.el-dialog__body{
padding-top:0
}
</style>

<div id="mask">
@@ -116,6 +142,7 @@
<div class="repository">
{{template "repo/header" .}}
<div class="repository new repo ui middle very relaxed page grid">
<div class="column">
{{template "base/alert" .}}
<div class="ui negative message" id="messageInfo">
@@ -200,53 +227,8 @@
{{end}}
</datalist>
</div>

<div class="inline required field" id="dataset-base">
<label>数据集</label>
<!-- <select id="cloudbrain_dataset" class="ui search dropdown" placeholder="选择数据集" style='width:385px' name="attachment" required>
{{range .attachments}}
<option name="attachment" value="{{.UUID}}">{{.Attachment.Name}}</option>
{{end}}
</select> -->
<input type="text" name="" id="">
<el-button type="text" @click="dialogVisible = true">点击打开 Dialog</el-button>
<el-dialog
title="选择数据集"
: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>

{{template "custom/select_dataset" .}}
<div class="inline required field">
<label>资源规格</label>
<select id="cloudbrain_resource_spec" class="ui search dropdown" placeholder="选择资源规格" style='width:385px' name="resource_spec_id">
@@ -301,6 +283,7 @@
</div>
{{template "base/footer" .}}
<script>
console.log({{.cloudbraintype}})
let form = document.getElementById('form_id');

let inputs = document.querySelectorAll('input[list]');


+ 0
- 3
templates/repo/datasets/edit.tmpl View File

@@ -70,6 +70,3 @@
</div>
</div>
{{template "base/footer" .}}
<script>
console.log({{.Dataset}})
</script>

+ 12
- 5
templates/repo/datasets/index.tmpl View File

@@ -97,6 +97,9 @@
fill: #FA8C16 !important;
stroke:#FA8C16 !important
}
.diy-popper{
max-width: 400px;
}
</style>
<div class="repository">
{{template "repo/header" .}}
@@ -196,15 +199,19 @@

<div class="four wide column" style="display: flex;align-items: center;">
{{if .Description}}
<el-tooltip class="item" effect="dark" content="{{.Description}}" placement="top">
<a class="dataset_title title" href="{{.DownloadURL}}" title="{{.Name}}" style="border: none;">
<el-tooltip class="item" effect="dark" placement="top" popper-class="diy-popper">
<div slot="content" >{{.Description}}</br><span><i class="ri-download-line"></i>下载:{{.DownloadCount}}</span></div>
<a class="dataset_title title" href="{{if $.CanRead}}{{.DownloadURL}}{{else}}javascript:void(0){{end}}" title="{{.Name}}" style="border: none;">
{{.Name}}
</a>
</el-tooltip>
{{else}}
<a class="dataset_title title" href="{{.DownloadURL}}" title="{{.Name}}" style="border: none;">
{{.Name}}
</a>
<el-tooltip class="item" effect="dark" placement="top" popper-class="diy-popper">
<div slot="content" ><span><i class="ri-download-line"></i>下载:{{.DownloadCount}}</span></div>
<a class="dataset_title title" href="{{if $.CanRead}}{{.DownloadURL}}{{else}}javascript:void(0){{end}}" title="{{.Name}}" style="border: none;">
{{.Name}}
</a>
</el-tooltip>
{{end}}
<i class="ri-lock-2-line" style="color: #fa8c16;" v-if="privates[{{$k}}]"></i>
</div>


+ 1
- 0
templates/repo/debugjob/index.tmpl View File

@@ -478,6 +478,7 @@
</div>
{{template "base/footer" .}}
<script>
console.log({{.Tasks}})
// 调试和评分新开窗口
const {AppSubUrl, StaticUrlPrefix, csrf} = window.config;
let url={{.RepoLink}}


+ 1
- 1
templates/repo/editor/upload.tmpl View File

@@ -27,7 +27,7 @@
</div>
<div class="field">
<div class="files"></div>
<div class="ui dropzone" id="dropzone" data-upload-url="{{.RepoLink}}/upload-file" data-remove-url="{{.RepoLink}}/upload-remove" data-csrf="{{.CsrfToken}}" data-accepts="{{.UploadAllowedTypes}}" data-max-file="{{.UploadMaxFiles}}" data-max-size="{{.UploadMaxSize}}" 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"}}"></div>
<div class="ui dropzone" id="dropzone" data-upload-url="{{.RepoLink}}/upload-file" data-remove-url="{{.RepoLink}}/upload-remove" data-csrf="{{.CsrfToken}}" data-accepts="{{.UploadAllowedTypes}}" data-max-file="{{.UploadMaxFiles}}" data-max-size="{{.UploadMaxSize}}" data-default-message="{{.i18n.Tr "dropzone.default_message"}}asdsadsad" 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"}}"></div>
</div>
{{template "repo/editor/commit_form" .}}
</form>


+ 1
- 1
templates/repo/header.tmpl View File

@@ -138,7 +138,7 @@
{{end}}

{{if .Permission.CanRead $.UnitTypeDatasets}}
<a class="{{if .PageIsDataset}}active{{end}} item" href="{{.RepoLink}}/datasets?type=0">
<a class="{{if .PageIsDataset}}active{{end}} item" href="{{.RepoLink}}/datasets">
<svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="none" d="M0 0h24v24H0z"/><path d="M20.083 15.2l1.202.721a.5.5 0 0 1 0 .858l-8.77 5.262a1 1 0 0 1-1.03 0l-8.77-5.262a.5.5 0 0 1 0-.858l1.202-.721L12 20.05l8.083-4.85zm0-4.7l1.202.721a.5.5 0 0 1 0 .858L12 17.65l-9.285-5.571a.5.5 0 0 1 0-.858l1.202-.721L12 15.35l8.083-4.85zm-7.569-9.191l8.771 5.262a.5.5 0 0 1 0 .858L12 13 2.715 7.429a.5.5 0 0 1 0-.858l8.77-5.262a1 1 0 0 1 1.03 0zM12 3.332L5.887 7 12 10.668 18.113 7 12 3.332z"/></svg>
{{.i18n.Tr "datasets"}}
</a>


+ 1
- 11
templates/repo/modelarts/notebook/new.tmpl View File

@@ -59,17 +59,7 @@
{{end}}
</select>
</div>

<div class="inline field">
<label>数据集</label>
<input type="text" list="cloudbrain_dataset" placeholder="选择数据集" name="" id="answerInput" autofocus maxlength="36">
<datalist id="cloudbrain_dataset" class="ui search" style='width:385px' name="attachment">
{{range .attachments}}
<option name="attachment" data-value="{{.UUID}}">{{.Attachment.Name}}</option>
{{end}}
</datalist>
<input type="hidden" name="attachment" id="answerInput-hidden">
</div>
{{template "custom/select_dataset" .}}

<!--<div class="inline required field">
<label>工作环境</label>


+ 3
- 0
web_src/js/components/MinioUploader.vue View File

@@ -135,6 +135,7 @@ export default {
console.log(this.uploadtype)
},
updateProgress(file, progress) {
console.log("progress---",progress)
file.previewTemplate.querySelector(
'.dz-upload'
).style.width = `${progress}%`
@@ -483,6 +484,7 @@ export default {
1}/${chunks}个分片上传`
);
this.progress = Math.ceil((currentChunk / chunks) * 100);
console.log("((currentChunk / chunks) * 100).toFixed(2)",((currentChunk / chunks) * 100).toFixed(2))
this.updateProgress(file, ((currentChunk / chunks) * 100).toFixed(2));
this.status = `${this.dropzoneParams.data('uploading')} ${(
(currentChunk / chunks) *
@@ -496,6 +498,7 @@ export default {
file.size
} 用时:${(new Date().getTime() - time) / 1000} s`
);
this.updateProgress(file, 100);
this.progress = 100;
this.status = this.dropzoneParams.data('upload-complete');
this.finishUpload(file);


+ 137
- 8
web_src/js/index.js View File

@@ -3665,6 +3665,9 @@ function initVueDataset() {
return;
}
let link=$('#square-link').data('link')
let repolink = $('.dataset-repolink').data('repolink')
let cloudbrainType = $('.dataset-repolink').data('cloudranin-type')
console.log("-------",repolink,cloudbrainType)
const clearBtn = document.getElementsByClassName("clear_dataset_value");
const params = new URLSearchParams(location.search)
for (let i = 0; i < clearBtn.length; i++) {
@@ -3713,7 +3716,7 @@ function initVueDataset() {
if(document.getElementById('dataset-file-desc')){
dataset_file_desc = document.getElementById('dataset-file-desc').value
}
// getEditInit(){
// if($('#dataset-edit-value')){
// $this = $('#dataset-edit-value')
@@ -3748,7 +3751,18 @@ function initVueDataset() {
num_stars:0,
dialogVisible:false,
activeName: 'first',
searchDataItem:'',
currentRepoDataset:[],
myDataset:[],
publicDataset:[],
myFavoriteDataset:[],
page:1,
totalnums:0,
repolink:'',
cloudbrainType:0,
dataset_uuid:'',
dataset_name:'',
loadingDataIndex:true,
ruleForm:{
title:'',
description:'',
@@ -3810,6 +3824,10 @@ function initVueDataset() {
// // this.getEditInit()
// this.getTypeList()
this.getTypeList()
if(!!document.getElementById('dataset-repolink-init')){
this.getCurrentRepoDataset(this.repolink,this.cloudbrainType)
}
},
created(){
@@ -3827,9 +3845,31 @@ function initVueDataset() {
this.taskLists = taskLists
this.licenseLists = licenseLists
this.descfile = dataset_file_desc
this.repolink = repolink
this.cloudbrainType = cloudbrainType
console.log(this.starItems,this.starActives)
},
methods:{
handleCurrentChange(val) {
this.page = val
console.log(val)
switch(this.activeName){
case 'first':
this.getCurrentRepoDataset(this.repolink,this.cloudbrainType)
break
case 'second':
this.getMyDataset(this.repolink,this.cloudbrainType)
break
case 'third':
this.getPublicDataset(this.repolink,this.cloudbrainType)
break
case 'fourth':
this.getStarDataset(this.repolink,this.cloudbrainType)
break
}

},
createDataset(formName){
let _this = this
this.$refs[formName].validate((valid)=>{
@@ -4047,41 +4087,130 @@ function initVueDataset() {

},
handleClick(repoLink, tabName,type) {
console.log(repoLink, tabName,type)
if(tabName=="first"){
this.page=1
this.searchDataItem=''
this.getCurrentRepoDataset(repoLink,type)
}
if(tabName=="second"){
this.page=1
this.searchDataItem=''
this.getMyDataset(repoLink,type)
}
if(tabName=="third"){
this.page=1
this.searchDataItem=''
this.getPublicDataset(repoLink,type)
}
if(tabName=="fourth"){
this.getStarDataset(repoLink),type
this.page=1
this.searchDataItem=''
this.getStarDataset(repoLink,type)
}
},
getCurrentRepoDataset(repoLink,type){
this.loadingDataIndex = true
let url = repoLink + '/datasets/current_repo'
this.$axios.get(url,{
params:{
type:type
type:type,
page:this.page,
q:this.searchDataItem
}
}).then((res)=>{
console.log(res)
console.log(JSON.parse(res.data.data))
console.log(res.data.count)
this.currentRepoDataset = JSON.parse(res.data.data)
this.totalnums = parseInt(res.data.count)
this.loadingDataIndex = false
})
},
getMyDataset(){
getMyDataset(repoLink,type){
this.loadingDataIndex = true
let url = repoLink + '/datasets/my_datasets'
this.$axios.get(url,{
params:{
type:type,
page:this.page,
q:this.searchDataItem
}
}).then((res)=>{
console.log(res)
console.log(JSON.parse(res.data.data))
this.myDataset = JSON.parse(res.data.data)
this.totalnums = parseInt(res.data.count)
this.loadingDataIndex = false
})

},
getPublicDataset(){
getPublicDataset(repoLink,type){
this.loadingDataIndex = true
let url = repoLink + '/datasets/public_datasets'
this.$axios.get(url,{
params:{
type:type,
page:this.page,
q:this.searchDataItem
}
}).then((res)=>{
console.log(res)
console.log(JSON.parse(res.data.data))
this.publicDataset = JSON.parse(res.data.data)
this.totalnums = parseInt(res.data.count)
this.loadingDataIndex = false
})

},
getStarDataset(){
getStarDataset(repoLink,type){
this.loadingDataIndex = true
let url = repoLink + '/datasets/my_favorite'
this.$axios.get(url,{
params:{
type:type,
page:this.page,
q:this.searchDataItem
}
}).then((res)=>{
console.log(res)
console.log(JSON.parse(res.data.data))
this.myFavoriteDataset = JSON.parse(res.data.data)
this.totalnums= parseInt(res.data.count)
this.loadingDataIndex = false
})

},

selectDataset(uuid,name){
console.log(uuid)
this.dataset_uuid = uuid
this.dataset_name = name
this.dialogVisible = false
},
searchDataset(){
console.log("click search")
switch(this.activeName){
case 'first':
this.page = 1
this.getCurrentRepoDataset(this.repolink,this.cloudbrainType)
break
case 'second':
this.page = 1
this.getMyDataset(this.repolink,this.cloudbrainType)
break
case 'third':
this.page = 1
this.getPublicDataset(this.repolink,this.cloudbrainType)
break
case 'fourth':
this.page = 1
this.getStarDataset(this.repolink,this.cloudbrainType)
break
}
}


},


Loading…
Cancel
Save