telemetry for organizations

This commit is contained in:
Kyle Spearrin 2017-04-26 10:32:14 -04:00
parent 90b0f3201e
commit d8f54fc15a
14 changed files with 34 additions and 10 deletions

View File

@ -3,6 +3,7 @@
.controller('organizationBillingAdjustSeatsController', function ($scope, $state, $uibModalInstance, apiService, .controller('organizationBillingAdjustSeatsController', function ($scope, $state, $uibModalInstance, apiService,
$analytics, toastr, add) { $analytics, toastr, add) {
$analytics.eventTrack('organizationBillingAdjustSeatsController', { category: 'Modal' });
$scope.add = add; $scope.add = add;
$scope.seatAdjustment = 0; $scope.seatAdjustment = 0;

View File

@ -3,6 +3,7 @@
.controller('organizationBillingChangePaymentController', function ($scope, $state, $uibModalInstance, apiService, stripe, .controller('organizationBillingChangePaymentController', function ($scope, $state, $uibModalInstance, apiService, stripe,
$analytics, toastr, existingPaymentMethod) { $analytics, toastr, existingPaymentMethod) {
$analytics.eventTrack('organizationBillingChangePaymentController', { category: 'Modal' });
$scope.existingPaymentMethod = existingPaymentMethod; $scope.existingPaymentMethod = existingPaymentMethod;
$scope.submit = function () { $scope.submit = function () {

View File

@ -1,7 +1,7 @@
angular angular
.module('bit.organization') .module('bit.organization')
.controller('organizationBillingController', function ($scope, apiService, $state, $uibModal, toastr) { .controller('organizationBillingController', function ($scope, apiService, $state, $uibModal, toastr, $analytics) {
$scope.charges = []; $scope.charges = [];
$scope.paymentSource = null; $scope.paymentSource = null;
$scope.plan = null; $scope.plan = null;
@ -71,6 +71,7 @@
apiService.organizations.putCancel({ id: $state.params.orgId }, {}) apiService.organizations.putCancel({ id: $state.params.orgId }, {})
.$promise.then(function (response) { .$promise.then(function (response) {
$analytics.eventTrack('Canceled Plan');
toastr.success('Organization subscription has been canceled.'); toastr.success('Organization subscription has been canceled.');
load(); load();
}); });
@ -83,6 +84,7 @@
apiService.organizations.putReinstate({ id: $state.params.orgId }, {}) apiService.organizations.putReinstate({ id: $state.params.orgId }, {})
.$promise.then(function (response) { .$promise.then(function (response) {
$analytics.eventTrack('Reinstated Plan');
toastr.success('Organization cancellation request has been removed.'); toastr.success('Organization cancellation request has been removed.');
load(); load();
}); });

View File

@ -7,8 +7,6 @@
if (!userProfile.organizations) { if (!userProfile.organizations) {
return; return;
} }
$scope.orgProfile = userProfile.organizations[$state.params.orgId]; $scope.orgProfile = userProfile.organizations[$state.params.orgId];
}); });
}); });

View File

@ -1,7 +1,8 @@
angular angular
.module('bit.organization') .module('bit.organization')
.controller('organizationPeopleController', function ($scope, $state, $uibModal, cryptoService, apiService, toastr) { .controller('organizationPeopleController', function ($scope, $state, $uibModal, cryptoService, apiService,
toastr, $analytics) {
$scope.users = []; $scope.users = [];
$scope.$on('$viewContentLoaded', function () { $scope.$on('$viewContentLoaded', function () {
loadList(); loadList();
@ -9,6 +10,7 @@
$scope.reinvite = function (user) { $scope.reinvite = function (user) {
apiService.organizationUsers.reinvite({ orgId: $state.params.orgId, id: user.id }, null, function () { apiService.organizationUsers.reinvite({ orgId: $state.params.orgId, id: user.id }, null, function () {
$analytics.eventTrack('Reinvited User');
toastr.success(user.email + ' has been invited again.', 'User Invited'); toastr.success(user.email + ' has been invited again.', 'User Invited');
}, function () { }, function () {
toastr.error('Unable to invite user.', 'Error'); toastr.error('Unable to invite user.', 'Error');
@ -21,6 +23,7 @@
} }
apiService.organizationUsers.del({ orgId: $state.params.orgId, id: user.id }, null, function () { apiService.organizationUsers.del({ orgId: $state.params.orgId, id: user.id }, null, function () {
$analytics.eventTrack('Deleted User');
toastr.success(user.email + ' has been removed.', 'User Removed'); toastr.success(user.email + ' has been removed.', 'User Removed');
var index = $scope.users.indexOf(user); var index = $scope.users.indexOf(user);
if (index > -1) { if (index > -1) {
@ -42,6 +45,7 @@
var key = cryptoService.rsaEncrypt(orgKey.key, userKey.PublicKey); var key = cryptoService.rsaEncrypt(orgKey.key, userKey.PublicKey);
apiService.organizationUsers.confirm({ orgId: $state.params.orgId, id: user.id }, { key: key }, function () { apiService.organizationUsers.confirm({ orgId: $state.params.orgId, id: user.id }, { key: key }, function () {
user.status = 2; user.status = 2;
$analytics.eventTrack('Confirmed User');
toastr.success(user.email + ' has been confirmed.', 'User Confirmed'); toastr.success(user.email + ' has been confirmed.', 'User Confirmed');
}, function () { }, function () {
toastr.error('Unable to confirm user.', 'Error'); toastr.error('Unable to confirm user.', 'Error');

View File

@ -1,7 +1,10 @@
angular angular
.module('bit.organization') .module('bit.organization')
.controller('organizationPeopleEditController', function ($scope, $state, $uibModalInstance, apiService, cipherService, id) { .controller('organizationPeopleEditController', function ($scope, $state, $uibModalInstance, apiService, cipherService, id,
$analytics) {
$analytics.eventTrack('organizationPeopleEditController', { category: 'Modal' });
$scope.loading = true; $scope.loading = true;
$scope.subvaults = []; $scope.subvaults = [];
$scope.selectedSubvaults = {}; $scope.selectedSubvaults = {};
@ -86,6 +89,7 @@
subvaults: subvaults, subvaults: subvaults,
accessAllSubvaults: $scope.accessAllSubvaults accessAllSubvaults: $scope.accessAllSubvaults
}, function () { }, function () {
$analytics.eventTrack('Edited User');
$uibModalInstance.close(); $uibModalInstance.close();
}).$promise; }).$promise;
}; };

View File

@ -1,7 +1,10 @@
angular angular
.module('bit.organization') .module('bit.organization')
.controller('organizationPeopleInviteController', function ($scope, $state, $uibModalInstance, apiService, cipherService) { .controller('organizationPeopleInviteController', function ($scope, $state, $uibModalInstance, apiService, cipherService,
$analytics) {
$analytics.eventTrack('organizationPeopleInviteController', { category: 'Modal' });
$scope.loading = true; $scope.loading = true;
$scope.subvaults = []; $scope.subvaults = [];
$scope.selectedSubvaults = {}; $scope.selectedSubvaults = {};
@ -75,6 +78,7 @@
subvaults: subvaults, subvaults: subvaults,
accessAllSubvaults: model.accessAllSubvaults accessAllSubvaults: model.accessAllSubvaults
}, function () { }, function () {
$analytics.eventTrack('Invited User');
$uibModalInstance.close(); $uibModalInstance.close();
}).$promise; }).$promise;
}; };

View File

@ -1,7 +1,8 @@
angular angular
.module('bit.organization') .module('bit.organization')
.controller('organizationSettingsController', function ($scope, $state, apiService, toastr, authService, $uibModal) { .controller('organizationSettingsController', function ($scope, $state, apiService, toastr, authService, $uibModal,
$analytics) {
$scope.model = {}; $scope.model = {};
$scope.$on('$viewContentLoaded', function () { $scope.$on('$viewContentLoaded', function () {
apiService.organizations.get({ id: $state.params.orgId }, function (org) { apiService.organizations.get({ id: $state.params.orgId }, function (org) {
@ -16,6 +17,7 @@
$scope.generalSave = function () { $scope.generalSave = function () {
$scope.generalPromise = apiService.organizations.put({ id: $state.params.orgId }, $scope.model, function (org) { $scope.generalPromise = apiService.organizations.put({ id: $state.params.orgId }, $scope.model, function (org) {
authService.updateProfileOrganization(org).then(function (updatedOrg) { authService.updateProfileOrganization(org).then(function (updatedOrg) {
$analytics.eventTrack('Updated Organization Settings');
toastr.success('Organization has been updated.', 'Success!'); toastr.success('Organization has been updated.', 'Success!');
}); });
}).$promise; }).$promise;

View File

@ -3,6 +3,8 @@
.controller('organizationSubvaultsAddController', function ($scope, $state, $uibModalInstance, apiService, cipherService, .controller('organizationSubvaultsAddController', function ($scope, $state, $uibModalInstance, apiService, cipherService,
$analytics) { $analytics) {
$analytics.eventTrack('organizationSubvaultsAddController', { category: 'Modal' });
$scope.submit = function (model) { $scope.submit = function (model) {
var subvault = cipherService.encryptSubvault(model, $state.params.orgId); var subvault = cipherService.encryptSubvault(model, $state.params.orgId);
$scope.submitPromise = apiService.subvaults.post({ orgId: $state.params.orgId }, subvault, function (response) { $scope.submitPromise = apiService.subvaults.post({ orgId: $state.params.orgId }, subvault, function (response) {

View File

@ -2,7 +2,7 @@
.module('bit.organization') .module('bit.organization')
.controller('organizationSubvaultsController', function ($scope, $state, apiService, $uibModal, cipherService, $filter, .controller('organizationSubvaultsController', function ($scope, $state, apiService, $uibModal, cipherService, $filter,
toastr) { toastr, $analytics) {
$scope.subvaults = []; $scope.subvaults = [];
$scope.loading = true; $scope.loading = true;
$scope.$on('$viewContentLoaded', function () { $scope.$on('$viewContentLoaded', function () {
@ -81,6 +81,7 @@
$scope.subvaults.splice(index, 1); $scope.subvaults.splice(index, 1);
} }
$analytics.eventTrack('Deleted Subvault');
toastr.success(subvault.name + ' has been deleted.', 'Subvault Deleted'); toastr.success(subvault.name + ' has been deleted.', 'Subvault Deleted');
}, function () { }, function () {
toastr.error(subvault.name + ' was not able to be deleted.', 'Error'); toastr.error(subvault.name + ' was not able to be deleted.', 'Error');

View File

@ -3,6 +3,7 @@
.controller('organizationSubvaultsEditController', function ($scope, $state, $uibModalInstance, apiService, cipherService, .controller('organizationSubvaultsEditController', function ($scope, $state, $uibModalInstance, apiService, cipherService,
$analytics, id) { $analytics, id) {
$analytics.eventTrack('organizationSubvaultsEditController', { category: 'Modal' });
$scope.subvault = {}; $scope.subvault = {};
$uibModalInstance.opened.then(function () { $uibModalInstance.opened.then(function () {

View File

@ -1,7 +1,8 @@
angular angular
.module('bit.organization') .module('bit.organization')
.controller('organizationSubvaultsGroupsController', function ($scope, $state, $uibModalInstance, subvault) { .controller('organizationSubvaultsGroupsController', function ($scope, $state, $uibModalInstance, subvault, $analytics) {
$analytics.eventTrack('organizationSubvaultsGroupsController', { category: 'Modal' });
$scope.subvault = subvault; $scope.subvault = subvault;
$scope.close = function () { $scope.close = function () {

View File

@ -3,6 +3,7 @@
.controller('organizationSubvaultsUsersController', function ($scope, $state, $uibModalInstance, apiService, cipherService, .controller('organizationSubvaultsUsersController', function ($scope, $state, $uibModalInstance, apiService, cipherService,
$analytics, subvault, toastr) { $analytics, subvault, toastr) {
$analytics.eventTrack('organizationSubvaultsUsersController', { category: 'Modal' });
$scope.loading = true; $scope.loading = true;
$scope.subvault = subvault; $scope.subvault = subvault;
$scope.users = []; $scope.users = [];
@ -42,6 +43,7 @@
apiService.subvaultUsers.del({ orgId: $state.params.orgId, id: user.id }, null, function () { apiService.subvaultUsers.del({ orgId: $state.params.orgId, id: user.id }, null, function () {
toastr.success(user.email + ' has been removed.', 'User Removed'); toastr.success(user.email + ' has been removed.', 'User Removed');
$analytics.eventTrack('Removed User From Subvault');
var index = $scope.users.indexOf(user); var index = $scope.users.indexOf(user);
if (index > -1) { if (index > -1) {
$scope.users.splice(index, 1); $scope.users.splice(index, 1);

View File

@ -112,7 +112,7 @@
} }
apiService.ciphers.putSubvaults({ id: login.id }, request).$promise.then(function (response) { apiService.ciphers.putSubvaults({ id: login.id }, request).$promise.then(function (response) {
$analytics.eventTrack('Removed From Subvault'); $analytics.eventTrack('Removed Login From Subvault');
login.subvaultIds = request.subvaultIds; login.subvaultIds = request.subvaultIds;
}); });
}; };
@ -123,6 +123,7 @@
} }
apiService.ciphers.delAdmin({ id: login.id }, function () { apiService.ciphers.delAdmin({ id: login.id }, function () {
$analytics.eventTrack('Deleted Login');
var index = $scope.logins.indexOf(login); var index = $scope.logins.indexOf(login);
if (index > -1) { if (index > -1) {
$scope.logins.splice(index, 1); $scope.logins.splice(index, 1);