Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websocket #580

Merged
merged 7 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
986 changes: 239 additions & 747 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
},
"homepage": "https://github.com/Azure/azure-iot-explorer#readme",
"dependencies": {
"@azure/core-amqp": "^3.2.0",
"@azure/event-hubs": "1.0.7",
"@azure/core-amqp": "3.2.0",
"@azure/event-hubs": "5.6.0",
"@azure/msal-node": "1.3.0",
"@fluentui/react": "8.20.2",
"@microsoft/applicationinsights-web": "2.8.4",
Expand All @@ -87,13 +87,12 @@
"immutable": "4.0.0-rc.12",
"jsonschema": "1.2.4",
"msal": "1.2.0",
"protobufjs": "^7.0.0",
"protobufjs": "7.0.0",
"react": "16.14.0",
"react-collapsible": "2.3.2",
"react-dom": "16.13.1",
"react-i18next": "11.11.1",
"react-jsonschema-form": "1.7.0",
"react-qr-code": "^2.0.1",
"react-router-dom": "5.2.0",
"react-smooth-dnd": "0.11.0",
"react-toastify": "4.4.0",
Expand All @@ -102,7 +101,8 @@
"semver": "6.3.0",
"typescript-fsa": "3.0.0-beta-2",
"typescript-fsa-reducers": "1.0.0",
"uuid": "3.3.3"
"uuid": "3.3.3",
"ws": "5.2.0"
},
"devDependencies": {
"@redux-saga/testing-utils": "1.1.3",
Expand All @@ -118,7 +118,7 @@
"@types/react": "16.9.35",
"@types/react-dom": "16.9.8",
"@types/react-jsonschema-form": "1.0.10",
"@types/react-router-dom": "^5.3.3",
"@types/react-router-dom": "5.3.3",
"@types/request": "2.48.1",
"@types/semver": "6.0.2",
"@types/uuid": "3.4.5",
Expand Down
3 changes: 0 additions & 3 deletions public/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ export const MESSAGE_CHANNELS = {
AUTHENTICATION_LOGIN: 'authentication_login',
AUTHENTICATION_LOGOUT: 'authentication_logout',
DIRECTORY_GET_DIRECTORIES: 'directory_getDirectories',
EVENTHUB_START_MONITORING: 'eventhub_startMonitoring',
EVENTHUB_STOP_MONITORING: 'eventhub_stopMonitoring',
MODEL_REPOSITORY_GET_DEFINITION: 'model_definition',
SETTING_HIGH_CONTRAST: 'setting_highContrast',
};
Expand All @@ -21,7 +19,6 @@ export const API_INTERFACES = {
AUTHENTICATION: 'api_authentication',
DEVICE: 'api_device',
DIRECTORY: 'api_directory',
EVENTHUB: 'api_eventhub',
MODEL_DEFINITION: 'api_modelDefinition',
SETTINGS: 'api_settings'
};
2 changes: 0 additions & 2 deletions public/contextBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ import { contextBridge } from 'electron';
import { generateSettingsInterface } from './factories/settingsInterfaceFactory';
import { generateDirectoryInterface } from './factories/directoryInterfaceFactory';
import { generateModelRepositoryInterface } from './factories/modelRepositoryInterfaceFactory';
import { generateEventHubInterface } from './factories/eventHubInterfaceFactory';
import { generateAuthenticationInterface } from './factories/authenticationInterfaceFactory';
import { API_INTERFACES } from './constants';

contextBridge.exposeInMainWorld(API_INTERFACES.DIRECTORY, generateDirectoryInterface());
contextBridge.exposeInMainWorld(API_INTERFACES.EVENTHUB, generateEventHubInterface());
contextBridge.exposeInMainWorld(API_INTERFACES.MODEL_DEFINITION, generateModelRepositoryInterface());
contextBridge.exposeInMainWorld(API_INTERFACES.SETTINGS, generateSettingsInterface());
contextBridge.exposeInMainWorld(API_INTERFACES.AUTHENTICATION, generateAuthenticationInterface());
3 changes: 0 additions & 3 deletions public/electron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { PLATFORMS, MESSAGE_CHANNELS } from './constants';
import { onSettingsHighContrast } from './handlers/settingsHandler';
import { onGetInterfaceDefinition } from './handlers/modelRepositoryHandler';
import { onGetDirectories } from './handlers/directoryHandler';
import { onStartMonitoring, onStopMonitoring } from './handlers/eventHubHandler';
import { formatError } from './utils/errorHelper';
import { AuthProvider } from './utils/authProvider';
import '../dist/server/serverElectron';
Expand All @@ -33,8 +32,6 @@ class Main {
Main.registerHandler(MESSAGE_CHANNELS.SETTING_HIGH_CONTRAST, onSettingsHighContrast);
Main.registerHandler(MESSAGE_CHANNELS.MODEL_REPOSITORY_GET_DEFINITION, onGetInterfaceDefinition);
Main.registerHandler(MESSAGE_CHANNELS.DIRECTORY_GET_DIRECTORIES, onGetDirectories);
Main.registerHandler(MESSAGE_CHANNELS.EVENTHUB_START_MONITORING, onStartMonitoring);
Main.registerHandler(MESSAGE_CHANNELS.EVENTHUB_STOP_MONITORING, onStopMonitoring);
Main.registerHandler(MESSAGE_CHANNELS.AUTHENTICATION_LOGIN, Main.onLogin);
Main.registerHandler(MESSAGE_CHANNELS.AUTHENTICATION_LOGOUT, Main.onLogout);
Main.registerHandler(MESSAGE_CHANNELS.AUTHENTICATION_GET_PROFILE_TOKEN, Main.onGetProfileToken);
Expand Down
18 changes: 0 additions & 18 deletions public/factories/eventHubInterfaceFactory.ts

This file was deleted.

46 changes: 0 additions & 46 deletions public/handlers/deviceHandler.ts

This file was deleted.

162 changes: 0 additions & 162 deletions public/handlers/eventHubHandler.ts

This file was deleted.

8 changes: 0 additions & 8 deletions public/interfaces/eventHubInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ export interface StartEventHubMonitoringParameters {
moduleId: string;
consumerGroup: string;
startTime: string;
startListeners: boolean;

customEventHubName?: string;
customEventHubConnectionString?: string;
hubConnectionString?: string;
}
Expand All @@ -20,8 +17,3 @@ export interface Message {
properties?: any; // tslint:disable-line:no-any
systemProperties?: {[key: string]: string};
}

export interface EventHubInterface {
startEventHubMonitoring(params: StartEventHubMonitoringParameters): Promise<Message[]>;
stopEventHubMonitoring(): Promise<void>;
}
26 changes: 26 additions & 0 deletions src/app/api/handlers/eventHubServiceHandler.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/***********************************************************
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License
**********************************************************/
import { Message, StartEventHubMonitoringParameters } from '../../../../public/interfaces/eventHubInterface';
import { CONTROLLER_API_ENDPOINT, DataPlaneStatusCode, EVENTHUB, MONITOR, STOP } from '../../constants/apiConstants';
import { request } from '../services/dataplaneServiceHelper';

const EVENTHUB_CONTROLLER_ENDPOINT = `${CONTROLLER_API_ENDPOINT}${EVENTHUB}`;
export const EVENTHUB_MONITOR_ENDPOINT = `${EVENTHUB_CONTROLLER_ENDPOINT}${MONITOR}`;
export const EVENTHUB_STOP_ENDPOINT = `${EVENTHUB_CONTROLLER_ENDPOINT}${STOP}`;

export const startEventHubMonitoring = async (params: StartEventHubMonitoringParameters): Promise<Message[]> => {
const response = await request(EVENTHUB_MONITOR_ENDPOINT, params);
if (response.status === DataPlaneStatusCode.SuccessLowerBound) {
return await response.json() as Message[];
}
else {
const error = await response.json();
throw new Error(error && error.name);
}
};

export const stopEventHubMonitoring = async (): Promise<void> => {
await request(EVENTHUB_STOP_ENDPOINT, {});
};
17 changes: 0 additions & 17 deletions src/app/api/legacy/devicesServiceHandler.ts

This file was deleted.

Loading