1
0
mirror of https://github.com/bitwarden/web synced 2025-12-12 22:33:23 +00:00

user vault collections changed to show all shared

This commit is contained in:
Kyle Spearrin
2017-04-27 16:24:38 -04:00
parent 54172c441f
commit a083fc9084
16 changed files with 71 additions and 48 deletions

View File

@@ -82,11 +82,11 @@ angular
refreshFromServer: false refreshFromServer: false
} }
}) })
.state('backend.user.collections', { .state('backend.user.shared', {
url: '^/collections', url: '^/shared',
templateUrl: 'app/vault/views/vaultCollections.html', templateUrl: 'app/vault/views/vaultShared.html',
controller: 'vaultCollectionsController', controller: 'vaultSharedController',
data: { pageTitle: 'Collections' } data: { pageTitle: 'Shared' }
}) })
.state('backend.user.settings', { .state('backend.user.settings', {
url: '^/settings', url: '^/settings',

View File

@@ -1,7 +1,7 @@
<section class="content-header"> <section class="content-header">
<h1> <h1>
Collections Collections
<small>share with your organization</small> <small>control what you share</small>
</h1> </h1>
</section> </section>
<section class="content"> <section class="content">

View File

@@ -1,6 +1,6 @@
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title"><i class="fa fa-share-alt"></i> Add Collection</h4> <h4 class="modal-title"><i class="fa fa-cubes"></i> Add Collection</h4>
</div> </div>
<form name="form" ng-submit="form.$valid && submit(model)" api-form="submitPromise"> <form name="form" ng-submit="form.$valid && submit(model)" api-form="submitPromise">
<div class="modal-body"> <div class="modal-body">

View File

@@ -1,6 +1,6 @@
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title"><i class="fa fa-share-alt"></i> Edit Collection</h4> <h4 class="modal-title"><i class="fa fa-cubes"></i> Edit Collection</h4>
</div> </div>
<form name="form" ng-submit="form.$valid && submit(collection)" api-form="submitPromise"> <form name="form" ng-submit="form.$valid && submit(collection)" api-form="submitPromise">
<div class="modal-body"> <div class="modal-body">

View File

@@ -16,7 +16,7 @@
ng-show="collections.length && (!main.searchVaultText || collectionLogins.length)"> ng-show="collections.length && (!main.searchVaultText || collectionLogins.length)">
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title"> <h3 class="box-title">
<i class="fa" ng-class="{'fa-share-alt-square': collection.id, 'fa-sitemap': !collection.id}"></i> <i class="fa" ng-class="{'fa-cubes': collection.id, 'fa-sitemap': !collection.id}"></i>
{{collection.name}} {{collection.name}}
<small ng-pluralize count="collectionLogins.length" when="{'1': '{} login', 'other': '{} logins'}"></small> <small ng-pluralize count="collectionLogins.length" when="{'1': '{} login', 'other': '{} logins'}"></small>
</h3> </h3>
@@ -48,7 +48,7 @@
</li> </li>
<li> <li>
<a href="javascript:void(0)" ng-click="editCollections(login)"> <a href="javascript:void(0)" ng-click="editCollections(login)">
<i class="fa fa-fw fa-share-alt"></i> Collections <i class="fa fa-fw fa-cubes"></i> Collections
</a> </a>
</li> </li>
<li> <li>

View File

@@ -1,6 +1,6 @@
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title"><i class="fa fa-share-alt"></i> Collections <small>{{cipher.name}}</small></h4> <h4 class="modal-title"><i class="fa fa-cubes"></i> Collections <small>{{cipher.name}}</small></h4>
</div> </div>
<form name="form" ng-submit="form.$valid && submit()" api-form="submitPromise"> <form name="form" ng-submit="form.$valid && submit()" api-form="submitPromise">
<div class="modal-body"> <div class="modal-body">

View File

@@ -252,8 +252,8 @@
$scope.share = function (login) { $scope.share = function (login) {
var modal = $uibModal.open({ var modal = $uibModal.open({
animation: true, animation: true,
templateUrl: 'app/vault/views/vaultShare.html', templateUrl: 'app/vault/views/vaultShareLogin.html',
controller: 'vaultShareController', controller: 'vaultShareLoginController',
resolve: { resolve: {
loginId: function () { return login.id; } loginId: function () { return login.id; }
} }

View File

@@ -1,9 +1,9 @@
angular angular
.module('bit.vault') .module('bit.vault')
.controller('vaultShareController', function ($scope, apiService, $uibModalInstance, authService, cipherService, .controller('vaultShareLoginController', function ($scope, apiService, $uibModalInstance, authService, cipherService,
loginId, $analytics, $state) { loginId, $analytics, $state) {
$analytics.eventTrack('vaultShareController', { category: 'Modal' }); $analytics.eventTrack('vaultShareLoginController', { category: 'Modal' });
$scope.model = {}; $scope.model = {};
$scope.login = {}; $scope.login = {};
$scope.collections = []; $scope.collections = [];
@@ -11,6 +11,7 @@
$scope.organizations = []; $scope.organizations = [];
var organizationCollectionCounts = {}; var organizationCollectionCounts = {};
$scope.loadingCollections = true; $scope.loadingCollections = true;
$scope.loading = true;
$scope.readOnly = false; $scope.readOnly = false;
apiService.logins.get({ id: loginId }).$promise.then(function (login) { apiService.logins.get({ id: loginId }).$promise.then(function (login) {
@@ -21,6 +22,7 @@
return login.Edit; return login.Edit;
}).then(function (canEdit) { }).then(function (canEdit) {
$scope.loading = false;
if (!canEdit) { if (!canEdit) {
return; return;
} }

View File

@@ -1,7 +1,7 @@
angular angular
.module('bit.vault') .module('bit.vault')
.controller('vaultCollectionsController', function ($scope, apiService, cipherService, $analytics, $q, $localStorage, .controller('vaultSharedController', function ($scope, apiService, cipherService, $analytics, $q, $localStorage,
$uibModal, $filter, $rootScope) { $uibModal, $filter, $rootScope) {
$scope.logins = []; $scope.logins = [];
$scope.collections = []; $scope.collections = [];
@@ -31,6 +31,14 @@
} }
} }
if (decLogins.length) {
$scope.collections.push({
id: null,
name: 'Unassigned',
collapsed: $localStorage.collapsedCollections && 'unassigned' in $localStorage.collapsedCollections
});
}
$scope.logins = decLogins; $scope.logins = decLogins;
}).$promise; }).$promise;
@@ -41,20 +49,34 @@
$scope.filterByCollection = function (collection) { $scope.filterByCollection = function (collection) {
return function (cipher) { return function (cipher) {
if (!cipher.collectionIds || !cipher.collectionIds.length) {
return collection.id === null;
}
return cipher.collectionIds.indexOf(collection.id) > -1; return cipher.collectionIds.indexOf(collection.id) > -1;
}; };
}; };
$scope.collectionSort = function (item) {
if (!item.id) {
return '';
}
return item.name.toLowerCase();
};
$scope.collapseExpand = function (collection) { $scope.collapseExpand = function (collection) {
if (!$localStorage.collapsedCollections) { if (!$localStorage.collapsedCollections) {
$localStorage.collapsedCollections = {}; $localStorage.collapsedCollections = {};
} }
if (collection.id in $localStorage.collapsedCollections) { var id = collection.id || 'unassigned';
delete $localStorage.collapsedCollections[collection.id];
if (id in $localStorage.collapsedCollections) {
delete $localStorage.collapsedCollections[id];
} }
else { else {
$localStorage.collapsedCollections[collection.id] = true; $localStorage.collapsedCollections[id] = true;
} }
}; };

View File

@@ -68,7 +68,7 @@
</li> </li>
<li ng-show="login.organizationId"> <li ng-show="login.organizationId">
<a href="javascript:void(0)" ng-click="collections(login)"> <a href="javascript:void(0)" ng-click="collections(login)">
<i class="fa fa-fw fa-share-alt"></i> Collections <i class="fa fa-fw fa-cubes"></i> Collections
</a> </a>
</li> </li>
<li> <li>
@@ -155,7 +155,7 @@
</li> </li>
<li ng-show="login.organizationId"> <li ng-show="login.organizationId">
<a href="javascript:void(0)" ng-click="collections(login)"> <a href="javascript:void(0)" ng-click="collections(login)">
<i class="fa fa-fw fa-share-alt"></i> Collections <i class="fa fa-fw fa-cubes"></i> Collections
</a> </a>
</li> </li>
<li> <li>

View File

@@ -1,6 +1,6 @@
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title"><i class="fa fa-share-alt"></i> Collections <small>{{login.name}}</small></h4> <h4 class="modal-title"><i class="fa fa-cubes"></i> Collections <small>{{login.name}}</small></h4>
</div> </div>
<form name="form" ng-submit="form.$valid && submit()" api-form="submitPromise"> <form name="form" ng-submit="form.$valid && submit()" api-form="submitPromise">
<div class="modal-body"> <div class="modal-body">

View File

@@ -11,14 +11,15 @@
<li ng-repeat="e in form.$errors">{{e}}</li> <li ng-repeat="e in form.$errors">{{e}}</li>
</ul> </ul>
</div> </div>
<div ng-show="!organizations.length" class="callout callout-default"> <p ng-show="loading">Loading...</p>
<div ng-show="!loading && !organizations.length" class="callout callout-default">
<h4><i class="fa fa-info-circle"></i> No Organizations</h4> <h4><i class="fa fa-info-circle"></i> No Organizations</h4>
<p>You do not belong to any organizations. Organizations allow you to share logins with other bitwarden users.</p> <p>You do not belong to any organizations. Organizations allow you to share logins with other bitwarden users.</p>
<a ng-click="createOrg()" class="btn btn-default btn-flat"> <a ng-click="createOrg()" class="btn btn-default btn-flat">
Create an Organization Create an Organization
</a> </a>
</div> </div>
<div ng-show="organizations.length"> <div ng-show="!loading && organizations.length">
<div class="form-group"> <div class="form-group">
<label for="organization">Organization</label> <span>*</span> <label for="organization">Organization</label> <span>*</span>
<select id="organization" name="Organization" ng-model="model.organizationId" class="form-control" <select id="organization" name="Organization" ng-model="model.organizationId" class="form-control"

View File

@@ -1,35 +1,32 @@
<section class="content-header"> <section class="content-header">
<h1> <h1>
Collections Shared
<small> <small>
<span ng-pluralize count="collections.length" when="{'1': '{} collection', 'other': '{} collections'}"></span>, <span ng-pluralize
count="collections.length > 0 && logins.length ? collections.length - 1 : collections.length"
when="{'1': '{} collection', 'other': '{} collections'}"></span>,
<span ng-pluralize count="logins.length" when="{'1': '{} login', 'other': '{} logins'}"></span> <span ng-pluralize count="logins.length" when="{'1': '{} login', 'other': '{} logins'}"></span>
</small> </small>
</h1> </h1>
</section> </section>
<section class="content"> <section class="content">
<div ng-show="loading && !collections.length"> <p ng-show="loading && !collections.length">Loading...</p>
<p>Loading...</p> <div class="callout callout-default" style="background: #fff;" ng-show="!loading && !collections.length && !logins.length">
</div> <h4>Nothing shared <i class="fa fa-frown-o"></i></h4>
<div class="callout callout-default" style="background: #fff;" ng-show="!loading && !collections.length">
<h4><i class="fa fa-info-circle"></i> No Collections</h4>
<p> <p>
You do not have any collections being shared with you. You do not have any logins or collections being shared with you.
</p> To start sharing, create an organization or ask an existing organization to invite you.
<p>
Collections allow you to share logins with other bitwarden users. To start using collections create an organization or
ask an existing organization to invite you.
</p> </p>
<a ui-sref="backend.user.settingsCreateOrg" class="btn btn-default btn-flat"> <a ui-sref="backend.user.settingsCreateOrg" class="btn btn-default btn-flat">
Create an Organization Create an Organization
</a> </a>
</div> </div>
<div class="box" ng-class="{'collapsed-box': collection.collapsed}" ng-repeat="collection in collections | <div class="box" ng-class="{'collapsed-box': collection.collapsed}" ng-repeat="collection in collections |
orderBy: ['name'] track by collection.id" orderBy: collectionSort track by collection.id"
ng-show="collections.length"> ng-show="collections.length">
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title"> <h3 class="box-title">
<i class="fa fa-share-alt-square"></i> <i class="fa" ng-class="{'fa-cubes': collection.id, 'fa-sitemap': !collection.id}"></i>
{{collection.name}} {{collection.name}}
<small ng-pluralize count="collectionLogins.length" when="{'1': '{} login', 'other': '{} logins'}"></small> <small ng-pluralize count="collectionLogins.length" when="{'1': '{} login', 'other': '{} logins'}"></small>
</h3> </h3>
@@ -41,13 +38,14 @@
</div> </div>
</div> </div>
<div class="box-body" ng-class="{'no-padding': collectionLogins.length}"> <div class="box-body" ng-class="{'no-padding': collectionLogins.length}">
<div ng-show="!collectionLogins.length"> <div ng-show="!collectionLogins.length && collection.id">
<p>No logins in this collection.</p> <p>No logins in this collection.</p>
<p> <p>
Share a login to this collection by selecting <i class="fa fa-share-alt"></i> <b>Share</b> or Share a login to this collection by selecting <i class="fa fa-share-alt"></i> <b>Share</b> or
<i class="fa fa-share-alt"></i> <b>Collections</b> from the login's options (<i class="fa fa-cog"></i>) menu. <i class="fa fa-cubes"></i> <b>Collections</b> from the login's options (<i class="fa fa-cog"></i>) menu.
</p> </p>
</div> </div>
<div ng-show="!collectionLogins.length && !collection.id">No unassigned logins.</div>
<div class="table-responsive" ng-show="collectionLogins.length"> <div class="table-responsive" ng-show="collectionLogins.length">
<table class="table table-striped table-hover table-vmiddle"> <table class="table table-striped table-hover table-vmiddle">
<tbody> <tbody>
@@ -66,7 +64,7 @@
</li> </li>
<li> <li>
<a href="javascript:void(0)" ng-click="editCollections(login)"> <a href="javascript:void(0)" ng-click="editCollections(login)">
<i class="fa fa-fw fa-share-alt"></i> Collections <i class="fa fa-fw fa-cubes"></i> Collections
</a> </a>
</li> </li>
<li> <li>

View File

@@ -58,7 +58,7 @@
</li> </li>
<li ng-class="{active: $state.is('backend.org.collections')}"> <li ng-class="{active: $state.is('backend.org.collections')}">
<a ui-sref="backend.org.collections({orgId: params.orgId})"> <a ui-sref="backend.org.collections({orgId: params.orgId})">
<i class="fa fa-share-alt fa-fw"></i> <span>Collections</span> <i class="fa fa-cubes fa-fw"></i> <span>Collections</span>
</a> </a>
</li> </li>
<li ng-class="{active: $state.is('backend.org.people')}"> <li ng-class="{active: $state.is('backend.org.people')}">

View File

@@ -54,11 +54,11 @@
</li> </li>
</ul> </ul>
</li> </li>
<li class="treeview" ng-class="{active: $state.is('backend.user.collections')}"> <li class="treeview" ng-class="{active: $state.is('backend.user.shared')}">
<a ui-sref="backend.user.collections"> <a ui-sref="backend.user.shared">
<small class="label pull-right bg-orange">NEW</small> <small class="label pull-right bg-orange">NEW</small>
<i class="fa fa-share-alt fa-fw"></i> <span>Collections</span> <i class="fa fa-share-alt fa-fw"></i> <span>Shared</span>
</a> </a>
</li> </li>
<li class="treeview" ng-class="{active: $state.is('backend.user.tools')}"> <li class="treeview" ng-class="{active: $state.is('backend.user.tools')}">
@@ -85,7 +85,7 @@
<li ng-class="{active: $state.is('backend.user.apps')}"> <li ng-class="{active: $state.is('backend.user.apps')}">
<a ui-sref="backend.user.apps"> <a ui-sref="backend.user.apps">
<small class="label pull-right bg-green">FREE</small> <small class="label pull-right bg-green">FREE</small>
<i class="fa fa-cubes fa-fw"></i> <span>Get the Apps</span> <i class="fa fa-download fa-fw"></i> <span>Get the Apps</span>
</a> </a>
</li> </li>
<li> <li>

View File

@@ -125,8 +125,8 @@
<script src="app/vault/vaultAddLoginController.js"></script> <script src="app/vault/vaultAddLoginController.js"></script>
<script src="app/vault/vaultEditFolderController.js"></script> <script src="app/vault/vaultEditFolderController.js"></script>
<script src="app/vault/vaultAddFolderController.js"></script> <script src="app/vault/vaultAddFolderController.js"></script>
<script src="app/vault/vaultShareController.js"></script> <script src="app/vault/vaultShareLoginController.js"></script>
<script src="app/vault/vaultCollectionsController.js"></script> <script src="app/vault/vaultSharedController.js"></script>
<script src="app/vault/vaultLoginCollectionsController.js"></script> <script src="app/vault/vaultLoginCollectionsController.js"></script>
<script src="app/organization/organizationModule.js"></script> <script src="app/organization/organizationModule.js"></script>