From 12cc50bc5cefdbea344945f8d1cf5e7799fb8d32 Mon Sep 17 00:00:00 2001 From: GermanBluefox Date: Thu, 3 Oct 2024 14:29:56 +0800 Subject: [PATCH] Fixed build --- .github/auto-merge.yml | 9 +- .github/dependabot.yml | 44 +-- .github/stale.yml | 49 ++-- .github/workflows/dependabot-automerge.yml | 26 +- .github/workflows/test-and-release.yml | 302 ++++++++++--------- admin/jsonConfig.json | 326 ++++++++++----------- package.json | 2 +- src-admin/public/index.html | 58 ++-- src-admin/src/Components.jsx | 2 +- src-admin/src/WelcomeComponent.jsx | 12 +- 10 files changed, 420 insertions(+), 410 deletions(-) diff --git a/.github/auto-merge.yml b/.github/auto-merge.yml index 3f5fbe3..1c01864 100644 --- a/.github/auto-merge.yml +++ b/.github/auto-merge.yml @@ -3,15 +3,14 @@ - match: # Only merge patches for production dependencies dependency_type: production - update_type: "semver:patch" + update_type: 'semver:patch' - match: # Except for security fixes, here we allow minor patches dependency_type: production - update_type: "security:minor" + update_type: 'security:minor' - match: # and development dependencies can have a minor update, too dependency_type: development - update_type: "semver:minor" - + update_type: 'semver:minor' # The syntax is based on the legacy dependabot v1 automerged_updates syntax, see: -# https://dependabot.com/docs/config-file/#automerged_updates \ No newline at end of file +# https://dependabot.com/docs/config-file/#automerged_updates diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 43237f8..4aad956 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,24 +1,24 @@ version: 2 updates: - - package-ecosystem: github-actions - directory: "/" - schedule: - interval: monthly - time: "04:00" - timezone: Europe/Berlin - - package-ecosystem: npm - directory: "/" - schedule: - interval: monthly - time: "04:00" - timezone: Europe/Berlin - open-pull-requests-limit: 5 - versioning-strategy: increase - - package-ecosystem: npm - directory: "/src" - schedule: - interval: monthly - time: "04:00" - timezone: Europe/Berlin - open-pull-requests-limit: 5 - versioning-strategy: increase + - package-ecosystem: github-actions + directory: '/' + schedule: + interval: monthly + time: '04:00' + timezone: Europe/Berlin + - package-ecosystem: npm + directory: '/' + schedule: + interval: monthly + time: '04:00' + timezone: Europe/Berlin + open-pull-requests-limit: 5 + versioning-strategy: increase + - package-ecosystem: npm + directory: '/src' + schedule: + interval: monthly + time: '04:00' + timezone: Europe/Berlin + open-pull-requests-limit: 5 + versioning-strategy: increase diff --git a/.github/stale.yml b/.github/stale.yml index 8a1bc21..c8cf3a3 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -12,9 +12,9 @@ onlyLabels: [] # Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable exemptLabels: - - enhancement - - security - - bug + - enhancement + - security + - bug # Set to true to ignore issues in a project (defaults to false) exemptProjects: true @@ -30,19 +30,19 @@ staleLabel: wontfix # Comment to post when marking as stale. Set to `false` to disable markComment: > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs within the next 7 days. - Please check if the issue is still relevant in the most current version of the adapter - and tell us. Also check that all relevant details, logs and reproduction steps - are included and update them if needed. - Thank you for your contributions. - - Dieses Problem wurde automatisch als veraltet markiert, da es in letzter Zeit keine Aktivitäten gab. - Es wird geschlossen, wenn nicht innerhalb der nächsten 7 Tage weitere Aktivitäten stattfinden. - Bitte überprüft, ob das Problem auch in der aktuellsten Version des Adapters noch relevant ist, - und teilt uns dies mit. Überprüft auch, ob alle relevanten Details, Logs und Reproduktionsschritte - enthalten sind bzw. aktualisiert diese. - Vielen Dank für Eure Unterstützung. + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs within the next 7 days. + Please check if the issue is still relevant in the most current version of the adapter + and tell us. Also check that all relevant details, logs and reproduction steps + are included and update them if needed. + Thank you for your contributions. + + Dieses Problem wurde automatisch als veraltet markiert, da es in letzter Zeit keine Aktivitäten gab. + Es wird geschlossen, wenn nicht innerhalb der nächsten 7 Tage weitere Aktivitäten stattfinden. + Bitte überprüft, ob das Problem auch in der aktuellsten Version des Adapters noch relevant ist, + und teilt uns dies mit. Überprüft auch, ob alle relevanten Details, Logs und Reproduktionsschritte + enthalten sind bzw. aktualisiert diese. + Vielen Dank für Eure Unterstützung. # Comment to post when removing the stale label. # unmarkComment: > @@ -50,22 +50,21 @@ markComment: > # Comment to post when closing a stale Issue or Pull Request. closeComment: > - This issue has been automatically closed because of inactivity. Please open a new - issue if still relevant and make sure to include all relevant details, logs and - reproduction steps. - Thank you for your contributions. + This issue has been automatically closed because of inactivity. Please open a new + issue if still relevant and make sure to include all relevant details, logs and + reproduction steps. + Thank you for your contributions. - Dieses Problem wurde aufgrund von Inaktivität automatisch geschlossen. Bitte öffnet ein - neues Issue, falls dies noch relevant ist und stellt sicher das alle relevanten Details, - Logs und Reproduktionsschritte enthalten sind. - Vielen Dank für Eure Unterstützung. + Dieses Problem wurde aufgrund von Inaktivität automatisch geschlossen. Bitte öffnet ein + neues Issue, falls dies noch relevant ist und stellt sicher das alle relevanten Details, + Logs und Reproduktionsschritte enthalten sind. + Vielen Dank für Eure Unterstützung. # Limit the number of actions per hour, from 1-30. Default is 30 limitPerRun: 30 # Limit to only `issues` or `pulls` only: issues - # Optionally, specify configuration settings that are specific to just 'issues' or 'pulls': # pulls: # daysUntilStale: 30 diff --git a/.github/workflows/dependabot-automerge.yml b/.github/workflows/dependabot-automerge.yml index dfddd2c..be71036 100644 --- a/.github/workflows/dependabot-automerge.yml +++ b/.github/workflows/dependabot-automerge.yml @@ -4,19 +4,19 @@ name: Auto-Merge Dependabot PRs on: - pull_request_target: + pull_request_target: jobs: - auto-merge: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 + auto-merge: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 - - name: Check if PR should be auto-merged - uses: ahmadnassri/action-dependabot-auto-merge@v2 - with: - # This must be a personal access token with push access - github-token: ${{ secrets.AUTO_MERGE_TOKEN }} - # By default, squash and merge, so Github chooses nice commit messages - command: squash and merge \ No newline at end of file + - name: Check if PR should be auto-merged + uses: ahmadnassri/action-dependabot-auto-merge@v2 + with: + # This must be a personal access token with push access + github-token: ${{ secrets.AUTO_MERGE_TOKEN }} + # By default, squash and merge, so Github chooses nice commit messages + command: squash and merge diff --git a/.github/workflows/test-and-release.yml b/.github/workflows/test-and-release.yml index ba6a4b0..0b583fe 100644 --- a/.github/workflows/test-and-release.yml +++ b/.github/workflows/test-and-release.yml @@ -6,160 +6,158 @@ name: Test and Release # Run this job on all pushes and pull requests # as well as tags with a semantic version on: - push: - branches: - - '*' - tags: - # normal versions - - "v?[0-9]+.[0-9]+.[0-9]+" - # pre-releases - - "v?[0-9]+.[0-9]+.[0-9]+-**" - pull_request: {} + push: + branches: + - '*' + tags: + # normal versions + - 'v?[0-9]+.[0-9]+.[0-9]+' + # pre-releases + - 'v?[0-9]+.[0-9]+.[0-9]+-**' + pull_request: {} # Cancel previous PR/branch runs when a new commit is pushed concurrency: - group: ${{ github.ref }} - cancel-in-progress: true + group: ${{ github.ref }} + cancel-in-progress: true jobs: - # Performs quick checks before the expensive test runs - check-and-lint: - if: contains(github.event.head_commit.message, '[skip ci]') == false - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Use Node.js 20.x - uses: actions/setup-node@v4 - with: - node-version: 20.x - - - - name: Install Dependencies - run: npm install - -# - name: Perform a type check -# run: npm run check:ts -# env: -# CI: true - # - name: Lint TypeScript code - # run: npm run lint -# - name: Test package files -# run: npm run test:package - - # Runs adapter tests on all supported node versions and OSes - adapter-tests: - if: contains(github.event.head_commit.message, '[skip ci]') == false - - needs: [check-and-lint] - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Use Node.js 20.x - uses: actions/setup-node@v4 - with: - node-version: 20.x - - - name: Install Dependencies - run: npm install - - - name: Build - run: npm run build - - - name: Run local tests - run: npm test -# - name: Run unit tests -# run: npm run test:unit -# - name: Run integration tests # (linux/osx) -# if: startsWith(runner.OS, 'windows') == false -# run: DEBUG=testing:* npm run test:integration -# - name: Run integration tests # (windows) -# if: startsWith(runner.OS, 'windows') -# run: set DEBUG=testing:* & npm run test:integration - - # Deploys the final package to NPM - deploy: - needs: [adapter-tests] - - # Trigger this step only when a commit on master is tagged with a version number - if: | - contains(github.event.head_commit.message, '[skip ci]') == false && - github.event_name == 'push' && - startsWith(github.ref, 'refs/tags/') - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Use Node.js 20.x - uses: actions/setup-node@v4 - with: - node-version: 20.x - - - name: Extract the version and commit body from the tag - id: extract_release - # The body may be multiline; therefore, we need to escape some characters - run: | - VERSION="${{ github.ref }}" - VERSION=${VERSION##*/} - VERSION=${VERSION##*v} - echo "::set-output name=VERSION::$VERSION" - BODY=$(git show -s --format=%b) - BODY="${BODY//'%'/'%25'}" - BODY="${BODY//$'\n'/'%0A'}" - BODY="${BODY//$'\r'/'%0D'}" - echo "::set-output name=BODY::$BODY" - - - name: Install Dependencies - run: npm install - -# - name: Create a clean build -# run: npm run build - - name: Publish package to npm - run: | - npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} - npm whoami - npm publish - - - name: Create Github Release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Release v${{ steps.extract_release.outputs.VERSION }} - draft: false - # Prerelease versions create pre-releases on GitHub - prerelease: ${{ contains(steps.extract_release.outputs.VERSION, '-') }} - body: ${{ steps.extract_release.outputs.BODY }} - - - name: Notify Sentry.io about the release - run: | - npm i -g @sentry/cli - export SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} - export SENTRY_URL=https://sentry.iobroker.net - export SENTRY_ORG=iobroker - export SENTRY_PROJECT=iobroker-welcome - export SENTRY_VERSION=iobroker.welcome@${{ steps.extract_release.outputs.VERSION }} - sentry-cli releases new $SENTRY_VERSION - sentry-cli releases set-commits $SENTRY_VERSION --auto - sentry-cli releases finalize $SENTRY_VERSION - - - name: Notify Sentry.io about the release - run: | - npm i -g @sentry/cli - export SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} - export SENTRY_URL=https://sentry.iobroker.net - export SENTRY_ORG=iobroker - export SENTRY_PROJECT=iobroker-welcome-react - export SENTRY_VERSION=iobroker.welcome-react@${{ steps.extract_release.outputs.VERSION }} - sentry-cli releases new $SENTRY_VERSION - sentry-cli releases set-commits $SENTRY_VERSION --auto - sentry-cli releases finalize $SENTRY_VERSION - - # Add the following line BEFORE finalize if sourcemap uploads are necessary - # sentry-cli releases files $SENTRY_VERSION upload-sourcemaps build/ + # Performs quick checks before the expensive test runs + check-and-lint: + if: contains(github.event.head_commit.message, '[skip ci]') == false + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 20.x + + - name: Install Dependencies + run: npm install + + # - name: Perform a type check + # run: npm run check:ts + # env: + # CI: true + # - name: Lint TypeScript code + # run: npm run lint + # - name: Test package files + # run: npm run test:package + + # Runs adapter tests on all supported node versions and OSes + adapter-tests: + if: contains(github.event.head_commit.message, '[skip ci]') == false + + needs: [check-and-lint] + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js 22.x + uses: actions/setup-node@v4 + with: + node-version: 22.x + + - name: Install Dependencies + run: npm install + + - name: Build + run: npm run build + + - name: Run local tests + run: npm test + # - name: Run unit tests + # run: npm run test:unit + # - name: Run integration tests # (linux/osx) + # if: startsWith(runner.OS, 'windows') == false + # run: DEBUG=testing:* npm run test:integration + # - name: Run integration tests # (windows) + # if: startsWith(runner.OS, 'windows') + # run: set DEBUG=testing:* & npm run test:integration + + # Deploys the final package to NPM + deploy: + needs: [adapter-tests] + + # Trigger this step only when a commit on master is tagged with a version number + if: | + contains(github.event.head_commit.message, '[skip ci]') == false && + github.event_name == 'push' && + startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Use Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 20.x + + - name: Extract the version and commit body from the tag + id: extract_release + # The body may be multiline; therefore, we need to escape some characters + run: | + VERSION="${{ github.ref }}" + VERSION=${VERSION##*/} + VERSION=${VERSION##*v} + echo "::set-output name=VERSION::$VERSION" + BODY=$(git show -s --format=%b) + BODY="${BODY//'%'/'%25'}" + BODY="${BODY//$'\n'/'%0A'}" + BODY="${BODY//$'\r'/'%0D'}" + echo "::set-output name=BODY::$BODY" + + - name: Install Dependencies + run: npm install + + # - name: Create a clean build + # run: npm run build + - name: Publish package to npm + run: | + npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} + npm whoami + npm publish + + - name: Create Github Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release v${{ steps.extract_release.outputs.VERSION }} + draft: false + # Prerelease versions create pre-releases on GitHub + prerelease: ${{ contains(steps.extract_release.outputs.VERSION, '-') }} + body: ${{ steps.extract_release.outputs.BODY }} + + - name: Notify Sentry.io about the release + run: | + npm i -g @sentry/cli + export SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} + export SENTRY_URL=https://sentry.iobroker.net + export SENTRY_ORG=iobroker + export SENTRY_PROJECT=iobroker-welcome + export SENTRY_VERSION=iobroker.welcome@${{ steps.extract_release.outputs.VERSION }} + sentry-cli releases new $SENTRY_VERSION + sentry-cli releases set-commits $SENTRY_VERSION --auto + sentry-cli releases finalize $SENTRY_VERSION + + - name: Notify Sentry.io about the release + run: | + npm i -g @sentry/cli + export SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} + export SENTRY_URL=https://sentry.iobroker.net + export SENTRY_ORG=iobroker + export SENTRY_PROJECT=iobroker-welcome-react + export SENTRY_VERSION=iobroker.welcome-react@${{ steps.extract_release.outputs.VERSION }} + sentry-cli releases new $SENTRY_VERSION + sentry-cli releases set-commits $SENTRY_VERSION --auto + sentry-cli releases finalize $SENTRY_VERSION + + # Add the following line BEFORE finalize if sourcemap uploads are necessary + # sentry-cli releases files $SENTRY_VERSION upload-sourcemaps build/ diff --git a/admin/jsonConfig.json b/admin/jsonConfig.json index 5405f7c..bfea69c 100644 --- a/admin/jsonConfig.json +++ b/admin/jsonConfig.json @@ -1,171 +1,171 @@ { - "i18n": true, - "type": "tabs", - "items": { - "_config": { - "type": "panel", - "label": "Web Server", - "items": { - "bind": { - "type": "ip", - "label": "Own IP address", - "sm": 6, - "md": 4, - "lg": 2 - }, - "port": { - "type": "port", - "label": "Port", - "default": 80, - "sm": 6, - "md": 4, - "lg": 2 - }, - "secure": { - "newLine": true, - "type": "checkbox", - "label": "Secure(HTTPS)", - "sm": 12, - "md": 6, - "lg": 2 - }, - "_certs": { - "type": "certificates", - "newLine": true, - "hidden": "!data.secure", - "sm": 12 - }, - "retryInterval": { - "newLine": true, - "type": "number", - "label": "Retry Interval", - "help": "Adapter will retry every X seconds to open the web server on the given port", - "sm": 6, - "md": 4, - "lg": 2 - } - } - }, - "_settings": { - "type": "panel", - "label": "Settings", - "items": { - "redirectToLink": { - "newLine": true, - "type": "checkbox", - "label": "Redirect to custom link", - "sm": 12, - "md": 6, - "lg": 4 - }, - "redirectUrl": { - "newLine": true, - "type": "text", - "label": "Custom URL", - "validator": "!data.redirectToLink || !!data.redirectUrl", - "validatorErrorText": "URL must be set", - "validatorNoSaveOnError": true, - "tooltip": "User will be immediately redirected to this link after opening of the page", - "sm": 12, - "md": 6, - "lg": 4, - "hidden": "!data.redirectToLink" - }, - "redirect": { - "newLine": true, - "type": "instance", - "label": "Redirect to instance by opening of the page", - "default": "", - "adapters": ["admin", "web"], - "sm": 12, - "md": 6, - "lg": 4, - "hidden": "!!data.redirectToLink" - }, - "welcomePhrase": { - "newLine": true, - "type": "text", - "label": "Welcome Phrase", - "sm": 12, - "hidden": "!!data.redirect || !!data.redirectToLink" - }, - "backgroundColor": { - "newLine": true, - "type": "color", - "label": "Background Color", - "sm": 6, - "md": 4, - "lg": 2, - "hidden": "!!data.redirect || !!data.redirectToLink" - }, - "backgroundToolbarColor": { - "newLine": true, - "type": "color", - "label": "Toolbar background Color", - "sm": 6, - "md": 4, - "lg": 2, - "hidden": "!!data.redirect || !!data.redirectToLink" - }, - "language": { - "newLine": true, - "type": "language", - "label": "Language", - "system": true, - "noTranslation": true, - "sm": 6, - "md": 4, - "lg": 2, - "hidden": "!!data.redirect || !!data.redirectToLink" + "i18n": true, + "type": "tabs", + "items": { + "_config": { + "type": "panel", + "label": "Web Server", + "items": { + "bind": { + "type": "ip", + "label": "Own IP address", + "sm": 6, + "md": 4, + "lg": 2 + }, + "port": { + "type": "port", + "label": "Port", + "default": 80, + "sm": 6, + "md": 4, + "lg": 2 + }, + "secure": { + "newLine": true, + "type": "checkbox", + "label": "Secure(HTTPS)", + "sm": 12, + "md": 6, + "lg": 2 + }, + "_certs": { + "type": "certificates", + "newLine": true, + "hidden": "!data.secure", + "sm": 12 + }, + "retryInterval": { + "newLine": true, + "type": "number", + "label": "Retry Interval", + "help": "Adapter will retry every X seconds to open the web server on the given port", + "sm": 6, + "md": 4, + "lg": 2 + } + } }, - "logo.png": { - "newLine": true, - "type": "image", - "label": "Logo", - "accept": { "image/*": [] }, - "sm": 6, - "md": 4, - "lg": 4, - "hidden": "!!data.redirect || !!data.redirectToLink" + "_settings": { + "type": "panel", + "label": "Settings", + "items": { + "redirectToLink": { + "newLine": true, + "type": "checkbox", + "label": "Redirect to custom link", + "sm": 12, + "md": 6, + "lg": 4 + }, + "redirectUrl": { + "newLine": true, + "type": "text", + "label": "Custom URL", + "validator": "!data.redirectToLink || !!data.redirectUrl", + "validatorErrorText": "URL must be set", + "validatorNoSaveOnError": true, + "tooltip": "User will be immediately redirected to this link after opening of the page", + "sm": 12, + "md": 6, + "lg": 4, + "hidden": "!data.redirectToLink" + }, + "redirect": { + "newLine": true, + "type": "instance", + "label": "Redirect to instance by opening of the page", + "default": "", + "adapters": ["admin", "web"], + "sm": 12, + "md": 6, + "lg": 4, + "hidden": "!!data.redirectToLink" + }, + "welcomePhrase": { + "newLine": true, + "type": "text", + "label": "Welcome Phrase", + "sm": 12, + "hidden": "!!data.redirect || !!data.redirectToLink" + }, + "backgroundColor": { + "newLine": true, + "type": "color", + "label": "Background Color", + "sm": 6, + "md": 4, + "lg": 2, + "hidden": "!!data.redirect || !!data.redirectToLink" + }, + "backgroundToolbarColor": { + "newLine": true, + "type": "color", + "label": "Toolbar background Color", + "sm": 6, + "md": 4, + "lg": 2, + "hidden": "!!data.redirect || !!data.redirectToLink" + }, + "language": { + "newLine": true, + "type": "language", + "label": "Language", + "system": true, + "noTranslation": true, + "sm": 6, + "md": 4, + "lg": 2, + "hidden": "!!data.redirect || !!data.redirectToLink" + }, + "logo.png": { + "newLine": true, + "type": "image", + "label": "Logo", + "accept": { "image/*": [] }, + "sm": 6, + "md": 4, + "lg": 4, + "hidden": "!!data.redirect || !!data.redirectToLink" + }, + "_custom": { + "newLine": true, + "type": "custom", + "sm": 12, + "md": 6, + "lg": 6, + "i18n": true, + "url": "custom/customComponents.js", + "name": "ConfigCustomWelcomeSet/Components/WelcomeComponent", + "hidden": "!!data.redirect || !!data.redirectToLink" + } + } }, "_custom": { - "newLine": true, - "type": "custom", - "sm": 12, - "md": 6, - "lg": 6, - "i18n": true, - "url": "custom/customComponents.js", - "name": "ConfigCustomWelcomeSet/Components/WelcomeComponent", - "hidden": "!!data.redirect || !!data.redirectToLink" - } - } - }, - "_custom": { - "type": "panel", - "label": "Custom links", - "hidden": "!!data.redirect || !!data.redirectToLink", - "items": { - "customLinks": { - "type": "table", - "items": [ - {"type": "checkbox", "width": 50, "attr": "enabled", "title": "Enabled"}, - {"type": "text", "width": "20%", "attr": "name", "title": "Name"}, - {"type": "text", "width": "20%", "attr": "link", "title": "Link"}, - {"type": "text", "width": "20%", "attr": "desc", "title": "Description"}, - { - "type": "image", - "base64": true, - "accept": { "image/*": [] }, - "width": "20%", - "attr": "icon", - "title": "Icon", - "maxSize": 1024000 + "type": "panel", + "label": "Custom links", + "hidden": "!!data.redirect || !!data.redirectToLink", + "items": { + "customLinks": { + "type": "table", + "items": [ + { "type": "checkbox", "width": 50, "attr": "enabled", "title": "Enabled" }, + { "type": "text", "width": "20%", "attr": "name", "title": "Name" }, + { "type": "text", "width": "20%", "attr": "link", "title": "Link" }, + { "type": "text", "width": "20%", "attr": "desc", "title": "Description" }, + { + "type": "image", + "base64": true, + "accept": { "image/*": [] }, + "width": "20%", + "attr": "icon", + "title": "Icon", + "maxSize": 1024000 + } + ], + "xs": 12 + } } - ], - "xs": 12 } - } } - } } diff --git a/package.json b/package.json index c7c898b..8e131b1 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "@alcalzone/release-script-plugin-iobroker": "^3.7.2", "@alcalzone/release-script-plugin-license": "^3.7.0", "@iobroker/eslint-config": "^0.1.6", - "@iobroker/build-tools": "^2.0.2", + "@iobroker/build-tools": "^2.0.5", "@iobroker/legacy-testing": "^1.0.13", "@iobroker/testing": "^5.0.0", "sinon-chai": "^3.7.0", diff --git a/src-admin/public/index.html b/src-admin/public/index.html index 56783b2..4ff426c 100644 --- a/src-admin/public/index.html +++ b/src-admin/public/index.html @@ -1,25 +1,39 @@ - + - - - - - Admin App - - - -
- - + document.head.appendChild(script); + + + +
+ + diff --git a/src-admin/src/Components.jsx b/src-admin/src/Components.jsx index 1b9008b..3144eb5 100644 --- a/src-admin/src/Components.jsx +++ b/src-admin/src/Components.jsx @@ -1,3 +1,3 @@ import WelcomeComponent from './WelcomeComponent'; -export default { WelcomeComponent }; \ No newline at end of file +export default { WelcomeComponent }; diff --git a/src-admin/src/WelcomeComponent.jsx b/src-admin/src/WelcomeComponent.jsx index 5caa83a..b615b6f 100644 --- a/src-admin/src/WelcomeComponent.jsx +++ b/src-admin/src/WelcomeComponent.jsx @@ -12,7 +12,7 @@ import { Paper, Checkbox, Switch, - FormControlLabel + FormControlLabel, } from '@mui/material'; // important to make from package and not from some children. // invalid @@ -27,7 +27,7 @@ class WelcomeComponent extends ConfigGeneric { constructor(props) { super(props); this.state = { - instances: null + instances: null, }; } @@ -46,7 +46,7 @@ class WelcomeComponent extends ConfigGeneric { id: id.replace('system.adapter.', ''), icon: instances[id].common.icon, title: instances[id].common.title, - name: instances[id].common.name + name: instances[id].common.name, }); } }); @@ -119,7 +119,7 @@ class WelcomeComponent extends ConfigGeneric { } onClick={() => { const specificInstances = [ - ...(this.props.data.specificInstances || []) + ...(this.props.data.specificInstances || []), ]; const pos = specificInstances.indexOf(instance.id); if (pos !== -1) { @@ -140,7 +140,7 @@ class WelcomeComponent extends ConfigGeneric { style={{ display: 'flex', alignItems: 'center', - gap: 5 + gap: 5, }} > {instance.icon ? ( @@ -172,7 +172,7 @@ WelcomeComponent.propTypes = { attr: PropTypes.string, schema: PropTypes.object, onError: PropTypes.func, - onChange: PropTypes.func + onChange: PropTypes.func, }; export default WelcomeComponent;