This repository has been archived by the owner on Aug 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 72
Adding Deployment message details formatting and removing onRowClick #1117
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
20bcd99
Deployment message details formatting and removing onRowClick
isaac-dasan ed1a577
fix for stephen's comments
isaac-dasan 39f48d7
minimize setState calls
isaac-dasan cad8c78
refactoring componentWillReceiveProps
isaac-dasan a807103
semicolon and single line
isaac-dasan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,7 +138,8 @@ export class DeviceDetails extends Component { | |
device, | ||
fetchModules | ||
} = nextProps; | ||
|
||
let tempState = this.state; | ||
let updateFlag = false; | ||
/* | ||
deviceModuleStatus is a prop fetched by making fetchModules() API call through deviceDetails.container on demand. | ||
moduleStatus is a prop sent from deploymentDetailsGrid which it already has in rowData. | ||
|
@@ -149,23 +150,31 @@ export class DeviceDetails extends Component { | |
|
||
// set deviceModuleStatus in state if moduleStatus doesn't exist and devicesReducer successfully received the API response | ||
if (!moduleStatus && !isDeviceModuleStatusPending && !deviceModuleStatusError) { | ||
this.setState({ currentModuleStatus: deviceModuleStatus }); | ||
tempState.currentModuleStatus = deviceModuleStatus; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
updateFlag = true; | ||
} | ||
|
||
// Reset state if the device changes | ||
if ((this.props.device || {}).id !== device.id) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. else if |
||
resetPendingAndError(); | ||
tempState = this.baseState; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
updateFlag = true; | ||
|
||
// If moduleStatus exist in props, set it in state, otherwise make an API call to get deviceModuleStatus. | ||
if (moduleStatus) { | ||
this.setState({ ...this.baseState, currentModuleStatus: moduleStatus }); | ||
tempState.currentModuleStatus = moduleStatus; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} else { | ||
this.setState(this.baseState); | ||
fetchModules(device.id); | ||
} | ||
|
||
const deviceId = (device || {}).id; | ||
this.resetTelemetry$.next(deviceId); | ||
this.fetchAlerts(deviceId); | ||
} | ||
|
||
if (updateFlag) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if (Object.keys(tempState).length) this.setState(tempState); |
||
this.setState(tempState); | ||
} | ||
} | ||
|
||
componentWillUnmount() { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{}