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;
}
:checked ~ label.tree_label:before { content: ''; }
/*
Tree branches
@ -434,21 +433,11 @@ label.tree_label:after { border-bottom: 0; }
ul.tree.files-only.ls-none {
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 {
height: 1em;
bottom: auto;
}
}
.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', {
url: 'account-settings',
views: {

View File

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

View File

@ -1,9 +1,9 @@
<div class="container">
<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">
Create Website
Create Share
</button>
<hr>
@ -207,7 +207,7 @@
ng-model="selectedAccess"
options="c.name for c in accessLevel"
change="selected()"
ng-change="showShareBtn = true">
ng-change="showShareBtn = true; vm.getSharedAccess(selectedAccess)">
</multiselect>
</div>
</div>

View File

@ -25,11 +25,11 @@
<div class="folder-actions">
<hr>
<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>
<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-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 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><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>
</ul>
</div>