Browse Source

fix issue

tags/v1.22.4.1^2
zhoupzh 4 years ago
parent
commit
4a67fb2baf
5 changed files with 77 additions and 23 deletions
  1. +1
    -0
      templates/repo/cloudbrain/image/edit.tmpl
  2. +15
    -1
      templates/repo/cloudbrain/image/submit.tmpl
  3. +20
    -5
      web_src/js/components/images/Images.vue
  4. +12
    -1
      web_src/js/components/images/selectImages.vue
  5. +29
    -16
      web_src/js/features/images.js

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

@@ -26,6 +26,7 @@
<div class="submit-image-tmplvalue" style="display: none;" data-link="/image/{{$.Image.ID}}"></div>
<div class="ui attached segment" style="padding: 2em 3em;padding-bottom: 7rem;">
<div class="ui form" id="form_image">
<input type="hidden" name="edit" value="edit">
{{.CsrfTokenHtml}}
<input type="hidden" name="id" value="{{.Image.ID}}">
<div class="inline field">


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

@@ -83,4 +83,18 @@
</div>
</div>
</div>
{{template "base/footer" .}}

<!-- 确认模态框 -->
<div id="deletemodel">
<div class="ui modal image_confirm_submit">
<div class="header">{{.i18n.Tr "repo.submit_image"}}</div>
<div class="content text red center">
<p><i class="exclamation icon"></i>{{.i18n.Tr "repo.image_overwrite"}}</p>
</div>
<div class="actions">
<button class="ui deny small button">{{.i18n.Tr "cloudbrain.operate_cancel"}}</button>
<button class="ui green small approve button">{{.i18n.Tr "cloudbrain.operate_confirm"}}</button>
</div>
</div>
</div>
{{template "base/footer" .}}

+ 20
- 5
web_src/js/components/images/Images.vue View File

@@ -195,7 +195,7 @@
<el-table-column
prop="cloudbrainType"
label="可用集群"
min-width="10%"
min-width="9%"
align="center"
>
<template slot-scope="scope">
@@ -205,19 +205,34 @@
<el-table-column
prop="isPrivate"
label="状态"
min-width="8%"
min-width="10%"
align="center"
>
<template slot-scope="scope">
<span v-if="scope.row.isPrivate" style="color: rgb(250, 140, 22);">私有</span>
<span v-else style="color: rgb(19, 194, 141);">公开</span>
<div style="display:flex;align-items: center;justify-content: center;">
<span v-if="scope.row.isPrivate" style="color: rgb(250, 140, 22);">私有</span>
<span v-else style="color: rgb(19, 194, 141);">公开</span>
<el-tooltip class="item" effect="dark" content="镜像提交中..." placement="top">
<i v-if="scope.row.status===0" class="CREATING" style="margin-left:0.3rem"></i>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="检测提交镜像是否大小超过20G!" placement="top">
<i v-if="scope.row.status===2" class="FAILED" style="margin-left:0.3rem"></i>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="镜像提交成功" placement="top">
<i v-if="scope.row.status===1" class="SUCCEEDED" style="margin-left:0.3rem"></i>
</el-tooltip>
</div>
</template>
</el-table-column>
<el-table-column
prop="createdUnix"
label="创建时间"
align="center"
min-width="14%"
min-width="13%"
>
<template slot-scope="scope">
{{scope.row.createdUnix | transformTimestamp}}


+ 12
- 1
web_src/js/components/images/selectImages.vue View File

@@ -65,7 +65,18 @@
</div>
</div>
<div>
<button class="ui primary basic button mini" @click.stop.prevent="selectImages(customData.place,customData.tag)">使用</button>
<button v-if="customData.status===1" class="ui primary basic button mini" @click.stop.prevent="selectImages(customData.place,customData.tag)">使用</button>
<span v-if="customData.status===0" style="display: flex;align-items: center;">
<i class="CREATING"></i>
<span style="margin-left: 0.4em;font-size: 12px;color: #5A5A5A;">提交中</span>
</span>
<span v-if="customData.status===2" style="display: flex;align-items: center;">
<i class="FAILED"></i>
<el-tooltip class="item" effect="dark" content="检测提交镜像是否大小超过20G!" placement="left">
<span style="margin-left: 0.4em;font-size: 12px;color:red;">提交失败</span>
</el-tooltip>
</span>
</div>
</div>
<div class="ui container" style="margin-top:50px;text-align:center">


+ 29
- 16
web_src/js/features/images.js View File

@@ -127,23 +127,36 @@ export default async function initImage(){
console.log(postData)
let formData = $params(postData)
console.log(formData)

$.ajax({
url:link+'/check',
type:'POST',
data:formData,
success:function(res){
console.log("res",res)
if(res.Code===1){
$('.alert').html(res.Message).removeClass('alert-success').addClass('alert-danger').show().delay(1500).fadeOut();
}else if(res.Code==0){
postImage(formData)
console.log()
if($("input[name='edit']").val()=="edit"){
postImage(formData)
}
else{
$.ajax({
url:link+'/check',
type:'POST',
data:formData,
success:function(res){
console.log("res",res)
if(res.Code===1){
$('.ui.modal.image_confirm_submit')
.modal({
onApprove: function() {
postImage(formData)
},
})
.modal('show')
}else if(res.Code==0){
postImage(formData)
}
},
error: function(xhr){
$('.alert').html(xhr.responseText).removeClass('alert-success').addClass('alert-danger').show().delay(1500).fadeOut();
}
},
error: function(xhr){
$('.alert').html(xhr.responseText).removeClass('alert-success').addClass('alert-danger').show().delay(1500).fadeOut();
}
})
})
}
})
$('#cancel_submit_image').click(()=>{
if(link.includes('cloudbrain')){


Loading…
Cancel
Save