1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-27 17:18:04 +01:00

cross navigation for event subject ids

This commit is contained in:
Kyle Spearrin 2017-12-19 11:14:15 -05:00
parent d5765d8814
commit 16892239fb
15 changed files with 126 additions and 49 deletions

View File

@ -171,13 +171,13 @@ angular
data: { pageTitle: 'Organization Dashboard' } data: { pageTitle: 'Organization Dashboard' }
}) })
.state('backend.org.people', { .state('backend.org.people', {
url: '/organization/:orgId/people', url: '/organization/:orgId/people?viewEvents&search',
templateUrl: 'app/organization/views/organizationPeople.html', templateUrl: 'app/organization/views/organizationPeople.html',
controller: 'organizationPeopleController', controller: 'organizationPeopleController',
data: { pageTitle: 'Organization People' } data: { pageTitle: 'Organization People' }
}) })
.state('backend.org.collections', { .state('backend.org.collections', {
url: '/organization/:orgId/collections', url: '/organization/:orgId/collections?search',
templateUrl: 'app/organization/views/organizationCollections.html', templateUrl: 'app/organization/views/organizationCollections.html',
controller: 'organizationCollectionsController', controller: 'organizationCollectionsController',
data: { pageTitle: 'Organization Collections' } data: { pageTitle: 'Organization Collections' }
@ -195,13 +195,13 @@ angular
data: { pageTitle: 'Organization Billing' } data: { pageTitle: 'Organization Billing' }
}) })
.state('backend.org.vault', { .state('backend.org.vault', {
url: '/organization/:orgId/vault', url: '/organization/:orgId/vault?viewEvents&search',
templateUrl: 'app/organization/views/organizationVault.html', templateUrl: 'app/organization/views/organizationVault.html',
controller: 'organizationVaultController', controller: 'organizationVaultController',
data: { pageTitle: 'Organization Vault' } data: { pageTitle: 'Organization Vault' }
}) })
.state('backend.org.groups', { .state('backend.org.groups', {
url: '/organization/:orgId/groups', url: '/organization/:orgId/groups?search',
templateUrl: 'app/organization/views/organizationGroups.html', templateUrl: 'app/organization/views/organizationGroups.html',
controller: 'organizationGroupsController', controller: 'organizationGroupsController',
data: { pageTitle: 'Organization Groups' } data: { pageTitle: 'Organization Groups' }

View File

@ -49,6 +49,10 @@ angular
vm.openControlSidebar = vm.usingControlSidebar && $document.width() > 768; vm.openControlSidebar = vm.usingControlSidebar && $document.width() > 768;
}); });
$scope.$on('setSearchVaultText', function (event, val) {
vm.searchVaultText = val;
});
$scope.addCipher = function () { $scope.addCipher = function () {
$scope.$broadcast('vaultAddCipher'); $scope.$broadcast('vaultAddCipher');
}; };

View File

