From 2a2f48a5b16d9eaff38317f13aee739cd2c16eaf Mon Sep 17 00:00:00 2001 From: Sam Bigelow Date: Tue, 29 Jan 2019 22:21:26 -0500 Subject: Clearly display diff statistics for MRs Put the statistics in the compare-versions header for the entire MR Put them in the file header for each individual file --- .../diffs/components/compare_versions.vue | 18 +++++++- .../diffs/components/diff_file_header.vue | 3 ++ .../javascripts/diffs/components/diff_stats.vue | 52 ++++++++++++++++++++++ .../javascripts/diffs/components/tree_list.vue | 11 +---- .../javascripts/diffs/store/modules/diff_state.js | 2 + 5 files changed, 75 insertions(+), 11 deletions(-) create mode 100644 app/assets/javascripts/diffs/components/diff_stats.vue (limited to 'app/assets/javascripts/diffs') diff --git a/app/assets/javascripts/diffs/components/compare_versions.vue b/app/assets/javascripts/diffs/components/compare_versions.vue index 3ef54752436..0bf2dde8b96 100644 --- a/app/assets/javascripts/diffs/components/compare_versions.vue +++ b/app/assets/javascripts/diffs/components/compare_versions.vue @@ -6,6 +6,7 @@ import { polyfillSticky } from '~/lib/utils/sticky'; import Icon from '~/vue_shared/components/icon.vue'; import CompareVersionsDropdown from './compare_versions_dropdown.vue'; import SettingsDropdown from './settings_dropdown.vue'; +import DiffStats from './diff_stats.vue'; export default { components: { @@ -14,6 +15,7 @@ export default { GlLink, GlButton, SettingsDropdown, + DiffStats, }, directives: { GlTooltip: GlTooltipDirective, @@ -35,8 +37,15 @@ export default { }, }, computed: { - ...mapState('diffs', ['commit', 'showTreeList', 'startVersion', 'latestVersionPath']), - ...mapGetters('diffs', ['hasCollapsedFile']), + ...mapGetters('diffs', ['hasCollapsedFile', 'diffFilesLength']), + ...mapState('diffs', [ + 'commit', + 'showTreeList', + 'startVersion', + 'latestVersionPath', + 'addedLines', + 'removedLines', + ]), comparableDiffs() { return this.mergeRequestDiffs.slice(1); }, @@ -104,6 +113,11 @@ export default { {{ commit.short_id }}
+ + diff --git a/app/assets/javascripts/diffs/store/modules/diff_state.js b/app/assets/javascripts/diffs/store/modules/diff_state.js index 05b4c552f6e..0e3c668fff6 100644 --- a/app/assets/javascripts/diffs/store/modules/diff_state.js +++ b/app/assets/javascripts/diffs/store/modules/diff_state.js @@ -11,6 +11,8 @@ const storedTreeShow = localStorage.getItem(MR_TREE_SHOW_KEY); export default () => ({ isLoading: true, + addedLines: null, + removedLines: null, endpoint: '', basePath: '', commit: null, -- cgit v1.2.1