Browse Source

fix issue

pull/1839/head
zhoupzh 3 years ago
parent
commit
455127d083
8 changed files with 70 additions and 63 deletions
  1. +1
    -1
      templates/admin/cloudbrain/images.html
  2. +1
    -1
      templates/repo/cloudbrain/image/edit.tmpl
  3. +11
    -2
      templates/repo/cloudbrain/image/submit.tmpl
  4. +5
    -1
      templates/repo/cloudbrain/trainjob/new.tmpl
  5. +21
    -13
      web_src/js/components/images/Images.vue
  6. +17
    -36
      web_src/js/components/images/selectImages.vue
  7. +10
    -5
      web_src/js/features/images.js
  8. +4
    -4
      web_src/less/openi.less

+ 1
- 1
templates/admin/cloudbrain/images.html View File

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


+ 1
- 1
templates/repo/cloudbrain/image/edit.tmpl View File

@@ -23,7 +23,7 @@
<h4 class="ui top attached header"> <h4 class="ui top attached header">
{{.i18n.Tr "repo.modify_image"}} {{.i18n.Tr "repo.modify_image"}}
</h4> </h4>
<div class="submit-image-tmplvalue" style="display: none;" data-link="/image/{{$.Image.ID}}"></div>
<div class="submit-image-tmplvalue" style="display: none;" data-link="/image/{{$.Image.ID}}" data-edit-page="{{.PageFrom}}"></div>
<div class="ui attached segment" style="padding: 2em 3em;padding-bottom: 7rem;"> <div class="ui attached segment" style="padding: 2em 3em;padding-bottom: 7rem;">
<div class="ui form" id="form_image"> <div class="ui form" id="form_image">
<input type="hidden" name="edit" value="edit"> <input type="hidden" name="edit" value="edit">


+ 11
- 2
templates/repo/cloudbrain/image/submit.tmpl View File

@@ -20,6 +20,10 @@
<div class="alert"></div> <div class="alert"></div>
<div class="ui container"> <div class="ui container">
<div> <div>
<div class="ui negative message" style="display: none;">
</div>
<div class="ui positive message" style="display: none;">
</div>
<h4 class="ui top attached header"> <h4 class="ui top attached header">
{{.i18n.Tr "repo.submit_image"}} {{.i18n.Tr "repo.submit_image"}}
</h4> </h4>
@@ -85,7 +89,7 @@
</div> </div>


<!-- 确认模态框 --> <!-- 确认模态框 -->
<div id="deletemodel">
<div>
<div class="ui modal image_confirm_submit"> <div class="ui modal image_confirm_submit">
<div class="header">{{.i18n.Tr "repo.submit_image"}}</div> <div class="header">{{.i18n.Tr "repo.submit_image"}}</div>
<div class="content text red center"> <div class="content text red center">
@@ -97,4 +101,9 @@
</div> </div>
</div> </div>
</div> </div>
{{template "base/footer" .}}
{{template "base/footer" .}}

<script>

$('.ui.positive.message').text('保存镜像成功').show().delay(1500).fadeOut();
</script>

+ 5
- 1
templates/repo/cloudbrain/trainjob/new.tmpl View File

@@ -152,7 +152,7 @@
</select> </select>
</div> </div>


<div class="required unite min_title inline field" style="position: relative;">
<!-- <div class="required unite min_title inline field" style="position: relative;">
<label style="font-weight: normal;">{{.i18n.Tr "cloudbrain.mirror"}}&nbsp;</label> <label style="font-weight: normal;">{{.i18n.Tr "cloudbrain.mirror"}}&nbsp;</label>
<input class="width81" type="text" list="cloudbrain_image" placeholder="{{.i18n.Tr "cloudbrain.choose_mirror"}}" name="image" required autofocus maxlength="255"> <input class="width81" type="text" list="cloudbrain_image" placeholder="{{.i18n.Tr "cloudbrain.choose_mirror"}}" name="image" required autofocus maxlength="255">
<i class="times circle outline icon icons" style="visibility: hidden;" onclick="clearValue()"></i> <i class="times circle outline icon icons" style="visibility: hidden;" onclick="clearValue()"></i>
@@ -164,6 +164,10 @@
<option name="image" value="{{.Place}}">{{.PlaceView}}</option> <option name="image" value="{{.Place}}">{{.PlaceView}}</option>
{{end}} {{end}}
</datalist> </datalist>
</div> -->

