Add file removal functionality
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
/* global angular */
|
||||
/* global angular, $ */
|
||||
|
||||
// create main application module
|
||||
var app = angular.module('Application', ['angular-md5', 'ui-notification']);
|
||||
@@ -55,20 +55,22 @@ app.controller('FileManagerController', ['$scope', 'Client', function ($scope, C
|
||||
console.log('uploadFolder');
|
||||
};
|
||||
|
||||
$scope.remove = function (entry) {
|
||||
console.log('remove', entry);
|
||||
};
|
||||
|
||||
$scope.open = function (entry) {
|
||||
var filePath = sanitize($scope.cwd + '/' + entry.filePath);
|
||||
|
||||
if (entry.isDirectory) {
|
||||
setDirectory($scope.cwd + '/' + entry.filePath);
|
||||
setDirectory(filePath);
|
||||
} else if (entry.isFile) {
|
||||
console.log('open', entry)
|
||||
Client.filesGet($scope.appId, filePath, function (error, result) {
|
||||
if (error) return Client.error(error);
|
||||
|
||||
console.log('open', result);
|
||||
});
|
||||
} else {}
|
||||
};
|
||||
|
||||
$scope.goDirectoryUp = function () {
|
||||
setDirectory($scope.cwd + '/..')
|
||||
setDirectory($scope.cwd + '/..');
|
||||
};
|
||||
|
||||
function setDirectory(path) {
|
||||
@@ -80,6 +82,36 @@ app.controller('FileManagerController', ['$scope', 'Client', function ($scope, C
|
||||
$scope.refresh();
|
||||
}
|
||||
|
||||
$scope.entryRemove = {
|
||||
busy: false,
|
||||
error: null,
|
||||
entry: {},
|
||||
|
||||
show: function (entry) {
|
||||
$scope.entryRemove.error = null;
|
||||
$scope.entryRemove.entry = entry;
|
||||
|
||||
$('#entryRemoveModal').modal('show');
|
||||
},
|
||||
|
||||
submit: function () {
|
||||
$scope.entryRemove.busy = true;
|
||||
|
||||
var filePath = sanitize($scope.cwd + '/' + $scope.entryRemove.entry.filePath);
|
||||
|
||||
Client.filesRemove($scope.appId, filePath, function (error, result) {
|
||||
$scope.entryRemove.busy = false;
|
||||
if (error) return Client.error(error);
|
||||
|
||||
console.log('remove', result);
|
||||
|
||||
$scope.refresh();
|
||||
|
||||
$('#entryRemoveModal').modal('hide');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function init() {
|
||||
|
||||
Client.getStatus(function (error, status) {
|
||||
|
||||
Reference in New Issue
Block a user