fixed shares, fixed breadcrumbs search

This commit is contained in:
Jon Lambson 2017-10-21 01:24:24 -06:00
parent 65d1c582af
commit 2ad1d1b96b
8 changed files with 120 additions and 85 deletions

View File

@ -369,7 +369,6 @@ label.tree_label:before {
line-height: .9em; line-height: .9em;
} }
:checked ~ label.tree_label:before { content: ''; }
/* /*
Tree branches Tree branches
@ -434,21 +433,11 @@ label.tree_label:after { border-bottom: 0; }
ul.tree.files-only.ls-none { ul.tree.files-only.ls-none {
margin-left: 30px; margin-left: 30px;
} }
:checked ~ label.tree_label:after {
border-radius: 0 .3em 0 0;
border-top: 1px solid #777;
border-right: 1px solid #777;
border-bottom: 0;
border-left: 0;
bottom: 0;
top: 0.5em;
height: auto;
}
.tree li:last-child:before { .tree li:last-child:before {
height: 1em; height: 1em;
bottom: auto; bottom: auto;
} }
.tree > li:last-child:before { display: none; } .tree > li:last-child:before { display: none; }

View File

@ -121,6 +121,24 @@ app.config(['$stateProvider', '$urlRouterProvider', 'localStorageServiceProvider
} }
} }
}) })
.state('app.applications', {
url: 'apps',
views: {
'content@': {
templateUrl: 'templates/applications.html',
controller: '',
}
}
})
.state('app.devices', {
url: 'devices',
views: {
'content@': {
templateUrl: 'templates/devices.html',
controller: '',
}
}
})
.state('app.account-settings', { .state('app.account-settings', {
url: 'account-settings', url: 'account-settings',
views: { views: {

View File

@ -83,7 +83,6 @@ app.controller('websiteCtrl', [
//vm.unzipPath = '/'; //vm.unzipPath = '/';
vm.uploadPath = '/'; vm.uploadPath = '/';
// already validated // already validated
function domainIsVerified(r) { function domainIsVerified(r) {
return r.verifiedAt || r.mode; return r.verifiedAt || r.mode;
@ -360,15 +359,15 @@ app.controller('websiteCtrl', [
vm.siteFiles = []; vm.siteFiles = [];
vm.Sites.allContents = function (r) { vm.Sites.allContents = function (r) {
vm.copyR = r; vm.copyR = r;
vm.strictPath = r.shareAccess.path.replace(/\//, ''); vm.strictPath = r.shareAccess.path;
var pkg = Auth.oauth3.pkg('www@daplie.com'); var pkg = Auth.oauth3.pkg('www@daplie.com');
return pkg.contents({ return pkg.contents({
hostname: r.domain hostname: r.domain,
, domain: r.domain domain: r.domain,
, tld: r.tld tld: r.tld,
, sld: r.sld sld: r.sld,
//, sub: r.sub // sub: r.sub,
, path: r.shareAccess.path path: r.shareAccess.path
}).then(function (result) { }).then(function (result) {
if (r.shareAccess.path !== '/') { if (r.shareAccess.path !== '/') {
var strictPathName = r.shareAccess.path.split('/'); var strictPathName = r.shareAccess.path.split('/');
@ -387,25 +386,30 @@ app.controller('websiteCtrl', [
} }
}); });
vm.displaySpinner = 'hidden'; vm.displaySpinner = 'hidden';
// window.alert(JSON.stringify(result));
}); });
}; };
var cleanPathQuery = function (path) {
vm.cleanedPath = path.replace(/\/+/g, '/');
return vm.cleanedPath;
};
vm.Sites.contents = function (r, dir) { vm.Sites.contents = function (r, dir) {
console.log("SEARCHING DIRECTORY ->", dir); vm.siteFiles = [];
vm.siteDirectories = [];
cleanPathQuery(dir);
dir = vm.cleanedPath;
vm.displaySpinner = ''; vm.displaySpinner = '';
var pkg = Auth.oauth3.pkg('www@daplie.com'); var pkg = Auth.oauth3.pkg('www@daplie.com');
return pkg.contents({ return pkg.contents({
hostname: r.domain hostname: r.domain,
, domain: r.domain domain: r.domain,
, tld: r.tld tld: r.tld,
, sld: r.sld sld: r.sld,
//, sub: r.sub // sub: r.sub,
, path: dir path: dir
}).then(function (result) { }).then(function (result) {
vm.displaySpinner = 'hidden'; vm.displaySpinner = 'hidden';
vm.siteFiles = [];
vm.siteDirectories = [];
vm.folderStructure = result; vm.folderStructure = result;
result.data.forEach(function(data){ result.data.forEach(function(data){
if (data.file) { if (data.file) {
@ -415,31 +419,48 @@ app.controller('websiteCtrl', [
vm.siteDirectories.push(data.name); vm.siteDirectories.push(data.name);
} }
}); });
// window.alert(JSON.stringify(result));
}); });
}; };
var crumbsCleanUp = function (crumb) {
var str2arryQuery = cleanPathQuery(vm.breadcrumbsPath.join('/'));
var str2arry = vm.breadcrumbs;
str2arryQuery = str2arryQuery.split('/');
var removeFromBreadcrumbsQuery = str2arryQuery.indexOf(crumb) + 1;
var removeFromBreadcrumbs = str2arry.indexOf(crumb) + 1;
vm.breadcrumbsPath = str2arryQuery.splice(0,removeFromBreadcrumbsQuery);
vm.breadcrumbs = str2arry.splice(0,removeFromBreadcrumbs);
};
vm.getDirectoriesFromBreadcrumbs = function (dir) { vm.getDirectoriesFromBreadcrumbs = function (dir) {
if (vm.copyR.shareAccess.path !== '/') { if (vm.copyR.shareAccess.path !== '/') {
var arry = vm.breadcrumbsPath.split('/'); crumbsCleanUp(dir);
arry.pop();
var removeFromBreadcrumbs = arry.indexOf(dir) + 1;
var newArry = vm.breadcrumbs;
newArry.pop();
vm.breadcrumbsPath = arry.splice(0,removeFromBreadcrumbs);
vm.breadcrumbs = vm.breadcrumbs.splice(0,removeFromBreadcrumbs);
vm.Sites.contents(vm.copyR, vm.breadcrumbsPath.join('/')); vm.Sites.contents(vm.copyR, vm.breadcrumbsPath.join('/'));
} else { } else {
vm.breadcrumbsPath.unshift(''); crumbsCleanUp(dir);
var removeFromBreadcrumbs = vm.breadcrumbsPath.indexOf(dir) + 1;
vm.breadcrumbsPath = vm.breadcrumbsPath.splice(0,removeFromBreadcrumbs);
vm.breadcrumbs = vm.breadcrumbs.splice(0,removeFromBreadcrumbs);
vm.Sites.contents(vm.copyR, vm.breadcrumbsPath.join('/')); vm.Sites.contents(vm.copyR, vm.breadcrumbsPath.join('/'));
if (dir === 'root') {
vm.breadcrumbs = ['root'];
vm.breadcrumbsPath = [];
}
} }
// var removeFromBreadcrumbs;
// if (vm.copyR.shareAccess.path !== '/') {
// var arry = vm.breadcrumbsPath.split('/');
// arry.pop();
// removeFromBreadcrumbs = arry.indexOf(dir) + 1;
// var newArry = vm.breadcrumbs;
// newArry.pop();
// vm.breadcrumbsPath = arry.splice(0,removeFromBreadcrumbs);
// vm.breadcrumbs = vm.breadcrumbs.splice(0,removeFromBreadcrumbs);
// vm.Sites.contents(vm.copyR, vm.breadcrumbsPath.join('/'));
// } else {
// vm.breadcrumbsPath.unshift('');
// removeFromBreadcrumbs = vm.breadcrumbsPath.indexOf(dir) + 1;
// vm.breadcrumbsPath = vm.breadcrumbsPath.splice(0,removeFromBreadcrumbs);
// vm.breadcrumbs = vm.breadcrumbs.splice(0,removeFromBreadcrumbs);
// vm.Sites.contents(vm.copyR, vm.breadcrumbsPath.join('/'));
// if (dir === 'root') {
// vm.breadcrumbs = ['root'];
// vm.breadcrumbsPath = [];
// }
// }
}; };
vm.getDirectories = function (dir) { vm.getDirectories = function (dir) {
@ -455,13 +476,12 @@ app.controller('websiteCtrl', [
} else { } else {
vm.breadcrumbs.push(dir); vm.breadcrumbs.push(dir);
vm.breadcrumbsPath.push(dir); vm.breadcrumbsPath.push(dir);
vm.breadcrumbsPath.unshift('');
vm.Sites.contents(vm.copyR, vm.breadcrumbsPath.join('/')); vm.Sites.contents(vm.copyR, vm.breadcrumbsPath.join('/'));
} }
}; };
vm.removeAllFiles = function (r, opts) { vm.removeAllFiles = function (r, opts) {
console.log(r);
console.log(opts);
opts = { opts = {
path: '/', path: '/',
confirm: true confirm: true
@ -523,26 +543,26 @@ app.controller('websiteCtrl', [
if (vm.breadcrumbsPath.join('/') === '' && vm.breadcrumbs.join('/') === '') { if (vm.breadcrumbsPath.join('/') === '' && vm.breadcrumbs.join('/') === '') {
sharePath = '/'; sharePath = '/';
} else { } else {
sharePath = vm.breadcrumbsPath.join('/'); sharePath = cleanPathQuery(vm.breadcrumbsPath.join('/'));
sharePath = sharePath + '/';
} }
// FIXME: shareMode may be broken
opts = { opts = {
sharePath: sharePath, sharePath: sharePath,
shareMode: '' shareMode: vm.copiedShareMode
}; };
vm.Shares.invite(r, opts); vm.Shares.invite(r, opts);
}; };
vm.createNewFolder = function (r) { vm.createNewFolder = function (r) {
if (r.shareAccess.path !== '/') { if (r.shareAccess.path !== '/') {
vm.breadcrumbsPath;
vm.breadcrumbs;
if (vm.breadcrumbsPath.length === 0) { if (vm.breadcrumbsPath.length === 0) {
vm.breadcrumbsPath = vm.strictPath.split('/'); vm.breadcrumbsPath = vm.strictPath.split('/');
vm.breadcrumbsPath.pop(); vm.breadcrumbsPath.pop();
vm.breadcrumbsPath.push(vm.folderName); vm.breadcrumbsPath.push(vm.folderName);
} else { } else {
r.folderName = vm.breadcrumbsPath + vm.folderName; vm.breadcrumbsPath.push(vm.folderName);
r.folderName = vm.breadcrumbsPath.join('/');
r.folderName = r.folderName + '/';
} }
} else { } else {
if (vm.breadcrumbsPath.join('/') === '') { if (vm.breadcrumbsPath.join('/') === '') {
@ -557,8 +577,8 @@ app.controller('websiteCtrl', [
var pkg = Auth.oauth3.pkg('www@daplie.com'); var pkg = Auth.oauth3.pkg('www@daplie.com');
//analyzeFile(r.newFile, r); //analyzeFile(r.newFile, r);
if (r.folderName !== '' && r.folderName !== undefined) { if (r.folderName !== '' && r.folderName !== undefined) {
r.uploadPath = r.folderName; cleanPathQuery(r.folderName);
debugger; r.uploadPath = vm.cleanedPath;
} else { } else {
if (!Array.isArray(vm.breadcrumbsPath)) { if (!Array.isArray(vm.breadcrumbsPath)) {
debugger; debugger;
@ -572,7 +592,7 @@ app.controller('websiteCtrl', [
} }
if (vm.breadcrumbsPath.join('/') === '') { if (vm.breadcrumbsPath.join('/') === '') {
if (vm.breadcrumbsPath.length === 0) { if (vm.breadcrumbsPath.length === 0) {
debugger debugger;
} else { } else {
r.uploadPath = '/'; r.uploadPath = '/';
} }
@ -624,9 +644,6 @@ debugger
//, sub: r.sub //, sub: r.sub
, path: r.sharePath , path: r.sharePath
}).then(function (result) { }).then(function (result) {
if (result.data.length === 0) {
vm.notSharedMessage = "Currently not shared...";
}
vm.displaySpinner = 'hidden'; vm.displaySpinner = 'hidden';
console.log('list shares result:'); console.log('list shares result:');
console.log(result); console.log(result);
@ -640,7 +657,7 @@ debugger
return; return;
} }
vm.Shares.remove(r, s); vm.Shares.remove(r, s);
} };
vm.Shares.remove = function (r, s) { vm.Shares.remove = function (r, s) {
console.log('Shares.remove'); console.log('Shares.remove');
@ -674,15 +691,11 @@ debugger
vm.listSites = function () { vm.listSites = function () {
var sites = []; var sites = [];
return $q.all(Auth.sessions.map(function (session) { return $q.all(Auth.sessions.map(function (session) {
return Auth.get(session).then(function (oauth3) { return Auth.get(session).then(function (oauth3) {
var pkg = oauth3.pkg('www@daplie.com'); var pkg = oauth3.pkg('www@daplie.com');
return pkg.list().then(function (result) { return pkg.list().then(function (result) {
var _sites = result.data; var _sites = result.data;
if (Array.isArray(_sites)) { if (Array.isArray(_sites)) {
sites = _sites.concat(sites); sites = _sites.concat(sites);
return; return;
@ -758,18 +771,16 @@ debugger
} }
}); });
$scope.$watch('selectedAccess', function (selectedAccess) { vm.getSharedAccess = function (access) {
if (selectedAccess.length !== 0) {
vm.accessLevelArry = []; vm.accessLevelArry = [];
vm.prettyAccessArray = []; vm.prettyAccessArray = [];
selectedAccess.forEach(function(letter) { access.forEach(function(letter) {
vm.prettyAccessArray.push(letter.name); vm.prettyAccessArray.push(letter.name);
vm.accessLevelArry.push(letter.value); vm.accessLevelArry.push(letter.value);
}); });
vm.prettyShareMode = vm.prettyAccessArray.join(", "); vm.prettyShareMode = vm.prettyAccessArray.join(", ");
vm.copiedShareMode = vm.accessLevelArry.join(","); vm.copiedShareMode = vm.accessLevelArry.join(",");
} };
});
$scope.selectedAccess = []; $scope.selectedAccess = [];
$scope.accessLevel = [{ name: 'Read', value: 'r' }, { name: 'Write', value: 'w' }, { name: 'Invite', value: 'x' }]; $scope.accessLevel = [{ name: 'Read', value: 'r' }, { name: 'Write', value: 'w' }, { name: 'Invite', value: 'x' }];

View File

@ -0,0 +1,2 @@
<h1>applications</h1>
<span class="text-danger">ps... you need a controller, nothing is hooked up.</span>

2
templates/devices.html Normal file
View File

@ -0,0 +1,2 @@
<h1>DEVICES</h1>
<span class="text-danger">ps... you need a controller, nothing is hooked up.</span>

View File

@ -1,10 +1,23 @@
<div class="side-menu"> <div class="side-menu">
<!-- <div class="button-container" ui-sref-active="active"> <div class="button-container" ui-sref-active="active">
<a ui-sref=".home"> <a ui-sref=".home">
<button type="button" name="button" class="btn btn-default side-menu-button"><i class="fa fa-home fa-2x" aria-hidden="true"></i></button> <button type="button" name="button" class="btn btn-default side-menu-button"><i class="fa fa-home fa-2x" aria-hidden="true"></i></button>
<p class="button-title">Home</p> <p class="button-title">Home</p>
</a> </a>
</div> </div>
<div class="button-container" ui-sref-active="active">
<a ui-sref=".devices">
<button type="button" name="button" class="btn btn-default side-menu-button"><i class="fa fa-desktop fa-2x" aria-hidden="true"></i></button>
<p class="button-title">devices</p>
</a>
</div>
<div class="button-container" ui-sref-active="active">
<a ui-sref=".applications">
<button type="button" name="button" class="btn btn-default side-menu-button"><i class="fa fa-th-large fa-2x" aria-hidden="true"></i></button>
<p class="button-title">apps</p>
</a>
</div>
<!--
<div class="button-container" ui-sref-active="active"> <div class="button-container" ui-sref-active="active">
<a ui-sref=".bolt"> <a ui-sref=".bolt">
<button type="button" name="button" class="btn btn-default side-menu-button"><i class="fa fa-bolt fa-2x" aria-hidden="true"></i></button> <button type="button" name="button" class="btn btn-default side-menu-button"><i class="fa fa-bolt fa-2x" aria-hidden="true"></i></button>
@ -37,7 +50,7 @@
</div> --> </div> -->
<div class="button-container" ui-sref-active="active"> <div class="button-container" ui-sref-active="active">
<a ui-sref=".website"> <a ui-sref=".website">
<button type="button" name="button" class="btn btn-default side-menu-button"><i class="fa fa-globe fa-2x" aria-hidden="true"></i></button> <button type="button" name="button" class="btn btn-default side-menu-button"><i class="fa fa-folder fa-2x" aria-hidden="true"></i></button>
<p class="button-title">Shares</p> <p class="button-title">Shares</p>
</a> </a>
</div> </div>

View File

@ -1,9 +1,9 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<h1>Verify Website</h1> <h1>Create Share</h1>
<button class="btn btn-primary btn-lg" title="..." data-toggle="modal" data-target=".create-website-modal"> <button class="btn btn-primary btn-lg" title="..." data-toggle="modal" data-target=".create-website-modal">
Create Website Create Share
</button> </button>
<hr> <hr>
@ -207,7 +207,7 @@
ng-model="selectedAccess" ng-model="selectedAccess"
options="c.name for c in accessLevel" options="c.name for c in accessLevel"
change="selected()" change="selected()"
ng-change="showShareBtn = true"> ng-change="showShareBtn = true; vm.getSharedAccess(selectedAccess)">
</multiselect> </multiselect>
</div> </div>
</div> </div>

View File

@ -25,11 +25,11 @@
<div class="folder-actions"> <div class="folder-actions">
<hr> <hr>
<div class=""> <div class="">
<button ng-if="r.shareAccess.write" type="button" name="button" class="btn btn-block btn-primary" ng-click="vm.showUploadFilesContainer = true; vm.autoPopulateFolderName(); vm.showUploadFolderContainer = false">Upload files</button> <button type="button" name="button" class="btn btn-block btn-primary" ng-click="vm.showUploadFilesContainer = true; vm.autoPopulateFolderName(); vm.showUploadFolderContainer = false">Upload files</button>
<button ng-if="r.shareAccess.invite" type="button" name="button" class="btn btn-block btn-primary" ng-click="vm.showAction('invite');">Share folder</button> <button ng-if="r.shareAccess.invite" type="button" name="button" class="btn btn-block btn-primary" ng-click="vm.showAction('invite');">Share folder</button>
<ul class="ls-none folder-actions-list"> <ul class="ls-none folder-actions-list">
<li ng-if="r.shareAccess.write" ng-hide="vm.showFolderAction"><span><i class="fa fa-upload cp"></i> <a ng-click="vm.showUploadFilesContainer = true; vm.autoPopulateFolderName(); vm.showUploadFolderContainer = false;" class="cp">Upload files</a></span></li> <li ng-hide="vm.showFolderAction"><span><i class="fa fa-upload cp"></i> <a ng-click="vm.showUploadFilesContainer = true; vm.autoPopulateFolderName(); vm.showUploadFolderContainer = false;" class="cp">Upload files</a></span></li>
<li ng-if="r.shareAccess.write"><span><i class="fa fa-folder cp"></i> <a ng-click="vm.cleanPath(); vm.showUploadFolderContainer = true; vm.showFileUploadBtn = false;" class="cp">New folder</a></span></li> <li><span><i class="fa fa-folder cp"></i> <a ng-click="vm.cleanPath(); vm.showUploadFolderContainer = true; vm.showFileUploadBtn = false;" class="cp">New folder</a></span></li>
<li ng-hide="vm.showUploadButton" ng-if="r.shareAccess.write"><span><i class="fa fa-trash cp"></i> <a ng-click="vm.triggerDeleteFolder(vm.currentFolder, r)" data="{{ vm.currentFolder }}" class="cp">Delete {{ vm.currentFolder | capitalize }} Folder</a></span></li> <li ng-hide="vm.showUploadButton" ng-if="r.shareAccess.write"><span><i class="fa fa-trash cp"></i> <a ng-click="vm.triggerDeleteFolder(vm.currentFolder, r)" data="{{ vm.currentFolder }}" class="cp">Delete {{ vm.currentFolder | capitalize }} Folder</a></span></li>
</ul> </ul>
</div> </div>