Skip to content

Commit

Permalink
Extend adapter object with messages (#2625)
Browse files Browse the repository at this point in the history
* Extend adapter object with messages

* Extend adapter object with messages

* use ioBroker.Translated and add some JSDoc

---------

Co-authored-by: foxriver76 <[email protected]>
  • Loading branch information
GermanBluefox and foxriver76 authored Mar 7, 2024
1 parent 4b8ddc6 commit 3bbff41
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/types-dev/objects.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,26 @@ declare global {

type LicenseInformation = LicenseInformationFree | LicenseInformationWithPayment;

interface MessageRule {
/** The message title */
title: ioBroker.Translated;
/** The message content */
text: ioBroker.Translated;
/** Optional link */
link?: string;
/** Text of the link */
linkText?: ioBroker.Translated;
/** The severity level of the message */
level: 'warn' | 'error' | 'info';
/** The buttons which should be shown on the message dialog */
buttons?: ('agree' | 'cancel' | 'ok')[];
/** The condition which needs to be met to display the message */
condition: {
operand: 'and' | 'or';
rules: string[];
};
}

interface AdapterCommon extends ObjectCommon {
/** Custom attributes to be shown in admin in the object browser */
adminColumns?: any[];
Expand Down Expand Up @@ -677,6 +697,8 @@ declare global {
license?: string;
/** An object representing information with the license details */
licenseInformation?: LicenseInformation;
/** Messages, that will be shown (if condition evaluates to true) by upgrade or installation */
messages?: MessageRule[];

// Make it possible to narrow the object type using the custom property
custom?: undefined;
Expand Down

0 comments on commit 3bbff41

Please sign in to comment.