Commit f902bc58 by luyt

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

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