1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-01-20 16:50:28 -05:00

Remove DiffFileList component

The benefit / functionality provided by DiffFileList is already (better)
integrated in the header of the files.
If you want an overview, you can collapse all files via the same
overflow menu (where the stats were available).
To reduce the maintenance effort, the DiffFileList component is
therefore removed.
This commit is contained in:
Beowulf 2025-01-19 18:55:01 +01:00
parent ce4730f9d7
commit 86c8949d9c
No known key found for this signature in database
GPG key ID: 44225F5F2792841D
7 changed files with 2 additions and 97 deletions

View file

@ -2643,7 +2643,6 @@ diff.git-notes.remove-header = Remove note
diff.git-notes.remove-body = This note will be removed. diff.git-notes.remove-body = This note will be removed.
diff.data_not_available = Diff content is not available diff.data_not_available = Diff content is not available
diff.options_button = Diff options diff.options_button = Diff options
diff.show_diff_stats = Show stats
diff.download_patch = Download patch file diff.download_patch = Download patch file
diff.download_diff = Download diff file diff.download_diff = Download diff file
diff.show_split_view = Split view diff.show_split_view = Split view

View file

@ -85,7 +85,6 @@
diffFileInfo.files.push(...diffDataFiles); diffFileInfo.files.push(...diffDataFiles);
window.config.pageData.diffFileInfo = diffFileInfo; window.config.pageData.diffFileInfo = diffFileInfo;
</script> </script>
<div id="diff-file-list"></div>
{{end}} {{end}}
<div id="diff-container"> <div id="diff-container">
{{if $showFileTree}} {{if $showFileTree}}

View file

@ -1,7 +1,6 @@
<div class="ui dropdown tiny basic button" data-tooltip-content="{{ctx.Locale.Tr "repo.diff.options_button"}}"> <div class="ui dropdown tiny basic button" data-tooltip-content="{{ctx.Locale.Tr "repo.diff.options_button"}}">
{{svg "octicon-kebab-horizontal"}} {{svg "octicon-kebab-horizontal"}}
<div class="menu"> <div class="menu">
<a class="item" id="show-file-list-btn">{{ctx.Locale.Tr "repo.diff.show_diff_stats"}}</a>
{{if .Issue.Index}} {{if .Issue.Index}}
<a class="item" href="{{$.RepoLink}}/pulls/{{.Issue.Index}}.patch" download="{{.Issue.Index}}.patch">{{ctx.Locale.Tr "repo.diff.download_patch"}}</a> <a class="item" href="{{$.RepoLink}}/pulls/{{.Issue.Index}}.patch" download="{{.Issue.Index}}.patch">{{ctx.Locale.Tr "repo.diff.download_patch"}}</a>
<a class="item" href="{{$.RepoLink}}/pulls/{{.Issue.Index}}.diff" download="{{.Issue.Index}}.diff">{{ctx.Locale.Tr "repo.diff.download_diff"}}</a> <a class="item" href="{{$.RepoLink}}/pulls/{{.Issue.Index}}.diff" download="{{.Issue.Index}}.diff">{{ctx.Locale.Tr "repo.diff.download_diff"}}</a>

View file

