X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=skyquake%2Fplugins%2Fcomposer%2Fsrc%2Fsrc%2Fcomponents%2Ffilemanager%2FFileManager.jsx;h=ed9ea93a5c83041b1436f366d6071b221be82299;hb=61b1762cb6a657c5a8eb09d52fbf9a35a2a73aff;hp=9772ca8625fac50d3faea51df6fdd9ca8d464000;hpb=8f1f42ce0339e356a170742ae44d261104cf530f;p=osm%2FUI.git diff --git a/skyquake/plugins/composer/src/src/components/filemanager/FileManager.jsx b/skyquake/plugins/composer/src/src/components/filemanager/FileManager.jsx index 9772ca862..ed9ea93a5 100644 --- a/skyquake/plugins/composer/src/src/components/filemanager/FileManager.jsx +++ b/skyquake/plugins/composer/src/src/components/filemanager/FileManager.jsx @@ -18,7 +18,8 @@ //https://raw.githubusercontent.com/RIFTIO/RIFT.ware/master/rift-shell -import _ from 'lodash' +import _cloneDeep from 'lodash/cloneDeep' +import _findIndex from 'lodash/findIndex' import React from 'react'; import ReactDOM from 'react-dom'; import TreeView from 'react-treeview'; @@ -83,11 +84,11 @@ class FileManager extends React.Component { let splitUrl = url.split('/'); let fileName = splitUrl[splitUrl.length - 1]; folder.pop; - let fullPath = _.cloneDeep(folder); + let fullPath = _cloneDeep(folder); fullPath.push(fileName); fullPath = fullPath.join('/'); folder = folder.join('/'); - let fileIndex = _.findIndex(files[folder], function(f) { + let fileIndex = _findIndex(files[folder], function(f) { return f.name == fullPath; }) if (fileIndex == -1) { @@ -123,7 +124,7 @@ class FileManager extends React.Component { function buildList(self, data) { let toReturn = []; data.id.map(function(k,i) { - toReturn.push (contentFolder(self, data.data[k], k, i, self.props.filesState, self.updateFileLocationInput, self.sendDownloadFileRequst, self.deleteFile)); + toReturn.push (contentFolder(self, data.data[k], k, k+i, self.props.filesState, self.updateFileLocationInput, self.sendDownloadFileRequst, self.deleteFile)); }); return toReturn.reverse(); } @@ -131,7 +132,8 @@ function buildList(self, data) { function contentFolder(context, folder, path, key, inputState, updateFn, sendDownloadFileRequst, deleteFn) { let type = context.props.type; let id = context.props.item.id; - const onboardDropZone = createDropZone.bind(this, FileManagerUploadDropZone.ACTIONS.onboard, '.ComposerAppAddFile.' + path.replace(/\//g, '-'), type, id, path); + let classId = `DZ-${path.replace(/\/|\s+/g, '-')}`; + const onboardDropZone = createDropZone.bind(this, FileManagerUploadDropZone.ACTIONS.onboard, '.ComposerAppAddFile.' + classId, type, id, path); return (
@@ -169,11 +171,12 @@ class ItemUpload extends React.Component { } render() { let {type, id, path, key, ...props} = this.props; + let classId = `DZ-${path.replace(/\/|\s+/g, '-')}`; return (
) @@ -183,6 +186,7 @@ function contentFile(context, file, path, key, deleteFn) { const name = stripPath(file.name, path); const id = context.props.item.id; const type = context.props.type; + const downloadHost = API_SERVER.match('localhost') || API_SERVER.match('127.0.0.1') ? `${window.location.protocol}//${window.location.hostname}` : API_SERVER; //{`${window.location.protocol}//${API_SERVER}:4567/api/package${type}/${id}/${path}/${name}`} return (
@@ -192,7 +196,7 @@ function contentFile(context, file, path, key, deleteFn) { {file.status && (file.status == 'IN_PROGRESS' || file.status == 'DOWNLOADING' ) ? : file.status }
- {name} + {name}
X