From 0dce88577878b79af01a574057ca2cae9def385b Mon Sep 17 00:00:00 2001 From: Jon Lambson Date: Wed, 8 Nov 2017 15:11:35 -0700 Subject: [PATCH] adding more info to contentRange params --- js/controllers/website-controller.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/js/controllers/website-controller.js b/js/controllers/website-controller.js index 1dbd7bf..505c8bc 100644 --- a/js/controllers/website-controller.js +++ b/js/controllers/website-controller.js @@ -396,7 +396,9 @@ app.controller('websiteCtrl', [ vm.folderName = ''; }; + vm.Sites.allContents = function (r) { + vm.filesInfo = []; vm.copyR = r; var pkg = Auth.oauth3.pkg('www@daplie.com'); return pkg.contents({ @@ -415,6 +417,7 @@ app.controller('websiteCtrl', [ result.data.forEach(function(data){ if (data.file) { vm.siteFiles.push(data.name); + vm.filesInfo.push(data); } if (data.directory) { vm.siteDirectories.push(data.name); @@ -434,20 +437,30 @@ app.controller('websiteCtrl', [ vm.closeFileUploadsContainers = function () { vm.uploadFolderContainer = false; vm.uploadFileContainer = false; + vm.folderStructure = undefined; }; vm.Sites.fileContents = function (file, r) { - var path = vm.breadcrumbsPath; - path.push(file); - path = path.join('/'); + vm.folderStructure = undefined; + var files = vm.filesInfo; + Object.keys(files).forEach(function (key) { + if (files[key]['name'] === file) { + vm.selectFile = files[key]; + } + }); + var path = vm.breadcrumbsPath.join('/'); + path = path + '/' + file cleanPathQuery(path); var pkg = Auth.oauth3.pkg('www@daplie.com'); + debugger; return pkg.contentRange({ hostname: r.domain, domain: r.domain, tld: r.tld, sld: r.sld, sub: r.sub, + offset: 0, + length: vm.selectFile.size, path: vm.cleanedPath }).then(function (result) { vm.folderStructure = result; @@ -457,6 +470,7 @@ app.controller('websiteCtrl', [ vm.Sites.contents = function (r, dir) { vm.siteFiles = []; vm.siteDirectories = []; + vm.filesInfo = []; dir = dir + '/'; cleanPathQuery(dir); dir = vm.cleanedPath; @@ -477,6 +491,7 @@ app.controller('websiteCtrl', [ result.data.forEach(function(data){ if (data.file) { vm.siteFiles.push(data.name); + vm.filesInfo.push(data); } if (data.directory) { vm.siteDirectories.push(data.name);