mirror of
https://github.com/openstf/stf
synced 2025-10-05 10:39:25 +02:00
add filesystem(file explorer) support, done
This commit is contained in:
parent
b258837757
commit
1dccda5e2a
11 changed files with 174 additions and 74 deletions
50
res/app/control-panes/filesystem/fs-controller.js
Normal file
50
res/app/control-panes/filesystem/fs-controller.js
Normal file
|
@ -0,0 +1,50 @@
|
|||
module.exports = function FsCtrl($scope, $timeout) {
|
||||
$scope.search = ''
|
||||
$scope.files = [];
|
||||
$scope.paths = [];
|
||||
|
||||
var listdir = function(){
|
||||
var path = '/'+$scope.paths.join('/');
|
||||
$scope.control.fslist(path)
|
||||
.then(function(result){
|
||||
$scope.files = result.body;
|
||||
$scope.$digest();
|
||||
})
|
||||
.catch(function(err){
|
||||
alert(err.message);
|
||||
})
|
||||
}
|
||||
|
||||
$scope.dirEnter = function(name){
|
||||
if (name){
|
||||
$scope.paths.push(name);
|
||||
}
|
||||
listdir();
|
||||
$scope.search = '';
|
||||
}
|
||||
|
||||
$scope.dirJump = function(){
|
||||
if ($scope.paths.length !== 0){
|
||||
$scope.paths.pop();
|
||||
}
|
||||
listdir();
|
||||
}
|
||||
|
||||
$scope.getFile = function(file){
|
||||
var path = '/'+$scope.paths.join('/')+'/'+file;
|
||||
$scope.control.fsretrive(path)
|
||||
.then(function(result){
|
||||
location.href = result.body.href+"?download"
|
||||
})
|
||||
.catch(function(err){
|
||||
alert(err.message);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// init
|
||||
// $scope.list($scope.dir); // FIXME(ssx): can't call immediately, do not known why.
|
||||
$timeout(function(){
|
||||
listdir();
|
||||
}, 800);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue