Browse Source

fix issue

tags/v1.22.4.1^2
zhoupzh 4 years ago
parent
commit
10ad928077
9 changed files with 139 additions and 54 deletions
  1. +3
    -1
      options/locale/locale_en-US.ini
  2. +6
    -3
      options/locale/locale_zh-CN.ini
  3. +20
    -0
      templates/admin/cloudbrain/images.html
  4. +2
    -2
      templates/custom/select_dataset.tmpl
  5. +20
    -0
      templates/explore/images.tmpl
  6. +2
    -13
      templates/repo/cloudbrain/benchmark/new.tmpl
  7. +42
    -21
      web_src/js/components/images/Images.vue
  8. +34
    -10
      web_src/js/components/images/adminImages.vue
  9. +10
    -4
      web_src/js/components/images/selectImages.vue

+ 3
- 1
options/locale/locale_en-US.ini View File

@@ -921,11 +921,13 @@ image_delete_fail=Failed to delete image, please try again later.
download=Download
score=Score

images.name = Image Name
images.name = Image Tag
images.name_placerholder = Please enter the image name
image.label_tooltips = Example Python 3.7, Tensorflow 2.0, cuda 10, pytorch 1.6
images.public_tooltips = After the image is set to public, it can be seen by other users.
images.name_rule = Please enter letters, numbers, _ and - up to 64 characters and cannot end with a dash (-).
images.delete_task = Delete image
images.task_delete_confirm = Are you sure you want to delete this image? Once this image is deleted, it cannot be recovered.

cloudbrain=Cloudbrain
cloudbrain.new=New cloudbrain


+ 6
- 3
options/locale/locale_zh-CN.ini View File

@@ -918,7 +918,7 @@ gpu_type_all=全部
model_download=结果下载
submit_image=提交镜像
modify_image=修改镜像
image_exist=镜像名称已被使用,请修改镜像名称
image_exist=镜像Tag已被使用,请修改镜像Tag
image_commit_fail=提交镜像失败,请稍后再试。
image_not_exist=镜像不存在。
image_edit_fail=编辑镜像失败,请稍后再试。
@@ -927,11 +927,13 @@ download=模型下载
score=评分


images.name = 镜像名称
images.name_placerholder = 请输入镜像名称
images.name = 镜像Tag
images.name_placerholder = 请输入镜像Tag
image.label_tooltips = 如Python 3.7, Tensorflow 2.0, cuda 10, pytorch 1.6
images.public_tooltips = 镜像设置为公开后,可被其他用户看到。
images.name_rule = 请输入字母、数字、_和-,最长100个字符,且不能以中划线(-)结尾。
images.delete_task = 删除镜像
images.task_delete_confirm = 你确认删除该镜像么?此镜像一旦删除不可恢复。

cloudbrain=云脑
cloudbrain.new=新建任务
@@ -2931,6 +2933,7 @@ task_delete_confirm = 你确认删除该任务么?此任务一旦删除不可
operate_confirm = 确定操作
operate_cancel = 取消操作


gpu_num = GPU数
cpu_num = CPU数
memory = 内存


+ 20
- 0
templates/admin/cloudbrain/images.html View File

@@ -18,5 +18,25 @@
</div>
</div>
<!-- 确认模态框 -->
<div id="deletemodel">
<div class="ui basic modal images">
<div class="ui icon header">
<i class="trash icon"></i> {{.i18n.Tr "repo.images.delete_task"}}
</div>

<div class="content">
<p>{{.i18n.Tr "repo.images.task_delete_confirm"}}</p>
</div>
<div class="actions">
<div class="ui red basic inverted cancel button">
<i class="remove icon"></i> {{.i18n.Tr "cloudbrain.operate_cancel"}}
</div>
<div class="ui green basic inverted ok button">
<i class="checkmark icon"></i> {{.i18n.Tr "cloudbrain.operate_confirm"}}
</div>
</div>
</div>
</div>
{{template "base/footer" .}}


+ 2
- 2
templates/custom/select_dataset.tmpl View File

