|
|
@@ -9,7 +9,9 @@
|
|
|
v-for="(git, index) in gits"
|
|
|
:key="index"
|
|
|
:timestamp="git.timestamp"
|
|
|
- placement="top">
|
|
|
+ placement="top"
|
|
|
+ :color="git.relatedType === 'bug_id' ? 'chocolate' : '#42b983'"
|
|
|
+ size="large">
|
|
|
<ElCard>
|
|
|
<h3 class="id">#{{git.id}}</h3>
|
|
|
<div style="margin-top: 10px; font-size: 16px">{{git.message}}</div>
|
|
|
@@ -20,7 +22,7 @@
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
类型:
|
|
|
- <span v-if="git.relatedType === 'BUG_ID'" class="node bug">缺陷</span>
|
|
|
+ <span v-if="git.relatedType === 'bug_id'" class="node bug">缺陷</span>
|
|
|
<span v-else class="node requirement">需求</span></el-col>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
@@ -32,46 +34,29 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { ProjectAPI } from '@/api';
|
|
|
+import { formatter } from '../../utils/time';
|
|
|
+
|
|
|
export default {
|
|
|
name: 'Commit.vue',
|
|
|
data() {
|
|
|
return {
|
|
|
- gits: [
|
|
|
- {
|
|
|
- id: '010f2a0ccf522fe6c1408bffdd494782880c1ec9',
|
|
|
- message: 'fix: working on #942#, 处理bug942',
|
|
|
- timestamp: '2021-07-10 15:09:36',
|
|
|
- gitlabUsername: 'xiaofei',
|
|
|
- relatedType: 'BUG_ID',
|
|
|
- relatedId: 942,
|
|
|
- },
|
|
|
- {
|
|
|
- id: '030a88a98695d83bdd91937783c08323451d5046',
|
|
|
- message: 'feat: complete #878# ',
|
|
|
- timestamp: '2021-07-09 23:18:20',
|
|
|
- gitlabUsername: '17313',
|
|
|
- relatedType: 'TREE_ID',
|
|
|
- relatedId: 878,
|
|
|
- },
|
|
|
- {
|
|
|
- id: '07f536fc5d660d8085d360961ab4fd337df9b8f1',
|
|
|
- message: 'fix: fixing on #17#',
|
|
|
- timestamp: '2021-07-08 13:45:22',
|
|
|
- gitlabUsername: 'suyiiis',
|
|
|
- relatedType: 'BUG_ID',
|
|
|
- relatedId: 17,
|
|
|
- },
|
|
|
- {
|
|
|
- id: '0c75b8b675291c1f90a56e912befc38341ec3171',
|
|
|
- message: 'feat: complete #273#',
|
|
|
- timestamp: '2021-07-08 10:11:23',
|
|
|
- gitlabUsername: 'YGcatwhite',
|
|
|
- relatedType: 'TREE_ID',
|
|
|
- relatedId: 273,
|
|
|
- },
|
|
|
- ],
|
|
|
+ gits: [],
|
|
|
};
|
|
|
},
|
|
|
+ async mounted() {
|
|
|
+ this.gits = await ProjectAPI.getCommits(this.$store.state.workspace.currentProjectId);
|
|
|
+ for (let i = 0; i < this.gits.length; i += 1) {
|
|
|
+ this.gits[i].timestamp = formatter(this.gits[i].timestamp);
|
|
|
+ }
|
|
|
+ this.gits.sort((a, b) => {
|
|
|
+ const aTimeString = a.timestamp;
|
|
|
+ const bTimeString = b.timestamp;
|
|
|
+ const aTime = new Date(aTimeString).getTime();
|
|
|
+ const bTime = new Date(bTimeString).getTime();
|
|
|
+ return bTime - aTime;
|
|
|
+ });
|
|
|
+ },
|
|
|
};
|
|
|
</script>
|
|
|
|