@ -2,7 +2,7 @@
.module('bit.organization') .module('bit.organization')
.controller('organizationCollectionsController', function ($scope, $state, apiService, $uibModal, cipherService, $filter, .controller('organizationCollectionsController', function ($scope, $state, apiService, $uibModal, cipherService, $filter,
toastr, $analytics) { toastr, $analytics, $uibModalStack) {
$scope.collections = []; $scope.collections = [];
$scope.loading = true; $scope.loading = true;
$scope.$on('$viewContentLoaded', function () { $scope.$on('$viewContentLoaded', function () {
@ -96,6 +96,12 @@
apiService.collections.listOrganization({ orgId: $state.params.orgId }, function (list) { apiService.collections.listOrganization({ orgId: $state.params.orgId }, function (list) {
$scope.collections = cipherService.decryptCollections(list.Data, $state.params.orgId, true); $scope.collections = cipherService.decryptCollections(list.Data, $state.params.orgId, true);
$scope.loading = false; $scope.loading = false;
if ($state.params.search) {
$uibModalStack.dismissAll();
$scope.filterSearch = $state.params.search;
$('#filterSearch').focus();
}
}); });
} }
}); });

View File

@ -2,7 +2,7 @@
.module('bit.organization') .module('bit.organization')
.controller('organizationEventsController', function ($scope, $state, apiService, $uibModal, $filter, .controller('organizationEventsController', function ($scope, $state, apiService, $uibModal, $filter,
toastr, $analytics, constants, eventService) { toastr, $analytics, constants, eventService, $compile, $sce) {
$scope.events = []; $scope.events = [];
$scope.orgUsers = []; $scope.orgUsers = [];
$scope.loading = true; $scope.loading = true;
@ -77,8 +77,9 @@
for (i = 0; i < list.Data.length; i++) { for (i = 0; i < list.Data.length; i++) {
var userId = list.Data[i].ActingUserId || list.Data[i].UserId; var userId = list.Data[i].ActingUserId || list.Data[i].UserId;
var eventInfo = eventService.getEventInfo(list.Data[i]); var eventInfo = eventService.getEventInfo(list.Data[i]);
var htmlMessage = $compile('<span>' + eventInfo.message + '</span>')($scope);
events.push({ events.push({
message: eventInfo.message, message: $sce.trustAsHtml(htmlMessage[0].outerHTML),
appIcon: eventInfo.appIcon, appIcon: eventInfo.appIcon,
appName: eventInfo.appName, appName: eventInfo.appName,
userId: userId, userId: userId,

View File

@ -2,7 +2,7 @@
.module('bit.organization') .module('bit.organization')
.controller('organizationGroupsController', function ($scope, $state, apiService, $uibModal, $filter, .controller('organizationGroupsController', function ($scope, $state, apiService, $uibModal, $filter,
toastr, $analytics) { toastr, $analytics, $uibModalStack) {
$scope.groups = []; $scope.groups = [];
$scope.loading = true; $scope.loading = true;
$scope.$on('$viewContentLoaded', function () { $scope.$on('$viewContentLoaded', function () {
@ -88,6 +88,12 @@
} }
$scope.groups = groups; $scope.groups = groups;
$scope.loading = false; $scope.loading = false;
if ($state.params.search) {
$uibModalStack.dismissAll();
$scope.filterSearch = $state.params.search;
$('#filterSearch').focus();
}
}); });
} }
}); });

View File

@ -2,7 +2,7 @@
.module('bit.organization') .module('bit.organization')
.controller('organizationPeopleController', function ($scope, $state, $uibModal, cryptoService, apiService, authService, .controller('organizationPeopleController', function ($scope, $state, $uibModal, cryptoService, apiService, authService,
toastr, $analytics) { toastr, $analytics, $filter, $uibModalStack) {
$scope.users = []; $scope.users = [];
$scope.useGroups = false; $scope.useGroups = false;
$scope.useEvents = false; $scope.useEvents = false;
@ -143,6 +143,20 @@
} }
$scope.users = users; $scope.users = users;
if ($state.params.search) {
$uibModalStack.dismissAll();
$scope.filterSearch = $state.params.search;
$('#filterSearch').focus();
}
if ($state.params.viewEvents) {
$uibModalStack.dismissAll();
var user = $filter('filter')($scope.users, { id: $state.params.viewEvents });
if (user && user.length) {
$scope.events(user[0]);
}
}
}); });
} }
}); });

View File

