oops broke everything
This commit is contained in:
parent
5196f55629
commit
192a8b7933
|
@ -348,12 +348,54 @@ app.controller('websiteCtrl', [
|
|||
|
||||
|
||||
vm.Sites.remove = function (r, opts) {
|
||||
var pkg = Auth.oauth3.pkg('www@daplie.com');
|
||||
|
||||
getPathToDelete(r, opts);
|
||||
|
||||
if (!window.confirm("Delete files for this site?")) {
|
||||
return;
|
||||
}
|
||||
|
||||
vm.checkForOthers(r);
|
||||
// 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) {
|
||||
// window.alert(JSON.stringify(result));
|
||||
// });
|
||||
debugger;
|
||||
function getPathToDelete(r, pathName) {
|
||||
vm.autoPopulateWebPath;
|
||||
if (vm.autoPopulateWebPath === undefined && opts !== undefined) {
|
||||
r.path = '/' + opts;
|
||||
} else {
|
||||
r.path = vm.autoPopulateWebPath + pathName;
|
||||
|
||||
// Delete the directory if there is no other files or directories inside
|
||||
// if (vm.currentDirectoryFilesCount === 1 && vm.currentDirectoryDirectoriesCount === 0) {
|
||||
// debugger;
|
||||
// r.path = vm.autoPopulateWebPath;
|
||||
// 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) {
|
||||
// // console.log('result', result);
|
||||
// });
|
||||
// } else {
|
||||
// console.log('do it');
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
if (opts === undefined) {
|
||||
opts = {};
|
||||
|
@ -363,29 +405,35 @@ app.controller('websiteCtrl', [
|
|||
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
|
||||
, tld: r.tld
|
||||
, sld: r.sld
|
||||
//, sub: vm.record.sub
|
||||
, path: opts.path || r.path
|
||||
, confirm: opts.confirm || r.confirm
|
||||
}).then(function (result) {
|
||||
console.log('the result', result);
|
||||
window.alert(JSON.stringify(result));
|
||||
});
|
||||
};
|
||||
|
||||
vm.checkForOthers = function (r) {
|
||||
vm.isOtherDirectories = [];
|
||||
vm.isOtherFiles = [];
|
||||
vm.currentDirectoryDirectoriesCount = 0;
|
||||
vm.currentDirectoryFilesCount = 0;
|
||||
var pkg = Auth.oauth3.pkg('www@daplie.com');
|
||||
return pkg.contents({
|
||||
hostname: r.domain,
|
||||
domain: r.domain,
|
||||
tld: r.tld,
|
||||
sld: r.sld,
|
||||
//, sub: r.sub,
|
||||
path: vm.autoPopulateWebPath
|
||||
}).then(function (result) {
|
||||
result.data.forEach(function(file){
|
||||
if (file.file) {
|
||||
vm.isOtherFiles.push(file);
|
||||
vm.currentDirectoryFilesCount = vm.isOtherFiles.length;
|
||||
} else if (file.directory) {
|
||||
vm.isOtherDirectories.push(file);
|
||||
vm.currentDirectoryDirectoriesCount = vm.isOtherDirectories.length;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
vm.breadcrumbs = ['Root'];
|
||||
vm.breadcrumbs = ['root'];
|
||||
vm.breadcrumbsPath = ['/'];
|
||||
vm.breadcrumbPathClicked = false;
|
||||
vm.webPathAutofill = '/';
|
||||
|
@ -407,8 +455,8 @@ app.controller('websiteCtrl', [
|
|||
vm.autoPopulateWebPath = vm.autoPopulateWebPath.join('');
|
||||
}
|
||||
if (vm.breadcrumbPathClicked) {
|
||||
if (path === 'Root') {
|
||||
vm.breadcrumbs = ['Root'];
|
||||
if (path === 'root') {
|
||||
vm.breadcrumbs = ['root'];
|
||||
vm.breadcrumbsPath = ['/'];
|
||||
vm.breadcrumbPathClicked = false;
|
||||
vm.autoPopulateWebPath = "/";
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<input type="checkbox" id="{{ r.challenge }}{{ $index }}" />
|
||||
<label class="tree_label" for="{{ r.challenge }}{{ $index }}" ng-click="vm.getDirectories(directory); vm.showUploadContainer = false" data="{{ directory }}">{{ directory }}</label>
|
||||
</li>
|
||||
<li></li>
|
||||
</ul>
|
||||
<ul class="tree files-only ls-none">
|
||||
<li ng-repeat="file in vm.siteFiles track by $index">
|
||||
|
@ -52,7 +53,6 @@
|
|||
</div>
|
||||
<div class="row">
|
||||
<div class="text-center">
|
||||
<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>
|
||||
|
|
Loading…
Reference in New Issue