aboutsummaryrefslogtreecommitdiffstats
path: root/moon_dashboard/moon/static/moon/js/import.service.js
diff options
context:
space:
mode:
authorThomas Duval <thomas.duval@orange.com>2018-06-19 16:13:31 +0200
committerThomas Duval <thomas.duval@orange.com>2018-06-19 16:30:55 +0200
commit2dbe655587ca98b67c1a3e3798c63fd47229adc0 (patch)
treedf374b5378225c9946ec0c97968bfa591fb9f9b6 /moon_dashboard/moon/static/moon/js/import.service.js
parentd28f8e68ac176a15dbbd7873f757f5a9f221d118 (diff)
Update code to 4.5 official version
Change-Id: I5075da0e2a3247ae1564f21b358748f482b75aa4
Diffstat (limited to 'moon_dashboard/moon/static/moon/js/import.service.js')
-rwxr-xr-xmoon_dashboard/moon/static/moon/js/import.service.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/moon_dashboard/moon/static/moon/js/import.service.js b/moon_dashboard/moon/static/moon/js/import.service.js
new file mode 100755
index 00000000..d55c8a19
--- /dev/null
+++ b/moon_dashboard/moon/static/moon/js/import.service.js
@@ -0,0 +1,27 @@
+(function () {
+
+ 'use strict';
+
+ angular
+ .module('moon')
+ .factory('moon.import.service', importService);
+
+ importService.$inject = ['moon.util.service', '$resource', 'moon.URI'];
+
+ function importService(util, $resource, URI) {
+ var host = URI.API;
+ var importResource = $resource(host + '/import/', {}, {
+ create: { method: 'POST' },
+ });
+
+ return {
+ importData: function importData(data) {
+ return importResource.create(null, data).$promise.then(success, util.displayErrorFunction('Unable to import data'));
+
+ function success(data) {
+ util.displaySuccess('Data imported');
+ }
+ }
+ }
+ }
+})(); \ No newline at end of file