@ -2,7 +2,7 @@
.module('bit.organization') .module('bit.organization')
.controller('organizationPeopleEventsController', function ($scope, apiService, $uibModalInstance, .controller('organizationPeopleEventsController', function ($scope, apiService, $uibModalInstance,
orgUser, $analytics, eventService, orgId) { orgUser, $analytics, eventService, orgId, $compile, $sce) {
$analytics.eventTrack('organizationPeopleEventsController', { category: 'Modal' }); $analytics.eventTrack('organizationPeopleEventsController', { category: 'Modal' });
$scope.email = orgUser.email; $scope.email = orgUser.email;
$scope.events = []; $scope.events = [];
@ -50,8 +50,9 @@
var events = []; var events = [];
for (var i = 0; i < list.Data.length; i++) { for (var i = 0; i < list.Data.length; i++) {
var eventInfo = eventService.getEventInfo(list.Data[i]); var eventInfo = eventService.getEventInfo(list.Data[i]);
var htmlMessage = $compile('<span>' + eventInfo.message + '</span>')($scope);
events.push({ events.push({
message: eventInfo.message, message: $sce.trustAsHtml(htmlMessage[0].outerHTML),
appIcon: eventInfo.appIcon, appIcon: eventInfo.appIcon,
appName: eventInfo.appName, appName: eventInfo.appName,
date: list.Data[i].Date, date: list.Data[i].Date,

View File

@ -2,7 +2,7 @@
.module('bit.organization') .module('bit.organization')
.controller('organizationVaultController', function ($scope, apiService, cipherService, $analytics, $q, $state, .controller('organizationVaultController', function ($scope, apiService, cipherService, $analytics, $q, $state,
$localStorage, $uibModal, $filter, authService) { $localStorage, $uibModal, $filter, authService, $filter, $uibModalStack) {
$scope.ciphers = []; $scope.ciphers = [];
$scope.collections = []; $scope.collections = [];
$scope.loading = true; $scope.loading = true;
@ -47,6 +47,20 @@
$q.all([collectionPromise, cipherPromise]).then(function () { $q.all([collectionPromise, cipherPromise]).then(function () {
$scope.loading = false; $scope.loading = false;
if ($state.params.search) {
$uibModalStack.dismissAll();
$scope.$emit('setSearchVaultText', $state.params.search);
$('#search').focus();
}
if ($state.params.viewEvents) {
$uibModalStack.dismissAll();
var cipher = $filter('filter')($scope.ciphers, { id: $state.params.viewEvents });
if (cipher && cipher.length) {
$scope.viewEvents(cipher[0]);
}
}
}); });
}); });

View File

@ -10,7 +10,7 @@
&nbsp; &nbsp;
<div class="box-filters hidden-xs"> <div class="box-filters hidden-xs">
<div class="form-group form-group-sm has-feedback has-feedback-left"> <div class="form-group form-group-sm has-feedback has-feedback-left">
<input type="text" id="search" class="form-control" placeholder="Search collections..." <input type="text" id="filterSearch" class="form-control" placeholder="Search collections..."
style="width: 200px;" ng-model="filterSearch"> style="width: 200px;" ng-model="filterSearch">
<span class="fa fa-search form-control-feedback text-muted" aria-hidden="true"></span> <span class="fa fa-search form-control-feedback text-muted" aria-hidden="true"></span>
</div> </div>

View File

@ -33,8 +33,8 @@
<thead> <thead>
<tr> <tr>
<th>Timestamp</th> <th>Timestamp</th>
<th>User</th>
<th><span class="sr-only">App</span></th> <th><span class="sr-only">App</span></th>
<th>User</th>
<th>Event</th> <th>Event</th>
</tr> </tr>
</thead> </thead>
@ -43,14 +43,14 @@
<td style="width: 210px; min-width: 100px;"> <td style="width: 210px; min-width: 100px;">
{{event.date | date:'medium'}} {{event.date | date:'medium'}}
</td> </td>
<td style="width: 150px; min-width: 100px;">
{{event.userName}}
</td>
<td style="width: 20px;" class="text-center"> <td style="width: 20px;" class="text-center">
<i class="text-muted fa fa-lg {{event.appIcon}}" title="{{event.appName}}, {{event.ip}}"></i> <i class="text-muted fa fa-lg {{event.appIcon}}" title="{{event.appName}}, {{event.ip}}"></i>
</td> </td>
<td style="width: 150px; min-width: 100px;">
{{event.userName}}
</td>
<td> <td>
{{event.message}} <div ng-bind-html="event.message"></div>
</td> </td>
</tr> </tr>
</tbody> </tbody>

View File

@ -10,7 +10,7 @@
&nbsp; &nbsp;
<div class="box-filters hidden-xs"> <div class="box-filters hidden-xs">
<div class="form-group form-group-sm has-feedback has-feedback-left"> <div class="form-group form-group-sm has-feedback has-feedback-left">
<input type="text" id="search" class="form-control" placeholder="Search groups..." <input type="text" id="filterSearch" class="form-control" placeholder="Search groups..."
style="width: 200px;" ng-model="filterSearch"> style="width: 200px;" ng-model="filterSearch">
<span class="fa fa-search form-control-feedback text-muted" aria-hidden="true"></span> <span class="fa fa-search form-control-feedback text-muted" aria-hidden="true"></span>
</div> </div>

View File

@ -10,7 +10,7 @@
&nbsp; &nbsp;
<div class="box-filters hidden-xs"> <div class="box-filters hidden-xs">
<div class="form-group form-group-sm has-feedback has-feedback-left"> <div class="form-group form-group-sm has-feedback has-feedback-left">
<input type="text" id="search" class="form-control" placeholder="Search people..." <input type="text" id="filterSearch" class="form-control" placeholder="Search people..."
style="width: 200px;" ng-model="filterSearch"> style="width: 200px;" ng-model="filterSearch">
<span class="fa fa-search form-control-feedback text-muted" aria-hidden="true"></span> <span class="fa fa-search form-control-feedback text-muted" aria-hidden="true"></span>
</div> </div>

View File

@ -38,7 +38,7 @@
<i class="text-muted fa fa-lg {{event.appIcon}}" title="{{event.appName}}, {{event.ip}}"></i> <i class="text-muted fa fa-lg {{event.appIcon}}" title="{{event.appName}}, {{event.ip}}"></i>
</td> </td>
<td> <td>
{{event.message}} <div ng-bind-html="event.message"></div>
</td> </td>
</tr> </tr>
</tbody> </tbody>

View File

@ -25,8 +25,8 @@
<thead> <thead>
<tr> <tr>
<th>Timestamp</th> <th>Timestamp</th>
<th>User</th>
<th><span class="sr-only">App</span></th> <th><span class="sr-only">App</span></th>
<th>User</th>
<th>Event</th> <th>Event</th>
</tr> </tr>
</thead> </thead>
@ -35,12 +35,12 @@
<td style="width: 210px; min-width: 100px;"> <td style="width: 210px; min-width: 100px;">
{{event.date | date:'medium'}} {{event.date | date:'medium'}}
</td> </td>
<td style="width: 150px; min-width: 100px;">
{{event.userName}}
</td>
<td style="width: 20px;" class="text-center"> <td style="width: 20px;" class="text-center">
<i class="text-muted fa fa-lg {{event.appIcon}}" title="{{event.appName}}, {{event.ip}}"></i> <i class="text-muted fa fa-lg {{event.appIcon}}" title="{{event.appName}}, {{event.ip}}"></i>
</td> </td>
<td style="width: 150px; min-width: 100px;">
{{event.userName}}
</td>
<td> <td>
{{event.message}} {{event.message}}
</td> </td>

View File

@ -77,61 +77,64 @@ angular
break; break;
// Cipher // Cipher
case constants.eventType.Cipher_Created: case constants.eventType.Cipher_Created:
msg = options.cipherInfo ? 'Created item ' + ev.CipherId + '.' : 'Created.'; msg = options.cipherInfo ? 'Created item ' + formatCipherId(ev) + '.' : 'Created.';
break; break;
case constants.eventType.Cipher_Updated: case constants.eventType.Cipher_Updated:
msg = options.cipherInfo ? 'Edited item ' + ev.CipherId + '.' : 'Edited.'; msg = options.cipherInfo ? 'Edited item ' + formatCipherId(ev) + '.' : 'Edited.';
break; break;
case constants.eventType.Cipher_Deleted: case constants.eventType.Cipher_Deleted:
msg = options.cipherInfo ? 'Deleted item ' + ev.CipherId + '.' : 'Deleted'; msg = options.cipherInfo ? 'Deleted item ' + formatCipherId(ev) + '.' : 'Deleted';
break; break;
case constants.eventType.Cipher_AttachmentCreated: case constants.eventType.Cipher_AttachmentCreated:
msg = options.cipherInfo ? 'Created attachment for item ' + ev.CipherId + '.' : 'Created attachment.'; msg = options.cipherInfo ? 'Created attachment for item ' + formatCipherId(ev) + '.' :
'Created attachment.';
break; break;
case constants.eventType.Cipher_AttachmentDeleted: case constants.eventType.Cipher_AttachmentDeleted:
msg = options.cipherInfo ? 'Deleted attachment for item ' + ev.CipherId + '.' : 'Deleted attachment.'; msg = options.cipherInfo ? 'Deleted attachment for item ' + formatCipherId(ev) + '.' :
'Deleted attachment.';
break; break;
case constants.eventType.Cipher_Shared: case constants.eventType.Cipher_Shared:
msg = options.cipherInfo ? 'Shared item ' + ev.CipherId + '.' : 'Shared.'; msg = options.cipherInfo ? 'Shared item ' + formatCipherId(ev) + '.' : 'Shared.';
break; break;
case constants.eventType.Cipher_UpdatedCollections: case constants.eventType.Cipher_UpdatedCollections:
msg = options.cipherInfo ? 'Update collections for item ' + ev.CipherId + '.' : 'Updated collections.'; msg = options.cipherInfo ? 'Update collections for item ' + formatCipherId(ev) + '.' :
'Updated collections.';
break; break;
// Collection // Collection
case constants.eventType.Collection_Created: case constants.eventType.Collection_Created:
msg = 'Created collection ' + ev.CollectionId + '.'; msg = 'Created collection ' + formatCollectionId(ev) + '.';
break; break;
case constants.eventType.Collection_Updated: case constants.eventType.Collection_Updated:
msg = 'Edited collection ' + ev.CollectionId + '.'; msg = 'Edited collection ' + formatCollectionId(ev) + '.';
break; break;
case constants.eventType.Collection_Deleted: case constants.eventType.Collection_Deleted:
msg = 'Deleted collection ' + ev.CollectionId + '.'; msg = 'Deleted collection ' + formatCollectionId(ev) + '.';
break; break;
// Group // Group
case constants.eventType.Group_Created: case constants.eventType.Group_Created:
msg = 'Created group ' + ev.GroupId + '.'; msg = 'Created group ' + formatGroupId(ev) + '.';
break; break;
case constants.eventType.Group_Updated: case constants.eventType.Group_Updated:
msg = 'Edited group ' + ev.GroupId + '.'; msg = 'Edited group ' + formatGroupId(ev) + '.';
break; break;
case constants.eventType.Group_Deleted: case constants.eventType.Group_Deleted:
msg = 'Deleted group ' + ev.GroupId + '.'; msg = 'Deleted group ' + formatGroupId(ev) + '.';
break; break;
// Org user // Org user
case constants.eventType.OrganizationUser_Invited: case constants.eventType.OrganizationUser_Invited:
msg = 'Invited user ' + ev.OrganizationUserId + '.'; msg = 'Invited user ' + formatOrgUserId(ev) + '.';
break; break;
case constants.eventType.OrganizationUser_Confirmed: case constants.eventType.OrganizationUser_Confirmed:
msg = 'Confirmed user ' + ev.OrganizationUserId + '.'; msg = 'Confirmed user ' + formatOrgUserId(ev) + '.';
break; break;
case constants.eventType.OrganizationUser_Updated: case constants.eventType.OrganizationUser_Updated:
msg = 'Edited user ' + ev.OrganizationUserId + '.'; msg = 'Edited user ' + formatOrgUserId(ev) + '.';
break; break;
case constants.eventType.OrganizationUser_Removed: case constants.eventType.OrganizationUser_Removed:
msg = 'Removed user ' + ev.OrganizationUserId + '.'; msg = 'Removed user ' + formatOrgUserId(ev) + '.';
break; break;
case constants.eventType.OrganizationUser_UpdatedGroups: case constants.eventType.OrganizationUser_UpdatedGroups:
msg = 'Edited groups for user ' + ev.OrganizationUserId + '.'; msg = 'Edited groups for user ' + formatOrgUserId(ev) + '.';
break; break;
// Org // Org
case constants.eventType.Organization_Updated: case constants.eventType.Organization_Updated:
@ -196,19 +199,19 @@ angular
appInfo.name = 'Desktop - Linux'; appInfo.name = 'Desktop - Linux';
break; break;
case constants.deviceType.chrome: case constants.deviceType.chrome:
appInfo.icon = 'fa-chrome'; appInfo.icon = 'fa-globe';
appInfo.name = 'Web Vault - Chrome'; appInfo.name = 'Web Vault - Chrome';
break; break;
case constants.deviceType.firefox: case constants.deviceType.firefox:
appInfo.icon = 'fa-firefox'; appInfo.icon = 'fa-globe';
appInfo.name = 'Web Vault - Firefox'; appInfo.name = 'Web Vault - Firefox';
break; break;
case constants.deviceType.opera: case constants.deviceType.opera:
appInfo.icon = 'fa-opera'; appInfo.icon = 'fa-globe';
appInfo.name = 'Web Vault - Opera'; appInfo.name = 'Web Vault - Opera';
break; break;
case constants.deviceType.safari: case constants.deviceType.safari:
appInfo.icon = 'fa-safari'; appInfo.icon = 'fa-globe';
appInfo.name = 'Web Vault - Safari'; appInfo.name = 'Web Vault - Safari';
break; break;
case constants.deviceType.vivaldi: case constants.deviceType.vivaldi:
@ -216,11 +219,11 @@ angular
appInfo.name = 'Web Vault - Vivaldi'; appInfo.name = 'Web Vault - Vivaldi';
break; break;
case constants.deviceType.edge: case constants.deviceType.edge:
appInfo.icon = 'fa-edge'; appInfo.icon = 'fa-globe';
appInfo.name = 'Web Vault - Edge'; appInfo.name = 'Web Vault - Edge';
break; break;
case constants.deviceType.ie: case constants.deviceType.ie:
appInfo.icon = 'fa-internet-explorer'; appInfo.icon = 'fa-globe';
appInfo.name = 'Web Vault - IE'; appInfo.name = 'Web Vault - IE';
break; break;
case constants.deviceType.unknown: case constants.deviceType.unknown:
@ -234,5 +237,33 @@ angular
return appInfo; return appInfo;
} }
function formatCipherId(ev) {
var shortId = ev.CipherId.substring(0, 8);
if (!ev.OrganizationId) {
return '<code>' + shortId + '</code>';
}
return '<a title="View item ' + ev.CipherId + '" ui-sref="backend.org.vault({orgId:\'' + ev.OrganizationId + '\',search:\'' + shortId + '\',viewEvents:\'' + ev.CipherId + '\'})">' +
'<code>' + shortId + '</code></a>';
}
function formatGroupId(ev) {
var shortId = ev.GroupId.substring(0, 8);
return '<a title="View group ' + ev.GroupId + '" ui-sref="backend.org.groups({orgId:\'' + ev.OrganizationId + '\',search:\'' + shortId + '\'})">' +
'<code>' + shortId + '</code></a>';
}
function formatCollectionId(ev) {
var shortId = ev.CollectionId.substring(0, 8);
return '<a title="View collection ' + ev.CollectionId + '" ui-sref="backend.org.collections({orgId:\'' + ev.OrganizationId + '\',search:\'' + shortId + '\'})">' +
'<code>' + shortId + '</code></a>';
}
function formatOrgUserId(ev) {
var shortId = ev.OrganizationUserId.substring(0, 8);
return '<a title="View user ' + ev.OrganizationUserId + '" ui-sref="backend.org.people({orgId:\'' + ev.OrganizationId + '\',search:\'' + shortId + '\'})">' +
'<code>' + shortId + '</code></a>';
}
return _service; return _service;
}); });