Skip to content

FrontEnd talks to WebServer about files #289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 522 commits into from
Nov 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
522 commits
Select commit Hold shift + click to select a range
59bde3a
Merge branch 'feature/FE-DSM' of https://github.com/odeimaiz/osparc-s…
sanderegg Oct 23, 2018
9d5fa41
Show FileId and Size in FilePicker
Oct 23, 2018
5b1aa97
added apihub in makefile push_images
sanderegg Oct 23, 2018
3fff592
copy file using its filename into S3
sanderegg Oct 23, 2018
e7cea71
Merge pull request #14 from sanderegg/small_fixes
odeimaiz Oct 23, 2018
c496180
Merge remote-tracking branch 'upstream/master'
sanderegg Oct 23, 2018
150ec80
only keep the first part of the key name before the name
sanderegg Oct 23, 2018
2db818c
Merge branch 'master' into feature/FE-DSM
odeimaiz Oct 23, 2018
5ce6f70
Merge pull request #15 from sanderegg/fix_port_key
odeimaiz Oct 23, 2018
4628a6e
Merge remote-tracking branch 'upstream/master'
pcrespov Oct 23, 2018
4797e46
Making pylint happy
Oct 23, 2018
94a1856
Colleen Clancy use cases added to Popular projects
Oct 23, 2018
4a1c89d
Added CC with containers
Oct 23, 2018
8b2218f
Merge branch 'master' of github.com:ITISFoundation/osparc-simcore
Oct 24, 2018
c07dbea
Make calls to datcore async
Oct 24, 2018
a7ad99e
Merge branch 'master' into is243/storage
Oct 24, 2018
64ce846
Merge branch 'master' into is243/storage
Oct 24, 2018
20a1a62
Add filter by uuid
Oct 24, 2018
9c49147
Merge remote-tracking branch 'upstream/master'
Oct 24, 2018
21aeab8
Merge branch 'master' of github.com:pcrespov/osparc-simcore
Oct 24, 2018
7579059
Merge remote-tracking branch 'upstream/master'
Oct 25, 2018
13699f7
Merge branch 'master' into is243/storage
Oct 25, 2018
2aaa8df
use app's engine
Oct 25, 2018
a93f62d
use app's event loop for dsm
Oct 25, 2018
7b556d1
Fix issue with default loop fixture when pytest-asyncio is present
Oct 25, 2018
c263a24
Starts adding routes/handler/oas specs for storage service
Oct 25, 2018
840fb96
Add api to copy files within s3
Oct 26, 2018
a21736c
Ping whether datcore tokens/access is granted
Oct 26, 2018
a812ebb
travis
Oct 26, 2018
79271e0
adds dummy handler for storage
Oct 26, 2018
5b3d3d4
Add some exception handling to the datcore calls
Oct 26, 2018
882ed0b
Merge remote-tracking branch 'upstream/master'
Oct 26, 2018
62eb5c5
Merge remote-tracking branch 'upstream/master'
Oct 26, 2018
fa6702f
pylint
Oct 26, 2018
28af259
Several small fixes related to running storage in a docker container
Oct 26, 2018
f8006e4
Merge branch 'master' into is243/storage
mguidon Oct 26, 2018
3be584c
pylint\n disable test that req. auth
mguidon Oct 26, 2018
c610816
disable test
mguidon Oct 26, 2018
eaa96ed
One more
mguidon Oct 26, 2018
6d04e7b
Merge remote-tracking branch 'upstream/master'
Oct 27, 2018
6ef273c
Merge branch 'master' into feature/FE-DSM
Oct 27, 2018
5a53ab8
replaced "dblclick" by "dbltap"
Oct 27, 2018
df035fe
Store implements all calls needed for getting list of files, upload, …
Oct 27, 2018
ea4ced5
Fake data updated
Oct 27, 2018
bc13cbe
File Picker also shows Fake data
Oct 27, 2018
75a7c83
improving code
Oct 27, 2018
9508a99
refatoring to reuse FilesTreePopulator code
Oct 27, 2018
28cebf4
FilesTreePopulator modified. Now can be used by FileManager as well
Oct 27, 2018
e1c1f14
minor
Oct 27, 2018
a952c4e
file to model converter adds "path"
Oct 27, 2018
2e9f148
minor
Oct 27, 2018
fd4af44
ups
Oct 27, 2018
98fdf9b
minor
Oct 27, 2018
6fd9508
minor
Oct 27, 2018
3c221ef
Bigger FileManager
Oct 27, 2018
54f7b80
FileManager uses FilesTreePopulator and VirtualTree. All features back
Oct 29, 2018
65f510c
Merge remote-tracking branch 'upstream/master'
Oct 29, 2018
8d9924a
Merge branch 'is243/storage' of git://github.com/mguidon/osparc-simco…
Oct 29, 2018
f4c772c
Squashed commit of the pr#275 (is200/auth business logic)
Oct 29, 2018
ee133cd
Fixes merge:
Oct 29, 2018
6cd86da
Removes login routes mapping from rest_routes submodule.
Oct 29, 2018
1c9d374
Added login_required to storage/locations.
Oct 29, 2018
5dcfbfa
Cleanup servicelib
pcrespov Oct 29, 2018
424f249
- Added login/decorators login_required and restricted_to
pcrespov Oct 29, 2018
6ed9d37
Added section for storage in config-file
pcrespov Oct 29, 2018
cc75782
A prototype of bypass for handlers
pcrespov Oct 29, 2018
c9d47b6
WIP: added test with a fake storage server
pcrespov Oct 29, 2018
0c52b98
Redefined login_settings
pcrespov Oct 29, 2018
71d3d54
Fixed cyclic import by adding storage_settings
pcrespov Oct 29, 2018
976c9f2
Fixed syntax error in test
pcrespov Oct 29, 2018
9aa30a1
Merge branch 'master' into feature/FE-DSM
odeimaiz Oct 30, 2018
6c185ae
Fixes decorator and keys in login
Oct 30, 2018
035fe79
Merge remote-tracking branch 'upstream/master'
Oct 30, 2018
ffecba8
Merge pull request #6 from pcrespov/mguidon-is243/storage
mguidon Oct 30, 2018
e52a3d8
Fix check_envelope in service-lib
Oct 30, 2018
be5f432
fix storage tests using fake server
Oct 30, 2018
73f9ad6
Merge branch 'master' into is243/storage
pcrespov Oct 30, 2018
375f6c3
Added cleanup_ctx to keep a unique application wide session
Oct 30, 2018
3e4c95d
Fixes apihub compose
Oct 30, 2018
cb0d7bf
Fixes linter errors
Oct 30, 2018
7a9c5ea
Fixing storage servcie config files
Oct 30, 2018
fada09a
Merge branch 'master' into feature/FE-DSM
odeimaiz Oct 30, 2018
dc29f7a
More configuration fixes
Oct 30, 2018
dde65ac
Merge branch 'master' into feature/FE-DSM
odeimaiz Oct 30, 2018
b7f2e9f
Fix initialization of engine/tables
Oct 30, 2018
2fbe942
print url
Oct 30, 2018
a37b500
fix nasyt typo in server spec
Oct 31, 2018
77d6ac1
Merge remote-tracking branch 'upstream/master'
pcrespov Oct 31, 2018
588f37e
Merge branch 'is243/storage' of git://github.com/mguidon/osparc-simco…
pcrespov Oct 31, 2018
20188fd
Merge pull request #7 from pcrespov/mguidon-is243/storage
mguidon Oct 31, 2018
4251c3e
Merge remote-tracking branch 'upstream/master'
Oct 31, 2018
52425c2
fixes env variables
Oct 31, 2018
b7c8b02
Merge branch 'master' into feature/FE-DSM
Oct 31, 2018
a423b11
Merge branch 'feature/FE-DSM' of github.com:odeimaiz/osparc-simcore i…
Oct 31, 2018
66272be
Merge branch 'master' into is243/storage
odeimaiz Oct 31, 2018
762a81a
Merge branch 'is243/storage' of git://github.com/mguidon/osparc-simco…
Oct 31, 2018
a16fb55
Fix pytest on travis
Oct 31, 2018
ac3c5da
Added SMTP_HOST and SMTP_PORT to the docker-composes
Oct 31, 2018
71c3526
Merge branch 'is243/storage' of git://github.com/mguidon/osparc-simco…
Oct 31, 2018
1f82489
No more fake files
Oct 31, 2018
6c2fc9f
Fixed webserver<->storage specs
Oct 31, 2018
1417061
File Picker get nodeModel and projectId
Oct 31, 2018
1e729bb
Get MyDocuments
Oct 31, 2018
1028fce
Trying to upload files
Oct 31, 2018
91ec7f4
fix swarm config for storage
Oct 31, 2018
9a47127
Merge branch 'master' into is243/storage
Oct 31, 2018
d7edc5a
Merge remote-tracking branch 'upstream/master'
Oct 31, 2018
cd37313
Increased PLATFORM_VERSION to 3.19
Oct 31, 2018
0b1226d
Revert "Increased PLATFORM_VERSION to 3.19"
Oct 31, 2018
e57e044
Increased PLATFORM_VERSION to 3.19
Oct 31, 2018
0ba0583
Merge branch 'master' into feature/FE-DSM
Oct 31, 2018
eaaccce
Merge branch 'master' into is243/storage
pcrespov Nov 2, 2018
dfe7a03
upgraded openapi code generator
sanderegg Nov 2, 2018
80dcece
go back to 3.2.3
sanderegg Nov 2, 2018
e06c25c
Merge branch 'master' into is243/storage
pcrespov Nov 4, 2018
eb3b6b5
renamed package name
sanderegg Nov 5, 2018
a6b9711
fixed crash when no datcore present
sanderegg Nov 5, 2018
6cb27d9
fixed openapi definition for getting locations - was not returning en…
sanderegg Nov 5, 2018
6ebe809
improved script to automatically remove output.yaml
sanderegg Nov 5, 2018
3132e21
modified openapi to specify it actually returns envelopes
sanderegg Nov 5, 2018
3d5ab3b
created sample file for testing client
sanderegg Nov 5, 2018
6cc4708
fixed usage of upload link
sanderegg Nov 5, 2018
fe38cb0
defines link as required
sanderegg Nov 5, 2018
c07a1f1
removed python notebook
sanderegg Nov 5, 2018
3cb098c
removed log
sanderegg Nov 5, 2018
f69f684
changed dependency from s3wrapper to storage client sdk
sanderegg Nov 5, 2018
cd4aef7
make use of Path to ensure correct /
sanderegg Nov 6, 2018
ba5c8ba
change name of package to follow conventions
sanderegg Nov 6, 2018
6ab61fb
renamed requirements for production
sanderegg Nov 6, 2018
3c7ffb6
code cleanup
sanderegg Nov 6, 2018
9077c35
added necesary config entries
sanderegg Nov 6, 2018
7866ce5
moved includes to fixtures to top'level conftest
sanderegg Nov 6, 2018
949982c
pylint
sanderegg Nov 6, 2018
835277b
fixed storage setup script to copy the openapi correctly
sanderegg Nov 6, 2018
d0a4ed1
fixed dependencies to servicelib
sanderegg Nov 6, 2018
a6f8c94
fixed naming
sanderegg Nov 6, 2018
c48f1c6
added logs
sanderegg Nov 6, 2018
1757a37
added exception for storage connection error
sanderegg Nov 6, 2018
dee9655
return value of location id is an integer not a number
sanderegg Nov 6, 2018
1e8f3a3
strip " from none
sanderegg Nov 6, 2018
4cea276
added fixture to start storage servicemoved minio out of the docker s…
sanderegg Nov 6, 2018
208689d
filemanager tests are passingadded exceptions to handle storage serve…
sanderegg Nov 6, 2018
9970151
added configuration for store and bucket
sanderegg Nov 7, 2018
5b168be
moved fixtures to conftest
sanderegg Nov 7, 2018
418ba6a
added new way of creating file id
sanderegg Nov 7, 2018
47c6f6d
parts of nodeports test passing
sanderegg Nov 7, 2018
a7fcde5
added more helpers functions for testing
sanderegg Nov 7, 2018
ef5fa29
fixes the warnings regarding ssl
sanderegg Nov 7, 2018
b9b4d37
refactoring
sanderegg Nov 7, 2018
c6c109c
fixed await missing
sanderegg Nov 7, 2018
a63ab5f
refactoring storage fixture
sanderegg Nov 7, 2018
bd22b2b
missing files
sanderegg Nov 7, 2018
bf9a413
Merge remote-tracking branch 'upstream/master'
Nov 7, 2018
1d91b83
Merge branch 'master' into feature/FE-DSM
Nov 7, 2018
4dd1b62
fixed tests for getting files and values from previous nodes
sanderegg Nov 7, 2018
1a85540
nodeports tests are passing again
sanderegg Nov 7, 2018
390bb1c
download using async library aiofiles
sanderegg Nov 7, 2018
42dd4be
pylint
sanderegg Nov 7, 2018
1b3f9df
code cleanup
sanderegg Nov 7, 2018
4c07191
pylint
sanderegg Nov 7, 2018
6b546c9
updated code generator to latest version
sanderegg Nov 7, 2018
2f56448
removed usage of prance to resolve openapi as this is now fixed by fi…
sanderegg Nov 7, 2018
8739512
changed image to use for testing
sanderegg Nov 7, 2018
938e357
Merge branch 'master' into adapt_nodeports_to_storage
sanderegg Nov 7, 2018
96d0d40
Merge branch 'master' into is243/storage
Nov 8, 2018
c718633
replace the minio fixture with the new external to the docker-compose…
sanderegg Nov 8, 2018
c0c546d
fixed endpoint without scheme
sanderegg Nov 8, 2018
be1826e
storage build for tests
sanderegg Nov 8, 2018
bddc458
Merge branch 'adapt_nodeports_to_storage' of git://github.com/sandere…
Nov 8, 2018
1f9029a
Merge branch 'sanderegg-adapt_nodeports_to_storage' into is243/storage
Nov 8, 2018
0316fba
Little fixes (#9)
sanderegg Nov 8, 2018
6026251
fix deps for mock
Nov 8, 2018
eb4bb4d
Merge remote-tracking branch 'upstream/master'
Nov 8, 2018
bcbe593
Merge branch 'master' into feature/FE-DSM
Nov 8, 2018
d6b8812
Slightly change API
Nov 8, 2018
832380a
Merge branch 'master' into is243/storage
Nov 8, 2018
f07ec4e
Revert back to old api
Nov 9, 2018
e265235
Remove unused field
Nov 9, 2018
1a2baf7
Merge remote-tracking branch 'upstream/master'
Nov 9, 2018
900e800
Merge branch 'master' into feature/FE-DSM
Nov 9, 2018
72dd7d4
Merge branch 'is243/storage' of git://github.com/mguidon/osparc-simco…
Nov 9, 2018
d41cf1b
FakeData updated to new data structure
Nov 9, 2018
b65084a
minor
Nov 9, 2018
ed68e33
presignedURL request fixed
Nov 9, 2018
e9be7fd
minor
Nov 9, 2018
7c1f991
minor
Nov 9, 2018
8362da1
cleanup
Nov 9, 2018
e634863
remove location from fileuuid
Nov 13, 2018
3d1e441
Merge branch 'master' into is243/storage
Nov 13, 2018
dc9678a
Merge sandereggs changes
Nov 13, 2018
4971bac
location name is not part of file ID anymore
sanderegg Nov 13, 2018
182ffe5
fix issues with openapi files
Nov 13, 2018
9a65022
Forgot those
Nov 13, 2018
91b69ae
Fix rerouting to storage
Nov 13, 2018
ff0a1b9
Merge master
Nov 13, 2018
508563e
Merge branch 'is243/storage' of git://github.com/mguidon/osparc-simco…
Nov 13, 2018
63d0389
yaml, we said yAml!!
Nov 13, 2018
e35d1e6
Merge branch 'master' into is243/storage
Nov 13, 2018
8437371
Remove bucket name from file_uuid. It is already defined by the locat…
Nov 13, 2018
4068f77
Make api for copy more clear
Nov 13, 2018
e0f96f6
Make api for copy more cleard-s
Nov 13, 2018
a6df194
Implements copy datcore->s3
Nov 13, 2018
c2ffb9b
Merge branch 'master' into is243/storage
Nov 13, 2018
439b90a
Merge branch 'fix_location_name' of git://github.com/sanderegg/osparc…
Nov 13, 2018
19c4085
removed bucket from file id
sanderegg Nov 13, 2018
2543328
Merge branch 'sanderegg-fixes_for_removing_bucket_from_file_id' into …
Nov 13, 2018
7faebc2
minor
Nov 13, 2018
6b8e9c5
Merge branch 'master' into is243/storage
odeimaiz Nov 14, 2018
9d1370b
Merge branch 'master' into feature/FE-DSM
Nov 14, 2018
1a2bf88
datcore fakedata updated
Nov 14, 2018
5a964f9
Adds test for file_uuid creator
Nov 14, 2018
64ca522
Merge branch 'master' into is243/storage
Nov 14, 2018
edcd9fa
Merge branch 'is243/storage' of github.com:mguidon/osparc-simcore int…
Nov 14, 2018
fdc3e0c
Merge branch 'master' into feature/FE-DSM
Nov 14, 2018
2283fc6
Merge branch 'feature/FE-DSM' of git://github.com/odeimaiz/osparc-sim…
Nov 14, 2018
5a9be5d
Create bucket if not yet there
Nov 14, 2018
7ba4e72
FakeData for files updated
Nov 14, 2018
f178c3c
FakeData for files updated 2
Nov 14, 2018
24f5ee8
File Picker lists simcore and datcore files
Nov 14, 2018
be8588d
FileFicker writes expected output
Nov 14, 2018
550850f
Repopulate OutputPortData after selecting file in FilePicker
Nov 14, 2018
89ad8e5
implementation for repopulateOutputPortData
Nov 14, 2018
1d8d5bb
cleaning
Nov 14, 2018
0e734ac
Check selected item is actually a file
Nov 14, 2018
12b8af0
cleaning
Nov 14, 2018
80ea5df
minor
Nov 14, 2018
b83585f
minor
Nov 14, 2018
2fcf4ef
minor
Nov 14, 2018
cd00cbe
Download file from storage implemented
Nov 14, 2018
897dda6
Feature/fe dsm (#15)
odeimaiz Nov 15, 2018
2c8a33c
Pylint
Nov 15, 2018
73c738f
Merge branch 'is243/storage' of github.com:mguidon/osparc-simcore int…
Nov 15, 2018
60cc1fd
Add reference osparc.itis stack template
Nov 15, 2018
f59d6a9
Merge branch 'master' into is243/storage
Nov 15, 2018
4c96af8
Merge branch 'master' into feature/FE-DSM
Nov 15, 2018
a58c768
Fix swarm
Nov 15, 2018
4ba2699
FileManager shows node files on the left tree
Nov 15, 2018
d66997f
presginedLink.link
Nov 15, 2018
27ddf61
Merge branch 'master' into is243/storage
odeimaiz Nov 15, 2018
f2a4d5e
Merge branch 'is243/storage' of git://github.com/mguidon/osparc-simco…
Nov 15, 2018
f4d413c
minor
Nov 15, 2018
d1fc463
Feature/fe dsm (#16)
odeimaiz Nov 15, 2018
2fdd607
Merge branch 'is243/storage' of git://github.com/mguidon/osparc-simco…
Nov 15, 2018
e6a3a55
We can download files
Nov 15, 2018
f8bbb12
Copy files working
Nov 16, 2018
ab3e699
Delete file and Node files
Nov 16, 2018
bb52dd3
merge master into my branch
Nov 16, 2018
4822df9
These files were deleted
Nov 16, 2018
55e82b8
make pylint happy
Nov 16, 2018
585e748
Merge branch 'master' into feature/FE-DSM
odeimaiz Nov 16, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ qx.Class.define("qxapp.component.widget.FileManager", {
treesLayout.add(nodeTree, {
flex: 1
});
nodeTree.getSelection().addListener("change", this.__itemSelected, this);
nodeTree.getSelection().addListener("change", this.__nodeItemSelected, this);

let userTree = this.__userTree = this._createChildControlImpl("userTree");
treesLayout.add(userTree, {
flex: 1
});
userTree.getSelection().addListener("change", this.__itemSelected, this);
userTree.getSelection().addListener("change", this.__userItemSelected, this);

let selectedFileLayout = this._createChildControlImpl("selectedFileLayout");
{
Expand Down Expand Up @@ -116,7 +116,7 @@ qx.Class.define("qxapp.component.widget.FileManager", {

__reloadNodeTree: function() {
let filesTreePopulator = new qxapp.utils.FilesTreePopulator(this.__nodeTree);
filesTreePopulator.populateNodeFiles();
filesTreePopulator.populateNodeFiles(this.getNodeModel().getNodeId());

let that = this;
let delegate = this.__nodeTree.getDelegate();
Expand Down Expand Up @@ -190,30 +190,59 @@ qx.Class.define("qxapp.component.widget.FileManager", {
if (e.supportsType("osparc-filePath")) {
const from = e.getRelatedTarget();
const to = e.getCurrentTarget();
let store = qxapp.data.Store.getInstance();
console.log("Copy", from.getFileId(), "to", to.getPath());
store.copyFile(from.getLocation(), from.getFileId(), to.getLocation(), to.getPath());
store.addListenerOnce("FileCopied", ev => {
this.__reloadUserTree();
}, this);
}
}, this);
},

__itemSelected: function() {
__nodeItemSelected: function() {
let selectedItem = this.__nodeTree.getSelection();
if (selectedItem.length < 1) {
return;
}
this.__userTree.resetSelection();
selectedItem = selectedItem.toArray();
if (this.__isFile(selectedItem[0])) {
this.__selection = selectedItem[0].getFileId();
this.__selectedLabel.setValue(selectedItem[0].getFileId());
this.__itemSelected(selectedItem[0]);
},

__userItemSelected: function() {
let selectedItem = this.__userTree.getSelection();
if (selectedItem.length < 1) {
return;
}
this.__nodeTree.resetSelection();
selectedItem = selectedItem.toArray();
this.__itemSelected(selectedItem[0]);
},

__itemSelected: function(selectedItem) {
if (this.__isFile(selectedItem)) {
this.__selection = selectedItem;
this.__selectedLabel.setValue(selectedItem.getFileId());
} else {
this.__selection = null;
this.__selectedLabel.setValue("");
}
},

__getItemSelected: function() {
let selectedItem = this.__selection;
if (selectedItem && this.__isFile(selectedItem)) {
return selectedItem;
}
return null;
},

// Request to the server an download
__retrieveURLAndDownload: function() {
if (this.__selection !== null) {
const fileId = this.__selection;
let selection = this.__getItemSelected();
if (selection) {
const fileId = selection.getFileId();
let fileName = fileId.split("/");
fileName = fileName[fileName.length-1];
let store = qxapp.data.Store.getInstance();
Expand All @@ -225,7 +254,7 @@ qx.Class.define("qxapp.component.widget.FileManager", {
}
}, this);
const download = true;
const locationId = 0;
const locationId = selection.getLocation();
store.getPresginedLink(download, locationId, fileId);
}
},
Expand All @@ -237,7 +266,7 @@ qx.Class.define("qxapp.component.widget.FileManager", {
xhr.onload = () => {
console.log("onload", xhr);
if (xhr.status == 200) {
var blob = new Blob(xhr.response);
let blob = new Blob([xhr.response]);
let urlBlob = window.URL.createObjectURL(blob);
let downloadAnchorNode = document.createElement("a");
downloadAnchorNode.setAttribute("href", urlBlob);
Expand All @@ -250,7 +279,18 @@ qx.Class.define("qxapp.component.widget.FileManager", {
},

__deleteFile: function() {
console.log("Delete ", this.__selection);
let selection = this.__getItemSelected();
if (selection) {
console.log("Delete ", selection);
const fileId = selection.getFileId();
const locationId = selection.getLocation();
let store = qxapp.data.Store.getInstance();
store.addListenerOnce("DeleteFile", e => {
this.__reloadNodeTree();
this.__reloadUserTree();
}, this);
store.deleteFile(locationId, fileId);
}
}
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ qx.Class.define("qxapp.component.widget.FileTreeItem", {
nullable : true
},

location : {
check : "String",
event: "changePath",
nullable : true
},

size : {
check : "String",
event: "changeSize",
Expand Down
102 changes: 58 additions & 44 deletions services/web/client/source/class/qxapp/data/Converters.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,58 +39,72 @@ qx.Class.define("qxapp.data.Converters", {
}
},

__isLocationValid: function(locID) {
if (locID === 0 || locID === "0" ||
locID === 1 || locID === "1") {
return true;
}
return false;
},

fromDSMToVirtualTreeModel: function(files) {
let children = [];
for (let i=0; i<files.length; i++) {
const file = files[i];
let fileInTree = {
label: file["location"],
path: file["location"],
children: []
};
if (file["location_id"] === 0 || file["location_id"] === "0") {
// simcore files
let splitted = file["file_uuid"].split("/");
if (splitted.length === 3) {
const prjId = splitted[0];
const nodejId = splitted[1];
const fileId = splitted[2];
// node file
fileInTree.children.push({
label: file["project_name"] ? file["project_name"] : prjId,
path: fileInTree.path +"/"+ file["project_name"],
children: [{
label: file["node_name"] ? file["node_name"] : nodejId,
path: fileInTree.path +"/"+ file["project_name"] +"/"+ file["node_name"],
if (this.__isLocationValid(file["location_id"])) {
let fileInTree = {
label: file["location"],
location: file["location_id"],
path: "",
children: []
};
if (file["location_id"] === 0 || file["location_id"] === "0") {
// simcore files
let splitted = file["file_uuid"].split("/");
if (splitted.length === 3) {
const prjId = splitted[0];
const nodejId = splitted[1];
const fileId = splitted[2];
// node file
fileInTree.children.push({
label: file["project_name"] === "" ? prjId : file["project_name"],
location: file["location_id"],
path: prjId,
children: [{
label: file["file_name"] ? file["file_name"] : fileId,
fileId: file["file_uuid"],
location: file["location_id"]
label: file["node_name"] === "" ? nodejId : file["node_name"],
location: file["location_id"],
path: prjId +"/"+ nodejId,
children: [{
label: file["file_name"] === "" ? fileId : file["file_name"],
location: file["location_id"],
fileId: file["file_uuid"]
}]
}]
}]
});
this.mergeChildren(children, fileInTree);
}
} else if (file["location_id"] === 1 || file["location_id"] === "1") {
// datcore files
let parent = fileInTree;
let splitted = file["file_uuid"].split("/");
for (let j=0; j<splitted.length-1; j++) {
const newItem = {
label: splitted[j],
path: parent.path +"/"+ splitted[j],
children: []
});
this.mergeChildren(children, fileInTree);
}
} else if (file["location_id"] === 1 || file["location_id"] === "1") {
// datcore files
let parent = fileInTree;
let splitted = file["file_uuid"].split("/");
for (let j=0; j<splitted.length-1; j++) {
const newItem = {
label: splitted[j],
location: file["location_id"],
path: parent.path === "" ? splitted[j] : parent.path +"/"+ splitted[j],
children: []
};
parent.children.push(newItem);
parent = newItem;
}
let fileInfo = {
label: splitted[splitted.length-1],
location: file["location_id"],
fileId: file["file_uuid"]
};
parent.children.push(newItem);
parent = newItem;
parent.children.push(fileInfo);
this.mergeChildren(children, fileInTree);
}
let fileInfo = {
label: splitted[splitted.length-1],
fileId: file["file_uuid"],
location: file["location_id"]
};
parent.children.push(fileInfo);
this.mergeChildren(children, fileInTree);
}
}

Expand Down
43 changes: 38 additions & 5 deletions services/web/client/source/class/qxapp/data/Store.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ qx.Class.define("qxapp.data.Store", {
"MyDocuments": "qx.event.type.Event",
"NodeFiles": "qx.event.type.Event",
"PresginedLink": "qx.event.type.Event",
"FileCopied": "qx.event.type.Event",
"DeleteFile": "qx.event.type.Event",
"FakeFiles": "qx.event.type.Event"
},
Expand Down Expand Up @@ -721,8 +722,8 @@ qx.Class.define("qxapp.data.Store", {
this.fireDataEvent("FakeFiles", data);
},

getNodeFiles: function(prjId, nodeId) {
const filter = "?uuid_filter=" + nodeId;
getNodeFiles: function(nodeId) {
const filter = "?uuid_filter=" + encodeURIComponent(nodeId);
let endPoint = "/storage/locations/0/files/metadata";
endPoint += filter;
let reqFiles = new qxapp.io.request.ApiRequest(endPoint, "GET");
Expand All @@ -740,7 +741,7 @@ qx.Class.define("qxapp.data.Store", {
const {
error
} = e.getTarget().getResponse();
console.log("Failed getting NodeF iles list", error);
console.log("Failed getting Node Files list", error);
});

reqFiles.send();
Expand Down Expand Up @@ -821,9 +822,41 @@ qx.Class.define("qxapp.data.Store", {
req.send();
},

copyFile: function(fromLoc, fileUuid, toLoc, pathId) {
// "/v0/locations/1/files/{}?user_id={}&extra_location={}&extra_source={}".format(quote(datcore_uuid, safe=''),
let fileName = fileUuid.split("/");
fileName = fileName[fileName.length-1];
let endPoint = "/storage/locations/"+toLoc+"/files/";
let parameters = encodeURIComponent(pathId + "/" + fileName);
parameters += "?extra_location=";
parameters += fromLoc;
parameters += "&extra_source=";
parameters += encodeURIComponent(fileUuid);
endPoint += parameters;
let req = new qxapp.io.request.ApiRequest(endPoint, "PUT");

req.addListener("success", e => {
const {
data
} = e.getTarget().getResponse();
this.fireDataEvent("FileCopied", data);
}, this);

req.addListener("fail", e => {
const {
error
} = e.getTarget().getResponse();
console.log(error);
console.log("Failed copying file", fileUuid, "to", pathId);
});

req.send();
},

deleteFile: function(locationId, fileUuid) {
// Deletes File
const endPoint = "/storage/locations/" + locationId + "/files/" + fileUuid;
let parameters = encodeURIComponent(fileUuid);
const endPoint = "/storage/locations/" + locationId + "/files/" + parameters;
let req = new qxapp.io.request.ApiRequest(endPoint, "DELETE");

req.addListener("success", e => {
Expand All @@ -837,7 +870,7 @@ qx.Class.define("qxapp.data.Store", {
const {
error
} = e.getTarget().getResponse();
console.log("Failed getting Presgined Link", error);
console.log("Failed deleting file", error);
});

req.send();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ qx.Class.define("qxapp.utils.FilesTreePopulator", {
members: {
__tree: null,

populateNodeFiles: function(prjId, nodeId) {
populateNodeFiles: function(nodeId) {
const treeName = "Node files";
this.__resetTree(treeName);
let store = qxapp.data.Store.getInstance();
Expand All @@ -21,7 +21,7 @@ qx.Class.define("qxapp.utils.FilesTreePopulator", {
this.__addTreeData(newChildren);
}, this);

store.getNodeFiles(prjId, nodeId);
store.getNodeFiles(nodeId);
},

populateMyDocuments: function() {
Expand Down Expand Up @@ -50,6 +50,9 @@ qx.Class.define("qxapp.utils.FilesTreePopulator", {
this.__tree.resetModel();
let data = {
label: treeName,
fileId: null,
location: null,
path: null,
children: []
};
let emptyModel = qx.data.marshal.Json.createModel(data, true);
Expand All @@ -59,6 +62,7 @@ qx.Class.define("qxapp.utils.FilesTreePopulator", {
bindItem: (c, item, id) => {
c.bindDefaultProperties(item, id);
c.bindProperty("fileId", "fileId", null, item, id);
c.bindProperty("location", "location", null, item, id);
c.bindProperty("path", "path", null, item, id);
c.bindProperty("size", "size", null, item, id);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from aiohttp import web


APP_LOGIN_CONFIG = __name__ + ".config"
CFG_LOGIN_STORAGE = "STORAGE" # Needs to match login.cfg!!!


def get_storage(app: web.Application):
return app[APP_LOGIN_CONFIG][CFG_LOGIN_STORAGE]
Loading