X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=blobdiff_plain;f=skyquake%2Fplugins%2Fcomposer%2Fsrc%2Fsrc%2Fstores%2FComposerAppStore.js;fp=skyquake%2Fplugins%2Fcomposer%2Fsrc%2Fsrc%2Fstores%2FComposerAppStore.js;h=ff24cbb926f748e4c882771380c15a43b47f7e74;hp=75276d22aa858532900d33a85f846b4d400e4d58;hb=756a58911e5ab70e42b7793ffef9807738d2f5e1;hpb=5bd1094cce6f4d46084e38bcd22dbb1ecdf659c3 diff --git a/skyquake/plugins/composer/src/src/stores/ComposerAppStore.js b/skyquake/plugins/composer/src/src/stores/ComposerAppStore.js index 75276d22a..ff24cbb92 100644 --- a/skyquake/plugins/composer/src/src/stores/ComposerAppStore.js +++ b/skyquake/plugins/composer/src/src/stores/ComposerAppStore.js @@ -41,6 +41,9 @@ import React from 'react'; //Hack for crouton fix. Should eventually put composer in skyquake alt context import SkyquakeComponent from 'widgets/skyquake_container/skyquakeComponent.jsx'; let NotificationError = null; + +import utils from '../libraries/utils'; + class ComponentBridge extends React.Component { constructor(props) { super(props); @@ -126,6 +129,7 @@ class ComposerAppStore { this.filesState = {}; this.downloadJobs = {}; this.containers = []; + this.newPathName = ''; //End File manager values this.bindListeners({ onResize: PanelResizeAction.RESIZE, @@ -164,7 +168,9 @@ class ComposerAppStore { closeFileManagerSockets: FileManagerActions.closeFileManagerSockets, openFileManagerSockets: FileManagerActions.openFileManagerSockets, openDownloadMonitoringSocketSuccess: FileManagerActions.openDownloadMonitoringSocketSuccess, - getFilelistSocketSuccess: FileManagerActions.getFilelistSocketSuccess + getFilelistSocketSuccess: FileManagerActions.getFilelistSocketSuccess, + newPathNameUpdated: FileManagerActions.newPathNameUpdated, + createDirectory: FileManagerActions.createDirectory }); this.exportPublicMethods({ closeFileManagerSockets: this.closeFileManagerSockets.bind(this) @@ -477,7 +483,7 @@ class ComposerAppStore { data: _.mergeWith(normalizedData.data, self.files.data, function(obj, src) { return _.uniqBy(obj? obj.concat(src) : src, 'name'); }), - id: self.files.id || normalizedData.id + id: normalizedData.id }, filesState: filesState } @@ -527,7 +533,7 @@ class ComposerAppStore { let type = data.type || this.item.uiState.type; let path = data.path; let url = data.url; - this.getInstance().addFile(id, type, path, url); + this.getInstance().addFile(id, type, path, url, data.refresh); } updateFileLocationInput = (data) => { let name = data.name; @@ -539,14 +545,16 @@ class ComposerAppStore { }); } addFileSuccess = (data) => { - let path = data.path; - let fileName = data.fileName; - let files = _.cloneDeep(this.files); - let loadingIndex = files.data[path].push({ - status: 'DOWNLOADING', - name: path + '/' + fileName - }) - 1; - this.setState({files: files}); + if(!data.refresh) { + let path = data.path; + let fileName = data.fileName; + let files = _.cloneDeep(this.files); + let loadingIndex = files.data[path].push({ + status: 'DOWNLOADING', + name: path + '/' + fileName + }) - 1; + this.setState({files: files}); + } } startWatchingJob = () => { @@ -663,6 +671,25 @@ class ComposerAppStore { files: files }) } + newPathNameUpdated = (event) => { + const value = event.target.value; + this.setState({ + newPathName: value + }) + } + createDirectory = () => { + console.log(this.newPathName); + this.sendDownloadFileRequst({ + id: this.item.id, + type: this.item.uiState.type, + path: this.item.name + '/' + this.newPathName, + url: utils.getSearchParams(window.location).dev_download_server || window.location.protocol + '//' + window.location.host, + refresh: true + }); + this.setState({ + newPathName: '' + }) + } } export default alt.createStore(ComposerAppStore, 'ComposerAppStore');