-
-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathhistory.vue
149 lines (138 loc) · 3.15 KB
/
history.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<template>
<div class="history">
<div class="history__logs">
<div v-if="!this.$store.state.history.commitInformation.isActive">
<logSkeleton v-if="repositoryLogs.length < 1" />
<VueScrollbar v-else class="history__logs__scrollbar">
<div>
<commitHistoryItem
v-for="log in repositoryLogs"
:key="log.hash"
:data="log"
@click.native="gitShow(log.hash)"
/>
</div>
</VueScrollbar>
</div>
<div v-else class="history__logs__detail">
<div class="history__logs__detail__buttons">
<div
class="history__logs__detail__buttons__back"
@click="toggleCommitDetail()"
>
Back
</div>
<div
class="history__logs__detail__buttons__export d-flex ml-auto"
@click="exportCommitDetail()"
>
<fileIcon />
</div>
</div>
<VueScrollbar class="history__logs__detail__scrollbar">
<commitInformation />
</VueScrollbar>
</div>
</div>
<div>
<diffPreview
v-if="this.$store.state.history.filePreview.isActive"
:preview="commitFileDiffPreview"
/>
<div v-else>
No content to show
</div>
</div>
</div>
</template>
<script>
import commitHistoryItem from "../../components/commit/commitHistoryItem";
import commitInformation from "../../components/commit/commitInformation";
import diffPreview from "../../components/diff/diffPreview";
import fileIcon from "../../components/icon/file";
import VueScrollbar from "vue2-scrollbar";
import gitLog from "../../git/log";
import logSkeleton from "../../components/skeleton/logs";
export default {
name: "History",
components: {
commitHistoryItem,
commitInformation,
diffPreview,
VueScrollbar,
fileIcon,
logSkeleton
},
computed: {
repositoryLogs() {
return this.$store.getters["history/allLogs"];
},
currentRepository() {
return this.$store.getters["workspace/currentRepository"];
},
commitFileDiffPreview() {
return this.$store.getters["history/getFilePreview"];
}
},
mounted() {
this.gitLog();
},
methods: {
gitLog() {
gitLog(this.currentRepository).then(result => {
this.$store.commit("history/updateLogs", {
logs: result
});
});
},
toggleCommitDetail() {
this.$store.commit("history/toggleCommitInformation");
this.$store.commit({
type: "history/toggleFilePreview",
isActive: false
});
},
gitShow(hash) {
this.toggleCommitDetail();
this.$store.dispatch({
type: "history/updateCommitInformationMeta",
commit_hash: hash
});
},
exportCommitDetail() {
this.$store.dispatch("model/showExportCommitData");
}
}
};
</script>
<style lang="sass">
.history
display: flex
flex-direction: row
&__logs
border-right: 1px solid #DEE0E3
width: 300px
&__detail
&__buttons
display: flex
padding: 10px
flex-direction: row
border-bottom: 1px solid #DEE0E3
&__back
font-size: 10px
cursor: pointer
color: #6C6F75
padding: 2px 6px
background-color: #DEE0E3
border-radius: 10px
&__export
cursor: pointer
svg
stroke: #6C6F75
width: 18px
height: 18px
&__scrollbar
max-height: 80.6vh
&__scrollbar
max-height: 90vh
</style>