-
-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #722: MQTT broker is now automatically started by Gladys
* Embedded mqtt broker * MQTT: use configuration method * Docker pull + system tests * Clean up caldav tests * Embedded broker configuration * Embeeded broker password display * Remove unsued * Auto-config embedded broker on install * Embedded docker magic url + restart policy * Fix merge issues * Rollback to localhost url + connect container to network * Embedded broker network mode info * Fix read network mode * Fix MQTT API URL * Replace everything linked to Caldav * Increase before/beforeEach timeout * Fix tests: stop using global sinon in caldav tests * Fix race condition * Improve MQTT error handling in UI * Add more timeout to mqtt.saveConfiguration tests * Fix system.exec test * Add more timout to tests Co-authored-by: atrovato <1839717+atrovato@users.noreply.github.com>
- Loading branch information
1 parent
82b6785
commit a787736
Showing
70 changed files
with
3,236 additions
and
749 deletions.
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
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
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
46 changes: 46 additions & 0 deletions
46
front/src/routes/integration/all/mqtt/setup-page/SetupBrokerContainer.jsx
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Component } from 'preact'; | ||
import { Text, MarkupText } from 'preact-i18n'; | ||
import { RequestStatus } from '../../../../../utils/consts'; | ||
|
||
class SetupBrokerContainer extends Component { | ||
installContainer = async () => { | ||
this.setState({ installing: RequestStatus.Getting }); | ||
try { | ||
await this.props.httpClient.post('/api/v1/service/mqtt/config/docker'); | ||
await this.props.loadProps(); | ||
this.props.updateConfiguration({ useEmbeddedBroker: true }); | ||
this.setState({ installing: RequestStatus.Success }); | ||
} catch (e) { | ||
this.setState({ installing: RequestStatus.Error }); | ||
} | ||
}; | ||
|
||
render({}, { installing }) { | ||
return ( | ||
<div> | ||
<div class="alert alert-info"> | ||
<MarkupText id="integration.mqtt.setup.brokerDockerNotInstalled" /> | ||
</div> | ||
{installing === RequestStatus.Error && ( | ||
<div class="alert alert-danger"> | ||
<MarkupText id="integration.mqtt.setup.installBrokerError" /> | ||
</div> | ||
)} | ||
<div class="form-group"> | ||
{installing !== RequestStatus.Getting && ( | ||
<button type="button" class="btn btn-primary" onClick={this.installContainer}> | ||
<Text id="integration.mqtt.setup.installBrokerButton" /> | ||
</button> | ||
)} | ||
{installing === RequestStatus.Getting && ( | ||
<button type="button" class="btn btn-primary btn-loading" disabled> | ||
<Text id="integration.mqtt.setup.installingBrokerButton" /> | ||
</button> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default SetupBrokerContainer; |
100 changes: 100 additions & 0 deletions
100
front/src/routes/integration/all/mqtt/setup-page/SetupForm.jsx
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 |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import { Component } from 'preact'; | ||
import { Text, Localizer } from 'preact-i18n'; | ||
import cx from 'classnames'; | ||
|
||
class SetupForm extends Component { | ||
updateUrl = e => { | ||
this.props.updateConfiguration({ mqttUrl: e.target.value }); | ||
}; | ||
|
||
updateUsername = e => { | ||
this.props.updateConfiguration({ mqttUsername: e.target.value }); | ||
}; | ||
|
||
updatePassword = e => { | ||
this.props.updateConfiguration({ mqttPassword: e.target.value, passwordChanges: true }); | ||
}; | ||
|
||
showPassword = () => { | ||
this.setState({ showPassword: true }); | ||
setTimeout(() => this.setState({ showPassword: false }), 5000); | ||
}; | ||
|
||
render(props, { showPassword }) { | ||
return ( | ||
<form> | ||
<div class="form-group"> | ||
<label for="mqttUrl" class="form-label"> | ||
<Text id={`integration.mqtt.setup.urlLabel`} /> | ||
</label> | ||
<Localizer> | ||
<input | ||
id="mqttUrl" | ||
name="mqttUrl" | ||
placeholder={<Text id="integration.mqtt.setup.urlPlaceholder" />} | ||
value={props.mqttUrl} | ||
class="form-control" | ||
onInput={this.updateUrl} | ||
disabled={props.useEmbeddedBroker} | ||
/> | ||
</Localizer> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label for="mqttUsername" class="form-label"> | ||
<Text id={`integration.mqtt.setup.userLabel`} /> | ||
</label> | ||
<Localizer> | ||
<input | ||
id="mqttUsername" | ||
name="mqttUsername" | ||
placeholder={<Text id="integration.mqtt.setup.userPlaceholder" />} | ||
value={props.mqttUsername} | ||
class="form-control" | ||
onInput={this.updateUsername} | ||
autoComplete="no" | ||
/> | ||
</Localizer> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label for="mqttPassword" class="form-label"> | ||
<Text id={`integration.mqtt.setup.passwordLabel`} /> | ||
</label> | ||
<div class="input-icon mb-3"> | ||
<Localizer> | ||
<input | ||
id="mqttPassword" | ||
name="mqttPassword" | ||
type={props.useEmbeddedBroker && showPassword ? 'text' : 'password'} | ||
placeholder={<Text id="integration.mqtt.setup.passwordPlaceholder" />} | ||
value={props.mqttPassword} | ||
class="form-control" | ||
onInput={this.updatePassword} | ||
autoComplete="new-password" | ||
/> | ||
</Localizer> | ||
{props.useEmbeddedBroker && ( | ||
<span class="input-icon-addon cursor-pointer" onClick={this.showPassword}> | ||
<i | ||
class={cx('fe', { | ||
'fe-eye': !showPassword, | ||
'fe-eye-off': showPassword | ||
})} | ||
/> | ||
</span> | ||
)} | ||
</div> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<button type="submit" class="btn btn-success" onClick={props.saveConfiguration}> | ||
<Text id="integration.mqtt.setup.saveLabel" /> | ||
</button> | ||
</div> | ||
</form> | ||
); | ||
} | ||
} | ||
|
||
export default SetupForm; |
Oops, something went wrong.