Browse Source

fix issue #164

tags/v1.21.12.1
zhoupzh 4 years ago
parent
commit
a3fbcffe15
8 changed files with 1768 additions and 24 deletions
  1. +1
    -0
      options/locale/locale_en-US.ini
  2. +1
    -0
      options/locale/locale_zh-CN.ini
  3. +1653
    -0
      public/img/icons.svg
  4. BIN
      public/img/loading.gif
  5. +19
    -3
      templates/repo/cloudbrain/index.tmpl
  6. +11
    -2
      templates/repo/home.tmpl
  7. +70
    -19
      web_src/js/components/EditTopics.vue
  8. +13
    -0
      web_src/less/openi.less

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

@@ -831,6 +831,7 @@ fork = Fork
download_archive = Download Repository

no_desc = No Description
no_label = No labels
quick_guide = Quick Guide
clone_this_repo = Clone this repository
create_new_repo_command = Creating a new repository on the command line


+ 1
- 0
options/locale/locale_zh-CN.ini View File

@@ -833,6 +833,7 @@ fork=派生
download_archive=下载此项目

no_desc=暂无描述
no_label = 暂无标签
quick_guide=快速帮助
clone_this_repo=克隆当前项目
create_new_repo_command=从命令行创建一个新的项目


+ 1653
- 0
public/img/icons.svg
File diff suppressed because it is too large
View File


BIN
public/img/loading.gif View File

Before After
Width: 16  |  Height: 16  |  Size: 2.9 kB

+ 19
- 3
templates/repo/cloudbrain/index.tmpl View File

@@ -187,6 +187,12 @@
cursor: pointer;
pointer-events: none;
}
.time-show{
font-size: 10px;
margin-top: 0.4rem;
display: inline-block;
}
</style>

<!-- 弹窗 -->
@@ -265,11 +271,21 @@

<div class="three wide column">
<!--任务状态 -->
<span class="ui compact button job-status" id="{{.JobID}}" data-repopath="{{$.RepoRelPath}}" data-jobid="{{.JobID}}">
<!-- <span class="ui compact button job-status" id="{{.JobID}}" data-repopath="{{$.RepoRelPath}}" data-jobid="{{.JobID}}">
{{.Status}}
</span>
</span> -->
{{if eq .Status "STOPPED"}}
<span style="display:flex;position: relative; justify-content: flex-start;"><i class="i-round i-bg-stop"></i><span style="margin-left: 0.4em;font-size: 12px;">已停止</span></span>
{{else if eq .Status "RUNNING"}}
<span style="display:flex;position: relative; justify-content: flex-start;"><i class="i-round i-bg-running"></i><span style="margin-left: 0.4em;font-size: 12px;">运行中</span></span>
{{else if eq .Status "FAILED"}}
<span style="display:flex;position: relative; justify-content: flex-start;"><i class="i-round i-bg-running"></i><span style="margin-left: 0.4em;font-size: 12px;">运行失败</span></span>
{{else if eq .Status "WAITING"}}
<span style="display:flex;position: relative; justify-content: flex-start;"><i class="showCircle"></i><span style="margin-left: 0.4em;font-size: 12px;">初始化等待</span></span>
{{end}}
<!-- 任务创建时间 -->
<span class="">{{TimeSinceUnix .CreatedUnix $.Lang}}</span>
<span class="time-show">{{TimeSinceUnix .CreatedUnix $.Lang}}</span>
</div>

<div class="seven wide column text right">


+ 11
- 2
templates/repo/home.tmpl View File

@@ -269,11 +269,20 @@

<div class="ui" id="repo-topics" style="display: flex;position: relative;margin-bottom: 1.0rem;">
<i class="grey bookmark icon"></i>
<div id="repo-topics1" style="flex: 1;">
{{range .Topics}}<a class="ui repo-topic small label topic" href="{{AppSubUrl}}/explore/repos?q={{.Name}}&topic=1">{{.Name}}</a>{{end}}
<!-- {{if not .Topics}}
<span class="no-description text-italic">{{.i18n.Tr "repo.no_desc"}}</span>
{{end}} -->
{{range .Topics}}
<a class="ui repo-topic small label topic" href="{{AppSubUrl}}/explore/repos?q={{.Name}}&topic=1">{{.Name}}</a>
{{end}}
</div>
<div>
{{if and .Permission.IsAdmin (not .Repository.IsArchived)}}<i id="manage_topic" class="plus icon"></i>{{end}}
{{if and .Permission.IsAdmin (not .Repository.IsArchived)}}<i id="manage_topic" style="cursor: pointer;" class="plus icon"></i>{{end}}
</div>
<div id="topic_edit" class="vue_menu" style="display:none">
<div id="topic_edit1">


+ 70
- 19
web_src/js/components/EditTopics.vue View File

@@ -3,13 +3,13 @@
<div class="input-search">
<el-input v-model="input" clearable :autofocus="true" @input="changeValue" id="topics_input" @keyup.enter.native="postTopic">
<el-input v-model="input" clearable :autofocus="true" @input="changeValue" id="topics_input" @keyup.enter.native="postTopic" placeholder="搜索或创建标签">

