1
0
Derivar 0

oops broke everything

Este cometimento está contido em:
Jon Lambson 2017-10-02 15:25:23 -06:00
ascendente 5196f55629
cometimento 192a8b7933
2 ficheiros modificados com 71 adições e 23 eliminações

Ver ficheiro

@ -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 = "/";

Ver ficheiro

@ -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>