<div id="images-new-cb">

</div> </div>


<div class="inline unite min_title field required"> <div class="inline unite min_title field required">


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

@@ -116,7 +116,7 @@
@current-change="handleCurrentChangePublic" @current-change="handleCurrentChangePublic"
:current-page="currentPagePublic" :current-page="currentPagePublic"
:page-size="pageSizePublic" :page-size="pageSizePublic"
:page-sizes="[10,15,20]"
:page-sizes="[5,10,15]"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="totalNumPublic"> :total="totalNumPublic">
</el-pagination> </el-pagination>
@@ -180,7 +180,7 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="镜像描述" label="镜像描述"
min-width="28%"
min-width="27%"
align="left" align="left"
prop="description" prop="description"
> >
@@ -232,7 +232,7 @@
prop="createdUnix" prop="createdUnix"
label="创建时间" label="创建时间"
align="center" align="center"
min-width="13%"
min-width="14%"
> >
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.createdUnix | transformTimestamp}} {{scope.row.createdUnix | transformTimestamp}}
@@ -273,7 +273,7 @@
@current-change="handleCurrentChangeCustom" @current-change="handleCurrentChangeCustom"
:current-page="currentPageCustom" :current-page="currentPageCustom"
:page-size="pageSizeCustom" :page-size="pageSizeCustom"
:page-sizes="[5,15,20]"
:page-sizes="[5,10,15]"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="totalNumCustom"> :total="totalNumCustom">
</el-pagination> </el-pagination>
@@ -406,7 +406,7 @@
@current-change="handleCurrentChangeStar" @current-change="handleCurrentChangeStar"
:current-page="currentPageStar" :current-page="currentPageStar"
:page-size="pageSizeStar" :page-size="pageSizeStar"
:page-sizes="[5,15,20]"
:page-sizes="[5,10,15]"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="totalNumStar"> :total="totalNumStar">
</el-pagination> </el-pagination>
@@ -456,24 +456,24 @@ export default {
search:'', search:'',
checked:false, checked:false,
currentPagePublic:1, currentPagePublic:1,
pageSizePublic:15,
pageSizePublic:10,
totalNumPublic:0, totalNumPublic:0,
paramsPublic:{page:1,pageSize:15,q:'',recommend:false},
paramsPublic:{page:1,pageSize:10,q:'',recommend:false},
tableDataPublic: [], tableDataPublic: [],
loadingPublic:false, loadingPublic:false,


currentPageCustom:1, currentPageCustom:1,
pageSizeCustom:15,
pageSizeCustom:10,
totalNumCustom:0, totalNumCustom:0,
paramsCustom:{page:1,pageSize:15,q:''},
paramsCustom:{page:1,pageSize:10,q:''},
tableDataCustom: [], tableDataCustom: [],
starCustom:[], starCustom:[],
loadingCustom:false, loadingCustom:false,


currentPageStar:1, currentPageStar:1,
pageSizeStar:15,
pageSizeStar:10,
totalNumStar:0, totalNumStar:0,
paramsStar:{page:1,pageSize:15,q:''},
paramsStar:{page:1,pageSize:10,q:''},
tableDataStar: [], tableDataStar: [],
loadingStar:false loadingStar:false
}; };
@@ -712,10 +712,18 @@ export default {
} }
}, },
mounted() { mounted() {
this.getImageListPublic()
}, },
created() { created() {
const params = new URLSearchParams(location.search)
if(params.has('type')&&params.get('type')=='myimage'){
this.activeName = 'second'
this.getImageListCustom()
}
else{
this.getImageListPublic()
}
} }


}; };


+ 17
- 36
web_src/js/components/images/selectImages.vue View File

