Skip to content

Commit

Permalink
Merge pull request #1043 from nrkno/fix/SOFIE-2585/unknown-error-in-h…
Browse files Browse the repository at this point in the history
…andleAccept
  • Loading branch information
jstarpl authored Oct 6, 2023
2 parents ef4a86f + 6c4c135 commit 561a83c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
21 changes: 13 additions & 8 deletions meteor/client/ui/Settings/DeviceSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ export default translateWithTracker<IDeviceSettingsProps, IDeviceSettingsState,
return null
}

restartDevice(device: PeripheralDevice) {
restartDevice(device: PeripheralDevice, e: React.UIEvent<HTMLElement>) {
e.persist()

const { t } = this.props
doModalDialog({
message: t('Are you sure you want to restart this device?'),
Expand Down Expand Up @@ -148,7 +150,7 @@ export default translateWithTracker<IDeviceSettingsProps, IDeviceSettingsState,
<h2 className="mhn mtn">{t('Generic Properties')}</h2>
<label className="field">
<LabelActual label={t('Device Name')} />
{!(this.props.device && this.props.device.name) ? (
{!(device && device.name) ? (
<div className="error-notice inline">
{t('No name set')} <FontAwesomeIcon icon={faExclamationTriangle} />
</div>
Expand All @@ -157,7 +159,7 @@ export default translateWithTracker<IDeviceSettingsProps, IDeviceSettingsState,
<EditAttribute
modifiedClassName="bghl"
attribute="name"
obj={this.props.device}
obj={device}
type="text"
collection={PeripheralDevices}
className="mdinput"
Expand All @@ -168,7 +170,10 @@ export default translateWithTracker<IDeviceSettingsProps, IDeviceSettingsState,
</div>
<div className="col c12 rl-c6 alright">
<div className="mbs">
<button className="btn btn-secondary btn-tight" onClick={() => device && this.restartDevice(device)}>
<button
className="btn btn-secondary btn-tight"
onClick={(e) => device && this.restartDevice(device, e)}
>
{t('Restart Device')}
</button>
</div>
Expand Down Expand Up @@ -213,7 +218,7 @@ export default translateWithTracker<IDeviceSettingsProps, IDeviceSettingsState,
<EditAttribute
modifiedClassName="bghl"
attribute="disableVersionChecks"
obj={this.props.device}
obj={device}
type="checkbox"
collection={PeripheralDevices}
className="input"
Expand All @@ -225,9 +230,9 @@ export default translateWithTracker<IDeviceSettingsProps, IDeviceSettingsState,
{this.renderSpecifics()}
</div>

{this.props.device &&
this.props.device.type === PeripheralDeviceType.PACKAGE_MANAGER &&
this.props.device.subType === PERIPHERAL_SUBTYPE_PROCESS
{device &&
device.type === PeripheralDeviceType.PACKAGE_MANAGER &&
device.subType === PERIPHERAL_SUBTYPE_PROCESS
? this.renderPackageManagerSpecial()
: null}
</div>
Expand Down
1 change: 1 addition & 0 deletions meteor/client/ui/Status/SystemStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ export const DeviceItem = reacti18next.withTranslation()(
onClick={(e) => {
e.preventDefault()
e.stopPropagation()
e.persist()

doModalDialog({
message: t('Are you sure you want to restart this device?'),
Expand Down
5 changes: 4 additions & 1 deletion meteor/lib/clientUserAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,10 @@ export function eventContextForLog(e: any): [string, Time] {
str = e.type
}
if (!str) {
logger.error('Unknown event', e)
logger.error(
'Could not create context in eventContextForLog, because provided event had no identifiable type',
e
)
str = 'N/A'
}

Expand Down

0 comments on commit 561a83c

Please sign in to comment.