@@ -4,9 +4,9 @@
<label>{{.i18n.Tr "dataset.dataset"}}</label>
<input type="hidden" name="attachment" :value="dataset_uuid">
{{if eq .cloudbraintype 0}}
<input class="disabled" type="text" :value="dataset_name" required onfocus="this.blur();">
<input class="disabled" type="text" :value="dataset_name" placeholder="{{.i18n.Tr "cloudbrain.select_dataset"}}" required onfocus="this.blur();">
{{else}}
<input class="disabled" type="text" :value="dataset_name">
<input class="disabled" type="text" :value="dataset_name" placeholder="{{.i18n.Tr "cloudbrain.select_dataset"}}">
{{end}}
<el-button type="text" @click="dialogVisible = true" icon="el-icon-plus"> {{.i18n.Tr "dataset.select_dataset"}}</el-button>
<el-dialog


+ 20
- 0
templates/explore/images.tmpl View File

@@ -1,4 +1,24 @@
{{template "base/head" .}}
<div id="images">
</div>
<!-- 确认模态框 -->
<div id="deletemodel">
<div class="ui basic modal images">
<div class="ui icon header">
<i class="trash icon"></i> {{.i18n.Tr "repo.images.delete_task"}}
</div>

<div class="content">
<p>{{.i18n.Tr "repo.images.task_delete_confirm"}}</p>
</div>
<div class="actions">
<div class="ui red basic inverted cancel button">
<i class="remove icon"></i> {{.i18n.Tr "cloudbrain.operate_cancel"}}
</div>
<div class="ui green basic inverted ok button">
<i class="checkmark icon"></i> {{.i18n.Tr "cloudbrain.operate_confirm"}}
</div>
</div>
</div>
</div>
{{template "base/footer" .}}

+ 2
- 13
templates/repo/cloudbrain/benchmark/new.tmpl View File

@@ -121,19 +121,8 @@
</div>
</div>

<div class="required unite min_title inline field">
<label style="font-weight: normal;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_mirror"}}</label>
<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<input type="text" list="cloudbrain_image" placeholder="{{.i18n.Tr "cloudbrain.choose_mirror"}}" name="image" value="{{.image}}" class="required autofocus" style='width:492px;' maxlength="254">
<i class="times circle outline icon icons" style="visibility: hidden;" onclick="clearValue()"></i>
<datalist class="ui search" id="cloudbrain_image" style='width:385px;' name="image">
{{range .images}}
<option name="image" value="{{.Place}}">{{.PlaceView}}</option>
{{end}}
{{range .public_images}}
<option name="image" value="{{.Place}}">{{.PlaceView}}</option>
{{end}}
</datalist>
<div id="images-new-cb">

</div>




+ 42
- 21
web_src/js/components/images/Images.vue View File

