summaryrefslogtreecommitdiff
path: root/app/assets
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-04 18:08:46 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-04 18:08:46 +0000
commitb41cd8cb92d53454b2b160ba922d33801933a9cf (patch)
tree3519da8856f8bf12ce9e75248e5ecb9ed4eacf14 /app/assets
parent8d3aee3636da5181ae94d23b47c6794b5610ab01 (diff)
downloadgitlab-ce-b41cd8cb92d53454b2b160ba922d33801933a9cf.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/diffs/components/app.vue31
-rw-r--r--app/assets/javascripts/diffs/store/actions.js2
-rw-r--r--app/assets/javascripts/diffs/store/mutations.js11
-rw-r--r--app/assets/javascripts/pipelines/components/test_reports/test_summary.vue4
4 files changed, 34 insertions, 14 deletions
diff --git a/app/assets/javascripts/diffs/components/app.vue b/app/assets/javascripts/diffs/components/app.vue
index 8039a9a7602..beda1a0dc14 100644
--- a/app/assets/javascripts/diffs/components/app.vue
+++ b/app/assets/javascripts/diffs/components/app.vue
@@ -144,6 +144,9 @@ export default {
isLimitedContainer() {
return !this.showTreeList && !this.isParallelView && !this.isFluidLayout;
},
+ shouldSetDiscussions() {
+ return this.isNotesFetched && !this.assignedDiscussions && !this.isLoading;
+ },
},
watch: {
diffViewType() {
@@ -160,6 +163,11 @@ export default {
},
isLoading: 'adjustView',
showTreeList: 'adjustView',
+ shouldSetDiscussions(newVal) {
+ if (newVal) {
+ this.setDiscussions();
+ }
+ },
},
mounted() {
this.setBaseConfig({
@@ -214,26 +222,28 @@ export default {
isLatestVersion() {
return window.location.search.indexOf('diff_id') === -1;
},
+ startDiffRendering() {
+ requestIdleCallback(
+ () => {
+ this.startRenderDiffsQueue();
+ },
+ { timeout: 1000 },
+ );
+ },
fetchData(toggleTree = true) {
if (this.isLatestVersion() && this.glFeatures.diffsBatchLoad) {
this.fetchDiffFilesMeta()
.then(() => {
if (toggleTree) this.hideTreeListIfJustOneFile();
+
+ this.startDiffRendering();
})
.catch(() => {
createFlash(__('Something went wrong on our end. Please try again!'));
});
this.fetchDiffFilesBatch()
- .then(() => {
- requestIdleCallback(
- () => {
- this.setDiscussions();
- this.startRenderDiffsQueue();
- },
- { timeout: 1000 },
- );
- })
+ .then(() => this.startDiffRendering())
.catch(() => {
createFlash(__('Something went wrong on our end. Please try again!'));
});
@@ -246,7 +256,6 @@ export default {
requestIdleCallback(
() => {
- this.setDiscussions();
this.startRenderDiffsQueue();
},
{ timeout: 1000 },
@@ -262,7 +271,7 @@ export default {
}
},
setDiscussions() {
- if (this.isNotesFetched && !this.assignedDiscussions && !this.isLoading) {
+ if (this.shouldSetDiscussions) {
this.assignedDiscussions = true;
requestIdleCallback(
diff --git a/app/assets/javascripts/diffs/store/actions.js b/app/assets/javascripts/diffs/store/actions.js
index d4594399ff5..5434184b450 100644
--- a/app/assets/javascripts/diffs/store/actions.js
+++ b/app/assets/javascripts/diffs/store/actions.js
@@ -119,7 +119,7 @@ export const fetchDiffFilesMeta = ({ commit, state }) => {
.get(state.endpointMetadata)
.then(({ data }) => {
const strippedData = { ...data };
- strippedData.diff_files = [];
+ delete strippedData.diff_files;
commit(types.SET_LOADING, false);
commit(types.SET_MERGE_REQUEST_DIFFS, data.merge_request_diffs || []);
commit(types.SET_DIFF_DATA, strippedData);
diff --git a/app/assets/javascripts/diffs/store/mutations.js b/app/assets/javascripts/diffs/store/mutations.js
index de2f68d729c..fccfd950d75 100644
--- a/app/assets/javascripts/diffs/store/mutations.js
+++ b/app/assets/javascripts/diffs/store/mutations.js
@@ -39,7 +39,16 @@ export default {
},
[types.SET_DIFF_DATA](state, data) {
- prepareDiffData(data);
+ if (
+ !(
+ gon &&
+ gon.features &&
+ gon.features.diffsBatchLoad &&
+ window.location.search.indexOf('diff_id') === -1
+ )
+ ) {
+ prepareDiffData(data);
+ }
Object.assign(state, {
...convertObjectPropsToCamelCase(data),
diff --git a/app/assets/javascripts/pipelines/components/test_reports/test_summary.vue b/app/assets/javascripts/pipelines/components/test_reports/test_summary.vue
index dce8b020d6f..1bac7ce9ac5 100644
--- a/app/assets/javascripts/pipelines/components/test_reports/test_summary.vue
+++ b/app/assets/javascripts/pipelines/components/test_reports/test_summary.vue
@@ -28,7 +28,9 @@ export default {
return this.report.name || __('Summary');
},
successPercentage() {
- return Math.round((this.report.success_count / this.report.total_count) * 100) || 0;
+ // Returns a full number when the decimals equal .00.
+ // Otherwise returns a float to two decimal points
+ return Number(((this.report.success_count / this.report.total_count) * 100 || 0).toFixed(2));
},
formattedDuration() {
return formatTime(secondsToMilliseconds(this.report.total_time));