@ -1709,26 +1709,6 @@ td .commit-summary {
max-width: initial; /* remove fomantic over 100% width */ max-width: initial; /* remove fomantic over 100% width */
} }
.repository .diff-stats {
clear: both;
margin-bottom: 5px;
max-height: 200px;
height: fit-content;
overflow: auto;
padding-left: 0;
}
.repository .diff-stats li {
list-style: none;
padding-bottom: 4px;
margin-bottom: 4px;
padding-left: 6px;
}
.repository .diff-stats li + li {
border-top: 1px solid var(--color-secondary);
}
.repository .repo-search-result { .repository .repo-search-result {
padding-top: 10px; padding-top: 10px;
padding-bottom: 10px; padding-bottom: 10px;
@ -1839,10 +1819,6 @@ details.repo-search-result summary::marker {
color: var(--color-success-text); color: var(--color-success-text);
} }
.repository .ui.attached.isSigned.isVerified.message .pull-right {
color: var(--color-text);
}
.repository .ui.attached.isSigned.isVerified.message .ui.text { .repository .ui.attached.isSigned.isVerified.message .ui.text {
color: var(--color-success-text); color: var(--color-success-text);
} }

View file

@ -1,58 +0,0 @@
<script>
import {loadMoreFiles} from '../features/repo-diff.js';
import {diffTreeStore} from '../modules/stores.js';
export default {
data: () => {
return {store: diffTreeStore()};
},
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.store.fileListIsVisible = !this.store.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() {
loadMoreFiles(this.store.linkLoadMore);
},
},
};
</script>
<template>
<ol class="diff-stats tw-m-0" ref="root" v-if="store.fileListIsVisible">
<li v-for="file in store.files" :key="file.NameHash">
<div class="tw-font-semibold tw-flex tw-items-center pull-right">
<span v-if="file.IsBin" class="tw-ml-0.5 tw-mr-2">{{ store.binaryFileMessage }}</span>
{{ file.IsBin ? '' : file.Addition + file.Deletion }}
<span v-if="!file.IsBin" class="diff-stats-bar tw-mx-2" :data-tooltip-content="store.statisticsMessage.replace('%d', (file.Addition + file.Deletion)).replace('%d', file.Addition).replace('%d', file.Deletion)">
<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 -->
<span :class="['status', diffTypeToString(file.Type)]" :data-tooltip-content="diffTypeToString(file.Type)">&nbsp;</span>
<a class="file tw-font-mono" :href="'#diff-' + file.NameHash">{{ file.Name }}</a>
</li>
<li v-if="store.isIncomplete" class="tw-pt-1">
<span class="file tw-flex tw-items-center tw-justify-between">{{ store.tooManyFilesMessage }}
<a :class="['ui', 'basic', 'tiny', 'button', store.isLoadingNewData ? 'disabled' : '']" @click.stop="loadMoreData">{{ store.showMoreMessage }}</a>
</span>
</li>
</ol>
</template>

View file

@ -1,6 +1,5 @@
import {createApp} from 'vue'; import {createApp} from 'vue';
import DiffFileTree from '../components/DiffFileTree.vue'; import DiffFileTree from '../components/DiffFileTree.vue';
import DiffFileList from '../components/DiffFileList.vue';
export function initDiffFileTree() { export function initDiffFileTree() {
const el = document.getElementById('diff-file-tree'); const el = document.getElementById('diff-file-tree');
@ -9,11 +8,3 @@ export function initDiffFileTree() {
const fileTreeView = createApp(DiffFileTree); const fileTreeView = createApp(DiffFileTree);
fileTreeView.mount(el); fileTreeView.mount(el);
} }
export function initDiffFileList() {
const fileListElement = document.getElementById('diff-file-list');
if (!fileListElement) return;
const fileListView = createApp(DiffFileList);
fileListView.mount(fileListElement);
}

View file

@ -1,7 +1,7 @@
import $ from 'jquery'; import $ from 'jquery';
import {initCompReactionSelector} from './comp/ReactionSelector.js'; import {initCompReactionSelector} from './comp/ReactionSelector.js';
import {initRepoIssueContentHistory} from './repo-issue-content.js'; import {initRepoIssueContentHistory} from './repo-issue-content.js';
import {initDiffFileTree, initDiffFileList} from './repo-diff-filetree.js'; import {initDiffFileTree} from './repo-diff-filetree.js';
import {initDiffCommitSelect} from './repo-diff-commitselect.js'; import {initDiffCommitSelect} from './repo-diff-commitselect.js';
import {validateTextareaNonEmpty} from './comp/ComboMarkdownEditor.js'; import {validateTextareaNonEmpty} from './comp/ComboMarkdownEditor.js';
import {initViewedCheckboxListenerFor, countAndUpdateViewedFiles, initExpandAndCollapseFilesButton} from './pull-view-file.js'; import {initViewedCheckboxListenerFor, countAndUpdateViewedFiles, initExpandAndCollapseFilesButton} from './pull-view-file.js';
@ -221,9 +221,8 @@ function initRepoDiffShowMore() {
export function initRepoDiffView() { export function initRepoDiffView() {
initRepoDiffConversationForm(); initRepoDiffConversationForm();
if (!$('#diff-file-list').length) return; if (!$('#diff-file-boxes').length) return;
initDiffFileTree(); initDiffFileTree();
initDiffFileList();
initDiffCommitSelect(); initDiffCommitSelect();
initRepoDiffShowMore(); initRepoDiffShowMore();
initRepoDiffReviewButton(); initRepoDiffReviewButton();