functionality to delete file by pathname

This commit is contained in:
Jon Lambson 2017-10-02 12:29:53 -06:00
parent f60017b725
commit 5627e4983d
2 changed files with 24 additions and 3 deletions

View File

@ -67,7 +67,6 @@ app.controller('websiteCtrl', [
vm.domains = [];
//vm.unzipPath = '/';
vm.uploadPath = '/';
vm.deleteAllFiles = false;
// already validated
function domainIsVerified(r) {
@ -346,11 +345,31 @@ app.controller('websiteCtrl', [
window.open(result.data.url);
});
};
vm.Sites.remove = function (r, opts) {
function getPathToDelete(r, pathName) {
vm.autoPopulateWebPath;
if (vm.autoPopulateWebPath === undefined && opts !== undefined) {
r.path = '/' + opts;
} else {
r.path = vm.autoPopulateWebPath + pathName;
}
if (opts === undefined) {
opts = {};
r.path = '/';
opts.path = '/';
r.confirm = true;
opts.confirm = true;
}
}
getPathToDelete(r, opts);
if (!window.confirm("Delete files for this site?")) {
return;
}
var pkg = Auth.oauth3.pkg('www@daplie.com');
return pkg.remove({
hostname: r.domain
, domain: r.domain
@ -365,6 +384,7 @@ app.controller('websiteCtrl', [
});
};
vm.breadcrumbs = ['Root'];
vm.breadcrumbsPath = ['/'];
vm.breadcrumbPathClicked = false;

View File

@ -16,7 +16,7 @@
</ul>
<ul class="tree files-only ls-none">
<li ng-repeat="file in vm.siteFiles track by $index">
<span class="tree_label filez">{{ file }}</span><span class="pull-right"><button type="button" class="btn btn-danger btn-xs" ng-click="vm.Sites.remove(file)" data="{{ file }}"><i class="fa fa-trash"></i></button></span>
<span class="tree_label filez">{{ file }}</span><span class="pull-right"><button type="button" class="btn btn-danger btn-xs" ng-click="vm.Sites.remove(r, file)" data="{{ file }}" data="{{ r }}"><i class="fa fa-trash"></i></button></span>
</li>
<li class="move-back">
<a ng-click="vm.showUploadContainer = true;"><i class="fa fa-plus"></i> Add Files</a>
@ -52,7 +52,8 @@
</div>
<div class="row">
<div class="text-center">
<button type="button" class="btn btn-danger" ng-click="vm.Sites.remove(r);"><i class="fa fa-trash"></i> Remove all Files</button>
<span class="text-danger">TODO:// Fix functionality to delete ALL files...</span><br>
<button type="button" class="btn btn-danger" ng-click="vm.Sites.remove(r)"><i class="fa fa-trash"></i> Remove all Files</button>
</div>
</div>
</div>