Skip to content

Commit

Permalink
Showed value in object edit dialog (#2845)
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox authored Dec 8, 2024
1 parent a36a282 commit 73af1f4
Show file tree
Hide file tree
Showing 38 changed files with 763 additions and 327 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ And with rest-api instance: `https://iobroker.mydomain.com/ioBrokerAPI/ => http:
You can add the following lines into Reverse Proxy tab to let Intro tab run behind reverse proxy properly:

| Global path | Instance | Instance path behind proxy |
| ----------------- | ------------- | -------------------------- |
|-------------------|---------------|----------------------------|
| `/ioBrokerAdmin/` | `web.0` | `/ioBrokerWeb/` |
| | `rest-api.0` | `/ioBrokerAPI/` |
| | `admin.0` | `/ioBrokerAdmin/` |
Expand All @@ -87,6 +87,10 @@ The icons may not be reused in other projects without the proper flaticon licens
<!--
### **WORK IN PROGRESS**
-->
### **WORK IN PROGRESS**

- (@GermanBluefox) Showed value in object edit dialog

### 7.4.3 (2024-12-01)

- (@GermanBluefox) Changed information box on the hosts tab
Expand Down
484 changes: 253 additions & 231 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/adapter-react-v5/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ If you want to create the configuration page with ReactJS:
- Change `name` from `src` to `ADAPTERNAME-admin` (Of course replace `ADAPTERNAME` with yours)
- Add to devDependencies:
```json
"@iobroker/adapter-react-v5": "^7.4.2",
"@iobroker/adapter-react-v5": "^7.4.3",
```
Versions can be higher.
So your `src/package.json` should look like:
Expand All @@ -24,7 +24,7 @@ If you want to create the configuration page with ReactJS:
"version": "0.1.0",
"private": true,
"dependencies": {
"@iobroker/adapter-react-v5": "^7.4.2",
"@iobroker/adapter-react-v5": "^7.4.3",
"@iobroker/build-tools": "^1.0.0",
"babel-eslint": "^10.1.0",
"react-scripts": "^5.0.1"
Expand Down
12 changes: 6 additions & 6 deletions packages/adapter-react-v5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@
"dependencies": {
"@emotion/react": "^11.13.5",
"@emotion/styled": "^11.13.5",
"@iobroker/js-controller-common": "^6.0.11",
"@iobroker/js-controller-common-db": "6.0.11",
"@iobroker/js-controller-common": "^7.0.5",
"@iobroker/js-controller-common-db": "^7.0.5",
"@iobroker/socket-client": "^3.1.3",
"@iobroker/types": "^6.0.11",
"@mui/icons-material": "^6.1.9",
"@mui/material": "^6.1.9",
"@sentry/browser": "^8.41.0",
"@iobroker/types": "^7.0.5",
"@mui/icons-material": "^6.1.10",
"@mui/material": "^6.1.10",
"@sentry/browser": "^8.42.0",
"cronstrue": "^2.52.0",
"react-color": "^2.19.3",
"react-colorful": "^5.6.1",
Expand Down
5 changes: 5 additions & 0 deletions packages/adapter-react-v5/src/Components/IconDeviceType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
Warning,
Water,
WaterDrop,
WbIridescent,
WbSunny,
Whatshot,
Window,
Expand Down Expand Up @@ -61,6 +62,7 @@ const deviceTypes = [
'gate',
'hue',
'humidity',
'illuminance',
'image',
'info',
'instance',
Expand Down Expand Up @@ -143,6 +145,9 @@ export function getDeviceIcon(type: DeviceType, props?: IconProps): React.JSX.El
if (type === 'humidity') {
SvgComponent = WaterDrop;
}
if (type === 'illuminance') {
SvgComponent = WbIridescent;
}
if (type === 'image') {
SvgComponent = Image;
}
Expand Down
3 changes: 2 additions & 1 deletion packages/adapter-react-v5/src/Components/ObjectBrowser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2045,6 +2045,7 @@ function formatValue(options: FormatValueOptions): {
if (isCommon?.unit) {
valText.u = isCommon.unit;
}

let valFull:
| {
/** label */
Expand Down Expand Up @@ -5575,7 +5576,7 @@ export class ObjectBrowserClass extends Component<ObjectBrowserProps, ObjectBrow
from: false,
ack: false,
q: false,
addID: false,
addId: false,
aggregate: 'minmax',
})
.then(values => {
Expand Down
1 change: 0 additions & 1 deletion packages/adapter-react-v5/src/LegacyConnection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1674,7 +1674,6 @@ export class LegacyConnection {
obj._id = newId as ioBroker.ObjectIDs.Group;
if (newName !== undefined) {
obj.common = obj.common || ({} as ioBroker.GroupCommon);
// @ts-expect-error will be corrected in the next js-controller release
obj.common.name = newName;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/adapter-react-v5/src/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"ra_Add objects tree from JSON file": "Objektbaum aus JSON-Datei hinzufügen",
"ra_Add row": "Zeile hinzufügen",
"ra_Advanced options": "Erweiterte Optionen",
"ra_All items are filtered out": "Alle Elemente werden herausgefiltert",
"ra_All items are filtered out": "Alle Elemente sind herausgefiltert",
"ra_All objects": "Alle Objekte",
"ra_Append": "Anhängen",
"ra_Append %s entries or replace existing?": "%s Einträge anhängen oder vorhandene ersetzen?",
Expand Down Expand Up @@ -447,4 +447,4 @@
"sch_validTo": "bis",
"sch_wholeDay": "Ganzer Tag",
"sch_yearEveryMonth": "jeden Monat"
}
}
3 changes: 2 additions & 1 deletion packages/adapter-react-v5/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
"ra_License %s": "License %s",
"ra_License agreement": "License agreement",
"ra_License does not exist": "License does not exist",
"ra_tooltip_expire": "Expires in",
"ra_License expired on %s": "License expired on %s",
"ra_License for other product \"%s\"": "License for other product \"%s\"",
"ra_License is for version %s, but required version is %s.": "License is for version %s, but required version is %s.",
Expand Down Expand Up @@ -447,4 +448,4 @@
"sch_validTo": "to",
"sch_wholeDay": "Whole day",
"sch_yearEveryMonth": "every month"
}
}
10 changes: 5 additions & 5 deletions packages/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"setup"
],
"dependencies": {
"@iobroker/adapter-core": "^3.2.2",
"@iobroker/adapter-core": "^3.2.3",
"@iobroker/i18n": "^0.3.1",
"@iobroker/socket-classes": "^1.6.1",
"@iobroker/socket-classes": "^1.6.2",
"@iobroker/webserver": "^1.0.6",
"@iobroker/ws": "^2.0.0",
"@iobroker/ws-server": "4.1.0",
Expand All @@ -34,7 +34,7 @@
"body-parser": "^1.20.3",
"compression": "^1.7.5",
"connect-flash": "^0.1.1",
"express": "^4.21.1",
"express": "^4.21.2",
"express-fileupload": "^1.5.1",
"express-session": "^1.18.1",
"json5": "^2.2.3",
Expand All @@ -43,7 +43,7 @@
"semver": "^7.6.3"
},
"devDependencies": {
"@iobroker/build-tools": "^2.0.9",
"@iobroker/build-tools": "^2.0.11",
"@iobroker/dm-gui-components": "file:../dm-gui-components",
"@iobroker/json-config": "file:../jsonConfig",
"@iobroker/legacy-testing": "^2.0.1",
Expand All @@ -61,7 +61,7 @@
"@types/validator": "^13.12.2",
"colorette": "^2.0.20",
"less": "^4.2.1",
"puppeteer": "^23.9.0",
"puppeteer": "^23.10.1",
"src-rx": "file:src-admin",
"typescript": "^5.7.2"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/admin/src-admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@fnando/sparkline": "^0.3.10",
"@foxriver76/iob-component-lib": "^0.1.6",
"@honkhonk/vite-plugin-svgr": "^1.1.0",
"@iobroker/admin-component-easy-access": "^1.0.8",
"@iobroker/admin-component-easy-access": "^1.0.11",
"@iobroker/dm-utils": "^0.6.9",
"@iobroker/socket-client": "^3.1.3",
"@originjs/vite-plugin-commonjs": "^1.0.3",
Expand Down Expand Up @@ -103,5 +103,5 @@
}
]
],
"version": "7.4.2"
"version": "7.4.3"
}
12 changes: 3 additions & 9 deletions packages/admin/src-admin/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2411,13 +2411,9 @@ class App extends Router<AppProps, AppState> {
if (this.state.user && this.props.width !== 'xs' && this.props.width !== 'sm') {
return (
<div>
{
// @ts-expect-error fixed in js-controller 7
this.state.systemConfig.common.siteName ? (
// @ts-expect-error fixed in js-controller 7
<div style={styles.siteName}>{this.state.systemConfig.common.siteName}</div>
) : null
}
{this.state.systemConfig.common.siteName ? (
<div style={styles.siteName}>{this.state.systemConfig.common.siteName}</div>
) : null}

<Box
component="div"
Expand Down Expand Up @@ -2460,9 +2456,7 @@ class App extends Router<AppProps, AppState> {
</div>
);
}
// @ts-expect-error fixed in js-controller 7
if (this.props.width !== 'xs' && this.props.width !== 'sm' && this.state.systemConfig.common.siteName) {
// @ts-expect-error fixed in js-controller 7
return <div style={styles.siteName}>{this.state.systemConfig.common.siteName}</div>;
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ export const genericStyles: Record<string, any> = {
currentVersionText: (theme: IobTheme) => ({
color: theme.palette.mode === 'dark' ? '#a3ffa3' : '#009800',
fontWeight: 'bold',
marginLeft: '4px',
}),
repoVersionText: (theme: IobTheme) => ({
color: theme.palette.mode === 'dark' ? '#a3fcff' : '#005498',
fontWeight: 'bold',
marginLeft: '4px',
}),
rating: {},
containerVersion: {},
Expand Down Expand Up @@ -719,6 +725,8 @@ export default abstract class AdapterGeneric<
return null;
}

const repoVersion = this.props.context.repository[this.props.adapterName]?.version;

return (
<CustomModal
title={this.props.context.t('Please select specific version of %s', this.props.adapterName)}
Expand Down Expand Up @@ -829,9 +837,13 @@ export default abstract class AdapterGeneric<
component="span"
sx={this.styles.currentVersionText}
>{`(${this.props.context.t('current')})`}</Box>
) : (
''
)}
) : null}
{repoVersion === version ? (
<Box
component="span"
sx={this.styles.repoVersionText}
>{`(${this.props.context.t('repository')})`}</Box>
) : null}
</Typography>
<Typography
variant="body2"
Expand Down
67 changes: 52 additions & 15 deletions packages/admin/src-admin/src/components/Adapters/AdaptersList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@ import React, { Component, Fragment, type JSX } from 'react';

import {
Box,
Button,
LinearProgress,
Table,
TableBody,
TableCell,
TableContainer,
TableHead,
TableRow,
Tooltip,
Typography,
} from '@mui/material';

import { Update as UpdateIcon } from '@mui/icons-material';

import { TabContent } from '@iobroker/adapter-react-v5';

import type { AdaptersContext } from '@/components/Adapters/AdapterInstallDialog';
Expand Down Expand Up @@ -126,13 +130,14 @@ interface AdaptersListProps {
adapters: string[];
}[];
toggleCategory: (category: string) => void;
clearAllFilters: () => void;
clearAllFilters: (onlyUpdate?: boolean) => void;
update: boolean;
descWidth: number;
sortByName: boolean;
sortPopularFirst: boolean;
sortRecentlyUpdated: boolean;
commandRunning: boolean;
updateListFilter: boolean;
}

interface AdaptersListState {
Expand Down Expand Up @@ -281,16 +286,27 @@ class AdaptersList extends Component<AdaptersListProps, AdaptersListState> {
return !this.props.update ? (
<tr>
<td
colSpan={4}
style={{
padding: 16,
fontSize: 18,
cursor: 'pointer',
}}
title={this.props.context.t('Click to clear all filters')}
onClick={() => this.props.clearAllFilters()}
colSpan={8}
style={{ textAlign: 'center' }}
>
{this.props.context.t('all items are filtered out')}
<Button
variant="outlined"
title={this.props.context.t('Click to clear all filters')}
onClick={() => this.props.clearAllFilters()}
>
{this.props.context.t('all items are filtered out')}
</Button>
{this.props.updateListFilter ? <br /> : null}
{this.props.updateListFilter ? (
<Button
style={{ marginTop: 16 }}
variant="outlined"
onClick={() => this.props.clearAllFilters(true)}
startIcon={<UpdateIcon />}
>
{this.props.context.t('Remove filter for updatable adapters')}
</Button>
) : null}
</td>
</tr>
) : null;
Expand All @@ -308,13 +324,34 @@ class AdaptersList extends Component<AdaptersListProps, AdaptersListState> {
return !this.props.update ? (
<div
style={{
margin: 20,
fontSize: 26,
width: '100%',
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
gap: 16,
}}
title={this.props.context.t('Click to clear all filters')}
onClick={() => this.props.clearAllFilters()}
>
{this.props.context.t('all items are filtered out')}
<Tooltip
title={this.props.context.t('Click to clear all filters')}
slotProps={{ popper: { sx: { pointerEvents: 'none' } } }}
>
<Button
variant="outlined"
onClick={() => this.props.clearAllFilters()}
>
{this.props.context.t('all items are filtered out')}
</Button>
</Tooltip>
{this.props.updateListFilter ? (
<Button
variant="outlined"
onClick={() => this.props.clearAllFilters(true)}
startIcon={<UpdateIcon />}
>
{this.props.context.t('Remove filter for updatable adapters')}
</Button>
) : null}
</div>
) : null;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src-admin/src/components/Hosts/HostRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const styles: Record<string, any> = {
alignItems: 'baseline',
},
collapse: {
height: 200,
height: 215,
backgroundColor: 'rgba(128, 128, 128, 0.1)',
// position: 'absolute',
width: '100%',
Expand Down
Loading

0 comments on commit 73af1f4

Please sign in to comment.