@@ -20,7 +20,7 @@
<el-col :span="4"><div style="visibility: hidden;">TODO</div></el-col>
<el-col :span="8">
<div>
<el-input placeholder="搜镜像名称/描述/标签..." v-model="search" class="input-with-select" @keyup.enter.native="searchName()">
<el-input placeholder="搜镜像Tag/描述/标签..." v-model="search" class="input-with-select" @keyup.enter.native="searchName()">
<el-button id="success" slot="append" icon="el-icon-search" @click="searchName()">搜索</el-button>
</el-input>
</div>
@@ -34,7 +34,7 @@
:header-cell-style="tableHeaderStyle"
>
<el-table-column
label="镜像名称"
label="镜像Tag"
min-width="19%"
align="left"
prop="tag"
@@ -55,7 +55,7 @@
<template slot-scope="scope">
<div class="image_desc" :title="scope.row.description">{{ scope.row.description}}</div>
<div v-if="!!scope.row.topics">
<span v-for="(topic,index) in scope.row.topics" class="ui repo-topic label topic" style="cursor: pointer;">{{topic}}</span>
<span v-for="(topic,index) in scope.row.topics" class="ui repo-topic label topic" style="cursor: default;">{{topic}}</span>
</div>
</template>
@@ -126,13 +126,13 @@
<el-row style="align-items: center;display: flex;">
<el-col :span="12">
<div>
<el-checkbox v-model="checked">备选项</el-checkbox>
<el-checkbox v-model="checked">仅显示平台推荐</el-checkbox>
</div>
</el-col>
<el-col :span="4"><div style="visibility: hidden;">TODO</div></el-col>
<el-col :span="8">
<div>
<el-input placeholder="搜镜像名称/描述/标签..." v-model="search" class="input-with-select" @keyup.enter.native="searchName()">
<el-input placeholder="搜镜像Tag/描述/标签..." v-model="search" class="input-with-select" @keyup.enter.native="searchName()">
<el-button id="success" slot="append" icon="el-icon-search" @click="searchName()">搜索</el-button>
</el-input>
</div>
@@ -153,7 +153,7 @@
<el-col :span="4"><div style="visibility: hidden;">TODO</div></el-col>
<el-col :span="8">
<div>
<el-input placeholder="搜镜像名称/描述/标签..." v-model="search" class="input-with-select" @keyup.enter.native="searchName()">
<el-input placeholder="搜镜像Tag/描述/标签..." v-model="search" class="input-with-select" @keyup.enter.native="searchName()">
<el-button id="success" slot="append" icon="el-icon-search" @click="searchName()">搜索</el-button>
</el-input>
</div>
@@ -166,14 +166,14 @@
:header-cell-style="tableHeaderStyle"
>
<el-table-column
label="镜像名称"
label="镜像Tag"
min-width="19%"
align="left"
prop="tag"
>
<template slot-scope="scope">
<div style="display: flex;align-items: center;">
<a class="text-over image_title" :title="scope.row.tag">{{ scope.row.tag }}</a>
<a class="text-over image_title" :title="scope.row.tag">{{ scope.row.tag }}</a>&nbsp;&nbsp;&nbsp;
<i class="ri-lock-2-line" style="color: #fa8c16;" v-if="scope.row.isPrivate"></i>
</div>
</template>
@@ -187,7 +187,7 @@
<template slot-scope="scope">
<div class="image_desc" :title="scope.row.description">{{ scope.row.description}}</div>
<div v-if="!!scope.row.topics">
<span v-for="(topic,index) in scope.row.topics" class="ui repo-topic label topic">{{topic}}</span>
<span v-for="(topic,index) in scope.row.topics" class="ui repo-topic label topic" style="cursor: default;">{{topic}}</span>
</div>
</template>
@@ -209,7 +209,8 @@
align="center"
>
<template slot-scope="scope">
{{scope.row.isPrivate | transformPravite}}
<span v-if="scope.row.isPrivate" style="color: rgb(250, 140, 22);">私有</span>
<span v-else style="color: rgb(19, 194, 141);">公开</span>
</template>
</el-table-column>
<el-table-column
@@ -273,7 +274,7 @@
<el-col :span="4"><div style="visibility: hidden;">TODO</div></el-col>
<el-col :span="8">
<div>
<el-input placeholder="搜镜像名称/描述/标签..." v-model="search" class="input-with-select" @keyup.enter.native="searchName()">
<el-input placeholder="搜镜像Tag/描述/标签..." v-model="search" class="input-with-select" @keyup.enter.native="searchName()">
<el-button id="success" slot="append" icon="el-icon-search" @click="searchName()">搜索</el-button>
</el-input>
</div>
@@ -294,7 +295,7 @@
<el-col :span="4"><div style="visibility: hidden;">TODO</div></el-col>
<el-col :span="8">
<div>
<el-input placeholder="搜镜像名称/描述/标签..." v-model="search" class="input-with-select" @keyup.enter.native="searchName()">
<el-input placeholder="搜镜像Tag/描述/标签..." v-model="search" class="input-with-select" @keyup.enter.native="searchName()">
<el-button id="success" slot="append" icon="el-icon-search" @click="searchName()">搜索</el-button>
</el-input>
</div>
@@ -308,7 +309,7 @@
:header-cell-style="tableHeaderStyle"
>
<el-table-column
label="镜像名称"
label="镜像Tag"
min-width="19%"
align="left"
prop="tag"
@@ -329,7 +330,7 @@
<template slot-scope="scope">
<div class="image_desc" :title="scope.row.description">{{ scope.row.description}}</div>
<div v-if="!!scope.row.topics">
<span v-for="(topic,index) in scope.row.topics" class="ui repo-topic label topic">{{topic}}</span>
<span v-for="(topic,index) in scope.row.topics" class="ui repo-topic label topic" style="cursor: default;">{{topic}}</span>
</div>
</template>
@@ -373,7 +374,7 @@
>
<template slot-scope="scope">
<div style="display: flex;justify-content: flex-end;align-items: center;">
<div style="display: flex;align-items: center;cursor:pointer;padding: 0 1rem;" @click="imageUnstar()">
<div style="display: flex;align-items: center;cursor:pointer;padding: 0 1rem;" @click="imageUnstar(scope.row.id)">
<svg width="1.4em" height="1.4em" viewBox="0 0 32 32" class="heart-stroke stars_active"><path d="M4.4 6.54c-1.761 1.643-2.6 3.793-2.36 6.056.24 2.263 1.507 4.521 3.663 6.534a29110.9 29110.9 0 0010.296 9.633l10.297-9.633c2.157-2.013 3.424-4.273 3.664-6.536.24-2.264-.599-4.412-2.36-6.056-1.73-1.613-3.84-2.29-6.097-1.955-1.689.25-3.454 1.078-5.105 2.394l-.4.319-.398-.319c-1.649-1.316-3.414-2.143-5.105-2.394a7.612 7.612 0 00-1.113-.081c-1.838 0-3.541.694-4.983 2.038z"></path></svg>
<span style="line-height: 2;margin-left:0.3rem;">{{scope.row.numStars}}</span>
</div>
@@ -407,7 +408,7 @@
<el-col :span="4"><div style="visibility: hidden;">TODO</div></el-col>
<el-col :span="8">
<div>
<el-input placeholder="搜镜像名称/描述/标签..." v-model="search" class="input-with-select" @keyup.enter.native="searchName()">
<el-input placeholder="搜镜像Tag/描述/标签..." v-model="search" class="input-with-select" @keyup.enter.native="searchName()">
<el-button id="success" slot="append" icon="el-icon-search" @click="searchName()">搜索</el-button>
</el-input>
</div>
@@ -558,10 +559,30 @@ export default {
},

