Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Zallmann <tzallmann@gitlab.com>2018-03-25 15:02:09 +0300
committerTim Zallmann <tzallmann@gitlab.com>2018-03-28 13:17:02 +0300
commitb452bdead4f217b7488f13db9b608a9ddce1830e (patch)
tree412aa5b7de7372fc28addfe31edff1fe6a07eec0 /app/assets/javascripts/ide/ide_router.js
parentf62359c23b86bb8c8dc241ff4e09bab24e74ccbd (diff)
Actual MR diff displayed
Diffstat (limited to 'app/assets/javascripts/ide/ide_router.js')
-rw-r--r--app/assets/javascripts/ide/ide_router.js63
1 files changed, 30 insertions, 33 deletions
diff --git a/app/assets/javascripts/ide/ide_router.js b/app/assets/javascripts/ide/ide_router.js
index f054a0a0364..d828b4e6778 100644
--- a/app/assets/javascripts/ide/ide_router.js
+++ b/app/assets/javascripts/ide/ide_router.js
@@ -123,40 +123,37 @@ router.beforeEach((to, from, next) => {
mergeRequestId: to.params.mrid,
})
.then(mrChanges => {
- if (mrChanges.changes.length > 0) {
- }
- mrChanges.changes.forEach((change, ind) => {
- console.log(`CHANGE : ${ind} : `, change);
-
- const changeTreeEntry =
- store.state.entries[change.new_path];
-
- console.log(
- 'Tree Entry for the change ',
- changeTreeEntry,
- change.diff,
- );
-
- if (changeTreeEntry) {
- store.dispatch('setFileMrDiff', {
- file: changeTreeEntry,
- mrDiff: change.diff,
+ store
+ .dispatch('getMergeRequestVersions', {
+ projectId: fullProjectId,
+ mergeRequestId: to.params.mrid,
+ })
+ .then(() => {
+ mrChanges.changes.forEach((change, ind) => {
+ const changeTreeEntry =
+ store.state.entries[change.new_path];
+
+ if (changeTreeEntry) {
+ store.dispatch('setFileMrDiff', {
+ file: changeTreeEntry,
+ mrDiff: change.diff,
+ });
+
+ if (ind < 5) {
+ store.dispatch('getFileData', {
+ path: change.new_path,
+ makeFileActive: ind === 0,
+ });
+ }
+ }
});
- store.dispatch('setFileTargetBranch', {
- file: changeTreeEntry,
- targetBranch: mrChanges.target_branch,
- });
-
- if (ind === 0) {
- store.dispatch('getFileData', change.new_path);
- } else {
- // TODO : Implement Tab reloading
- store.dispatch('preloadFileTab', changeTreeEntry);
- }
- } else {
- console.warn(`No Tree Entry for ${change.new_path}`);
- }
- });
+ })
+ .catch(e => {
+ flash(
+ 'Error while loading the merge request versions. Please try again.',
+ );
+ throw e;
+ });
})
.catch(e => {
flash(