@@ -13,14 +13,18 @@
> >
<div class="ui icon input" style="z-index: 9999;position: absolute;right: 50px;height:30px;"> <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="searchName()"></i> <i class="search icon" style="cursor: pointer;pointer-events:auto" @click="searchName()"></i>
<input type="text" placeholder="" v-model="search" @keyup.enter="searchName()">
<input type="text" placeholder="搜镜像Tag/描述/标签..." v-model="search" @keyup.enter="searchName()">
</div> </div>
<el-tabs v-model="activeName" @tab-click="handleClick"> <el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="公开镜像" name="first" v-loading="loadingPublic"> <el-tab-pane label="公开镜像" name="first" v-loading="loadingPublic">
<div style="display: flex;align-items: center;justify-content: space-between;padding: 1rem 0;border-bottom:1px solid #F5F5F5" v-for="(publicData,index) in tableDataPublic" :key="index"> <div style="display: flex;align-items: center;justify-content: space-between;padding: 1rem 0;border-bottom:1px solid #F5F5F5" v-for="(publicData,index) in tableDataPublic" :key="index">
<div style="width: 90%;"> <div style="width: 90%;">
<div style="display: flex;align-items: center;justify-content: space-between;"> <div style="display: flex;align-items: center;justify-content: space-between;">
<span class="panel_dataset_name text-over" style="margin-left: 0;">{{publicData.tag}} </span>
<div style="display: flex;align-items: center;">
<span class="panel_dataset_name text-over" style="margin-left: 0;">{{publicData.tag}} </span>
<img v-if="publicData.type==5" src="/img/jian.svg" style="margin-left: 0.5rem;">
</div>
<div v-if="!!publicData.topics" class="text-over"> <div v-if="!!publicData.topics" class="text-over">
<span v-for="(topic,index) in publicData.topics" class="ui repo-topic label topic">{{topic}}</span> <span v-for="(topic,index) in publicData.topics" class="ui repo-topic label topic">{{topic}}</span>
</div> </div>
@@ -95,7 +99,11 @@
<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="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%;"> <div style="width: 90%;">
<div style="display: flex;align-items: center;justify-content: space-between;"> <div style="display: flex;align-items: center;justify-content: space-between;">
<span class="panel_dataset_name text-over" style="margin-left: 0;">{{starData.tag}} </span>
<div style="display: flex;align-items: center;">
<span class="panel_dataset_name text-over" style="margin-left: 0;">{{starData.tag}} </span>
<img v-if="starData.type==5" src="/img/jian.svg" style="margin-left: 0.5rem;">
</div>
<div v-if="!!starData.topics" class="text-over"> <div v-if="!!starData.topics" class="text-over">
<span v-for="(topic,index) in starData.topics" class="ui repo-topic label topic">{{topic}}</span> <span v-for="(topic,index) in starData.topics" class="ui repo-topic label topic">{{topic}}</span>
</div> </div>
@@ -293,7 +301,7 @@ export default {
}, },
mounted() { mounted() {
this.getImageListPublic() this.getImageListPublic()
if(location.href.indexOf('benchmark')!==-1){
if(location.href.indexOf('benchmark')!==-1 || location.href.indexOf('train-job')!==-1){
this.benchmarkNew = true this.benchmarkNew = true
} }
}, },
@@ -316,54 +324,27 @@ export default {
position: relative; position: relative;
top:-40px; top:-40px;
} }
.el-dropdown-menu__item--divided{
border-top: 1px solid blue;
}
.el-table thead{
background-color: #f5f5f6;
}
/deep/ .el-tabs__item:hover{
color: #000;
font-weight: 500;
}
/deep/ .el-tabs__item.is-active {
color: #000;
font-weight: 500;
}
/deep/ .el-tabs__active-bar{
background-color:#000
}


/deep/ .el-pagination.is-background .el-pager li:not(.disabled).active { /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active {
background-color: #5bb973;
background-color: #409eff !important;
color: #FFF; color: #FFF;
} }
/deep/ .el-pagination.is-background .el-pager li.active { /deep/ .el-pagination.is-background .el-pager li.active {
color: #fff; color: #fff;
cursor: default; cursor: default;
background-color: #409eff !important;
} }
/deep/ .el-pagination.is-background .el-pager li:hover { /deep/ .el-pagination.is-background .el-pager li:hover {
color: #5bb973;
color: #409eff !important;
} }
/deep/ .el-pagination.is-background .el-pager li:not(.disabled):hover { /deep/ .el-pagination.is-background .el-pager li:not(.disabled):hover {
color: #5bb973;
color: #409eff !important;
} }
/deep/ .el-pagination.is-background .el-pager li:not(.disabled).active:hover { /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active:hover {
background-color: #5bb973;
background-color: #409eff !important;
color: #FFF; color: #FFF;
} }


/deep/ .el-pager li.active {
color: #08C0B9;
cursor: default;
}
/deep/ .el-pagination .el-pager li:hover {
color: #08C0B9;
}
/deep/ .el-pagination .el-pager li:not(.disabled):hover {
color: #08C0B9;
}
#success{ #success{
background-color: #5bb973; background-color: #5bb973;
color: white; color: white;


