Commit f902bc58 by luyt

add:git hook commit记录 前后端,数据库调整

1 parent 6bef5cc8
......@@ -2,12 +2,12 @@ import request2 from '@/plugins/axios/index2.js';
// console.log('request2',request2)
const gitLog = {
getCommitList(id) {
getCommitList(id,branch) {
return request2({
url: '/commons/getList',
url: `/${id}/repository/commits`,
method: 'get',
params: {
project_id:id
ref_name:branch
}
})
},
......
......@@ -12,7 +12,8 @@ import {
Select,
Comment,
Tooltip,
Popover
Popover,
BackTop
} from 'ant-design-vue'
......@@ -31,5 +32,6 @@ export const components = [
Select,
Comment,
Tooltip,
Popover
Popover,
BackTop
]
\ No newline at end of file
......@@ -11,7 +11,7 @@ let url = process.env.NODE_ENV == "development" ? "/api2" : "http://192.168.3.23
const service = axios.create({
withCredentials: false,
baseURL: url,
headers:{
headers:{ //master账号权限
'PRIVATE-TOKEN':'3Jx5WzakT73dR2ybKQh3'
}
})
......
......@@ -2,13 +2,19 @@
<div class="gitlog">
<div class="branch">
<a-select
default-value="master"
:defaultValue="currentBranch"
style="width: 120px"
@change="handleChange"
>
<a-select-option v-for="(item,index) in branchs" :key="index+'branch'" :value="index"> {{ item.name}} </a-select-option>
<a-select-option
v-for="(item, index) in branchs"
:key="index + 'branch'"
:value="item.name"
>
{{ item.name }}
</a-select-option>
</a-select>
<span class="current">当前分支:{{currentBranch.name}}</span>
<span class="current">当前分支:{{ currentBranch }}</span>
</div>
<a-list item-layout="horizontal" :data-source="data">
<a-list-item slot="renderItem" slot-scope="item">
......@@ -25,13 +31,14 @@
</a-list-item-meta>
</a-list-item>
</a-list>
<a-back-top />
</div>
</template>
<script>
import moment from "moment";
export default {
name: "",
name: "gitlog",
props: {},
data() {
return {
......@@ -52,72 +59,51 @@ export default {
},
],
branchs: [
{
name: "SCRM-V1.0.2",
commit: {
id: "266eb49b58dbc3dfdf12e52395fb5de9edcbf47a",
short_id: "266eb49b",
title: "1.3.7",
created_at: "2022-01-17T14:26:31.000+08:00",
parent_ids: ["aa7f2e56c33073428325efb7deff5f25e1da9c80"],
message: "1.3.7\n",
author_name: "limin",
author_email: "17653212@qq.com",
authored_date: "2022-01-17T14:26:31.000+08:00",
committer_name: "limin",
committer_email: "17653212@qq.com",
committed_date: "2022-01-17T14:26:31.000+08:00",
},
merged: true,
protected: false,
developers_can_push: false,
developers_can_merge: false,
},
{
name: "dev",
commit: {
id: "d51cb098bf2eae3295c336c9cf8000776e8e2a3a",
short_id: "d51cb098",
title: "add:修改table左对齐,金额右对齐",
created_at: "2022-02-16T15:39:30.000+08:00",
parent_ids: ["a423fa7e0afb347a2854ac03069dd19167d3acbb"],
message: "add:修改table左对齐,金额右对齐\n",
author_name: "luyt",
author_email: "q9OUYzI2",
authored_date: "2022-02-16T15:39:30.000+08:00",
committer_name: "luyt",
committer_email: "q9OUYzI2",
committed_date: "2022-02-16T15:39:30.000+08:00",
},
merged: false,
protected: false,
developers_can_push: false,
developers_can_merge: false,
},
// {
// name: "SCRM-V1.0.2",
// commit: {
// id: "266eb49b58dbc3dfdf12e52395fb5de9edcbf47a",
// short_id: "266eb49b",
// title: "1.3.7",
// created_at: "2022-01-17T14:26:31.000+08:00",
// parent_ids: ["aa7f2e56c33073428325efb7deff5f25e1da9c80"],
// message: "1.3.7\n",
// author_name: "limin",
// author_email: "17653212@qq.com",
// authored_date: "2022-01-17T14:26:31.000+08:00",
// committer_name: "limin",
// committer_email: "17653212@qq.com",
// committed_date: "2022-01-17T14:26:31.000+08:00",
// },
// merged: true,
// protected: false,
// developers_can_push: false,
// developers_can_merge: false,
// },
// {
// name: "dev",
// commit: {
// id: "d51cb098bf2eae3295c336c9cf8000776e8e2a3a",
// short_id: "d51cb098",
// title: "add:修改table左对齐,金额右对齐",
// created_at: "2022-02-16T15:39:30.000+08:00",
// parent_ids: ["a423fa7e0afb347a2854ac03069dd19167d3acbb"],
// message: "add:修改table左对齐,金额右对齐\n",
// author_name: "luyt",
// author_email: "q9OUYzI2",
// authored_date: "2022-02-16T15:39:30.000+08:00",
// committer_name: "luyt",
// committer_email: "q9OUYzI2",
// committed_date: "2022-02-16T15:39:30.000+08:00",
// },
// merged: false,
// protected: false,
// developers_can_push: false,
// developers_can_merge: false,
// },
],
currentBranch: {
"name": "master",
"commit": {
"id": "98285ed4f3df5ef58a01607651f61592248dd101",
"short_id": "98285ed4",
"title": "add:主题色加深色值调整",
"created_at": "2022-02-10T14:00:54.000+08:00",
"parent_ids": [
"37efaa1ece09035aafd490a8e4d94931b23fedd2"
],
"message": "add:主题色加深色值调整\n",
"author_name": "luyt",
"author_email": "q9OUYzI2",
"authored_date": "2022-02-10T14:00:54.000+08:00",
"committer_name": "luyt",
"committer_email": "q9OUYzI2",
"committed_date": "2022-02-10T14:00:54.000+08:00"
},
"merged": false,
"protected": true,
"developers_can_push": false,
"developers_can_merge": false
},
currentBranch: "master",
projectId: 173,
};
},
filters: {
......@@ -127,23 +113,41 @@ export default {
},
},
created() {
this.getBranchData()
this.getProjectId();
},
mounted() {},
methods: {
//获取项目id
getProjectId() {
console.log('this.$route.query.projectId',this.$route.query.projectId)
if (this.$route.query.projectId) {
this.projectId = this.$route.query.projectId;
this.getBranches();
this.getCommitList();
}
},
handleChange(value) {
this.currentBranch = this.branchs[value]
// console.log('value: ', value);
this.currentBranch = value;
this.getCommitList();
},
defaultBranch(){
//获取所有分支
async getBranches() {
const res = await this.api.gitLog.getBranches(this.projectId);
if (res.length > 0) {
this.branchs = res;
}
},
//获取某个分支下的所有commit
async getCommitList() {
const res = await this.api.gitLog.getCommitList(
this.projectId,
this.currentBranch
);
if (res.length > 0) {
this.data = res;
}
},
getBranchData(value) {
console.log('value: ', value);
this.api.gitLog.getBranches(173).then(res=>{
console.log('res: ', res);
})
}
},
components: {},
computed: {},
......@@ -160,5 +164,12 @@ export default {
.author {
color: #008dff;
}
.ant-list-split .ant-list-item {
transition: all 0.3s;
}
.ant-list-split .ant-list-item:hover {
border-color: rgba(0, 0, 0, 0.09);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
}
}
</style>
\ No newline at end of file
......@@ -61,6 +61,8 @@ export default {
test_url: "",
product_url: "",
technology: "",
git_url: "",
git_id: "",
},
rules: {
project_title: [
......@@ -85,6 +87,12 @@ export default {
technology: [
{ required: true, message: "请输入相关技术栈", trigger: "blur" },
],
git_url: [
{ required: true, message: "请输入gitlab地址", trigger: "blur" },
],
git_id: [
{ required: true, message: "请输入项目gitlab id", trigger: "blur" },
],
},
};
},
......@@ -147,7 +155,7 @@ export default {
//编辑项目
editeItemFn() {
const editeItem = this.$route.params;
if ( Object.keys(editeItem).length === 0) return;
if (Object.keys(editeItem).length === 0) return;
this.isNewAdd = false;
this.form = {
...editeItem,
......
......@@ -86,8 +86,7 @@ const data = [
product_url: "http://sso.glsx.com.cn/#/login",
technology: "vue",
git_url:'http://giturl.com/',
// git_commit:'http://gitcommit.com/',
git_id:12
git_id:173
},
{
id: 2,
......@@ -99,8 +98,7 @@ const data = [
product_url: "http://glsx-account.glsx.com.cn",
technology: "vue",
git_url:'http://giturl.com/',
// git_commit:'http://gitcommit.com/',
git_id:25
git_id:173
},
];
import projectImgUrl from "@/assets/project.jpg";
......@@ -158,13 +156,18 @@ export default {
});
},
checkGitLog(item){
console.log('item: ', item);
if(!item.git_id){
return this.$message.error("请填写gitlab项目id");
}
// console.log('item: ', item);
this.$router.push({name:'GitLog',query:{projectId:item.git_id}})
}
},
};
</script>
<style lang="scss">
.home-project {
padding: 20px;
.ant-list-item {
padding: 10px;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!