Skip to content
Snippets Groups Projects
Commit 1bea5da0 authored by juanf's avatar juanf
Browse files

SSDM-3287 : Tree navigation - working prototype

SVN: 35873
parent 9667e014
No related branches found
No related tags found
No related merge requests found
...@@ -34,7 +34,7 @@ function DataSetViewerModel(containerId, profile, sample, serverFacade, datastor ...@@ -34,7 +34,7 @@ function DataSetViewerModel(containerId, profile, sample, serverFacade, datastor
this.enableOpenDataset = enableOpenDataset; this.enableOpenDataset = enableOpenDataset;
this.sampleDataSets = {}; this.sampleDataSets = {};
this.datastoreDownloadURL = datastoreDownloadURL this.datastoreDownloadURL = datastoreDownloadURL
this.lastUsedPath = []; this.lastUsedPathList = [];
this.dataSetViewerMode = DataSetViewerMode.LIST; this.dataSetViewerMode = DataSetViewerMode.LIST;
......
...@@ -222,7 +222,7 @@ function DataSetViewerView(dataSetViewerController, dataSetViewerModel) { ...@@ -222,7 +222,7 @@ function DataSetViewerView(dataSetViewerController, dataSetViewerModel) {
dfd.resolve(results); dfd.resolve(results);
}; };
_this.updateDirectoryView(datasetCode, pathToLoad, false, repaintEvent); _this.updateDirectoryView(datasetCode, pathToLoad, true, repaintEvent);
}; };
$tree.fancytree({ $tree.fancytree({
...@@ -236,11 +236,11 @@ function DataSetViewerView(dataSetViewerController, dataSetViewerModel) { ...@@ -236,11 +236,11 @@ function DataSetViewerView(dataSetViewerController, dataSetViewerModel) {
} }
this.updateDirectoryView = function(code, path, isBack, repaintEvent) { this.updateDirectoryView = function(code, path, notAddPath, repaintEvent) {
var _this = this; var _this = this;
mainController.serverFacade.listFilesForDataSet(code, path, false, function(files) { mainController.serverFacade.listFilesForDataSet(code, path, false, function(files) {
if(!isBack) { if(!notAddPath) {
_this._dataSetViewerModel.lastUsedPath.push(path); _this._dataSetViewerModel.lastUsedPathList.push(path);
} }
if(!repaintEvent) { if(!repaintEvent) {
...@@ -264,7 +264,7 @@ function DataSetViewerView(dataSetViewerController, dataSetViewerModel) { ...@@ -264,7 +264,7 @@ function DataSetViewerView(dataSetViewerController, dataSetViewerModel) {
var _this = this; var _this = this;
// Path // Path
var parentPath = this._dataSetViewerModel.lastUsedPath[this._dataSetViewerModel.lastUsedPath.length - 1]; var parentPath = this._dataSetViewerModel.lastUsedPathList[this._dataSetViewerModel.lastUsedPathList.length - 1];
$container.append($("<legend>").append("Path: " + parentPath)); $container.append($("<legend>").append("Path: " + parentPath));
// //
...@@ -294,16 +294,16 @@ function DataSetViewerView(dataSetViewerController, dataSetViewerModel) { ...@@ -294,16 +294,16 @@ function DataSetViewerView(dataSetViewerController, dataSetViewerModel) {
}); });
var backClick = function(event) { var backClick = function(event) {
if(_this._dataSetViewerModel.lastUsedPath.length === 1) { if(_this._dataSetViewerModel.lastUsedPathList.length === 1) {
_this.repaintDatasets(); _this.repaintDatasets();
} else { } else {
var repaintEvent = function(code, files) { var repaintEvent = function(code, files) {
_this.repaintFiles(code, files.result); _this.repaintFiles(code, files.result);
}; };
_this.updateDirectoryView(datasetCode, _this._dataSetViewerModel.lastUsedPath[_this._dataSetViewerModel.lastUsedPath.length - 2], true, repaintEvent); _this.updateDirectoryView(datasetCode, _this._dataSetViewerModel.lastUsedPathList[_this._dataSetViewerModel.lastUsedPathList.length - 2], true, repaintEvent);
} }
_this._dataSetViewerModel.lastUsedPath.pop(); _this._dataSetViewerModel.lastUsedPathList.pop();
event.stopPropagation(); event.stopPropagation();
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment