X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=blobdiff_plain;f=skyquake%2Fplugins%2Fcomposer%2Fsrc%2Fsrc%2Fcomponents%2Ffilemanager%2FFileManagerSource.js;h=4b36277aea2c81847f0d6a8c7c4e03fee0af5401;hp=d2d9765859444bfd9386857ad5d996d5311edcd0;hb=8ab41d9e9bd54549a0d9eda1255b570b22ca9ca8;hpb=b06607173b5bafa999594cdc1e60a825f578e8e6 diff --git a/skyquake/plugins/composer/src/src/components/filemanager/FileManagerSource.js b/skyquake/plugins/composer/src/src/components/filemanager/FileManagerSource.js index d2d976585..4b36277ae 100644 --- a/skyquake/plugins/composer/src/src/components/filemanager/FileManagerSource.js +++ b/skyquake/plugins/composer/src/src/components/filemanager/FileManagerSource.js @@ -18,7 +18,6 @@ */ 'use strict'; -import _ from 'lodash' import $ from 'jquery' import alt from '../../alt' import utils from '../../libraries/utils' @@ -58,20 +57,22 @@ const FileManagerSource = { }, addFile: function() { return { - remote: function(state, id, type, path, url) { + remote: function(state, id, type, path, url, refresh) { return new Promise(function(resolve, reject) { console.log('Adding file'); console.log(id, type, path, url); let splitUrl = url.split('/'); let fileName = splitUrl[splitUrl.length -1]; + let packagePath = refresh ? path + ((path[path.length - 1] == '/') ? '' : '/') : path + '/' + fileName; $.ajax({ beforeSend: Utils.addAuthorizationStub, - url: 'api/file-manager?api_server=' + utils.getSearchParams(window.location).api_server +'&package_type=' + type + '&package_id=' + id + '&package_path=' + path + '/' + fileName + '&url=' + url, + url: 'api/file-manager?api_server=' + utils.getSearchParams(window.location).api_server +'&package_type=' + type + '&package_id=' + id + '&package_path=' + packagePath + '&url=' + url, success: function(data) { resolve({ data:data, path: path, - fileName: fileName + fileName: fileName, + refresh: refresh }); }, error: function(error) { @@ -144,11 +145,11 @@ const FileManagerSource = { return new Promise(function(resolve, reject) { //api/operational/download-jobs/job/ $.ajax({ - url: '/socket-polling?api_server=' + API_SERVER , + url: '/socket-polling?api_server=' + API_SERVER, type: 'POST', beforeSend: Utils.addAuthorizationStub, data: { - url: 'http://localhost:8000/composer/api/file-manager/jobs/' + packageID + '?api_server=' + API_SERVER, + url: 'composer/api/file-manager/jobs/' + packageID + '?api_server=' + API_SERVER, }, success: function(data, textStatus, jqXHR) { Utils.checkAndResolveSocketRequest(data, resolve, reject); @@ -169,11 +170,11 @@ const FileManagerSource = { return new Promise(function(resolve, reject) { //api/operational/download-jobs/job/ $.ajax({ - url: '/socket-polling?api_server=' + API_SERVER , + url: '/socket-polling?api_server=' + API_SERVER, type: 'POST', beforeSend: Utils.addAuthorizationStub, data: { - url: 'http://localhost:8000/composer/api/file-manager?api_server=' + utils.getSearchParams(window.location).api_server +'&package_type=' + type + '&package_id=' + id + url: 'composer/api/file-manager?api_server=' + utils.getSearchParams(window.location).api_server +'&package_type=' + type + '&package_id=' + id }, success: function(data, textStatus, jqXHR) { Utils.checkAndResolveSocketRequest(data, resolve, reject);