Skip to content

Commit

Permalink
feat:代码库优化一期功能点 #9347
Browse files Browse the repository at this point in the history
  • Loading branch information
vhwweng committed Sep 14, 2023
1 parent 5e16eb5 commit ab7accf
Show file tree
Hide file tree
Showing 10 changed files with 302 additions and 205 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@
:cur-repo="curRepo"
:repo-info="repoInfo"
:type="type"
:is-p4="isP4"
:is-svn="isSvn"
:is-git-lab="isGitLab"
:is-t-git="isTGit"
:is-git="isGit"
:is-github="isGithub"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,19 @@
size="16"
/>
<a
v-if="repoInfo.url && repoInfo.url.startsWith('http')"
class="codelib-address"
v-bk-overflow-tips
@click="handleToRepo(repoInfo.url)"
>
{{ repoInfo.url }}
</a>
<p
v-else
class="codelib-address"
>
{{ repoInfo.url }}
</p>
<span @click="handleCopy">
<Icon
name="copy2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
:type="isSearch ? 'search-empty' : 'empty'"
@clear="resetFilter"
/>
{{ scmType}}
</section>
</template>
<script>
Expand Down Expand Up @@ -83,7 +84,8 @@
catchRepoId: '',
isLoadingMore: false,
hasLoadEnd: false,
pageLoading: false
pageLoading: false,
isInitTime: true
}
},
computed: {
Expand All @@ -96,67 +98,6 @@
triggerType () {
return this.curRepo.type || ''
},
// triggerTypeList () {
// return [
// { name: this.$t('codelib.手动触发'), id: 'MANUAL' },
// { name: this.$t('codelib.定时触发'), id: 'TIME_TRIGGER' },
// { name: this.$t('codelib.服务触发'), id: 'SERVICE' },
// { name: this.$t('codelib.流水线触发'), id: 'PIPELINE' },
// { name: this.$t('codelib.远程触发'), id: 'REMOTE' }
// ]
// },
// eventTypeList () {
// const listMap = {
// GITHUB: [
// { name: this.$t('codelib.创建Branch/Tag事件'), id: 'CREATE' },
// { name: this.$t('codelib.PR事件'), id: 'PULL_REQUEST' }
// ],
// CODE_SVN: [
// { name: this.$t('codelib.POST_COMMIT事件'), id: 'POST_COMMIT' },
// { name: this.$t('codelib.LOCK_COMMIT事件'), id: 'LOCK_COMMIT' },
// { name: this.$t('codelib.PRE_COMMIT事件'), id: 'PRE_COMMIT' }
// ],
// CODE_GIT: [
// { name: this.$t('codelib.推送事件'), id: 'PUSH' },
// { name: this.$t('codelib.标签推送事件'), id: 'TAG_PUSH' },
// { name: this.$t('codelib.合并请求事件'), id: 'MERGE_REQUEST' },
// { name: this.$t('codelib.议题事件'), id: 'ISSUES' },
// { name: this.$t('codelib.评论事件'), id: 'NOTE' },
// { name: this.$t('codelib.评审事件'), id: 'REVIEW' }
// ],
// CODE_GITLAB: [
// { name: this.$t('codelib.推送事件'), id: 'PUSH' },
// { name: this.$t('codelib.标签推送事件'), id: 'TAG_PUSH' },
// { name: this.$t('codelib.合并请求事件'), id: 'MERGE_REQUEST' },
// { name: this.$t('codelib.议题事件'), id: 'ISSUES' },
// { name: this.$t('codelib.评论事件'), id: 'NOTE' },
// { name: this.$t('codelib.评审事件'), id: 'REVIEW' }
// ],
// CODE_TGIT: [
// { name: this.$t('codelib.推送事件'), id: 'PUSH' },
// { name: this.$t('codelib.标签推送事件'), id: 'TAG_PUSH' },
// { name: this.$t('codelib.合并请求事件'), id: 'MERGE_REQUEST' },
// { name: this.$t('codelib.议题事件'), id: 'ISSUES' },
// { name: this.$t('codelib.评论事件'), id: 'NOTE' },
// { name: this.$t('codelib.评审事件'), id: 'REVIEW' }
// ],
// CODE_P4: [
// { name: this.$t('codelib.CHANGE_COMMIT事件'), id: 'CHANGE_COMMIT' },
// { name: this.$t('codelib.PUSH_SUBMIT事件'), id: '.PUSH_SUBMIT' },
// { name: this.$t('codelib.CHANGE_CONTENT事件'), id: 'CHANGE_CONTENT' },
// { name: this.$t('codelib.CHANGE_SUBMIT事件'), id: 'CHANGE_SUBMIT' },
// { name: this.$t('codelib.PUSH_CONTENT事件'), id: 'PUSH_CONTENT' },
// { name: this.$t('codelib.PUSH_COMMIT事件'), id: 'PUSH_COMMIT' },
// { name: this.$t('codelib.FIX_ADD事件'), id: 'FIX_ADD' },
// { name: this.$t('codelib.FIX_DELETE事件'), id: 'FIX_DELETE' },
// { name: this.$t('codelib.FORM_COMMIT事件'), id: 'FORM_COMMIT' },
// { name: this.$t('codelib.SHELVE_COMMIT事件'), id: 'SHELVE_COMMIT' },
// { name: this.$t('codelib.SHELVE_DELETE事件'), id: 'SHELVE_DELETE' },
// { name: this.$t('codelib.SHELVE_SUBMIT事件'), id: 'SHELVE_SUBMIT' }
// ]
// }
// return listMap[this.triggerType] || []
// },
searchList () {
const list = [
{
Expand All @@ -183,6 +124,9 @@
})
},
isSearch () {
if (this.isInitTime) {
return false
}
return this.daterange[0] || this.searchValue.length
}
},
Expand All @@ -191,16 +135,19 @@
await this.resetFilter()
this.catchRepoId = id
},
daterange () {
daterange (newVal, oldVal) {
if (oldVal[0]) this.isInitTime = false
this.page = 1
this.hasLoadEnd = false
this.eventList = []
this.timelineMap = {}
console.log(this.catchRepoId === this.repoId, 'this.catchRepoId === this.repoId')
if (this.catchRepoId === this.repoId) {
this.getListData()
}
},
searchValue () {
searchValue (newVal, oldVal) {
this.isInitTime = false
this.page = 1
this.hasLoadEnd = false
this.eventList = []
Expand All @@ -215,6 +162,10 @@
this.getEventTypeList()
this.getTriggerTypeList()
this.getListData()
const endTime = new Date()
const startTime = new Date()
startTime.setTime(startTime.getTime() - 3600 * 1000 * 24 * 7)
this.daterange = [startTime, endTime]
},
methods: {
...mapActions('codelib', [
Expand All @@ -223,7 +174,9 @@
'fetchTriggerType'
]),
getEventTypeList () {
this.fetchEventType().then(res => {
this.fetchEventType({
scmType: this.triggerType
}).then(res => {
this.eventTypeList = res.map(i => {
return {
...i,
Expand Down Expand Up @@ -267,8 +220,8 @@
pageSize: this.pageSize,
...params,
triggerType: params.triggerType || this.triggerType,
startTimeEndTime: daterange[0],
endTimeStartTime: daterange[1]
startTime: daterange[0],
endTime: daterange[1]
}).then(res => {
this.eventList = [...this.eventList, ...res.records]
this.timelineMap = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<bk-radio
value="HTTP"
>
{{ $t('codelib.用户名密码+个人token') }}
{{ $t('codelib.访问令牌') }}
</bk-radio>
</bk-radio-group>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<bk-radio
value="http"
>
{{ $t('codelib.用户名密码+个人token') }}
{{ $t('codelib.用户名密码') }}
</bk-radio>
</bk-radio-group>
</bk-form-item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@
}
</script>

<style lang="scss">
<style lang="scss" scoped>
::v-deep .bk-exception-img.part-img {
margin-top: 200px;
}
.empty-tips {
margin-top: 8px;
font-size: 12px;
Expand Down
10 changes: 5 additions & 5 deletions src/frontend/devops-codelib/src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,10 +441,10 @@ const actions = {
eventType = '',
triggerUser = '',
pipelineName = '',
startTimeEndTime = '',
endTimeStartTime = ''
startTime = '',
endTime = ''
}) {
return vue.$ajax.get(`${PROCESS_API_URL_PREFIX}/user/trigger/event/${projectId}/${repositoryHashId}/listRepoTriggerEvent?page=${page}&pageSize=${pageSize}&triggerType=${triggerType}&eventType=${eventType}&triggerUser=${triggerUser}&pipelineName=${pipelineName}&startTimeEndTime=${startTimeEndTime}&endTimeStartTime=${endTimeStartTime}`)
return vue.$ajax.get(`${PROCESS_API_URL_PREFIX}/user/trigger/event/${projectId}/${repositoryHashId}/listRepoTriggerEvent?page=${page}&pageSize=${pageSize}&triggerType=${triggerType}&eventType=${eventType}&triggerUser=${triggerUser}&pipelineName=${pipelineName}&startTime=${startTime}&endTime=${endTime}`)
},

/**
Expand Down Expand Up @@ -481,8 +481,8 @@ const actions = {
* 获取事件类型
*/

fetchEventType ({ commit }) {
return vue.$ajax.get(`${PROCESS_API_URL_PREFIX}/user/trigger/event/listEventType`)
fetchEventType ({ commit }, { scmType }) {
return vue.$ajax.get(`${PROCESS_API_URL_PREFIX}/user/trigger/event/listEventType?scmType=${scmType}`)
},

/**
Expand Down
32 changes: 3 additions & 29 deletions src/frontend/locale/codelib/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"linkCodelibLabel": "Link {0} Repositories",
"typeCodelib": "{0} Repositories",
"link": "link",
"linkRepo": "Link {0} Repositories",
"codelibDesc": "Code Repositories service can link your existed SVN and GIT repositories to CI,which will be a pipeline's materials",
"laodingTitle": "Loading repositories list",
"aliasNamePlaceholder": "Input alias name and press Enter for search",
Expand Down Expand Up @@ -147,39 +148,12 @@
"触发器类型/事件类型/触发人/流水线名称": "触发器类型/事件类型/触发人/流水线名称",
"加载更多": "Load More",
"到底啦": "End",
"手动触发": "手动触发",
"定时触发": "定时触发",
"服务触发": "服务触发",
"流水线触发": "流水线触发",
"远程触发": "远程触发",
"创建Branch/Tag事件": "创建Branch/Tag事件",
"PR事件": "PR事件",
"POST_COMMIT事件": "POST_COMMIT事件",
"LOCK_COMMIT事件": "LOCK_COMMIT事件",
"PRE_COMMIT事件": "PRE_COMMIT事件",
"推送事件": "推送事件",
"标签推送事件": "标签推送事件",
"合并请求事件": "合并请求事件",
"议题事件": "议题事件",
"评论事件": "评论事件",
"评审事件": "评审事件",
"CHANGE_COMMIT事件": "CHANGE_COMMIT事件",
"PUSH_SUBMIT事件": "PUSH_SUBMIT事件",
"CHANGE_CONTENT事件": "CHANGE_CONTENT事件",
"CHANGE_SUBMIT事件": "CHANGE_SUBMIT事件",
"PUSH_CONTENT事件": "PUSH_CONTENT事件",
"PUSH_COMMIT事件": "PUSH_COMMIT事件",
"FIX_ADD事件": "FIX_ADD事件",
"FIX_DELETE事件": "FIX_DELETE事件",
"FORM_COMMIT事件": "FORM_COMMIT事件",
"SHELVE_COMMIT事件": "SHELVE_COMMIT事件",
"SHELVE_DELETE事件": "SHELVE_DELETE事件",
"SHELVE_SUBMIT事件": "SHELVE_SUBMIT事件",
"一键重新触发": "一键重新触发",
"重新触发": "重新触发",
"触发成功": "触发成功",
"触发器类型/事件类型": "触发器类型/事件类型",
"事件": "事件",
"流水线数量": "流水线数量",
"操作": "操作"
"操作": "Actions",
"访问令牌": "Access Token"
}
31 changes: 2 additions & 29 deletions src/frontend/locale/codelib/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,39 +152,12 @@
"触发器类型/事件类型/触发人/流水线名称": "触发器类型/事件类型/触发人/流水线名称",
"加载更多": "加载更多",
"到底啦": "到底啦",
"手动触发": "手动触发",
"定时触发": "定时触发",
"服务触发": "服务触发",
"流水线触发": "流水线触发",
"远程触发": "远程触发",
"创建Branch/Tag事件": "创建Branch/Tag事件",
"PR事件": "PR事件",
"POST_COMMIT事件": "POST_COMMIT事件",
"LOCK_COMMIT事件": "LOCK_COMMIT事件",
"PRE_COMMIT事件": "PRE_COMMIT事件",
"推送事件": "推送事件",
"标签推送事件": "标签推送事件",
"合并请求事件": "合并请求事件",
"议题事件": "议题事件",
"评论事件": "评论事件",
"评审事件": "评审事件",
"CHANGE_COMMIT事件": "CHANGE_COMMIT事件",
"PUSH_SUBMIT事件": "PUSH_SUBMIT事件",
"CHANGE_CONTENT事件": "CHANGE_CONTENT事件",
"CHANGE_SUBMIT事件": "CHANGE_SUBMIT事件",
"PUSH_CONTENT事件": "PUSH_CONTENT事件",
"PUSH_COMMIT事件": "PUSH_COMMIT事件",
"FIX_ADD事件": "FIX_ADD事件",
"FIX_DELETE事件": "FIX_DELETE事件",
"FORM_COMMIT事件": "FORM_COMMIT事件",
"SHELVE_COMMIT事件": "SHELVE_COMMIT事件",
"SHELVE_DELETE事件": "SHELVE_DELETE事件",
"SHELVE_SUBMIT事件": "SHELVE_SUBMIT事件",
"一键重新触发": "一键重新触发",
"重新触发": "重新触发",
"触发成功": "触发成功",
"触发器类型/事件类型": "触发器类型/事件类型",
"事件": "事件",
"流水线数量": "流水线数量",
"操作": "操作"
"操作": "操作",
"访问令牌": "访问令牌"
}

0 comments on commit ab7accf

Please sign in to comment.