From d5765d8814247ba06fe372faa518d57fe1951d60 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 18 Dec 2017 13:56:38 -0500 Subject: [PATCH] display app/device info on events --- src/app/constants.js | 13 ++++- src/app/services/eventService.js | 99 +++++++++++++++++++++++++++++++- 2 files changed, 108 insertions(+), 4 deletions(-) diff --git a/src/app/constants.js b/src/app/constants.js index 45a7d06ad1..c81c135b69 100644 --- a/src/app/constants.js +++ b/src/app/constants.js @@ -40,14 +40,25 @@ angular.module('bit') boolean: 2 }, deviceType: { + android: 0, + ios: 1, + chromeExt: 2, + firefoxExt: 3, + operaExt: 4, + edgeExt: 5, + windowsDesktop: 6, + macOsDesktop: 7, + linuxDesktop: 8, chrome: 9, firefox: 10, opera: 11, edge: 12, ie: 13, unknown: 14, + uwp: 16, safari: 17, - vivaldi: 18 + vivaldi: 18, + vivaldiExt: 19 }, eventType: { User_LoggedIn: 1000, diff --git a/src/app/services/eventService.js b/src/app/services/eventService.js index 16925abd7f..8530039aec 100644 --- a/src/app/services/eventService.js +++ b/src/app/services/eventService.js @@ -1,7 +1,7 @@ angular .module('bit.services') - .factory('eventService', function (constants, $filter) { + .factory('eventService', function (constants, $filter, constants) { var _service = {}; _service.getDefaultDateFilters = function () { @@ -40,10 +40,13 @@ angular options = options || { cipherInfo: true }; + + var appInfo = getAppInfo(ev); + return { message: getEventMessage(ev, options), - appIcon: 'fa-globe', - appName: 'Web' + appIcon: appInfo.icon, + appName: appInfo.name }; }; @@ -141,5 +144,95 @@ angular return msg === '' ? null : msg; } + function getAppInfo(ev) { + var appInfo = { + icon: 'fa-globe', + name: 'Unknown' + }; + + switch (ev.DeviceType) { + case constants.deviceType.android: + appInfo.icon = 'fa-android'; + appInfo.name = 'Mobile App - Android'; + break; + case constants.deviceType.ios: + appInfo.icon = 'fa-apple'; + appInfo.name = 'Mobile App - iOS'; + break; + case constants.deviceType.uwp: + appInfo.icon = 'fa-windows'; + appInfo.name = 'Mobile App - Windows'; + break; + case constants.deviceType.chromeExt: + appInfo.icon = 'fa-chrome'; + appInfo.name = 'Extension - Chrome'; + break; + case constants.deviceType.firefoxExt: + appInfo.icon = 'fa-firefox'; + appInfo.name = 'Extension - Firefox'; + break; + case constants.deviceType.operaExt: + appInfo.icon = 'fa-opera'; + appInfo.name = 'Extension - Opera'; + break; + case constants.deviceType.edgeExt: + appInfo.icon = 'fa-edge'; + appInfo.name = 'Extension - Edge'; + break; + case constants.deviceType.vivaldiExt: + appInfo.icon = 'fa-puzzle-piece'; + appInfo.name = 'Extension - Vivaldi'; + break; + case constants.deviceType.windowsDesktop: + appInfo.icon = 'fa-windows'; + appInfo.name = 'Desktop - Windows'; + break; + case constants.deviceType.macOsDesktop: + appInfo.icon = 'fa-apple'; + appInfo.name = 'Desktop - macOS'; + break; + case constants.deviceType.linuxDesktop: + appInfo.icon = 'fa-linux'; + appInfo.name = 'Desktop - Linux'; + break; + case constants.deviceType.chrome: + appInfo.icon = 'fa-chrome'; + appInfo.name = 'Web Vault - Chrome'; + break; + case constants.deviceType.firefox: + appInfo.icon = 'fa-firefox'; + appInfo.name = 'Web Vault - Firefox'; + break; + case constants.deviceType.opera: + appInfo.icon = 'fa-opera'; + appInfo.name = 'Web Vault - Opera'; + break; + case constants.deviceType.safari: + appInfo.icon = 'fa-safari'; + appInfo.name = 'Web Vault - Safari'; + break; + case constants.deviceType.vivaldi: + appInfo.icon = 'fa-globe'; + appInfo.name = 'Web Vault - Vivaldi'; + break; + case constants.deviceType.edge: + appInfo.icon = 'fa-edge'; + appInfo.name = 'Web Vault - Edge'; + break; + case constants.deviceType.ie: + appInfo.icon = 'fa-internet-explorer'; + appInfo.name = 'Web Vault - IE'; + break; + case constants.deviceType.unknown: + appInfo.icon = 'fa-globe'; + appInfo.name = 'Web Vault - Unknown'; + break; + default: + break; + } + + return appInfo; + } + return _service; });