added delete functionality

This commit is contained in:
Jon Lambson 2017-10-17 14:29:24 -06:00
parent 57eb74d1c9
commit e91d913547
2 changed files with 41 additions and 1 deletions

View File

@ -447,6 +447,46 @@ app.controller('websiteCtrl', [
vm.removeAllFiles = function (r, opts) {
console.log(r);
console.log(opts);
opts = {
path: '/',
confirm: true
};
vm.Sites.remove(r, opts);
};
vm.deleteFilesFrom = function (r, opts) {
var file = opts;
var requestedPath = vm.breadcrumbsPath.join('/') + '/' + file;
opts = {
path: requestedPath
};
vm.Sites.remove(r, opts);
};
vm.Sites.remove = function (r, opts) {
if (!window.confirm("Delete files for this site?")) {
return;
}
var pkg = Auth.oauth3.pkg('www@daplie.com');
debugger;
return pkg.remove({
hostname: r.domain,
domain: r.domain,
tld: r.tld,
sld: r.sld,
// sub: vm.record.sub,
path: opts.path || r.path,
confirm: opts.confirm || r.confirm
}).then(function (result) {
var msg = "'"+ vm.pathRemoved + "'" + ' has been removed';
vm.buildNotification(result, msg);
window.alert(JSON.stringify(result));
});
};

View File

@ -81,7 +81,7 @@
</div> </div>
<div class="row"> <div class="row">
<div class="padding-side-15"> <div class="padding-side-15">
<button ng-if="r.shareAccess.write" type="button" class="btn btn-danger pull-right" ng-click="vm.deleteFilesFrom(r, path)"><i class="fa fa-trash"></i> Remove all Files</button> <button ng-if="r.shareAccess.write" type="button" class="btn btn-danger pull-right" ng-click="vm.removeAllFiles(r, opts)"><i class="fa fa-trash"></i> Remove all Files</button>
</div> </div>
</div> </div>
</div> </div>