deleteImage(id){
this.$axios.delete('/image/'+id).then((res)=>{
console.log(res)
this.getImageListCustom()
console.log("deleteImage")
let flag=1
let _this = this
$('.ui.basic.modal.images')
.modal({
onDeny: function() {
flag = false
},
onApprove: function() {
_this.$axios.delete('/image/'+id).then((res)=>{
console.log(res)
_this.getImageListCustom()
})
flag = true
},
onHidden: function() {
if (flag == false) {
$('.alert').html('您已取消操作').removeClass('alert-success').addClass('alert-danger').show().delay(1500).fadeOut();
}else{
$('.alert').html('删除成功').removeClass('alert-danger').addClass('alert-success').show().delay(1500).fadeOut();
}
}
})
.modal('show')
},
eidtImage(id){
location.href = `/image/${id}/imageSquare`
@@ -592,8 +613,8 @@ export default {
}
},
imageUnstar(){
this.$axios.put(`/image/${id}/action/star`).then((res)=>{
imageUnstar(id){
this.$axios.put(`/image/${id}/action/unstar`).then((res)=>{
if(res.data.Code==0){
this.getImageListStar()
}else{


+ 34
- 10
web_src/js/components/images/adminImages.vue View File

@@ -6,7 +6,7 @@
<div class="ui attached segment">
<div class="ui form ignore-dirty">
<div class="ui fluid action input">
<input type="text" v-model="search" @keyup.enter="searchName()">
<input type="text" placeholder="搜镜像Tag/描述/标签..." v-model="search" @keyup.enter="searchName()">
<button class="ui blue button" @click="searchName()">搜索</button>
</div>
</div>
@@ -16,7 +16,7 @@
<el-checkbox v-model="checked" style="padding: 0.5rem 1rem;">仅显示平台推荐</el-checkbox>
</el-col>
<el-col :span="6">
<el-dropdown @command="handleCommand" size="small" trigger="click" style="border: 1px solid rgba(34,36,38,.15);border-radius: 4px;padding: 0.5rem 1rem;">
<el-dropdown @command="handleCommand" trigger="click" style="border: 1px solid rgba(34,36,38,.15);border-radius: 4px;padding: 0.5rem 1rem;">
<span class="el-dropdown-link">
{{dropdownPrivate}}<i class="el-icon-caret-bottom el-icon--right"></i>
</span>
@@ -35,7 +35,7 @@
:header-cell-style="tableHeaderStyle"
>
<el-table-column
label="镜像名称"
label="镜像Tag"
min-width="19%"
align="left"
prop="tag"
@@ -57,7 +57,7 @@
<template slot-scope="scope">
<div class="image_desc" :title="scope.row.description">{{ scope.row.description}}</div>
<div v-if="!!scope.row.topics">
<span v-for="(topic,index) in scope.row.topics" class="ui repo-topic label topic" style="cursor: pointer;">{{topic}}</span>
<span v-for="(topic,index) in scope.row.topics" class="ui repo-topic label topic" style="cursor: default;">{{topic}}</span>
</div>
</template>
@@ -79,7 +79,8 @@
align="center"
>
<template slot-scope="scope">
{{scope.row.isPrivate | transformPravite}}
<span v-if="scope.row.isPrivate" style="color: rgb(250, 140, 22);">私有</span>
<span v-else style="color: rgb(19, 194, 141);">公开</span>
</template>
</el-table-column>
<el-table-column
@@ -115,8 +116,11 @@
<svg width="1.4em" height="1.4em" viewBox="0 0 32 32" class="heart-stroke"><path d="M4.4 6.54c-1.761 1.643-2.6 3.793-2.36 6.056.24 2.263 1.507 4.521 3.663 6.534a29110.9 29110.9 0 0010.296 9.633l10.297-9.633c2.157-2.013 3.424-4.273 3.664-6.536.24-2.264-.599-4.412-2.36-6.056-1.73-1.613-3.84-2.29-6.097-1.955-1.689.25-3.454 1.078-5.105 2.394l-.4.319-.398-.319c-1.649-1.316-3.414-2.143-5.105-2.394a7.612 7.612 0 00-1.113-.081c-1.838 0-3.541.694-4.983 2.038z"></path></svg>
<span style="line-height: 2;margin-left:0.3rem;">{{scope.row.numStars}}</span>
</div>
<span style="padding: 0 1rem;color: rgb(250, 140, 22);cursor:pointer;" v-if="scope.row.type==5" @click="unSetRecommend(scope.$index,scope.row.id)">取消推荐</span>
<span style="padding: 0 1rem;color: rgb(19, 194, 141);cursor:pointer;" v-else @click="setRecommend(scope.$index,scope.row.id)">设为推荐</span>
<template v-if="!scope.row.isPrivate">
<span style="padding: 0 1rem;color: rgb(250, 140, 22);cursor:pointer;" v-if="scope.row.type==5" @click="unSetRecommend(scope.$index,scope.row.id)">取消推荐</span>
<span style="padding: 0 1rem;color: rgb(19, 194, 141);cursor:pointer;" v-else @click="setRecommend(scope.$index,scope.row.id)">设为推荐</span>
</template>
<span style="padding: 0 1rem;color:#0366d6;cursor:pointer;" @click="copyUrl(scope.row.place)">复制地址</span>
<div style="padding-left:1rem;cursor:pointer;">
@@ -214,10 +218,30 @@ export default {
})
},
deleteImage(id){
this.$axios.delete('/image/'+id).then((res)=>{
console.log(res)
this.getImageListCustom()
console.log("deleteImage")
let flag=1
let _this = this
$('.ui.basic.modal.images')
.modal({
onDeny: function() {
flag = false
},
onApprove: function() {
_this.$axios.delete('/image/'+id).then((res)=>{
console.log(res)
_this.getImageListCustom()
})
flag = true
},
onHidden: function() {
if (flag == false) {
$('.alert').html('您已取消操作').removeClass('alert-success').addClass('alert-danger').show().delay(1500).fadeOut();
}else{
$('.alert').html('删除成功').removeClass('alert-danger').addClass('alert-success').show().delay(1500).fadeOut();
}
}
})
.modal('show')
},
eidtImage(id){
location.href = `/image/${id}/imageAdmin`


+ 10
- 4
web_src/js/components/images/selectImages.vue View File

@@ -1,8 +1,10 @@
<template>

<div class="inline required field">
<label for="">镜像</label>
<input type="text" name="image" :value="imageAddress">
<div class="inline required field" :class="{ 'unite': benchmarkNew, 'min_title': benchmarkNew}">
<label v-if="benchmarkNew" style="font-weight: normal;">镜像</label>
<label v-else>镜像</label>
<span v-if="benchmarkNew">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<input type="text" name="image" :value="imageAddress" placeholder="选择镜像或输入镜像地址">
<el-button type="text" @click="dialogVisible = true" icon="el-icon-plus">选择镜像</el-button>
<el-dialog
title="选择镜像"
@@ -77,7 +79,7 @@
</el-pagination>
</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="(starData,index) in tableDataStar" :key="index">
<div style="width: 90%;">
@@ -131,6 +133,7 @@ export default {
data() {
return {
dialogVisible:false,
benchmarkNew:false,
imageAddress:'',
activeName: 'first',
search:'',
@@ -279,6 +282,9 @@ export default {
},
mounted() {
this.getImageListPublic()
if(location.href.indexOf('benchmark')!==-1){
this.benchmarkNew = true
}
},
created() {


Loading…
Cancel
Save