diff --git a/README.md b/README.md index 83c35ddac..031aa4af8 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,11 @@ The icons may not be reused in other projects without the proper flaticon licens +### **WORK IN PROGRESS** + +- (@GermanBluefox) Show latest/stable labels by updating/downgrading of adapters +- (@GermanBluefox) Corrected selection of chinese language + ### 7.4.7 (2024-12-12) - (@GermanBluefox) Corrected the rendering of custom JSON config components diff --git a/package-lock.json b/package-lock.json index 5ef5fdc8a..e75953c69 100644 --- a/package-lock.json +++ b/package-lock.json @@ -48055,7 +48055,7 @@ }, "packages/admin/src-admin": { "name": "src-rx", - "version": "7.4.5", + "version": "7.4.7", "dev": true, "dependencies": { "@iobroker/adapter-react-v5": "file:../../adapter-react-v5", diff --git a/packages/adapter-react-v5/README.md b/packages/adapter-react-v5/README.md index cc9529bd3..f5b2e55bd 100644 --- a/packages/adapter-react-v5/README.md +++ b/packages/adapter-react-v5/README.md @@ -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.6", + "@iobroker/adapter-react-v5": "^7.4.7", ``` Versions can be higher. So your `src/package.json` should look like: @@ -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.6", + "@iobroker/adapter-react-v5": "^7.4.7", "@iobroker/build-tools": "^1.0.0", "babel-eslint": "^10.1.0", "react-scripts": "^5.0.1" diff --git a/packages/admin/src-admin/package.json b/packages/admin/src-admin/package.json index e6947d109..904a779ac 100644 --- a/packages/admin/src-admin/package.json +++ b/packages/admin/src-admin/package.json @@ -103,5 +103,5 @@ } ] ], - "version": "7.4.6" + "version": "7.4.7" } \ No newline at end of file diff --git a/packages/admin/src-admin/src/App.tsx b/packages/admin/src-admin/src/App.tsx index e041be171..110817833 100644 --- a/packages/admin/src-admin/src/App.tsx +++ b/packages/admin/src-admin/src/App.tsx @@ -88,11 +88,11 @@ import HostSelectors from './components/HostSelectors'; import ExpertModeDialog from './dialogs/ExpertModeDialog'; import NewsAdminDialog, { checkMessages, type DbType, type ShowMessage } from './dialogs/NewsAdminDialog'; import HostWarningDialog from './dialogs/HostWarningDialog'; -import LogsWorker from './Workers/LogsWorker'; -import InstancesWorker from './Workers/InstancesWorker'; -import HostsWorker, { type HostEvent, type NotificationAnswer } from './Workers/HostsWorker'; -import AdaptersWorker, { type AdapterEvent } from './Workers/AdaptersWorker'; -import ObjectsWorker from './Workers/ObjectsWorker'; +import { LogsWorker } from './Workers/LogsWorker'; +import { InstancesWorker } from './Workers/InstancesWorker'; +import { HostsWorker, type HostEvent, type NotificationAnswer } from './Workers/HostsWorker'; +import { AdaptersWorker, type AdapterEvent } from './Workers/AdaptersWorker'; +import { ObjectsWorker } from './Workers/ObjectsWorker'; import DiscoveryDialog from './dialogs/DiscoveryDialog'; import SlowConnectionWarningDialog, { SlowConnectionWarningDialogClass } from './dialogs/SlowConnectionWarningDialog'; import IsVisible from './components/IsVisible'; diff --git a/packages/admin/src-admin/src/Workers/AdaptersWorker.tsx b/packages/admin/src-admin/src/Workers/AdaptersWorker.tsx index 68deb3f03..b1dba5df1 100644 --- a/packages/admin/src-admin/src/Workers/AdaptersWorker.tsx +++ b/packages/admin/src-admin/src/Workers/AdaptersWorker.tsx @@ -1,11 +1,11 @@ import { type AdminConnection } from '@iobroker/adapter-react-v5'; -import GenericWorker, { type EventType, type GenericEvent } from './GenericWorker'; +import { GenericWorker, type EventType, type GenericEvent } from './GenericWorker'; export type AdapterEventType = EventType; export type AdapterEvent = GenericEvent<'adapter'>; -export default class AdaptersWorker extends GenericWorker<'adapter'> { +export class AdaptersWorker extends GenericWorker<'adapter'> { private readonly repositoryHandlers: (() => void)[]; private repoTimer: ReturnType | null; diff --git a/packages/admin/src-admin/src/Workers/GenericWorker.tsx b/packages/admin/src-admin/src/Workers/GenericWorker.tsx index 06c773f12..3f4716473 100644 --- a/packages/admin/src-admin/src/Workers/GenericWorker.tsx +++ b/packages/admin/src-admin/src/Workers/GenericWorker.tsx @@ -56,7 +56,7 @@ export type GenericEvent = { oldObj?: GetObjectFromType; }; -export default class GenericWorker { +export class GenericWorker { protected readonly socket: AdminConnection; protected readonly handlers: ((events: GenericEvent[]) => void)[] = []; diff --git a/packages/admin/src-admin/src/Workers/HostAdapterWorker.tsx b/packages/admin/src-admin/src/Workers/HostAdapterWorker.tsx index 4b3c2f51c..1c97998b8 100644 --- a/packages/admin/src-admin/src/Workers/HostAdapterWorker.tsx +++ b/packages/admin/src-admin/src/Workers/HostAdapterWorker.tsx @@ -1,11 +1,11 @@ import { type AdminConnection } from '@iobroker/adapter-react-v5'; -import GenericWorker, { type EventType, type GenericEvent } from './GenericWorker'; +import { GenericWorker, type EventType, type GenericEvent } from './GenericWorker'; export type HostAdapterEventType = EventType; export type HostAdapterEvent = GenericEvent<'adapter'>; -export default class HostAdapterWorker extends GenericWorker<'adapter'> { +export class HostAdapterWorker extends GenericWorker<'adapter'> { private readonly host: string; private readonly prefix: string; diff --git a/packages/admin/src-admin/src/Workers/HostsWorker.tsx b/packages/admin/src-admin/src/Workers/HostsWorker.tsx index e4ad60595..9a2b33ed9 100644 --- a/packages/admin/src-admin/src/Workers/HostsWorker.tsx +++ b/packages/admin/src-admin/src/Workers/HostsWorker.tsx @@ -1,6 +1,6 @@ import type { AdminConnection } from '@iobroker/adapter-react-v5'; import type { FilteredNotificationInformation } from '@iobroker/socket-client'; -import GenericWorker, { type EventType, type GenericEvent } from './GenericWorker'; +import { GenericWorker, type EventType, type GenericEvent } from './GenericWorker'; export type HostEventType = EventType; @@ -14,7 +14,7 @@ export interface HostAliveEvent { type: HostEventType; } -export default class HostsWorker extends GenericWorker<'host'> { +export class HostsWorker extends GenericWorker<'host'> { private readonly aliveHandlers: (((events: HostAliveEvent[]) => void) | false)[] = []; private readonly notificationsHandlers: ((notifications: Record) => void)[] = []; diff --git a/packages/admin/src-admin/src/Workers/InstancesWorker.tsx b/packages/admin/src-admin/src/Workers/InstancesWorker.tsx index 1ea89b11e..2c13b1f2b 100644 --- a/packages/admin/src-admin/src/Workers/InstancesWorker.tsx +++ b/packages/admin/src-admin/src/Workers/InstancesWorker.tsx @@ -1,11 +1,11 @@ import { type AdminConnection } from '@iobroker/adapter-react-v5'; -import GenericWorker, { type EventType, type GenericEvent } from './GenericWorker'; +import { GenericWorker, type EventType, type GenericEvent } from './GenericWorker'; export type InstanceEventType = EventType; export type InstanceEvent = GenericEvent<'instance'>; -export default class InstancesWorker extends GenericWorker<'instance'> { +export class InstancesWorker extends GenericWorker<'instance'> { constructor(socket: AdminConnection) { super(socket, 'system.adapter', 'instance'); } diff --git a/packages/admin/src-admin/src/Workers/LogsWorker.tsx b/packages/admin/src-admin/src/Workers/LogsWorker.tsx index ab1ce8f75..0524766f9 100644 --- a/packages/admin/src-admin/src/Workers/LogsWorker.tsx +++ b/packages/admin/src-admin/src/Workers/LogsWorker.tsx @@ -13,7 +13,7 @@ export interface LogLineSaved extends LogLine { key?: number; } -export default class LogsWorker { +export class LogsWorker { private readonly socket: AdminConnection; private readonly handlers: ((events: LogLineSaved[], messageSize: number) => void)[]; diff --git a/packages/admin/src-admin/src/Workers/ObjectsWorker.tsx b/packages/admin/src-admin/src/Workers/ObjectsWorker.tsx index b27d34893..b172ae753 100644 --- a/packages/admin/src-admin/src/Workers/ObjectsWorker.tsx +++ b/packages/admin/src-admin/src/Workers/ObjectsWorker.tsx @@ -10,7 +10,7 @@ export interface ObjectEvent { oldObj?: ioBroker.Object; } -export default class ObjectsWorker { +export class ObjectsWorker { private readonly socket: AdminConnection; private readonly handlers: ((events: ObjectEvent[]) => void)[]; diff --git a/packages/admin/src-admin/src/components/Adapters/AdapterGeneric.tsx b/packages/admin/src-admin/src/components/Adapters/AdapterGeneric.tsx index eedee40bc..97bc0d2ec 100644 --- a/packages/admin/src-admin/src/components/Adapters/AdapterGeneric.tsx +++ b/packages/admin/src-admin/src/components/Adapters/AdapterGeneric.tsx @@ -55,7 +55,7 @@ import AdapterInstallDialog, { import AutoUpgradeConfigDialog, { ICONS } from '@/dialogs/AutoUpgradeConfigDialog'; import IsVisible from '../IsVisible'; -import { extractUrlLink } from './Utils'; +import { extractUrlLink, type RepoInfo } from './Utils'; import sentryIcon from '../../assets/sentry.svg'; export const genericStyles: Record = { @@ -136,7 +136,12 @@ export const genericStyles: Record = { fontWeight: 'bold', marginLeft: '4px', }), - repoVersionText: (theme: IobTheme) => ({ + repoStableVersionText: (theme: IobTheme) => ({ + color: theme.palette.mode === 'dark' ? '#8dff7a' : '#2b9800', + fontWeight: 'bold', + marginLeft: '4px', + }), + repoLatestVersionText: (theme: IobTheme) => ({ color: theme.palette.mode === 'dark' ? '#a3fcff' : '#005498', fontWeight: 'bold', marginLeft: '4px', @@ -676,6 +681,7 @@ export default abstract class AdapterGeneric< onUpdate={version => this.setState({ showUpdateDialog: false, showDialog: false }, () => this.update(version)) } + isStable={(this.props.context.repository._repoInfo as unknown as RepoInfo).stable} onIgnore={ignoreVersion => this.setState({ showUpdateDialog: false, showDialog: false }, () => this.props.context.socket @@ -724,8 +730,16 @@ export default abstract class AdapterGeneric< if (!this.state.showInstallVersion) { return null; } - - const repoVersion = this.props.context.repository[this.props.adapterName]?.version; + let stableVersion: string; + let latestVersion: string; + const repoInfo: RepoInfo = this.props.context.repository._repoInfo as unknown as RepoInfo; + if (repoInfo?.stable) { + stableVersion = this.props.context.repository[this.props.adapterName]?.version; + latestVersion = this.props.context.repository[this.props.adapterName]?.latestVersion; + } else { + stableVersion = this.props.context.repository[this.props.adapterName]?.stable; + latestVersion = this.props.context.repository[this.props.adapterName]?.version; + } return ( {`(${this.props.context.t('current')})`} ) : null} - {repoVersion === version ? ( + {latestVersion === version ? ( + + (latest) + + ) : null} + {stableVersion === version ? ( {`(${this.props.context.t('repository')})`} + sx={this.styles.repoStableVersionText} + >{`(${this.props.context.t('stable')})`} ) : null} { colSpan={8} style={{ textAlign: 'center' }} > - - {this.props.updateListFilter ?
: null} + {this.props.searchFilter || this.props.installedListFilter ? ( + + ) : null} + {this.props.updateListFilter && (this.props.searchFilter || this.props.installedListFilter) ? ( +
+ ) : null} {this.props.updateListFilter ? ( - + + + ) : null} {this.props.updateListFilter ? (