-
Notifications
You must be signed in to change notification settings - Fork 191
Expand file tree
/
Copy pathc-home.vue
More file actions
243 lines (226 loc) · 7.06 KB
/
Copy pathc-home.vue
File metadata and controls
243 lines (226 loc) · 7.06 KB
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<template lang="pug">
#home
template(v-if="userUpdated")
c-resizer
template(#left)
#summary-wrapper(ref="summaryWrapper", @scroll="handleSummaryScroll")
c-intro(ref="cIntro")
c-summary.tab-padding(
v-if="!isPortfolio",
ref="summary",
:repos="users",
:error-messages="errorMessages",
@view-file-browser="$emit('view-file-browser', $event)",
@go-back-to-welcome-tab="$emit('go-back-to-welcome-tab')"
)
c-summary-portfolio.tab-padding(
v-else,
ref="summary",
:repos="users",
:error-messages="errorMessages"
)
.timestamp-footer
span Generated by
a(
:href="getSpecificCommitLink()", target="_blank"
)
strong this version
span of
a(
:href="getRepoSenseHomeLink()", target="_blank"
)
strong RepoSense
span (
a(
:href="getUserGuideLink()", target ="_blank"
)
strong User Guide
span ) on {{ creationDate }}
.report-generation-time(style="display: none;")
span {{ reportGenerationTime }}
c-scroll-top-button(
:show-back-to-top="showSummaryBackToTop",
@scroll-to-top="scrollSummaryToTop"
)
template(#right)
#tabs-wrapper(ref="tabWrapper", @scroll="handleTabsScroll")
.tab-content.panel-padding
.tab-pane
c-authorship#tab-authorship(v-if="tabType === 'authorship'")
c-global-file-browser#tab-file-browser(
v-else-if="tabType === 'file-browser'",
:files="globalFiles"
)
c-zoom#tab-zoom(v-else-if="tabType === 'zoom'")
#tab-empty(v-else)
.title
h2 Welcome to this RepoSense report!
p The charts on the left show the contribution activities, grouped by repository and author.
p
| To view the code attributed to a specific author, click the
font-awesome-icon(icon="code")
| icon next to that author's name.
br
| To view the breakdown of commits made by a specific author, click the
font-awesome-icon(icon="list-ul")
| icon next to that author's name.
br
| To hide the code view and show only the activity charts, click the
font-awesome-icon(icon="caret-right")
| icon on the centre divider.
p
| See the
a(
:href="getUsingReportsUserGuideLink()", target="_blank"
)
strong User Guide
| to get a better understanding of how to interpret the report.
c-scroll-top-button(
:show-back-to-top="showTabsBackToTop",
@scroll-to-top="scrollTabsToTop"
)
template(v-else)
.empty Please upload a .zip file generated by RepoSense.
form#file-upload(onsubmit="return false;")
input(type="file", accept=".zip", @change="updateReportZip")
</template>
<script lang='ts'>
import { defineComponent, PropType } from 'vue';
import cIntro from '../components/c-intro.vue';
import cResizer from '../components/c-resizer.vue';
import cZoom from './c-zoom.vue';
import cScrollTopButton from '../components/c-scroll-top-button.vue';
import cSummary from './c-summary.vue';
import cSummaryPortfolio from './c-summary-portfolio.vue';
import cAuthorship from './c-authorship.vue';
import cGlobalFileBrowser from './c-global-file-browser.vue';
import { GlobalFileEntry, Repo } from '../types/types';
const home = defineComponent({
name: 'c-home',
components: {
cGlobalFileBrowser,
cIntro,
cResizer,
cZoom,
cScrollTopButton,
cSummary,
cSummaryPortfolio,
cAuthorship,
},
props: {
updateReportZip: {
type: Function,
required: true,
},
repos: {
type: Object,
required: true,
},
users: {
type: Array<Repo>,
required: true,
},
userUpdated: {
type: Boolean,
required: true,
},
loadingOverlayOpacity: {
type: Number,
required: true,
},
tabType: {
type: String,
required: true,
},
creationDate: {
type: String,
required: true,
},
reportGenerationTime: {
type: String,
required: true,
},
errorMessages: {
type: Object,
required: true,
},
globalFiles: {
type: Array as PropType<Array<GlobalFileEntry>>,
required: true,
},
},
emits: [
'view-file-browser',
'go-back-to-welcome-tab',
'open-local-tab',
],
data(): {
showSummaryBackToTop: boolean,
showTabsBackToTop: boolean,
} {
return {
showSummaryBackToTop: false,
showTabsBackToTop: false,
};
},
computed: {
isPortfolio(): boolean {
return window.isPortfolio;
}
},
mounted() {
this.handleTabsScroll();
this.handleSummaryScroll();
},
methods: {
getRepoSenseHomeLink(): string {
const version = window.repoSenseVersion;
if (!version) {
return `${window.HOME_PAGE_URL}/RepoSense/`;
}
return `${window.HOME_PAGE_URL}`;
},
getSpecificCommitLink(): string {
const version = window.repoSenseVersion;
if (!version) {
return `${window.REPOSENSE_REPO_URL}`;
}
if (version.startsWith('v')) {
return `${window.REPOSENSE_REPO_URL}/releases/tag/${version}`;
}
return `${window.REPOSENSE_REPO_URL}/commit/${version}`;
},
getUserGuideLink(): string {
const version = window.repoSenseVersion;
if (!version) {
return `${window.HOME_PAGE_URL}/RepoSense/ug/index.html`;
}
return `${window.HOME_PAGE_URL}/ug/index.html`;
},
getUsingReportsUserGuideLink(): string {
const version = window.repoSenseVersion;
if (!version) {
return `${window.HOME_PAGE_URL}/RepoSense/ug/usingReports.html`;
}
return `${window.HOME_PAGE_URL}/ug/usingReports.html`;
},
handleSummaryScroll(): void {
const el = this.$refs.summaryWrapper as HTMLElement | undefined;
this.showSummaryBackToTop = (el?.scrollTop ?? 0) > 200;
},
handleTabsScroll(): void {
const el = this.$refs.tabWrapper as HTMLElement | undefined;
this.showTabsBackToTop = (el?.scrollTop ?? 0) > 200;
},
scrollSummaryToTop(): void {
const el = this.$refs.summaryWrapper as HTMLElement | undefined;
el?.scrollTo({ top: 0, behavior: 'smooth' });
},
scrollTabsToTop(): void {
const el = this.$refs.tabWrapper as HTMLElement | undefined;
el?.scrollTo({ top: 0, behavior: 'smooth' });
},
},
});
export default home;
</script>