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

View File

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

View File

@ -2,7 +2,7 @@
.module('bit.organization')
.controller('organizationCollectionsController', function ($scope, $state, apiService, $uibModal, cipherService, $filter,
toastr, $analytics) {
toastr, $analytics, $uibModalStack) {
$scope.collections = [];
$scope.loading = true;
$scope.$on('$viewContentLoaded', function () {
@ -96,6 +96,12 @@
apiService.collections.listOrganization({ orgId: $state.params.orgId }, function (list) {
$scope.collections = cipherService.decryptCollections(list.Data, $state.params.orgId, true);
$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')
.controller('organizationEventsController', function ($scope, $state, apiService, $uibModal, $filter,
toastr, $analytics, constants, eventService) {
toastr, $analytics, constants, eventService, $compile, $sce) {
$scope.events = [];
$scope.orgUsers = [];
$scope.loading = true;
@ -77,8 +77,9 @@
for (i = 0; i < list.Data.length; i++) {
var userId = list.Data[i].ActingUserId || list.Data[i].UserId;
var eventInfo = eventService.getEventInfo(list.Data[i]);
var htmlMessage = $compile('<span>' + eventInfo.message + '</span>')($scope);
events.push({
message: eventInfo.message,
message: $sce.trustAsHtml(htmlMessage[0].outerHTML),
appIcon: eventInfo.appIcon,
appName: eventInfo.appName,
userId: userId,

View File

@ -2,7 +2,7 @@
.module('bit.organization')
.controller('organizationGroupsController', function ($scope, $state, apiService, $uibModal, $filter,
toastr, $analytics) {
toastr, $analytics, $uibModalStack) {
$scope.groups = [];
$scope.loading = true;
$scope.$on('$viewContentLoaded', function () {
@ -88,6 +88,12 @@
}
$scope.groups = groups;
$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')
.controller('organizationPeopleController', function ($scope, $state, $uibModal, cryptoService, apiService, authService,
toastr, $analytics) {
toastr, $analytics, $filter, $uibModalStack) {
$scope.users = [];
$scope.useGroups = false;
$scope.useEvents = false;
@ -143,6 +143,20 @@
}
$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')
.controller('organizationPeopleEventsController', function ($scope, apiService, $uibModalInstance,
orgUser, $analytics, eventService, orgId) {
orgUser, $analytics, eventService, orgId, $compile, $sce) {
$analytics.eventTrack('organizationPeopleEventsController', { category: 'Modal' });
$scope.email = orgUser.email;
$scope.events = [];
@ -50,8 +50,9 @@
var events = [];
for (var i = 0; i < list.Data.length; i++) {
var eventInfo = eventService.getEventInfo(list.Data[i]);
var htmlMessage = $compile('<span>' + eventInfo.message + '</span>')($scope);
events.push({
message: eventInfo.message,
message: $sce.trustAsHtml(htmlMessage[0].outerHTML),
appIcon: eventInfo.appIcon,
appName: eventInfo.appName,
date: list.Data[i].Date,

View File

@ -2,7 +2,7 @@
.module('bit.organization')
.controller('organizationVaultController', function ($scope, apiService, cipherService, $analytics, $q, $state,
$localStorage, $uibModal, $filter, authService) {
$localStorage, $uibModal, $filter, authService, $filter, $uibModalStack) {
$scope.ciphers = [];
$scope.collections = [];
$scope.loading = true;
@ -47,6 +47,20 @@
$q.all([collectionPromise, cipherPromise]).then(function () {
$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;
<div class="box-filters hidden-xs">
<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">
<span class="fa fa-search form-control-feedback text-muted" aria-hidden="true"></span>
</div>

View File

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

View File

@ -10,7 +10,7 @@
&nbsp;
<div class="box-filters hidden-xs">
<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">
<span class="fa fa-search form-control-feedback text-muted" aria-hidden="true"></span>
</div>

View File

@ -10,7 +10,7 @@
&nbsp;
<div class="box-filters hidden-xs">
<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">
<span class="fa fa-search form-control-feedback text-muted" aria-hidden="true"></span>
</div>

View File

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

View File

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

View File

@ -77,61 +77,64 @@ angular
break;
// Cipher
case constants.eventType.Cipher_Created:
msg = options.cipherInfo ? 'Created item ' + ev.CipherId + '.' : 'Created.';
msg = options.cipherInfo ? 'Created item ' + formatCipherId(ev) + '.' : 'Created.';
break;
case constants.eventType.Cipher_Updated:
msg = options.cipherInfo ? 'Edited item ' + ev.CipherId + '.' : 'Edited.';
msg = options.cipherInfo ? 'Edited item ' + formatCipherId(ev) + '.' : 'Edited.';
break;
case constants.eventType.Cipher_Deleted:
msg = options.cipherInfo ? 'Deleted item ' + ev.CipherId + '.' : 'Deleted';
msg = options.cipherInfo ? 'Deleted item ' + formatCipherId(ev) + '.' : 'Deleted';
break;
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;
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;
case constants.eventType.Cipher_Shared:
msg = options.cipherInfo ? 'Shared item ' + ev.CipherId + '.' : 'Shared.';
msg = options.cipherInfo ? 'Shared item ' + formatCipherId(ev) + '.' : 'Shared.';
break;
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;
// Collection
case constants.eventType.Collection_Created:
msg = 'Created collection ' + ev.CollectionId + '.';
msg = 'Created collection ' + formatCollectionId(ev) + '.';
break;
case constants.eventType.Collection_Updated:
msg = 'Edited collection ' + ev.CollectionId + '.';
msg = 'Edited collection ' + formatCollectionId(ev) + '.';
break;
case constants.eventType.Collection_Deleted:
msg = 'Deleted collection ' + ev.CollectionId + '.';
msg = 'Deleted collection ' + formatCollectionId(ev) + '.';
break;
// Group
case constants.eventType.Group_Created:
msg = 'Created group ' + ev.GroupId + '.';
msg = 'Created group ' + formatGroupId(ev) + '.';
break;
case constants.eventType.Group_Updated:
msg = 'Edited group ' + ev.GroupId + '.';
msg = 'Edited group ' + formatGroupId(ev) + '.';
break;
case constants.eventType.Group_Deleted:
msg = 'Deleted group ' + ev.GroupId + '.';
msg = 'Deleted group ' + formatGroupId(ev) + '.';
break;
// Org user
case constants.eventType.OrganizationUser_Invited:
msg = 'Invited user ' + ev.OrganizationUserId + '.';
msg = 'Invited user ' + formatOrgUserId(ev) + '.';
break;
case constants.eventType.OrganizationUser_Confirmed:
msg = 'Confirmed user ' + ev.OrganizationUserId + '.';
msg = 'Confirmed user ' + formatOrgUserId(ev) + '.';
break;
case constants.eventType.OrganizationUser_Updated:
msg = 'Edited user ' + ev.OrganizationUserId + '.';
msg = 'Edited user ' + formatOrgUserId(ev) + '.';
break;
case constants.eventType.OrganizationUser_Removed:
msg = 'Removed user ' + ev.OrganizationUserId + '.';
msg = 'Removed user ' + formatOrgUserId(ev) + '.';
break;
case constants.eventType.OrganizationUser_UpdatedGroups:
msg = 'Edited groups for user ' + ev.OrganizationUserId + '.';
msg = 'Edited groups for user ' + formatOrgUserId(ev) + '.';
break;
// Org
case constants.eventType.Organization_Updated:
@ -196,19 +199,19 @@ angular
appInfo.name = 'Desktop - Linux';
break;
case constants.deviceType.chrome:
appInfo.icon = 'fa-chrome';
appInfo.icon = 'fa-globe';
appInfo.name = 'Web Vault - Chrome';
break;
case constants.deviceType.firefox:
appInfo.icon = 'fa-firefox';
appInfo.icon = 'fa-globe';
appInfo.name = 'Web Vault - Firefox';
break;
case constants.deviceType.opera:
appInfo.icon = 'fa-opera';
appInfo.icon = 'fa-globe';
appInfo.name = 'Web Vault - Opera';
break;
case constants.deviceType.safari:
appInfo.icon = 'fa-safari';
appInfo.icon = 'fa-globe';
appInfo.name = 'Web Vault - Safari';
break;
case constants.deviceType.vivaldi:
@ -216,11 +219,11 @@ angular
appInfo.name = 'Web Vault - Vivaldi';
break;
case constants.deviceType.edge:
appInfo.icon = 'fa-edge';
appInfo.icon = 'fa-globe';
appInfo.name = 'Web Vault - Edge';
break;
case constants.deviceType.ie:
appInfo.icon = 'fa-internet-explorer';
appInfo.icon = 'fa-globe';
appInfo.name = 'Web Vault - IE';
break;
case constants.deviceType.unknown:
@ -234,5 +237,33 @@ angular
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;
});