Skip to content

Commit

Permalink
Merge pull request #91 from dachcom-digital/feature/extendable-backen…
Browse files Browse the repository at this point in the history
…d-ui

introduced backend ui event
  • Loading branch information
benwalch authored Oct 17, 2024
2 parents b5c6dda + 9652f77 commit 4d9a2a5
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 23 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ jobs:
matrix:
php: [ 8.2 ]
symfony: [ ^6.2 ]
pimcore: [ ~11.0.0 ]
pimcore: [ ~11.2.0 ]
include:
- pimcore: ~11.0.0
- pimcore: ~11.2.0
template_tag: v11.0.0
steps:
- uses: actions/checkout@v2
- uses: nanasess/setup-chromedriver@v2
- uses: actions/checkout@v4
with:
path: lib/test-bundle

Expand Down Expand Up @@ -98,20 +99,22 @@ jobs:

- name: Setup Chromium
run: |
nohup $CHROMEWEBDRIVER/chromedriver --url-base=/wd/hub /dev/null 2>&1 &
export DISPLAY=:99
chromedriver --url-base=/wd/hub --port=9515 &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
- name: Start Webserver and Chrome
- name: Start Symfony Server
run: |
curl -sS https://get.symfony.com/cli/installer | bash -s -- --install-dir=$HOME/.symfony/bin
~/.symfony/bin/symfony server:start --port=8080 --dir=public --allow-http --no-tls --daemon
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer Downloads
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
Expand All @@ -136,7 +139,7 @@ jobs:
vendor/bin/codecept run --env github -c ${{ github.workspace }}/lib/test-bundle
- name: Log Output
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: failure()
with:
name: "Logs (PHP ${{ matrix.php }}, Pimcore ${{ matrix.pimcore }}, Symfony ${{ matrix.symfony }})"
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ $ bin/console dynamic-search:run -v
- Multi Search Channels
- Filter (Faceted Search / Aggregation)
- Create Filter Definition
- [Backend UI](docs/50_BackendUI.md)
- API


## Copyright and License
Copyright: [DACHCOM.DIGITAL](http://dachcom-digital.com)
For licensing details please visit [LICENSE.md](LICENSE.md)
Expand Down
4 changes: 4 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Upgrade Notes

# 4.0.2

* introduced backend ui event [#91](https://github.com/dachcom-digital/pimcore-dynamic-search/pull/91)

# 4.0.1

* fix resource deletion [#90](https://github.com/dachcom-digital/pimcore-dynamic-search/pull/90)
Expand Down
7 changes: 6 additions & 1 deletion config/pimcore/routing.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
dynamic_search.controller.admin.get_state:
path: /admin/dynamic-search/settings/health-state
defaults: { _controller: DynamicSearchBundle\Controller\Admin\SettingsController::healthStateAction }
options:
expose: true

dynamic_search.controller.admin.get_provider:
path: /admin/dynamic-search/settings/provider
defaults: { _controller: DynamicSearchBundle\Controller\Admin\SettingsController::providerAction }
options:
expose: true

dynamic_search.controller.json_search:
path: /dynamic-search/{contextName}/j-{outputChannelName}
defaults: { _controller: DynamicSearchBundle\Controller\SearchController::jsonSearchAction }
defaults: { _controller: DynamicSearchBundle\Controller\SearchController::jsonSearchAction }
19 changes: 19 additions & 0 deletions docs/50_BackendUI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Backend UI

It is possible to extend the backend user interface.
Listen to the event `dynamic_search.event.settings.postBuildLayout`:

```javascript
document.addEventListener(
'dynamic_search.event.settings.postBuildLayout',
(event) => {
const dsSettings = event.detail.subject;

dsSettings.panel.add({
'xtype': 'button',
'text': 'my button'
// ...etc
});
}
);
```
31 changes: 21 additions & 10 deletions public/js/backend/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,29 @@ pimcore.plugin.dynamicSearch.settings = Class.create({
title: t('dynamic_search_settings'),
iconCls: 'dynamic_search_bundle',
border: false,
layout: 'border',
bodyPadding: 10,
layout: {
type: 'vbox',
align: 'stretch'
},
closable: true,
items: [
this.buildStatusPanel(),
this.buildProviderGrid()
]
});

this.panel.on('destroy', function () {
pimcore.globalmanager.remove('dynamic_search_settings');
}.bind(this));

this.panel.add(this.buildStatusPanel())
this.panel.add(this.buildProviderGrid())
const postBuildLayoutEvent = new CustomEvent('dynamic_search.event.settings.postBuildLayout', {
detail: {
subject: this
}
});

document.dispatchEvent(postBuildLayoutEvent);

pimcoreSystemPanel.add(this.panel);
pimcoreSystemPanel.setActiveItem('dynamic_search_settings');
Expand All @@ -41,8 +54,7 @@ pimcore.plugin.dynamicSearch.settings = Class.create({
title: 'Health Status',
layout: 'table',
viewType: 'tableview',
region: 'north',
style: 'padding: 10px',
style: 'margin-bottom: 10px',
border: false,
columnLines: true,
stripeRows: true,
Expand All @@ -56,7 +68,7 @@ pimcore.plugin.dynamicSearch.settings = Class.create({
autoLoad: true,
proxy: {
type: 'ajax',
url: '/admin/dynamic-search/settings/health-state',
url: Routing.generate('dynamic_search.controller.admin.get_state'),
reader: {
type: 'json',
rootProperty: 'lines'
Expand Down Expand Up @@ -109,9 +121,8 @@ pimcore.plugin.dynamicSearch.settings = Class.create({

return new Ext.grid.GridPanel({
title: 'Provider',
layout: 'fit',
region: 'center',
style: 'padding: 10px',
layout: 'table',
style: 'margin-bottom: 10px',
columnLines: true,
stripeRows: true,
disableSelection: true,
Expand All @@ -123,7 +134,7 @@ pimcore.plugin.dynamicSearch.settings = Class.create({
autoLoad: true,
proxy: {
type: 'ajax',
url: '/admin/dynamic-search/settings/provider',
url: Routing.generate('dynamic_search.controller.admin.get_provider'),
reader: {
type: 'json',
rootProperty: 'provider'
Expand Down
9 changes: 5 additions & 4 deletions tests/_envs/github.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
modules:
config:
\Dachcom\Codeception\Helper\Browser\WebDriver:
\Dachcom\Codeception\Support\Helper\Browser\WebDriver:
browser: chrome
port: 9515
restart: true
wait: 1
window_size: 1280x1024
capabilities:
chromeOptions:
args: ['--no-sandbox', '--disable-extensions', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--window-size=1024,768']
'goog:chromeOptions':
args: ['--no-sandbox', '--disable-extensions', '--headless', '--disable-gpu', '--disable-dev-shm-usage', '--window-size=1280,1024']
prefs:
download.default_directory: '%TEST_BUNDLE_TEST_DIR%/_data/downloads'
download.default_directory: '%TEST_BUNDLE_TEST_DIR%/_data/downloads'

0 comments on commit 4d9a2a5

Please sign in to comment.