Skip to content

Commit 22f5492

Browse files
committed
Initial commit
0 parents  commit 22f5492

23 files changed

Lines changed: 2438 additions & 0 deletions

.babelrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"presets": [
3+
["@babel/preset-env", {
4+
"targets": {
5+
"node": "current"
6+
}
7+
}]
8+
]
9+
}

.eslintrc.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
es2021: true,
5+
jest: true
6+
},
7+
extends: 'eslint:recommended',
8+
parserOptions: {
9+
ecmaVersion: 2021,
10+
sourceType: 'script'
11+
},
12+
rules: {
13+
'indent': ['error', 4],
14+
'linebreak-style': ['error', 'unix'],
15+
'quotes': ['error', 'single'],
16+
'semi': ['error', 'always'],
17+
'no-unused-vars': ['warn'],
18+
'no-console': ['warn', { allow: ['error', 'warn'] }]
19+
},
20+
globals: {
21+
'DOMParser': 'readonly'
22+
}
23+
};

.github/workflows/ci.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
javascript-tests:
11+
name: JavaScript Tests
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
node-version: [16.x, 18.x, 20.x]
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
21+
- name: Use Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
cache: 'npm'
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Run linter
31+
run: npm run lint
32+
33+
- name: Run tests with coverage
34+
run: npm run test:js:coverage
35+
36+
- name: Upload coverage to Codecov
37+
uses: codecov/codecov-action@v3
38+
with:
39+
files: ./coverage/lcov.info
40+
flags: javascript
41+
42+
php-tests:
43+
name: PHP Tests
44+
runs-on: ubuntu-latest
45+
46+
strategy:
47+
matrix:
48+
php-version: ['7.4', '8.0', '8.1', '8.2']
49+
silverstripe-version: ['^4.0', '^5.0']
50+
exclude:
51+
- php-version: '7.4'
52+
silverstripe-version: '^5.0'
53+
54+
steps:
55+
- uses: actions/checkout@v3
56+
57+
- name: Setup PHP
58+
uses: shivammathur/setup-php@v2
59+
with:
60+
php-version: ${{ matrix.php-version }}
61+
extensions: mbstring, intl, pdo, pdo_mysql
62+
coverage: xdebug
63+
64+
- name: Validate composer.json
65+
run: composer validate --strict
66+
67+
- name: Cache Composer packages
68+
uses: actions/cache@v3
69+
with:
70+
path: vendor
71+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
72+
restore-keys: |
73+
${{ runner.os }}-php-
74+
75+
- name: Install dependencies
76+
run: |
77+
composer require silverstripe/framework:${{ matrix.silverstripe-version }} --no-update
78+
composer install --prefer-dist --no-progress
79+
80+
- name: Run test suite
81+
run: vendor/bin/phpunit --coverage-clover coverage.xml
82+
83+
- name: Upload coverage to Codecov
84+
uses: codecov/codecov-action@v3
85+
with:
86+
files: ./coverage.xml
87+
flags: php
88+
89+
build:
90+
name: Build Assets
91+
runs-on: ubuntu-latest
92+
93+
steps:
94+
- uses: actions/checkout@v3
95+
96+
- name: Use Node.js
97+
uses: actions/setup-node@v3
98+
with:
99+
node-version: '18.x'
100+
cache: 'npm'
101+
102+
- name: Install dependencies
103+
run: npm ci
104+
105+
- name: Build production assets
106+
run: npm run build
107+
108+
- name: Verify build output
109+
run: |
110+
test -f client/dist/queuedjobs-admin.js || exit 1
111+
test -f client/dist/queuedjobs-admin.css || exit 1

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules/
2+
client/dist/
3+
npm-debug.log
4+
yarn-error.log
5+
.DS_Store
6+
coverage/
7+
vendor/
8+
.phpunit.result.cache

CHANGELOG.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [1.0.0] - 2025-01-24
9+
10+
### Added
11+
- Initial release
12+
- Play/pause toggle button for auto-refresh functionality
13+
- Auto-refresh polling every 5 seconds
14+
- Smart pausing on user interaction (10 seconds)
15+
- Session timeout detection and handling
16+
- Network error handling with user notifications
17+
- Scroll position preservation during refresh
18+
- Focus state preservation during refresh
19+
- Subtle refresh indicator in button (spinning icon)
20+
- Secondary outline button styling
21+
- Button positioned to left of filter button
22+
- MutationObserver to maintain button through DOM updates
23+
- Comprehensive Jest test suite for JavaScript
24+
- Comprehensive PHPUnit test suite for PHP
25+
- ESLint configuration for code quality
26+
- GitHub Actions CI/CD pipeline
27+
- Full documentation suite (Installation, Usage, Technical, Testing)
28+
- Progressive enhancement support
29+
30+
### Technical
31+
- Page scraping approach using Fetch API
32+
- DOM parsing and GridField extraction
33+
- Memory-safe event listener management
34+
- Proper interval cleanup
35+
- Cross-browser compatibility (Chrome, Firefox, Safari, Edge)
36+
- Responsive design support
37+
- ES6 JavaScript with IIFE wrapper
38+
- SilverStripe Extension pattern
39+
- Requirements API integration
40+
41+
### Security
42+
- Read-only GET requests
43+
- Session authentication via cookies
44+
- CSRF-safe implementation
45+
- XSS prevention
46+
- Same-origin policy compliance

