Skip to content

Commit

Permalink
remove enqueue time from events
Browse files Browse the repository at this point in the history
  • Loading branch information
YingXue committed Apr 4, 2024
1 parent 85a45f8 commit b491f08
Show file tree
Hide file tree
Showing 12 changed files with 9 additions and 240 deletions.
1 change: 0 additions & 1 deletion public/interfaces/eventHubInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export interface StartEventHubMonitoringParameters {
deviceId: string;
moduleId: string;
consumerGroup: string;
startTime: string;
customEventHubConnectionString?: string;
hubConnectionString?: string;
}
Expand Down
1 change: 0 additions & 1 deletion src/app/api/parameters/deviceParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export interface MonitorEventsParameters {
consumerGroup: string;
customEventHubConnectionString?: string;
hubConnectionString?: string;
startTime?: Date;
decoderPrototype?: Type;
}

Expand Down
7 changes: 2 additions & 5 deletions src/app/api/services/devicesService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,16 +252,13 @@ export const deleteDevices = async (parameters: DeleteDevicesParameters) => {
};

export const monitorEvents = async (parameters: MonitorEventsParameters): Promise<void> => {
let requestParameters = {
...parameters,
startTime: parameters.startTime && parameters.startTime.toISOString()
};
let requestParameters = parameters;

// if no custom event hub info is provided, use default hub connection string to connect to event hub
if (!parameters.customEventHubConnectionString) {
const connectionInfo = await dataPlaneConnectionHelper();
requestParameters = {
...requestParameters,
...parameters,
hubConnectionString: connectionInfo.connectionString
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ exports[`deviceEvents matches snapshot after loaded 1`] = `
setConsumerGroup={[Function]}
/>
</div>
<StartTime
monitoringData={false}
setHasError={[Function]}
setSpecifyStartTime={[Function]}
setStartTime={[Function]}
specifyStartTime={false}
/>
<div
className="horizontal-item"
>
Expand Down

This file was deleted.

24 changes: 2 additions & 22 deletions src/app/devices/deviceEvents/components/deviceEvents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { DeviceSimulationPanel } from './deviceSimulationPanel';
import { Commands } from './commands';
import { CustomEventHub } from './customEventHub';
import { ConsumerGroup } from './consumerGroup';
import { StartTime } from './startTime';
import { DeviceContentTypePanel } from './deviceContentTypePanel';
import { Loader } from './loader';
import { EventsContent } from './eventsContent';
Expand All @@ -35,8 +34,6 @@ export const DeviceEvents: React.FC = () => {

// event hub settings
const [consumerGroup, setConsumerGroup] = React.useState(DEFAULT_CONSUMER_GROUP);
const [specifyStartTime, setSpecifyStartTime] = React.useState<boolean>(false);
const [startTime, setStartTime] = React.useState<Date>();
const [useBuiltInEventHub, setUseBuiltInEventHub] = React.useState<boolean>(true);
const [customEventHubConnectionString, setCustomEventHubConnectionString] = React.useState<string>(undefined);
const [showSystemProperties, setShowSystemProperties] = React.useState<boolean>(false);
Expand Down Expand Up @@ -85,8 +82,6 @@ export const DeviceEvents: React.FC = () => {
React.useEffect( // tslint:disable-next-line: cyclomatic-complexity
() => {
if (state.formMode === 'updating' ||
// when specifying start time, valid time need to be provided
(specifyStartTime && (!startTime || hasError)) ||
// when using custom event hub, both valid connection string and name need to be provided
(!useBuiltInEventHub && (!customEventHubConnectionString || hasError))) {
setStartDisabled(true);
Expand All @@ -95,7 +90,7 @@ export const DeviceEvents: React.FC = () => {
setStartDisabled(false);
}
},
[hasError, state.formMode, useBuiltInEventHub, customEventHubConnectionString, specifyStartTime, startTime]);
[hasError, state.formMode, useBuiltInEventHub, customEventHubConnectionString]);

const onSystemPropertyCheckBoxChange = (ev?: React.FormEvent<HTMLElement | HTMLInputElement>, checked?: boolean) => {
setShowSystemProperties(!!checked);
Expand Down Expand Up @@ -131,19 +126,6 @@ export const DeviceEvents: React.FC = () => {
);
};

const renderStartTimePicker = () => {
return (
<StartTime
monitoringData={monitoringData}
specifyStartTime={specifyStartTime}
startTime={startTime}
setSpecifyStartTime={setSpecifyStartTime}
setStartTime={setStartTime}
setHasError={setHasError}
/>
);
};

const renderCustomEventHub = () => {
return (
<div className="horizontal-item">
Expand All @@ -170,8 +152,7 @@ export const DeviceEvents: React.FC = () => {
consumerGroup,
decoderPrototype,
deviceId,
moduleId,
startTime
moduleId
};

if (!useBuiltInEventHub) {
Expand Down Expand Up @@ -203,7 +184,6 @@ export const DeviceEvents: React.FC = () => {
tooltip={ResourceKeys.deviceEvents.tooltip}
/>
{renderConsumerGroup()}
{renderStartTimePicker()}
{renderCustomEventHub()}
<DeviceSimulationPanel
showSimulationPanel={showSimulationPanel}
Expand Down
56 changes: 0 additions & 56 deletions src/app/devices/deviceEvents/components/startTime.spec.tsx

This file was deleted.

95 changes: 0 additions & 95 deletions src/app/devices/deviceEvents/components/startTime.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/app/devices/deviceEvents/reducer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Type } from 'protobufjs';

describe('deviceEventsReducer', () => {
const deviceId = 'testDeviceId';
const params = {consumerGroup: DEFAULT_CONSUMER_GROUP, deviceId, moduleId:'', startTime: new Date()};
const params = {consumerGroup: DEFAULT_CONSUMER_GROUP, deviceId, moduleId:''};
const events = [{
body: {
humid: '123' // intentionally set a value which type is double
Expand Down
5 changes: 0 additions & 5 deletions src/localization/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -593,11 +593,6 @@
"label": "Consumer group",
"tooltip": "Consumer groups are used by applications to pull data from the IoT Hub. To change the current consumer group, stop monitoring telemetry."
},
"startTime": {
"error": "Please enter datetime format in yyyy/mm/dd/hh/mm/ss",
"label": "Start time",
"tooltip": "Indicates the local enqueue time that should be used to read messages from the event hub. If not specified, the enqueue time would be the moment you click on the 'Start' button."
},
"customEventHub": {
"connectionString": {
"label": "Custom event hub connection string",
Expand Down
5 changes: 0 additions & 5 deletions src/localization/resourceKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,11 +419,6 @@ export class ResourceKeys {
tooltiop : "deviceEvents.simulation.prerequisite.tooltiop",
},
},
startTime : {
error : "deviceEvents.startTime.error",
label : "deviceEvents.startTime.label",
tooltip : "deviceEvents.startTime.tooltip",
},
toggleShowRawData : {
label : "deviceEvents.toggleShowRawData.label",
off : "deviceEvents.toggleShowRawData.off",
Expand Down
6 changes: 4 additions & 2 deletions src/server/serverBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as express from 'express';
import * as bodyParser from 'body-parser';
import * as cors from 'cors';
import fetch from 'node-fetch';
import { EventHubConsumerClient, Subscription, ReceivedEventData } from '@azure/event-hubs';
import { EventHubConsumerClient, Subscription, ReceivedEventData, earliestEventPosition } from '@azure/event-hubs';
import { generateDataPlaneRequestBody, generateDataPlaneResponse } from './dataPlaneHelper';
import { convertIotHubToEventHubsConnectionString } from './eventHubHelper';
import { fetchDirectories, fetchDrivesOnWindows, findMatchingFile, readFileFromLocal } from './utils';
Expand Down Expand Up @@ -230,8 +230,10 @@ const initializeEventHubClient = async (params: any) => {
},
processError: async (err) => {
console.log(err);
}
},

},
{startPosition: earliestEventPosition}
);

timerId = setInterval(() => {
Expand Down

0 comments on commit b491f08

Please sign in to comment.