2022-09-27 10:52:19 +05:30
|
|
|
<template>
|
2023-02-13 23:29:59 +05:30
|
|
|
<ol class="diff-detail-box diff-stats gt-m-0" ref="root" v-if="fileListIsVisible">
|
2022-09-27 10:52:19 +05:30
|
|
|
<li v-for="file in files" :key="file.NameHash">
|
2023-05-22 05:07:32 +05:30
|
|
|
<div class="gt-font-semibold gt-df gt-ac pull-right">
|
2023-02-13 23:29:59 +05:30
|
|
|
<span v-if="file.IsBin" class="gt-ml-1 gt-mr-3">{{ binaryFileMessage }}</span>
|
2022-09-27 10:52:19 +05:30
|
|
|
{{ file.IsBin ? '' : file.Addition + file.Deletion }}
|
2023-03-24 16:05:38 +05:30
|
|
|
<span v-if="!file.IsBin" class="diff-stats-bar gt-mx-3" :data-tooltip-content="statisticsMessage.replace('%d', (file.Addition + file.Deletion)).replace('%d', file.Addition).replace('%d', file.Deletion)">
|
2022-09-27 10:52:19 +05:30
|
|
|
<div class="diff-stats-add-bar" :style="{ 'width': diffStatsWidth(file.Addition, file.Deletion) }" />
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<!-- todo finish all file status, now modify, add, delete and rename -->
|
2023-03-24 16:05:38 +05:30
|
|
|
<span :class="['status', diffTypeToString(file.Type)]" :data-tooltip-content="diffTypeToString(file.Type)"> </span>
|
2023-02-13 23:29:59 +05:30
|
|
|
<a class="file gt-mono" :href="'#diff-' + file.NameHash">{{ file.Name }}</a>
|
2022-09-27 10:52:19 +05:30
|
|
|
</li>
|
2023-02-13 23:29:59 +05:30
|
|
|
<li v-if="isIncomplete" id="diff-too-many-files-stats" class="gt-pt-2">
|
|
|
|
<span class="file gt-df gt-ac gt-sb">{{ tooManyFilesMessage }}
|
2022-09-27 10:52:19 +05:30
|
|
|
<a :class="['ui', 'basic', 'tiny', 'button', isLoadingNewData === true ? 'disabled' : '']" id="diff-show-more-files-stats" @click.stop="loadMoreData">{{ showMoreMessage }}</a>
|
|
|
|
</span>
|
|
|
|
</li>
|
|
|
|
</ol>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import {doLoadMoreFiles} from '../features/repo-diff.js';
|
|
|
|
|
|
|
|
const {pageData} = window.config;
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data: () => {
|
|
|
|
return pageData.diffFileInfo;
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
document.getElementById('show-file-list-btn').addEventListener('click', this.toggleFileList);
|
|
|
|
},
|
|
|
|
unmounted() {
|
|
|
|
document.getElementById('show-file-list-btn').removeEventListener('click', this.toggleFileList);
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
toggleFileList() {
|
|
|
|
this.fileListIsVisible = !this.fileListIsVisible;
|
|
|
|
},
|
|
|
|
diffTypeToString(pType) {
|
|
|
|
const diffTypes = {
|
|
|
|
1: 'add',
|
|
|
|
2: 'modify',
|
|
|
|
3: 'del',
|
|
|
|
4: 'rename',
|
|
|
|
5: 'copy',
|
|
|
|
};
|
|
|
|
return diffTypes[pType];
|
|
|
|
},
|
|
|
|
diffStatsWidth(adds, dels) {
|
|
|
|
return `${adds / (adds + dels) * 100}%`;
|
|
|
|
},
|
|
|
|
loadMoreData() {
|
|
|
|
this.isLoadingNewData = true;
|
|
|
|
doLoadMoreFiles(this.link, this.diffEnd, () => {
|
|
|
|
this.isLoadingNewData = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|