Skip to content

Commit

Permalink
(simatec) Fix Notification Instance
Browse files Browse the repository at this point in the history
  • Loading branch information
simatec committed Sep 3, 2024
1 parent 091a729 commit 691fc11
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 26 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ When you allow iobroker GmbH to collect diagnostic data, then also your installa
<!-- ### **WORK IN PROGRESS** -->

## Changelog
### **WORK IN PROGRESS**
* (simatec) Fix Notification Instance
* (simatec) Fix Notification Design
* (simatec) Fix Default Settings

### 3.0.21 (2024-09-01)
* (simatec) Fix Onedrive Notification
* (simatec) Fix Zigbee2MQTT Backup
Expand Down
2 changes: 1 addition & 1 deletion admin/custom/customComponents.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion admin/custom/customComponents.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@
"debugLevel": false,
"deleteOldDataBase": false,
"discordInstance": "discord.0",
"discordNoticeType": "longWhatsappNotice",
"discordNoticeType": "longDiscordNotice",
"discordOnlyError": false,
"discordTarget": "",
"discordWaitToSend": 0,
Expand Down
19 changes: 14 additions & 5 deletions src-admin/src/Instance.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,26 @@ class Instance extends BaseField {
const itemInstance = this.state.instances?.find(it => it.value === (this.state.instance || ''));
const itemTarget = this.state.targets?.find(it => it.value === (this.state.target || ''));

return <div style={{ width: '100%' }}>
{this.state.instances ? <FormControl style={this.props.schema.adapter === 'telegram' || this.props.schema.adapter === 'discord' ? { width: 'calc(50% - 5px)', marginRight: 10 } : { width: '100%', marginRight: 10 }} variant="standard">
return <div
style={{
display: 'grid',
gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))',
gap: 12,
justifyContent: 'space-evenly',
alignContent: 'center',
justifyItems: 'stretch',
gridAutoRows: '1fr',
}}
>
{this.state.instances ? <FormControl style={{ width: '100%', marginRight: 10 }} variant="standard">
<InputLabel>{I18n.t(this.props.schema.label)}</InputLabel>
<Select
variant="standard"
value={this.state.instance || '_'}
renderValue={() => this.getText(itemInstance?.label, itemInstance?.label !== 'none')}
onChange={e => this.setState({ instance: e.target.value === '_' ? '' : e.target.value }, () => {
this.readTargets();
this.onChange(this.props.attr, this.state.value);
this.onChange(this.props.attr, this.state.instance);
})}
>
{this.state.instances.map((it, i) => <MenuItem key={i} value={it.value}>
Expand All @@ -117,7 +127,7 @@ class Instance extends BaseField {
{this.props.schema.help ? <FormHelperText>{this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)}</FormHelperText> : null}
</FormControl> : null}

{this.state.targets && (this.props.schema.adapter === 'telegram' || this.props.schema.adapter === 'discord') ? <FormControl style={{ width: 'calc(50% - 5px)' }} variant="standard">
{this.state.targets && (this.props.schema.adapter === 'telegram' || this.props.schema.adapter === 'discord') ? <FormControl variant="standard">
<InputLabel>{I18n.t(this.props.schema.adapter === 'telegram' ? 'Telegram receiver' : 'Discord receiver')}</InputLabel>
<Select
disabled={!this.state.instance}
Expand All @@ -133,7 +143,6 @@ class Instance extends BaseField {
</Select>
{this.props.schema.help ? <FormHelperText>{this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)}</FormHelperText> : null}
</FormControl> : this.props.schema.adapter === 'telegram' || this.props.schema.adapter === 'discord' ? <TextField
style={{ width: 'calc(50% - 5px)' }}
variant="standard"
disabled={!this.state.instance}
label={I18n.t(this.props.schema.adapter === 'telegram' ? 'Telegram receiver' : 'Discord receiver')}
Expand Down

0 comments on commit 691fc11

Please sign in to comment.