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

remove enqueue time from events #659

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
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
Loading