CONTRIBUTING.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Contributing
2+
3+
Thank you for considering contributing to this project!
4+
5+
## Development
6+
7+
### Prerequisites
8+
9+
- Node.js and npm
10+
- SilverStripe Framework ^4.0 or ^5.0
11+
- symbiote/silverstripe-queuedjobs ^4.0 or ^5.0
12+
13+
### Setup
14+
15+
1. Clone the repository
16+
2. Run `npm install` to install dependencies
17+
3. Make your changes in `client/src/`
18+
4. Run `npm run dev` to build the files for development
19+
5. Test your changes in a SilverStripe installation
20+
21+
### Building
22+
23+
- `npm run dev` - Copy source files to dist/ (for development)
24+
- `npm run build` - Minify JavaScript and copy CSS to dist/ (for production)
25+
- `npm run watch` - Watch for changes and rebuild automatically
26+
27+
### Code Style
28+
29+
- Follow existing code style
30+
- Use meaningful variable and function names
31+
- Add comments for complex logic
32+
- Test in multiple browsers
33+
34+
### Testing
35+
36+
Test your changes in:
37+
- Chrome
38+
- Firefox
39+
- Safari
40+
- Edge
41+
42+
Ensure:
43+
- Auto-refresh works correctly
44+
- Session timeout is handled gracefully
45+
- Network errors don't break the interface
46+
- User interactions pause the polling
47+
- Scroll position is preserved
48+
- Focus state is maintained
49+
50+
## Submitting Changes
51+
52+
1. Create a feature branch
53+
2. Make your changes
54+
3. Test thoroughly
55+
4. Submit a pull request with a clear description
56+
57+
## Reporting Issues
58+
59+
When reporting issues, please include:
60+
- SilverStripe version
61+
- Browser and version
62+
- Steps to reproduce
63+
- Expected vs actual behavior
64+
- Console errors (if any)

LICENSE

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2025, Ed Wilde
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
1. Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
11+
2. Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
15+
3. Neither the name of the copyright holder nor the names of its
16+
contributors may be used to endorse or promote products derived from
17+
this software without specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# SilverStripe Queued Jobs Live
2+
3+
Adds live auto-refresh capability to the SilverStripe Queued Jobs admin panel.
4+
5+
## Features
6+
7+
- Play/pause toggle button positioned next to the filter button
8+
- Auto-refresh every 5 seconds without full page reload
9+
- Subtle refresh indicator in the button icon (no intrusive popups)
10+
- Preserves scroll position and focus state
11+
- Smart pausing (10 seconds) on user interaction
12+
- Session timeout detection and handling
13+
- Network error handling with notifications
14+
- Button persists through DOM updates (MutationObserver ensures it remains available)
15+
- Progressive enhancement (graceful degradation when JavaScript is disabled)
16+
- Comprehensive automated test coverage (Jest + PHPUnit)
17+
18+
## Installation
19+
20+
```bash
21+
composer require edwilde/silverstripe-queuedjobs-live
22+
```
23+
24+
## Usage
25+
26+
Once installed, the Queued Jobs admin panel will automatically include a play/pause button positioned to the left of the "Filter" button. Click it to enable automatic refreshing of the jobs grid every 5 seconds.
27+
28+
The button uses a subtle outline style and shows a spinning refresh icon while updating.
29+
30+
## Development
31+
32+
```bash
33+
# Install dependencies
34+
npm install
35+
36+
# Build for development
37+
npm run dev
38+
39+
# Build for production
40+
npm run build
41+
42+
# Run tests
43+
npm test
44+
45+
# Run tests in watch mode
46+
npm run test:js:watch
47+
48+
# Lint code
49+
npm run lint
50+
```
51+
52+
## Requirements
53+
54+
- SilverStripe Framework ^4.0 || ^5.0
55+
- symbiote/silverstripe-queuedjobs ^4.0 || ^5.0
56+
57+
## License
58+
59+
BSD-3-Clause

_config/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
Name: queuedjobs-live
3+
After:
4+
- '#queuedjobs'
5+
---
6+
Symbiote\QueuedJobs\Controllers\QueuedJobsAdmin:
7+
extensions:
8+
- EdWilde\QueuedJobsLive\QueuedJobsAdminExtension

0 commit comments

Comments
 (0)