mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-11-21 08:34:40 -06:00
SDA-4291 - Move interfaces into a dedicate file (#1978)
This commit is contained in:
parent
ae41c6ceee
commit
ee9e81037d
@ -1,6 +1,6 @@
|
||||
jest.mock('save-svg-as-png', function () {
|
||||
return {
|
||||
svgAsPngUri: async function (svg) {
|
||||
async svgAsPngUri(svg) {
|
||||
return Promise.resolve(svg);
|
||||
},
|
||||
};
|
||||
@ -8,7 +8,7 @@ jest.mock('save-svg-as-png', function () {
|
||||
|
||||
import { mount, shallow } from 'enzyme';
|
||||
import * as React from 'react';
|
||||
import { ScreenSnippetActionTypes } from '../src/app/bi/analytics-handler';
|
||||
import { ScreenSnippetActionTypes } from '../src/app/bi/interface';
|
||||
import { ScreenShotAnnotation } from '../src/common/ipcEvent';
|
||||
import SnippingTool from '../src/renderer/components/snipping-tool';
|
||||
import { ipcRenderer } from './__mocks__/electron';
|
||||
|
@ -10,12 +10,7 @@ import { apiName } from '../common/api-interface';
|
||||
import { isLinux, isMac, isWindowsOS } from '../common/env';
|
||||
import { i18n, LocaleType } from '../common/i18n';
|
||||
import { logger } from '../common/logger';
|
||||
import {
|
||||
analytics,
|
||||
AnalyticsActions,
|
||||
AnalyticsElements,
|
||||
MenuActionTypes,
|
||||
} from './bi/analytics-handler';
|
||||
import { analytics } from './bi/analytics-handler';
|
||||
import { CloudConfigDataTypes, config, IConfig } from './config-handler';
|
||||
import { restartDialog, titleBarChangeDialog } from './dialog-handler';
|
||||
import { exportCrashDumps, exportLogs } from './reports-handler';
|
||||
@ -39,6 +34,11 @@ import {
|
||||
|
||||
import { autoLaunchInstance as autoLaunch } from './auto-launch-controller';
|
||||
import { autoUpdate, AutoUpdateTrigger } from './auto-update-handler';
|
||||
import {
|
||||
AnalyticsActions,
|
||||
AnalyticsElements,
|
||||
MenuActionTypes,
|
||||
} from './bi/interface';
|
||||
|
||||
export const menuSections = {
|
||||
about: 'about',
|
||||
|
@ -6,8 +6,8 @@ import { isMac, isWindowsOS } from '../common/env';
|
||||
import { logger } from '../common/logger';
|
||||
import { isUrl } from '../common/utils';
|
||||
import { whitelistHandler } from '../common/whitelist-handler';
|
||||
import { InstallActionTypes, InstallTypes } from './bi/analytics-handler';
|
||||
import { sendAutoUpdateAnalytics } from './bi/auto-update-analytics';
|
||||
import { InstallActionTypes, InstallTypes } from './bi/interface';
|
||||
import { config } from './config-handler';
|
||||
import { retrieveWindowsRegistry } from './registry-handler';
|
||||
import { EChannelRegistry, RegistryStore } from './stores/registry-store';
|
||||
|
@ -2,135 +2,14 @@ import { app, WebContents } from 'electron';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import { logger } from '../../common/logger';
|
||||
|
||||
export interface IAnalyticsData {
|
||||
element: AnalyticsElements;
|
||||
action_type?:
|
||||
| MenuActionTypes
|
||||
| ScreenSnippetActionTypes
|
||||
| ToastNotificationActionTypes
|
||||
| SDAUserSessionActionTypes
|
||||
| InstallActionTypes;
|
||||
action_result?: AnalyticsActions;
|
||||
extra_data?: object;
|
||||
}
|
||||
|
||||
export interface ICrashData extends IAnalyticsData {
|
||||
process: SDACrashProcess;
|
||||
crashCause: string;
|
||||
windowName: string;
|
||||
miniDump?: string;
|
||||
}
|
||||
|
||||
export interface ISessionData extends IAnalyticsData {
|
||||
extra_data?: {
|
||||
sessionStartDatetime?: string;
|
||||
machineStartDatetime?: string;
|
||||
machineId?: string;
|
||||
InstallVariant?: string;
|
||||
osName?: string;
|
||||
osVersion?: string;
|
||||
osLanguage?: string;
|
||||
osTimeZone?: string;
|
||||
cpuNumberOfCores?: number;
|
||||
cpuMaxFrequency?: number;
|
||||
cpuUsagePercent?: number;
|
||||
maxCPUUsagePercent?: number;
|
||||
memoryTotal?: number;
|
||||
memoryUsedPercent?: number;
|
||||
maxMemoryUsedPercent?: number;
|
||||
sdaUsedMemory?: number;
|
||||
memoryAvailable?: number;
|
||||
vdi?: boolean;
|
||||
endReason?: string;
|
||||
crashProcess?: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface IInstallData extends IAnalyticsData {
|
||||
extra_data?: {
|
||||
installLocation: string;
|
||||
installType: string;
|
||||
};
|
||||
}
|
||||
|
||||
export enum MenuActionTypes {
|
||||
AUTO_LAUNCH_ON_START_UP = 'auto_launch_on_start_up',
|
||||
ALWAYS_ON_TOP = 'always_on_top',
|
||||
MINIMIZE_ON_CLOSE = 'minimize_on_close',
|
||||
FLASH_NOTIFICATION_IN_TASK_BAR = 'flash_notification_in_task_bar',
|
||||
HAMBURGER_MENU = 'hamburger_menu',
|
||||
REFRESH_APP_IN_IDLE = 'refresh_app_in_idle',
|
||||
}
|
||||
|
||||
export enum ScreenSnippetActionTypes {
|
||||
SCREENSHOT_TAKEN = 'screenshot_taken',
|
||||
ANNOTATE_ADDED_PEN = 'annotate_added_pen',
|
||||
ANNOTATE_ADDED_HIGHLIGHT = 'annotate_added_highlight',
|
||||
ANNOTATE_ADD = 'annotate_done',
|
||||
ANNOTATE_CLEARED = 'annotate_cleared',
|
||||
ANNOTATE_ERASED = 'annotate_erased',
|
||||
ANNOTATE_COPY = 'annotate_copy',
|
||||
ANNOTATE_SAVE_AS = 'annotate_save_as',
|
||||
ANNOTATE_CLOSE = 'annotate_close',
|
||||
}
|
||||
|
||||
export enum ToastNotificationActionTypes {
|
||||
TOAST_CLOSED = 'toast_closed',
|
||||
}
|
||||
|
||||
export enum SDAUserSessionActionTypes {
|
||||
Start = 'Start',
|
||||
End = 'End',
|
||||
Login = 'Login',
|
||||
Logout = 'Logout',
|
||||
Crash = 'Crash',
|
||||
ForceReload = 'Force_reload',
|
||||
}
|
||||
|
||||
export enum InstallActionTypes {
|
||||
InstallStarted = 'Install_started',
|
||||
InstallCompleted = 'Install_completed',
|
||||
InstallFailed = 'Install_failed',
|
||||
}
|
||||
|
||||
export enum InstallTypes {
|
||||
Auto = 'auto',
|
||||
Manual = 'manual',
|
||||
}
|
||||
|
||||
export enum InstallLocationTypes {
|
||||
PROG_FILES = 'PROG_FILES',
|
||||
REMOTE = 'REMOTE',
|
||||
LOCAL = 'LOCAL',
|
||||
CUSTOM = 'CUSTOM',
|
||||
}
|
||||
|
||||
export enum SDAEndReasonTypes {
|
||||
Reboot = 'Reboot',
|
||||
Closed = 'Closed',
|
||||
Crashed = 'Crashed',
|
||||
}
|
||||
|
||||
export enum AnalyticsActions {
|
||||
ENABLED = 'ON',
|
||||
DISABLED = 'OFF',
|
||||
}
|
||||
|
||||
export enum AnalyticsElements {
|
||||
MENU = 'Menu',
|
||||
SCREEN_CAPTURE_ANNOTATE = 'screen_capture_annotate',
|
||||
TOAST_NOTIFICATION = 'toast_notification',
|
||||
SDA_CRASH = 'sda_crash',
|
||||
SDA_SESSION = 'sda_session',
|
||||
SDA_INSTALL = 'sda_install',
|
||||
}
|
||||
|
||||
export enum SDACrashProcess {
|
||||
MAIN = 'main',
|
||||
RENDERER = 'renderer',
|
||||
GPU = 'gpu',
|
||||
}
|
||||
import {
|
||||
AnalyticsElements,
|
||||
IAnalyticsData,
|
||||
ICrashData,
|
||||
InstallActionTypes,
|
||||
ISessionData,
|
||||
SDAUserSessionActionTypes,
|
||||
} from './interface';
|
||||
|
||||
const MAX_EVENT_QUEUE_LENGTH = 50;
|
||||
const analyticsCallback = 'analytics-callback';
|
||||
|
@ -1,13 +1,13 @@
|
||||
import { app } from 'electron';
|
||||
import { isMac, isWindowsOS } from '../../common/env';
|
||||
import { analytics } from './analytics-handler';
|
||||
import {
|
||||
analytics,
|
||||
AnalyticsElements,
|
||||
IInstallData,
|
||||
InstallActionTypes,
|
||||
InstallLocationTypes,
|
||||
InstallTypes,
|
||||
} from './analytics-handler';
|
||||
} from './interface';
|
||||
|
||||
/**
|
||||
* Sends auto update analytics event
|
||||
|
128
src/app/bi/interface.ts
Normal file
128
src/app/bi/interface.ts
Normal file
@ -0,0 +1,128 @@
|
||||
export enum SDACrashProcess {
|
||||
MAIN = 'main',
|
||||
RENDERER = 'renderer',
|
||||
GPU = 'gpu',
|
||||
}
|
||||
|
||||
export interface ICrashData extends IAnalyticsData {
|
||||
process: SDACrashProcess;
|
||||
crashCause: string;
|
||||
windowName: string;
|
||||
miniDump?: string;
|
||||
}
|
||||
|
||||
export interface IInstallData extends IAnalyticsData {
|
||||
extra_data?: {
|
||||
installLocation: string;
|
||||
installType: string;
|
||||
};
|
||||
}
|
||||
|
||||
export enum MenuActionTypes {
|
||||
AUTO_LAUNCH_ON_START_UP = 'auto_launch_on_start_up',
|
||||
ALWAYS_ON_TOP = 'always_on_top',
|
||||
MINIMIZE_ON_CLOSE = 'minimize_on_close',
|
||||
FLASH_NOTIFICATION_IN_TASK_BAR = 'flash_notification_in_task_bar',
|
||||
HAMBURGER_MENU = 'hamburger_menu',
|
||||
REFRESH_APP_IN_IDLE = 'refresh_app_in_idle',
|
||||
}
|
||||
|
||||
export enum ScreenSnippetActionTypes {
|
||||
SCREENSHOT_TAKEN = 'screenshot_taken',
|
||||
ANNOTATE_ADDED_PEN = 'annotate_added_pen',
|
||||
ANNOTATE_ADDED_HIGHLIGHT = 'annotate_added_highlight',
|
||||
ANNOTATE_ADD = 'annotate_done',
|
||||
ANNOTATE_CLEARED = 'annotate_cleared',
|
||||
ANNOTATE_ERASED = 'annotate_erased',
|
||||
ANNOTATE_COPY = 'annotate_copy',
|
||||
ANNOTATE_SAVE_AS = 'annotate_save_as',
|
||||
ANNOTATE_CLOSE = 'annotate_close',
|
||||
}
|
||||
|
||||
export enum ToastNotificationActionTypes {
|
||||
TOAST_CLOSED = 'toast_closed',
|
||||
}
|
||||
|
||||
export enum SDAUserSessionActionTypes {
|
||||
Start = 'Start',
|
||||
End = 'End',
|
||||
Login = 'Login',
|
||||
Logout = 'Logout',
|
||||
Crash = 'Crash',
|
||||
ForceReload = 'Force_reload',
|
||||
}
|
||||
|
||||
export enum InstallActionTypes {
|
||||
InstallStarted = 'Install_started',
|
||||
InstallCompleted = 'Install_completed',
|
||||
InstallFailed = 'Install_failed',
|
||||
}
|
||||
|
||||
export enum InstallTypes {
|
||||
Auto = 'auto',
|
||||
Manual = 'manual',
|
||||
}
|
||||
|
||||
export enum InstallLocationTypes {
|
||||
PROG_FILES = 'PROG_FILES',
|
||||
REMOTE = 'REMOTE',
|
||||
LOCAL = 'LOCAL',
|
||||
CUSTOM = 'CUSTOM',
|
||||
}
|
||||
|
||||
export enum SDAEndReasonTypes {
|
||||
Reboot = 'Reboot',
|
||||
Closed = 'Closed',
|
||||
Crashed = 'Crashed',
|
||||
}
|
||||
|
||||
export enum AnalyticsActions {
|
||||
ENABLED = 'ON',
|
||||
DISABLED = 'OFF',
|
||||
}
|
||||
|
||||
export enum AnalyticsElements {
|
||||
MENU = 'Menu',
|
||||
SCREEN_CAPTURE_ANNOTATE = 'screen_capture_annotate',
|
||||
TOAST_NOTIFICATION = 'toast_notification',
|
||||
SDA_CRASH = 'sda_crash',
|
||||
SDA_SESSION = 'sda_session',
|
||||
SDA_INSTALL = 'sda_install',
|
||||
}
|
||||
|
||||
export interface IAnalyticsData {
|
||||
element: AnalyticsElements;
|
||||
action_type?:
|
||||
| MenuActionTypes
|
||||
| ScreenSnippetActionTypes
|
||||
| ToastNotificationActionTypes
|
||||
| SDAUserSessionActionTypes
|
||||
| InstallActionTypes;
|
||||
action_result?: AnalyticsActions;
|
||||
extra_data?: object;
|
||||
}
|
||||
|
||||
export interface ISessionData extends IAnalyticsData {
|
||||
extra_data?: {
|
||||
sessionStartDatetime?: string;
|
||||
machineStartDatetime?: string;
|
||||
machineId?: string;
|
||||
InstallVariant?: string;
|
||||
osName?: string;
|
||||
osVersion?: string;
|
||||
osLanguage?: string;
|
||||
osTimeZone?: string;
|
||||
cpuNumberOfCores?: number;
|
||||
cpuMaxFrequency?: number;
|
||||
cpuUsagePercent?: number;
|
||||
maxCPUUsagePercent?: number;
|
||||
memoryTotal?: number;
|
||||
memoryUsedPercent?: number;
|
||||
maxMemoryUsedPercent?: number;
|
||||
sdaUsedMemory?: number;
|
||||
memoryAvailable?: number;
|
||||
vdi?: boolean;
|
||||
endReason?: string;
|
||||
crashProcess?: string;
|
||||
};
|
||||
}
|
@ -7,14 +7,14 @@ import { buildNumber } from '../../package.json';
|
||||
import { isDevEnv, isElectronQA, isLinux, isMac } from '../common/env';
|
||||
import { logger } from '../common/logger';
|
||||
import { arrayEquals, filterOutSelectedValues, pick } from '../common/utils';
|
||||
import { analytics } from './bi/analytics-handler';
|
||||
import { sendAutoUpdateAnalytics } from './bi/auto-update-analytics';
|
||||
import {
|
||||
analytics,
|
||||
InstallActionTypes,
|
||||
InstallTypes,
|
||||
SDAEndReasonTypes,
|
||||
SDAUserSessionActionTypes,
|
||||
} from './bi/analytics-handler';
|
||||
import { sendAutoUpdateAnalytics } from './bi/auto-update-analytics';
|
||||
} from './bi/interface';
|
||||
import { appStats } from './stats';
|
||||
|
||||
const writeFile = util.promisify(fs.writeFile);
|
||||
|
@ -8,12 +8,8 @@ import {
|
||||
} from 'electron';
|
||||
import { i18n } from '../common/i18n';
|
||||
import { logger } from '../common/logger';
|
||||
import {
|
||||
analytics,
|
||||
AnalyticsElements,
|
||||
ICrashData,
|
||||
SDACrashProcess,
|
||||
} from './bi/analytics-handler';
|
||||
import { analytics } from './bi/analytics-handler';
|
||||
import { AnalyticsElements, ICrashData, SDACrashProcess } from './bi/interface';
|
||||
import { ICustomBrowserWindow } from './window-handler';
|
||||
import { windowExists } from './window-utils';
|
||||
|
||||
|
@ -21,7 +21,7 @@ import { logger } from '../common/logger';
|
||||
import { whitelistHandler } from '../common/whitelist-handler';
|
||||
import { activityDetection } from './activity-detection';
|
||||
import appStateHandler from './app-state-handler';
|
||||
import { analytics, SDAUserSessionActionTypes } from './bi/analytics-handler';
|
||||
import { analytics } from './bi/analytics-handler';
|
||||
import { closeC9Pipe, connectC9Pipe, writeC9Pipe } from './c9-pipe-handler';
|
||||
import { loadC9Shell, terminateC9Shell } from './c9-shell-handler';
|
||||
import { getCitrixMediaRedirectionStatus } from './citrix-handler';
|
||||
@ -53,6 +53,7 @@ import {
|
||||
import { getCommandLineArgs } from '../common/utils';
|
||||
import callNotificationHelper from '../renderer/call-notification-helper';
|
||||
import { autoUpdate, AutoUpdateTrigger } from './auto-update-handler';
|
||||
import { SDAUserSessionActionTypes } from './bi/interface';
|
||||
import { presenceStatus } from './presence-status-handler';
|
||||
import { appStats } from './stats';
|
||||
import { presenceStatusStore } from './stores/index';
|
||||
|
@ -2,7 +2,7 @@ import * as electron from 'electron';
|
||||
|
||||
import { isMac } from '../common/env';
|
||||
import { logger } from '../common/logger';
|
||||
import { SDAUserSessionActionTypes } from './bi/analytics-handler';
|
||||
import { SDAUserSessionActionTypes } from './bi/interface';
|
||||
import { CloudConfigDataTypes, config } from './config-handler';
|
||||
import { appStats } from './stats';
|
||||
import { windowHandler } from './window-handler';
|
||||
|
@ -25,11 +25,8 @@ import {
|
||||
import { i18n } from '../common/i18n';
|
||||
import { ScreenShotAnnotation } from '../common/ipcEvent';
|
||||
import { logger } from '../common/logger';
|
||||
import {
|
||||
analytics,
|
||||
AnalyticsElements,
|
||||
ScreenSnippetActionTypes,
|
||||
} from './bi/analytics-handler';
|
||||
import { analytics } from './bi/analytics-handler';
|
||||
import { AnalyticsElements, ScreenSnippetActionTypes } from './bi/interface';
|
||||
import { winStore } from './stores';
|
||||
import { IWindowState } from './stores/window-store';
|
||||
import { updateAlwaysOnTop } from './window-actions';
|
||||
|
@ -4,13 +4,13 @@ import * as si from 'systeminformation';
|
||||
|
||||
import { buildNumber, version } from '../../package.json';
|
||||
import { logger } from '../common/logger';
|
||||
import { analytics } from './bi/analytics-handler';
|
||||
import {
|
||||
analytics,
|
||||
AnalyticsElements,
|
||||
ISessionData,
|
||||
SDAEndReasonTypes,
|
||||
SDAUserSessionActionTypes,
|
||||
} from './bi/analytics-handler';
|
||||
} from './bi/interface';
|
||||
|
||||
const MAX_USAGE_CHECK_INTERVAL = 15 * 60 * 1000; // every 15min
|
||||
|
||||
|
@ -40,11 +40,8 @@ import {
|
||||
import { notification } from '../renderer/notification';
|
||||
import { cleanAppCacheOnCrash } from './app-cache-handler';
|
||||
import { AppMenu } from './app-menu';
|
||||
import {
|
||||
analytics,
|
||||
SDAEndReasonTypes,
|
||||
SDAUserSessionActionTypes,
|
||||
} from './bi/analytics-handler';
|
||||
import { analytics } from './bi/analytics-handler';
|
||||
import { SDAEndReasonTypes, SDAUserSessionActionTypes } from './bi/interface';
|
||||
import { closeC9Pipe } from './c9-pipe-handler';
|
||||
import { handleChildWindow } from './child-window-handler';
|
||||
import {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { IAnalyticsData } from '../app/bi/analytics-handler';
|
||||
import { IAnalyticsData } from '../app/bi/interface';
|
||||
import {
|
||||
apiCmds,
|
||||
apiName,
|
||||
|
@ -3,7 +3,7 @@ import * as React from 'react';
|
||||
import {
|
||||
AnalyticsElements,
|
||||
ScreenSnippetActionTypes,
|
||||
} from '../../app/bi/analytics-handler';
|
||||
} from '../../app/bi/interface';
|
||||
import {
|
||||
IDimensions,
|
||||
IPath,
|
||||
|
@ -4,7 +4,7 @@ import { svgAsPngUri } from 'save-svg-as-png';
|
||||
import {
|
||||
AnalyticsElements,
|
||||
ScreenSnippetActionTypes,
|
||||
} from '../../app/bi/analytics-handler';
|
||||
} from '../../app/bi/interface';
|
||||
import { i18n } from '../../common/i18n-preload';
|
||||
import { ScreenShotAnnotation } from '../../common/ipcEvent';
|
||||
import * as PenIcon from '../../renderer/assets/snip-draw.svg';
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { app, BrowserWindow, ipcMain } from 'electron';
|
||||
|
||||
import { analytics } from '../app/bi/analytics-handler';
|
||||
import {
|
||||
analytics,
|
||||
AnalyticsElements,
|
||||
ToastNotificationActionTypes,
|
||||
} from '../app/bi/analytics-handler';
|
||||
} from '../app/bi/interface';
|
||||
import { config } from '../app/config-handler';
|
||||
import {
|
||||
AUX_CLICK,
|
||||
|
Loading…
Reference in New Issue
Block a user