From 16892239fbd5131904ae0c079f0acda779ac75c1 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 19 Dec 2017 11:14:15 -0500 Subject: [PATCH] cross navigation for event subject ids --- src/app/config.js | 8 +- src/app/global/mainController.js | 4 + .../organizationCollectionsController.js | 8 +- .../organizationEventsController.js | 5 +- .../organizationGroupsController.js | 8 +- .../organizationPeopleController.js | 16 +++- .../organizationPeopleEventsController.js | 5 +- .../organizationVaultController.js | 16 +++- .../views/organizationCollections.html | 2 +- .../views/organizationEvents.html | 10 +-- .../views/organizationGroups.html | 2 +- .../views/organizationPeople.html | 2 +- .../views/organizationPeopleEvents.html | 2 +- .../views/organizationVaultCipherEvents.html | 8 +- src/app/services/eventService.js | 79 +++++++++++++------ 15 files changed, 126 insertions(+), 49 deletions(-) diff --git a/src/app/config.js b/src/app/config.js index 6403188443..5e50d690c4 100644 --- a/src/app/config.js +++ b/src/app/config.js @@ -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' } diff --git a/src/app/global/mainController.js b/src/app/global/mainController.js index a6878c434a..09d35cfb57 100644 --- a/src/app/global/mainController.js +++ b/src/app/global/mainController.js @@ -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'); }; diff --git a/src/app/organization/organizationCollectionsController.js b/src/app/organization/organizationCollectionsController.js index 98457b1774..880d3932e5 100644 --- a/src/app/organization/organizationCollectionsController.js +++ b/src/app/organization/organizationCollectionsController.js @@ -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(); + } }); } }); diff --git a/src/app/organization/organizationEventsController.js b/src/app/organization/organizationEventsController.js index 53a2676a90..9857cb933a 100644 --- a/src/app/organization/organizationEventsController.js +++ b/src/app/organization/organizationEventsController.js @@ -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('' + eventInfo.message + '')($scope); events.push({ - message: eventInfo.message, + message: $sce.trustAsHtml(htmlMessage[0].outerHTML), appIcon: eventInfo.appIcon, appName: eventInfo.appName, userId: userId, diff --git a/src/app/organization/organizationGroupsController.js b/src/app/organization/organizationGroupsController.js index f8a54229d0..7ff81d217b 100644 --- a/src/app/organization/organizationGroupsController.js +++ b/src/app/organization/organizationGroupsController.js @@ -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(); + } }); } }); diff --git a/src/app/organization/organizationPeopleController.js b/src/app/organization/organizationPeopleController.js index 8e03c82625..864da7bd39 100644 --- a/src/app/organization/organizationPeopleController.js +++ b/src/app/organization/organizationPeopleController.js @@ -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]); + } + } }); } }); diff --git a/src/app/organization/organizationPeopleEventsController.js b/src/app/organization/organizationPeopleEventsController.js index 9870c55d5d..02a56936a2 100644 --- a/src/app/organization/organizationPeopleEventsController.js +++ b/src/app/organization/organizationPeopleEventsController.js @@ -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('' + eventInfo.message + '')($scope); events.push({ - message: eventInfo.message, + message: $sce.trustAsHtml(htmlMessage[0].outerHTML), appIcon: eventInfo.appIcon, appName: eventInfo.appName, date: list.Data[i].Date, diff --git a/src/app/organization/organizationVaultController.js b/src/app/organization/organizationVaultController.js index fa18beee40..87ee00befb 100644 --- a/src/app/organization/organizationVaultController.js +++ b/src/app/organization/organizationVaultController.js @@ -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]); + } + } }); }); diff --git a/src/app/organization/views/organizationCollections.html b/src/app/organization/views/organizationCollections.html index 0af8f94310..971c5f96b0 100644 --- a/src/app/organization/views/organizationCollections.html +++ b/src/app/organization/views/organizationCollections.html @@ -10,7 +10,7 @@