</el-input>
<div class="scrolling-menu">
<div v-if="showSearchTopic" class="item-text" v-for="(arr,i) in array" @click="addTopics(i,arr)">
<div class="icon-wrapper">
<i style="vertical-align: middle;color: #303643;" v-if="showInitTopic[i]" class="el-icon-check" ></i>
<i style="line-height: 1.5;color: #303643;font-weight: 900;" v-if="showInitTopic[i]" class="el-icon-check" ></i>
</div>
<div class="text">{{arr.topic_name}} </div>
</div>
@@ -18,7 +18,7 @@
</div>
<div v-if="showAddTopic" class="item-text" @click="addPostTopic">
<div class="icon-wrapper">
<i style="vertical-align: middle;color: #303643;" v-if="showAddFlage" class="el-icon-check" ></i>
<i style="line-height: 1.5;color: #303643;font-weight: 900;" v-if="showAddFlage" class="el-icon-check" ></i>
</div>
<div class="text">{{input}}</div>
</div>
@@ -72,6 +72,7 @@ export default {
})
this.Post(data,topics)
this.$set(this.showInitTopic,item,true)
$('#repo-topics1').children('span').remove()

@@ -91,6 +92,12 @@ export default {
})
this.Post(data,topics)
this.$set(this.showInitTopic,item,false)
if(this.arrayTopics.length===0){
console.log("set empty")
$('#repo-topics1').append('<span class="no-description text-italic">暂无标签</span>')
}else{
$('#repo-topics1').children('span').remove()
}

}
@@ -190,21 +197,34 @@ export default {
})
},
postTopic(){
const patter = /^[\u4e00-\u9fa5a-z0-9][\u4e00-\u9fa5a-zA-Z0-9-]{0,35}$/
let regexp = patter.test(this.input)
console.log("regexp",regexp)
if(!regexp){
this.$notify({
message: '主题必须以中文、字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符',
duration: 3000,
type:'error'
});
return
}else{
let topic = this.input
this.arrayTopics.push(topic)
let topics = this.arrayTopics
let strTopics = topics.join(',')
let data = this.qs.stringify({
_csrf:csrf,
topics:strTopics
})
this.Post(data,topics)
$('#repo-topics1').children('span').remove()
this.showInputValue = false
this.showAddTopic = true
this.showAddFlage = true
}
let topic = this.input
this.arrayTopics.push(topic)
let topics = this.arrayTopics
let strTopics = topics.join(',')
let data = this.qs.stringify({
_csrf:csrf,
topics:strTopics
})
this.Post(data,topics)
this.showInputValue = false
this.showAddTopic = true
this.showAddFlage = true

},
addPostTopic(){
@@ -218,7 +238,13 @@ export default {
topics:strTopics
})
this.Post(data,topics)

if(this.arrayTopics.length===0){
console.log("add postTopic")
$('#repo-topics1').append('<span class="no-description text-italic">暂无标签</span>')
}else{
$('#repo-topics1').children('span').remove()
}
}
else if(!this.showAddFlage){
let topic = this.input
@@ -231,6 +257,7 @@ export default {
topics:strTopics
})
this.Post(data,topics)
$('#repo-topics1').children('span').remove()
}
this.showAddFlage = !this.showAddFlage
},
@@ -245,6 +272,27 @@ export default {
editDiv.css('display', ''); // show Semantic UI Grid
this.input = ''
if (this.input === ''){
this.array = this.arrayTopics
let data = []
this.showInitTopic = []
this.array.forEach((element,index) => {
let item = {}
item.topic_name = element
data.push(item)
this.showInitTopic.push(true)
});
this.array = data
this.showInputValue = false
this.showSearchTopic = true
}
stopPropagation(e);
@@ -310,7 +358,10 @@ mounted() {
context.arrayTopics.push($(this).text())
});
if(this.arrayTopics.length===0){
$('#repo-topics1').append('<span class="no-description text-italic">暂无标签</span>')
}
this.changeValue()
} ,
created(){


+ 13
- 0
web_src/less/openi.less View File

@@ -220,3 +220,16 @@ footer .column{margin-bottom:0!important; padding-bottom:0!important;}
.ui.vertical.menu .dropdown.item .menu {
left: 50%;
}

// icon cloudbrain
.i-round{display:inline-block;width:18px;height:18px;background:url("/img/icons.svg");background-position: -496px -52px;}
.i-bg-organ{background-position: -496px -52px;}
.i-bg-stop{background-position: -459px -52px;}
.i-bg-running{background-position: -478px -52px;}
.i-bg-orange{background-position: -495px -51px;}
.i-bg-red{background-position: -532px -52px;}
.i-bg-green{background-position: -441px -52px;}
.i-bg-used{background-position: -514px -52px;}
.icon-bind{background-position: -550px -52px;}
.icon-unbind{background-position: -568px -52px;}
.showCircle{display:inline-block;background-image:url('/img/loading.gif');background-repeat:no-repeat;width:16px;height:16px;background-size:16px 16px;margin-right:5px;}

Loading…
Cancel
Save