Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gui helper removed #2821

Merged
merged 20 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
Utils,
} from '@iobroker/adapter-react-v5';
import {
type BackEndCommandGeneric,
type BackEndCommand,
type BackEndCommandOpenLink,
type ConfigItemPanel,
JsonConfigComponent,
Expand Down Expand Up @@ -233,7 +233,7 @@ class NotificationMessage extends Component<NotificationMessageProps, Notificati
data={this.state.data}
onError={(error?: boolean) => this.setState({ error })}
onChange={(data: Record<string, any>) => this.setState({ data })}
onBackEndCommand={(command?: BackEndCommandGeneric) => {
onBackEndCommand={(command?: BackEndCommand) => {
if (command.schema) {
this.setState({ schema: command.schema, data: command.data || this.state.data });
}
Expand All @@ -242,7 +242,7 @@ class NotificationMessage extends Component<NotificationMessageProps, Notificati
this.getGui();
}
if (command.command === 'link') {
this.props.onLink(command as BackEndCommandOpenLink);
this.props.onLink(command);
}
}}
embedded
Expand Down
21 changes: 1 addition & 20 deletions packages/admin/test/engineHelper.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,12 @@
const fs = require('node:fs');
const path = require('node:path');
const setup = require('@iobroker/legacy-testing');
const { deleteFoldersRecursive } = require('@iobroker/build-tools');

let rootDir = path.join(__dirname, '../');
let objects = null;
let states = null;
let onStateChanged = null;

function deleteFoldersRecursive(path) {
if (path.endsWith('/')) {
path = path.substring(0, path.length - 1);
}
if (fs.existsSync(path)) {
const files = fs.readdirSync(path);
for (const file of files) {
const curPath = `${path}/${file}`;
const stat = fs.statSync(curPath);
if (stat.isDirectory()) {
deleteFoldersRecursive(curPath);
fs.rmdirSync(curPath);
} else {
fs.unlinkSync(curPath);
}
}
}
}

function startIoBroker(options) {
options = options || {};
if (options.rootDir) {
Expand Down
66 changes: 0 additions & 66 deletions packages/admin/test/guiHelper.js

This file was deleted.

12 changes: 4 additions & 8 deletions packages/admin/test/testAdapter.gui.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
const engineHelper = require('./engineHelper');
const guiHelper = require('./guiHelper');
const guiHelper = require('@iobroker/legacy-testing/guiHelper');

let gPage;

async function screenshot(page, fileName) {
page = page || gPage;
await page.screenshot({ path: `${__dirname}/../tmp/screenshots/${fileName}.png` });
}
const rootDir = `${__dirname}/../`;

describe('admin-gui', () => {
before(async function () {
this.timeout(240_000);

// install js-controller, web and vis-2-beta
await engineHelper.startIoBroker();
const { page } = await guiHelper.startBrowser(process.env.CI === 'true');
const { page } = await guiHelper.startBrowser(null, rootDir, process.env.CI === 'true', '/');
gPage = page;
});

it('Check all widgets', async function () {
this.timeout(120_000);
await gPage.waitForSelector('a[href="/#easy"]', { timeout: 120_000 });
await screenshot(gPage, '00_started');
await guiHelper.screenshot(rootDir, gPage, '01_started');
});

after(async function () {
Expand Down
76 changes: 42 additions & 34 deletions packages/jsonConfig/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1084,46 +1084,54 @@ Special input for ports. It checks automatically if port is used by other instan

(admin >= 7.1.0) Show control or information from the state

| Property | Description |
|------------------|-------------------------------------------------------------------------------------------------------------------------------|
| `oid` | Which object ID should be taken for the controlling. The ID is without "adapter.X." prefix |
| `system` | If true, the state will be taken from system.adapter.XX.I. and not from XX.I |
| `control` | How the value of the state should be shown: `text`, `html`, `input`, `slider`, `select`, `button`, `switch`, `number` |
| `controlled` | If true, the state will be shown as switch, select, button, slider or text input. Used only if no control property is defined |
| `unit` | Add unit to the value |
| `trueText` | this text will be shown if the value is true |
| `trueTextStyle` | Style of the text if the value is true |
| `falseText` | this text will be shown if the value is false or if the control is a "button" |
| `falseTextStyle` | Style of the text if the value is false or if the control is a "button" |
| `trueImage` | This image will be shown if the value is true |
| `falseImage` | This image will be shown if the value is false or if the control is a "button" |
| `min` | Minimum value for control type slider or number |
| `max` | Maximum value for control type slider or number |
| `step` | Step value for control type slider or number |
| `controlDelay` | delay in ms for slider or number |
| `variant` | Variant of button: `contained`, `outlined`, `text` |
| `readOnly` | Defines if the control is read-only |
| Property | Description |
|------------------|--------------------------------------------------------------------------------------------------------------------------------------|
| `oid` | Which object ID should be taken for the controlling. The ID is without `adapter.X.` prefix |
| `system` | If true, the state will be taken from `system.adapter.X.` and not from `adapter.X` |
| `foreign` | The `oid` is absolute and no need to add `adapter.X` or `system.adapter.X.` to oid |
| `control` | How the value of the state should be shown: `text`, `html`, `input`, `slider`, `select`, `button`, `switch`, `number` |
| `controlled` | If true, the state will be shown as switch, select, button, slider or text input. Used only if no control property is defined |
| `unit` | Add unit to the value |
| `trueText` | this text will be shown if the value is true |
| `trueTextStyle` | Style of the text if the value is true |
| `falseText` | this text will be shown if the value is false or if the control is a "button" |
| `falseTextStyle` | Style of the text if the value is false or if the control is a "button" |
| `trueImage` | This image will be shown if the value is true |
| `falseImage` | This image will be shown if the value is false or if the control is a "button" |
| `min` | Minimum value for control type slider or number |
| `max` | Maximum value for control type slider or number |
| `step` | Step value for control type slider or number |
| `controlDelay` | delay in ms for slider or number |
| `variant` | Variant of button: `contained`, `outlined`, `text` |
| `readOnly` | Defines if the control is read-only |
| `narrow` | Normally the title and value are shown on the left and right of the line. With this flag, the value will appear just after the label |
| `blinkOnUpdate` | Value should blink when updated (true or color) |
| `size` | Font size: small, normal, large or number |
| `addColon` | Add to label the colon at the end if not exist in label |
| `labelIcon` | Base64 icon for label |

### `staticInfo`

(admin >= 7.3.3) Shows static information in preformatted form, like "Title: value unit"
This control is used mostly in dynamic forms

| Property | Description |
|-------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| `data` | Value to be shown |
| `label` | Label for the value (could be multi-language) |
| `unit` | (optional) unit (could be multi-language) |
| `narrow` | (optional) Normally the title and value are shown on the left and right of the line. With this flag, the value will appear just after the label |
| `addColon` | (optional) Add to label the colon at the end if not exist in label |
| `blinkOnUpdate` | (optional) Value should blink when updated (true or color) |
| `blink` | (optional) Value should blink continuously (true or color) |
| `styleLabel` | (optional) React CSS Styles |
| `styleValue` | (optional) React CSS Styles |
| `styleUnit` | (optional) React CSS Styles |
| `copyToClipboard` | (optional) Show copy to clipboard button for value |
| `labelIcon` | (optional) base64 icon for label |
| `size` | (optional) font size: small, normal, large or number |
| Property | Description |
|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| `data` | Value to be shown |
| `label` | Label for the value (could be multi-language) |
| `unit` | (optional) unit (could be multi-language) |
| `narrow` | (optional) Normally the title and value are shown on the left and right of the line. With this flag, the value will appear just after the label |
| `addColon` | (optional) Add to label the colon at the end if not exist in label |
| `blinkOnUpdate` | (optional) Value should blink when updated (true or color) |
| `blink` | (optional) Value should blink continuously (true or color) |
| `styleLabel` | (optional) React CSS Styles |
| `styleValue` | (optional) React CSS Styles |
| `styleUnit` | (optional) React CSS Styles |
| `copyToClipboard` | (optional) Show copy to clipboard button for value |
| `labelIcon` | (optional) base64 icon for label |
| `size` | (optional) font size: small, normal, large or number |
| `highlight` | (optional) Highlight line on mouse over |
| `booleanAsCheckbox` | (optional) Show boolean values as checkbox |

### `deviceManager`

Expand Down
Loading
Loading