summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/repo
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-10-02 13:32:53 +0100
committerPhil Hughes <me@iamphill.com>2017-10-10 10:14:22 +0100
commitfa2af5e0f5e290eff32f62c7ea9f935a6ad33967 (patch)
tree539846b44a1e8e5c0c3117bf71455c6131c135d1 /app/assets/javascripts/repo
parent99806914a5ca382b22588de722a0db1c7a8bfff6 (diff)
downloadgitlab-ce-fa2af5e0f5e290eff32f62c7ea9f935a6ad33967.tar.gz
Flash is now a ES6 module
Reduced the technical debt around our JS flash function by making it a module that is imported rather than relying on the global function. The global function still exists mainly for technical debt with how some requests are being completed, but new JS should import the module directly. Also reduces some tech debt in the file by removing the need for jQuery. Instead Flash is now 100% vanilla JS.
Diffstat (limited to 'app/assets/javascripts/repo')
-rw-r--r--app/assets/javascripts/repo/components/repo_commit_section.vue2
-rw-r--r--app/assets/javascripts/repo/helpers/repo_helper.js3
-rw-r--r--app/assets/javascripts/repo/services/repo_service.js6
3 files changed, 5 insertions, 6 deletions
diff --git a/app/assets/javascripts/repo/components/repo_commit_section.vue b/app/assets/javascripts/repo/components/repo_commit_section.vue
index 119e38c583d..6d8cc964eb2 100644
--- a/app/assets/javascripts/repo/components/repo_commit_section.vue
+++ b/app/assets/javascripts/repo/components/repo_commit_section.vue
@@ -1,5 +1,5 @@
<script>
-/* global Flash */
+import Flash from '../../flash';
import Store from '../stores/repo_store';
import RepoMixin from '../mixins/repo_mixin';
import Service from '../services/repo_service';
diff --git a/app/assets/javascripts/repo/helpers/repo_helper.js b/app/assets/javascripts/repo/helpers/repo_helper.js
index 7483f8bc305..46204598e1d 100644
--- a/app/assets/javascripts/repo/helpers/repo_helper.js
+++ b/app/assets/javascripts/repo/helpers/repo_helper.js
@@ -1,7 +1,6 @@
-/* global Flash */
import Service from '../services/repo_service';
import Store from '../stores/repo_store';
-import '../../flash';
+import Flash from '../../flash';
const RepoHelper = {
monacoInstance: null,
diff --git a/app/assets/javascripts/repo/services/repo_service.js b/app/assets/javascripts/repo/services/repo_service.js
index af83497fa39..fe37102880b 100644
--- a/app/assets/javascripts/repo/services/repo_service.js
+++ b/app/assets/javascripts/repo/services/repo_service.js
@@ -1,5 +1,5 @@
-/* global Flash */
import axios from 'axios';
+import Flash from '../../flash';
import Store from '../stores/repo_store';
import Api from '../../api';
import Helper from '../helpers/repo_helper';
@@ -72,9 +72,9 @@ const RepoService = {
commitFlash(data) {
if (data.short_id && data.stats) {
- window.Flash(`Your changes have been committed. Commit ${data.short_id} with ${data.stats.additions} additions, ${data.stats.deletions} deletions.`, 'notice');
+ Flash(`Your changes have been committed. Commit ${data.short_id} with ${data.stats.additions} additions, ${data.stats.deletions} deletions.`, 'notice');
} else {
- window.Flash(data.message);
+ Flash(data.message);
}
},
};