670746d70c
## Summary
Fixes TRU-11: when the department selector on the dashboard changes, the
Selvvask (self-wash) usage view did not re-query with the new
department. Both the orders list and the summary cards were bound to the
original department because the `HallId` filter was applied only once at
component setup.
## Root cause
`XLVaskUsagePagination.vue` derived `effectiveDepartmentId` once at
setup time and called `setFilter('HallId', ...)` a single time. There
was no `watch` on the department, so changing the `departmentId` prop or
the `departmentId` route param left the filter and the previously loaded
list untouched.
## Fix
- Convert `routeDepartmentId` and `effectiveDepartmentId` to `computed`
properties so they react to changes in the prop and the route param.
- Add a `watch(effectiveDepartmentId, ...)` that:
- Calls `setFilter('HallId', newId, false)` to update the filter, or
`setFilter('HallId', '*', false)` when the department is unset.
- Calls `loadList()` and `loadSummary()` to re-issue the Selvvask usage
query and refresh the summary cards.
- Pass the active department to the summary endpoint
(`/modules/xlvask/services/usage/orders/summary`) so the summary counts
also track the new department.
## Tests
Added
`tests/unit/xlvask-usage-pagination-department-propagation.spec.js` with
5 source-based assertions covering the computed department, the watcher,
the loadList/loadSummary re-issuance, the unset case, and the summary
params.
```
$ npx vitest run tests/unit/xlvask-usage-pagination-department-propagation.spec.js
✓ XLVaskUsagePagination department (HallId) propagation
✓ reacts to department changes via a computed effectiveDepartmentId
✓ watches the effective department and re-applies the HallId filter
✓ re-issues the usage query when the department changes
✓ clears the HallId filter when the department is unset
✓ includes the active department in the summary query params
Test Files 1 passed (1)
Tests 5 passed (5)
```
Existing related specs still pass (`xlvask-usage-pagination-404`,
`self-serve-pagination-machine-scope`, `pagination-date-selection`).
## Out of scope
`InvoicingBillingPeriodViewSelfWash.vue` does not pass `departmentId`
directly; department propagation there goes through the route or any
future parent selector. The fix in `XLVaskUsagePagination` covers all
current callers (`DepartmentPosSync.vue` and any future parent that
passes the prop or sets the route param).
## Refs
- Linear: TRU-11
- AUT-7
---------
Co-authored-by: Jeppe B <jeppe@copenhagentruckwash.io>
Co-authored-by: Pleno Bugfix Bot <bugfix-bot@pleno.local>
Co-authored-by: jeppemaxclaw[bot] <bot@jeppemaxclaw.local>
104 lines
2.9 KiB
YAML
104 lines
2.9 KiB
YAML
name: Deploy pleno-vue to Hetzner (staging)
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: deploy-pleno-vue
|
|
cancel-in-progress: false
|
|
|
|
env:
|
|
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
|
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
|
|
|
|
jobs:
|
|
test-and-deploy:
|
|
name: Build + Deploy
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 25
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
|
|
- name: Install + Build
|
|
run: |
|
|
npm ci --ignore-scripts
|
|
npm run build
|
|
|
|
- name: Setup SSH
|
|
uses: webfactory/ssh-agent@v0.9.0
|
|
with:
|
|
ssh-private-key: ${{ secrets.DEPLOY_SSH_KEY }}
|
|
|
|
- name: Add host key
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
ssh-keyscan -H "$DEPLOY_HOST" >> ~/.ssh/known_hosts 2>/dev/null
|
|
|
|
- name: Pre-deploy snapshot
|
|
id: pre
|
|
run: |
|
|
ssh "$DEPLOY_USER@$DEPLOY_HOST" '
|
|
set -e
|
|
cd /opt/pleno-vue
|
|
git rev-parse HEAD > /tmp/last_deploy_sha
|
|
echo "pre_sha=$(cat /tmp/last_deploy_sha)" >> $GITHUB_OUTPUT
|
|
'
|
|
|
|
- name: Deploy
|
|
id: deploy
|
|
run: |
|
|
ssh "$DEPLOY_USER@$DEPLOY_HOST" '
|
|
set -e
|
|
cd /opt/pleno-vue
|
|
git fetch origin master
|
|
git reset --hard origin/master
|
|
npm ci --ignore-scripts
|
|
npm run build
|
|
sudo systemctl reload nginx || true
|
|
sudo systemctl reload pleno-vue || true
|
|
echo "Deploy complete: $(git rev-parse --short HEAD)"
|
|
'
|
|
|
|
- name: Smoke test
|
|
id: smoke
|
|
continue-on-error: true
|
|
env:
|
|
SMOKE_BASE_URL: ${{ secrets.SMOKE_BASE_URL }}
|
|
run: |
|
|
bash scripts/smoke-test.sh "$SMOKE_BASE_URL"
|
|
|
|
- name: Auto-rollback on smoke failure
|
|
if: steps.smoke.outcome == 'failure'
|
|
run: |
|
|
echo "::error::Smoke test failed — rolling back to ${{ steps.pre.outputs.pre_sha }}"
|
|
ssh "$DEPLOY_USER@$DEPLOY_HOST" '
|
|
set -e
|
|
cd /opt/pleno-vue
|
|
git reset --hard ${{ steps.pre.outputs.pre_sha }}
|
|
npm ci --ignore-scripts
|
|
npm run build
|
|
sudo systemctl reload nginx || true
|
|
'
|
|
|
|
- name: Post Slack status
|
|
if: always()
|
|
uses: slackapi/slack-github-action@v1.27.0
|
|
with:
|
|
channel-id: ${{ secrets.AI_DAILY_CHANNEL }}
|
|
payload: |
|
|
{
|
|
"text": "${{ job.status == 'success' && '✅' || '❌' }} Deploy *pleno-vue@${{ github.sha[0:7] }}* — ${{ job.status }}\n${{ steps.smoke.outcome == 'failure' && '⚠️ Auto-rolled back' || '✓ Smoke passed' }}"
|
|
}
|
|
env:
|
|
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
|