+ 10
- 5
web_src/js/features/images.js View File

@@ -67,6 +67,7 @@ export default async function initImage(){
validate() validate()
initDropdown() initDropdown()
let link = $('.submit-image-tmplvalue').data('link') let link = $('.submit-image-tmplvalue').data('link')
let pageform = $('.submit-image-tmplvalue').data('edit-page') || ''
function postImage(formData) { function postImage(formData) {
$("#mask").css({"display":"block","z-index":"999"}) $("#mask").css({"display":"block","z-index":"999"})
$.ajax({ $.ajax({
@@ -79,15 +80,15 @@ export default async function initImage(){
$('.alert').html(res.Message).removeClass('alert-success').addClass('alert-danger').show().delay(1500).fadeOut(); $('.alert').html(res.Message).removeClass('alert-success').addClass('alert-danger').show().delay(1500).fadeOut();
}else if(res.Code==0){ }else if(res.Code==0){
if(link.indexOf('commit_image')===1){ if(link.indexOf('commit_image')===1){
$('.alert').html('保存镜像成功').removeClass('alert-danger').addClass('alert-success').show().delay(1500).fadeOut();
$('.ui.positive.message').text('保存镜像成功').show().delay(1500).fadeOut();
}else{ }else{
$('.alert').html('提交镜像成功').removeClass('alert-danger').addClass('alert-success').show().delay(1500).fadeOut();
$('.ui.positive.message').text('提交镜像成功').show().delay(1500).fadeOut();
} }
if(location.href.indexOf('imageAdmin')!==-1){ if(location.href.indexOf('imageAdmin')!==-1){
location.href = `${window.config.AppSubUrl}/admin/images` location.href = `${window.config.AppSubUrl}/admin/images`
}else{ }else{
location.href = `${window.config.AppSubUrl}/explore/images`
location.href = `${window.config.AppSubUrl}/explore/images?type=myimage`
} }
} }
}, },
@@ -96,7 +97,7 @@ export default async function initImage(){
// 只有请求不正常(状态码不为200)才会执行 // 只有请求不正常(状态码不为200)才会执行
// $('.ui.error.message').text(xhr.responseText) // $('.ui.error.message').text(xhr.responseText)
// $('.ui.error.message').css('display','block') // $('.ui.error.message').css('display','block')
$('.alert').html(xhr.responseText).removeClass('alert-success').addClass('alert-danger').show().delay(1500).fadeOut();
$('.ui.positive.message').html(xhr.responseText).show().delay(1500).fadeOut();
}, },
complete:function(xhr){ complete:function(xhr){
$("#mask").css({"display":"none","z-index":"1"}) $("#mask").css({"display":"none","z-index":"1"})
@@ -152,7 +153,7 @@ export default async function initImage(){
} }
}, },
error: function(xhr){ error: function(xhr){
$('.alert').html(xhr.responseText).removeClass('alert-success').addClass('alert-danger').show().delay(1500).fadeOut();
$('.ui.positive.message').text(xhr.responseText).show().delay(1500).fadeOut();
} }
}) })
} }
@@ -162,6 +163,10 @@ export default async function initImage(){
if(link.includes('cloudbrain')){ if(link.includes('cloudbrain')){
let repoLink = link.split('cloudbrain')[0] let repoLink = link.split('cloudbrain')[0]
location.href = `${window.config.AppSubUrl}${repoLink}debugjob?debugListType=all` location.href = `${window.config.AppSubUrl}${repoLink}debugjob?debugListType=all`
}else if(pageform=='imageSquare'){
location.href = `${window.config.AppSubUrl}/explore/images?type=myimage`
}else if(pageform=='imageAdmin'){
location.href = `${window.config.AppSubUrl}/admin/images`
} }
}) })
console.log("initImage") console.log("initImage")


+ 4
- 4
web_src/less/openi.less View File

@@ -386,10 +386,10 @@ display: block;
margin: -1px; margin: -1px;
background: #FFF !important; background: #FFF !important;
} }
#deletemodel {
width: 100%;
height: 100%;
}
// #deletemodel {
// width: 100%;
// height: 100%;
// }
/* 弹窗 */ /* 弹窗 */


#mask { #mask {


Loading…
Cancel
Save