From 037ed127ecf1fd190d38037d7aea679f40d487b6 Mon Sep 17 00:00:00 2001 From: Joe <104938042+lrljoe@users.noreply.github.com> Date: Tue, 30 Apr 2024 15:42:08 +0100 Subject: [PATCH] Add single setConfigurableArea (#1706) * Add setConfigurableArea * Update Workflows --------- Co-authored-by: lrljoe --- .github/workflows/run-tests-pcov-pull.yml | 13 ++- .github/workflows/run-tests-pcov.yml | 92 ------------------- .github/workflows/run-tests-pull.yml | 11 ++- .github/workflows/run-tests.yml | 5 +- CHANGELOG.md | 7 ++ docs/datatable/configurable-areas.md | 13 ++- .../ConfigurableAreasConfiguration.php | 9 ++ 7 files changed, 53 insertions(+), 97 deletions(-) delete mode 100644 .github/workflows/run-tests-pcov.yml diff --git a/.github/workflows/run-tests-pcov-pull.yml b/.github/workflows/run-tests-pcov-pull.yml index 387cc75f3..08e7eea08 100644 --- a/.github/workflows/run-tests-pcov-pull.yml +++ b/.github/workflows/run-tests-pcov-pull.yml @@ -1,6 +1,10 @@ name: run-tests-pcov-pull -on: [pull_request] +on: + pull_request: + branches: + - 'develop' + - 'master' jobs: test: @@ -41,6 +45,13 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Cache extensions + uses: actions/cache@v3 + with: + path: ${{ steps.extcache.outputs.dir }} + key: ${{ steps.extcache.outputs.key }} + restore-keys: ${{ steps.extcache.outputs.key }} + - name: Setup problem matchers for PHP run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" diff --git a/.github/workflows/run-tests-pcov.yml b/.github/workflows/run-tests-pcov.yml deleted file mode 100644 index 08f1ec574..000000000 --- a/.github/workflows/run-tests-pcov.yml +++ /dev/null @@ -1,92 +0,0 @@ -name: run-tests-pcov - -on: [push] - -jobs: - test: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - php: [8.3] - laravel: [10] - stability: [prefer-dist] - - name: PCOV-PUSH - ${{ matrix.os }} - P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - env: - extensionKey: phpextensions-${{ matrix.os }}-P${{ matrix.php }}-withpcov - extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pcov,pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo, :psr - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Setup cache environment - id: extcache - uses: shivammathur/cache-extensions@v1 - with: - php-version: ${{ matrix.php }} - extensions: ${{ env.extensions }} - key: ${{ env.extensionKey }} - - - name: Cache extensions - uses: actions/cache@v3 - with: - path: ${{ steps.extcache.outputs.dir }} - key: ${{ steps.extcache.outputs.key }} - restore-keys: ${{ steps.extcache.outputs.key }} - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - extensions: ${{ env.extensions }} - tools: phpunit:latest - ini-values: memory_limit=512M - coverage: pcov - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Setup problem matchers for PHP - run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" - - - name: Get composer cache directory - id: composer-cache - run: | - echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - uses: actions/cache@v3 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-PCOV-PUSH-PHP-${{ matrix.php }}-Laravel${{ matrix.laravel }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: ${{ runner.os }}-PCOV-PUSH-PHP${{ matrix.php }}-Laravel${{ matrix.laravel }}-composer- - - - name: Add token - run: | - composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} - - - name: Install dependencies - if: steps.composer-cache.outputs.cache-hit != 'true' - run: composer require "laravel/framework:${{ matrix.laravel }}.*" --no-interaction --no-update - - - name: Update dependencies - if: steps.composer-cache.outputs.cache-hit != 'true' - run: composer update --${{ matrix.stability }} --no-interaction - - - name: Setup problem matchers for PHPUnit - run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - - - name: Run Unit Tests - run: php ./vendor/bin/paratest --cache-directory=".phpunit.cache/code-coverage" --strict-coverage --coverage-clover ./coverage.xml --processes=4 - - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: - token: ${{ secrets.CODE_COV_TOKEN }} - files: ./coverage.xml - verbose: true - - diff --git a/.github/workflows/run-tests-pull.yml b/.github/workflows/run-tests-pull.yml index 0b53b11f8..50c0c38be 100644 --- a/.github/workflows/run-tests-pull.yml +++ b/.github/workflows/run-tests-pull.yml @@ -1,6 +1,10 @@ name: run-tests-pull -on: [pull_request] +on: + pull_request: + branches: + - 'develop' + - 'master' jobs: test: @@ -10,8 +14,11 @@ jobs: matrix: os: [ubuntu-latest] php: [8.1, 8.2, 8.3] - laravel: [10] + laravel: [10.*,11.*] stability: [prefer-dist] + exclude: + - laravel: 11.* + php: 8.1 name: STD-PULL - ${{ matrix.os }} - P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} env: diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 073bbe9c5..ce258214d 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -10,8 +10,11 @@ jobs: matrix: os: [ubuntu-latest] php: [8.1, 8.2, 8.3] - laravel: [10] + laravel: [10.*,11.*] stability: [prefer-dist] + exclude: + - laravel: 11.* + php: 8.1 name: STD-PUSH - ${{ matrix.os }} - P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} env: diff --git a/CHANGELOG.md b/CHANGELOG.md index e3e60a676..a7a9af809 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to `laravel-livewire-tables` will be documented in this file +## UNRELEASED +### New Features +- Add setConfigurableArea by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1706 + +### Tweaks +- Adjust Workflow behaviour for PCOV by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1706 + ## [v3.2.4] - 2024-03-01 ### Bug Fixes - Collapsing Columns fix when multiple tables are displayed on a page by @lrljoe diff --git a/docs/datatable/configurable-areas.md b/docs/datatable/configurable-areas.md index 256d67dd4..bb9d78a5b 100644 --- a/docs/datatable/configurable-areas.md +++ b/docs/datatable/configurable-areas.md @@ -7,9 +7,20 @@ There are certain areas of the datatable as of `v2.3` where you can include your ## Available Methods +### setConfigurableArea + +You can use the `setConfigurableArea` method to set an area that you want to configure. + +```php +public function configure(): void +{ + $this->setConfigurableArea('before-tools', 'path.to.my.view'); +} +``` + ### setConfigurableAreas -You can use the `setConfigurableAreas` method to set the areas that you want to be configurable. +You can use the `setConfigurableAreas` method to set multiple areas that you want to configure. ```php public function configure(): void diff --git a/src/Traits/Configuration/ConfigurableAreasConfiguration.php b/src/Traits/Configuration/ConfigurableAreasConfiguration.php index ac372b335..043c2964c 100644 --- a/src/Traits/Configuration/ConfigurableAreasConfiguration.php +++ b/src/Traits/Configuration/ConfigurableAreasConfiguration.php @@ -14,6 +14,15 @@ public function setConfigurableAreas(array $areas): self return $this; } + public function setConfigurableArea(string $configurableArea, mixed $config): self + { + if (array_key_exists($configurableArea, $this->configurableAreas)) { + $this->configurableAreas[$configurableArea] = $config; + } + + return $this; + } + public function setHideConfigurableAreasWhenReorderingStatus(bool $status): self { $this->hideConfigurableAreasWhenReorderingStatus = $status;