2022-09-27 08:22:19 +03:00
< template >
2023-05-30 13:53:15 +03:00
< ol class = "diff-detail-box diff-stats gt-m-0" ref = "root" v-if ="store.fileListIsVisible" >
< li v-for ="file in store.files" :key="file.NameHash" >
2023-05-22 02:37:32 +03:00
< div class = "gt-font-semibold gt-df gt-ac pull-right" >
2023-05-30 13:53:15 +03:00
< span v-if ="file.IsBin" class="gt-ml-1 gt-mr-3" > {{ store.binaryFileMessage }} < / span >
2022-09-27 08:22:19 +03:00
{ { file . IsBin ? '' : file . Addition + file . Deletion } }
2023-05-30 13:53:15 +03:00
< span v-if ="!file.IsBin" class="diff-stats-bar gt-mx-3" :data-tooltip-content="store.statisticsMessage.replace('%d', (file.Addition + file.Deletion)).replace('%d', file.Addition).replace('%d', file.Deletion)" >
2023-05-29 19:58:53 +03:00
< div class = "diff-stats-add-bar" : style = "{ 'width': diffStatsWidth(file.Addition, file.Deletion) }" / >
2022-09-27 08:22:19 +03:00
< / span >
< / div >
<!-- todo finish all file status , now modify , add , delete and rename -- >
2023-03-24 13:35:38 +03:00
< span : class = "['status', diffTypeToString(file.Type)]" :data-tooltip-content ="diffTypeToString(file.Type)" > & nbsp ; < / span >
2023-02-13 20:59:59 +03:00
< a class = "file gt-mono" : href = "'#diff-' + file.NameHash" > { { file . Name } } < / a >
2022-09-27 08:22:19 +03:00
< / li >
2023-05-30 13:53:15 +03:00
< li v-if ="store.isIncomplete" class="gt-pt-2" >
< span class = "file gt-df gt-ac gt-sb" > { { store . tooManyFilesMessage } }
< a : class = "['ui', 'basic', 'tiny', 'button', store.isLoadingNewData ? 'disabled' : '']" @click.stop ="loadMoreData" > { { store . showMoreMessage } } < / a >
2022-09-27 08:22:19 +03:00
< / span >
< / li >
< / ol >
< / template >
< script >
2023-05-30 13:53:15 +03:00
import { loadMoreFiles } from '../features/repo-diff.js' ;
import { diffTreeStore } from '../modules/stores.js' ;
2022-09-27 08:22:19 +03:00
export default {
data : ( ) => {
2023-05-30 13:53:15 +03:00
return { store : diffTreeStore ( ) } ;
2022-09-27 08:22:19 +03:00
} ,
mounted ( ) {
document . getElementById ( 'show-file-list-btn' ) . addEventListener ( 'click' , this . toggleFileList ) ;
} ,
unmounted ( ) {
document . getElementById ( 'show-file-list-btn' ) . removeEventListener ( 'click' , this . toggleFileList ) ;
} ,
methods : {
toggleFileList ( ) {
2023-05-30 13:53:15 +03:00
this . store . fileListIsVisible = ! this . store . fileListIsVisible ;
2022-09-27 08:22:19 +03:00
} ,
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 ( ) {
2023-05-30 13:53:15 +03:00
loadMoreFiles ( this . store . linkLoadMore ) ;
2022-09-27 08:22:19 +03:00
}
} ,
} ;
< / script >