Compare commits
6
Commits
5a482b49bb
..
v0.0.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7aa11b0396 | ||
|
|
161c35dc8a | ||
|
|
a1f0160ab9 | ||
|
|
1ee83aad37 | ||
|
|
b2c2a8d80b | ||
|
|
31b9e61adb |
No files matched your search
@@ -0,0 +1,40 @@
|
|||||||
|
name: version-changelog
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
version-changelog:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Check version bump and changelog entry
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
PR_VERSION=$(grep -m1 '"version"' composer.json | sed -E 's/.*"version"[[:space:]]*:[[:space:]]*"([^"]+)".*/\1/')
|
||||||
|
MAIN_VERSION=$(git show origin/main:composer.json | grep -m1 '"version"' | sed -E 's/.*"version"[[:space:]]*:[[:space:]]*"([^"]+)".*/\1/')
|
||||||
|
|
||||||
|
echo "main version: $MAIN_VERSION"
|
||||||
|
echo "PR version: $PR_VERSION"
|
||||||
|
|
||||||
|
if [ "$MAIN_VERSION" = "$PR_VERSION" ]; then
|
||||||
|
echo "::error::composer.json version ($PR_VERSION) was not bumped from main ($MAIN_VERSION)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
HIGHEST=$(printf '%s\n%s\n' "$MAIN_VERSION" "$PR_VERSION" | sort -V | tail -n1)
|
||||||
|
if [ "$HIGHEST" != "$PR_VERSION" ]; then
|
||||||
|
echo "::error::composer.json version ($PR_VERSION) is not greater than main's ($MAIN_VERSION)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! grep -qF "## [$PR_VERSION]" CHANGELOG.md; then
|
||||||
|
echo "::error::CHANGELOG.md is missing a '## [$PR_VERSION]' heading"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "OK: version bumped to $PR_VERSION and documented in CHANGELOG.md"
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
name: release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
env:
|
||||||
|
SERVER_URL: https://git.arthurerlich.de
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
token: ${{ secrets.RELEASE_TOKEN }}
|
||||||
|
|
||||||
|
- name: Determine version and guard against re-release
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
VERSION=$(grep -m1 '"version"' composer.json | sed -E 's/.*"version"[[:space:]]*:[[:space:]]*"([^"]+)".*/\1/')
|
||||||
|
TAG="v${VERSION}"
|
||||||
|
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
|
||||||
|
if git ls-remote --tags origin "refs/tags/${TAG}" | grep -q "${TAG}"; then
|
||||||
|
echo "skip=true" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "Tag ${TAG} already exists, nothing to release."
|
||||||
|
else
|
||||||
|
echo "skip=false" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Extract changelog section
|
||||||
|
if: steps.version.outputs.skip == 'false'
|
||||||
|
run: |
|
||||||
|
awk -v ver="${{ steps.version.outputs.version }}" '
|
||||||
|
BEGIN { found=0 }
|
||||||
|
/^## \[/ {
|
||||||
|
if (found) exit
|
||||||
|
if ($0 ~ "\[" ver "\]") { found=1; next }
|
||||||
|
}
|
||||||
|
found { print }
|
||||||
|
' CHANGELOG.md > release-notes.md
|
||||||
|
cat release-notes.md
|
||||||
|
|
||||||
|
- name: Create and push tag
|
||||||
|
if: steps.version.outputs.skip == 'false'
|
||||||
|
run: |
|
||||||
|
git config user.name "gitea-actions"
|
||||||
|
git config user.email "actions@git.arthurerlich.de"
|
||||||
|
git tag "${{ steps.version.outputs.tag }}"
|
||||||
|
git push origin "${{ steps.version.outputs.tag }}"
|
||||||
|
|
||||||
|
- name: Install shopware-cli
|
||||||
|
if: steps.version.outputs.skip == 'false'
|
||||||
|
run: |
|
||||||
|
curl -sL -o /tmp/shopware-cli.tar.gz \
|
||||||
|
https://github.com/shopware/shopware-cli/releases/latest/download/shopware-cli_Linux_x86_64.tar.gz
|
||||||
|
mkdir -p /tmp/swcli-extract
|
||||||
|
tar -xzf /tmp/shopware-cli.tar.gz -C /tmp/swcli-extract
|
||||||
|
cp /tmp/swcli-extract/shopware-cli /usr/local/bin/shopware-cli
|
||||||
|
|
||||||
|
- name: Validate extension (informational only, does not gate the release)
|
||||||
|
if: steps.version.outputs.skip == 'false'
|
||||||
|
run: shopware-cli extension validate . || true
|
||||||
|
|
||||||
|
- name: Package Store-style zip for the Gitea Release asset
|
||||||
|
if: steps.version.outputs.skip == 'false'
|
||||||
|
run: |
|
||||||
|
shopware-cli extension package . --output-directory .build \
|
||||||
|
--filename "AeonDumpManager-${{ steps.version.outputs.tag }}.zip"
|
||||||
|
|
||||||
|
- name: Build root-level zip for the Composer registry
|
||||||
|
if: steps.version.outputs.skip == 'false'
|
||||||
|
run: git archive --format=zip -o "composer-package-${{ steps.version.outputs.tag }}.zip" "${{ steps.version.outputs.tag }}"
|
||||||
|
|
||||||
|
- name: Create Gitea Release
|
||||||
|
if: steps.version.outputs.skip == 'false'
|
||||||
|
uses: akkuman/gitea-release-action@v1
|
||||||
|
with:
|
||||||
|
server_url: ${{ env.SERVER_URL }}
|
||||||
|
token: ${{ secrets.RELEASE_TOKEN }}
|
||||||
|
tag_name: ${{ steps.version.outputs.tag }}
|
||||||
|
name: ${{ steps.version.outputs.tag }}
|
||||||
|
body_path: release-notes.md
|
||||||
|
files: .build/AeonDumpManager-${{ steps.version.outputs.tag }}.zip
|
||||||
|
|
||||||
|
- name: Publish to Composer registry
|
||||||
|
if: steps.version.outputs.skip == 'false'
|
||||||
|
run: |
|
||||||
|
STATUS=$(curl -s -o /tmp/composer-publish.log -w "%{http_code}" \
|
||||||
|
-u "haylan:${{ secrets.RELEASE_TOKEN }}" \
|
||||||
|
-T "composer-package-${{ steps.version.outputs.tag }}.zip" \
|
||||||
|
"https://git.arthurerlich.de/api/packages/haylan/composer")
|
||||||
|
cat /tmp/composer-publish.log
|
||||||
|
if [ "$STATUS" != "201" ] && [ "$STATUS" != "409" ]; then
|
||||||
|
echo "Unexpected HTTP status $STATUS publishing to the Composer registry"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
+11
-3
@@ -5,6 +5,17 @@ All notable changes to AeonDumpManager will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [0.0.2] - 2026-09-21
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Automated release pipeline: a pre-merge check enforcing a semver version bump and a matching
|
||||||
|
CHANGELOG entry on every PR into `main`, and a post-merge workflow that tags the release,
|
||||||
|
packages the plugin with `shopware-cli`, publishes a Gitea Release with the packaged zip, and
|
||||||
|
publishes the package to this Gitea instance's Composer registry.
|
||||||
|
- `main` is now a protected branch: no direct pushes, merges require the version/changelog check
|
||||||
|
to pass.
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
@@ -20,6 +31,3 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
creation runs synchronously.
|
creation runs synchronously.
|
||||||
- ACL-gated (`aeon_dump_manager.viewer`/`.creator`/`.deleter`), enforced both client-side and
|
- ACL-gated (`aeon_dump_manager.viewer`/`.creator`/`.deleter`), enforced both client-side and
|
||||||
server-side.
|
server-side.
|
||||||
- Filter the dump list by a from/to date range, and sort the `datetime`/`sizeBytes` columns
|
|
||||||
ascending or descending. Dates are formatted with Shopware's locale/timezone-aware
|
|
||||||
`Shopware.Utils.format.date`, matching the existing `fileSize` formatting.
|
|
||||||
@@ -11,7 +11,6 @@ use Shopware\Core\Framework\Routing\ApiRouteScope;
|
|||||||
use Shopware\Core\PlatformRequest;
|
use Shopware\Core\PlatformRequest;
|
||||||
use Symfony\Component\HttpFoundation\HeaderUtils;
|
use Symfony\Component\HttpFoundation\HeaderUtils;
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
@@ -40,46 +39,16 @@ class DumpController
|
|||||||
defaults: [PlatformRequest::ATTRIBUTE_ACL => ['aeon_dump_manager.viewer']],
|
defaults: [PlatformRequest::ATTRIBUTE_ACL => ['aeon_dump_manager.viewer']],
|
||||||
methods: ['GET']
|
methods: ['GET']
|
||||||
)]
|
)]
|
||||||
public function list(Request $request): JsonResponse
|
public function list(): JsonResponse
|
||||||
{
|
{
|
||||||
$dumps = array_map(
|
$dumps = array_map(
|
||||||
static fn ($dumpFile) => $dumpFile->jsonSerialize(),
|
static fn ($dumpFile) => $dumpFile->jsonSerialize(),
|
||||||
$this->dumpLister->list(
|
$this->dumpLister->list()
|
||||||
$this->parseBoundDate($request->query->get('from'), false),
|
|
||||||
$this->parseBoundDate($request->query->get('to'), true),
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return new JsonResponse(['dumps' => $dumps]);
|
return new JsonResponse(['dumps' => $dumps]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The admin's date filter sends mixed shapes: the "from" bound is a naive local
|
|
||||||
* date string with no timezone marker (e.g. "2026-03-01T00:00:00"), while
|
|
||||||
* sw-date-filter widens "to" to end-of-day client-side via `Date#toISOString()`,
|
|
||||||
* which is always UTC (e.g. "2026-03-01T23:59:59.000Z"). Re-expressing both in
|
|
||||||
* PHP's default timezone (the same one DumpFilenameParser uses) before applying
|
|
||||||
* our own day-boundary keeps the calendar day the user actually picked, regardless
|
|
||||||
* of which shape arrived. An empty bound (no date set) stays null so the range is
|
|
||||||
* open on that side.
|
|
||||||
*/
|
|
||||||
private function parseBoundDate(?string $value, bool $endOfDay): ?\DateTimeImmutable
|
|
||||||
{
|
|
||||||
if ($value === null || trim($value) === '') {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
$dateTime = (new \DateTimeImmutable($value))->setTimezone(new \DateTimeZone(date_default_timezone_get()));
|
|
||||||
} catch (\Exception) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $endOfDay
|
|
||||||
? $dateTime->setTime(23, 59, 59)
|
|
||||||
: $dateTime->setTime(0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[Route(
|
#[Route(
|
||||||
path: '/api/_action/aeon-dump-manager/dumps',
|
path: '/api/_action/aeon-dump-manager/dumps',
|
||||||
name: 'api.action.aeon_dump_manager.dumps.create',
|
name: 'api.action.aeon_dump_manager.dumps.create',
|
||||||
|
|||||||
+1
-11
@@ -14,24 +14,14 @@
|
|||||||
|
|
||||||
<template #content>
|
<template #content>
|
||||||
<div class="aeon-dump-manager-list__content">
|
<div class="aeon-dump-manager-list__content">
|
||||||
<sw-filter-panel
|
|
||||||
:filters="listFilters"
|
|
||||||
:defaults="defaultFilters"
|
|
||||||
:store-key="storeKey"
|
|
||||||
@criteria-changed="onCriteriaChanged"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<sw-data-grid
|
<sw-data-grid
|
||||||
:data-source="sortedDumps"
|
:data-source="dumps"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:is-loading="isLoading"
|
:is-loading="isLoading"
|
||||||
:show-selection="acl.can('aeon_dump_manager.deleter')"
|
:show-selection="acl.can('aeon_dump_manager.deleter')"
|
||||||
:full-page="true"
|
:full-page="true"
|
||||||
:sort-by="sortBy"
|
|
||||||
:sort-direction="sortDirection"
|
|
||||||
identifier="filename"
|
identifier="filename"
|
||||||
@selection-change="onSelectionChange"
|
@selection-change="onSelectionChange"
|
||||||
@column-sort="onSortColumn"
|
|
||||||
>
|
>
|
||||||
<template #bulk>
|
<template #bulk>
|
||||||
<a
|
<a
|
||||||
|
|||||||
+13
-87
@@ -11,12 +11,6 @@ interface PendingJob {
|
|||||||
|
|
||||||
const CREATE_MODAL_AUTO_CLOSE_MS = 1500;
|
const CREATE_MODAL_AUTO_CLOSE_MS = 1500;
|
||||||
|
|
||||||
interface DateRangeCriteria {
|
|
||||||
type: string;
|
|
||||||
field: string;
|
|
||||||
parameters?: { gte?: string; lte?: string };
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ComponentData {
|
interface ComponentData {
|
||||||
dumps: DumpFile[];
|
dumps: DumpFile[];
|
||||||
isLoading: boolean;
|
isLoading: boolean;
|
||||||
@@ -24,12 +18,6 @@ interface ComponentData {
|
|||||||
deleteFilenames: string[] | null;
|
deleteFilenames: string[] | null;
|
||||||
selection: Record<string, DumpFile>;
|
selection: Record<string, DumpFile>;
|
||||||
pollTimer: number | null;
|
pollTimer: number | null;
|
||||||
dateFrom: string | null;
|
|
||||||
dateTo: string | null;
|
|
||||||
sortBy: string;
|
|
||||||
sortDirection: string;
|
|
||||||
storeKey: string;
|
|
||||||
defaultFilters: string[];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ComponentInstance extends ComponentData {
|
interface ComponentInstance extends ComponentData {
|
||||||
@@ -37,25 +25,17 @@ interface ComponentInstance extends ComponentData {
|
|||||||
$tc: (key: string, count?: number, values?: Record<string, unknown>) => string;
|
$tc: (key: string, count?: number, values?: Record<string, unknown>) => string;
|
||||||
createNotificationError: (options: { message: string }) => void;
|
createNotificationError: (options: { message: string }) => void;
|
||||||
createNotificationSuccess: (options: { message: string }) => void;
|
createNotificationSuccess: (options: { message: string }) => void;
|
||||||
getList: () => Promise<void>;
|
loadList: () => Promise<void>;
|
||||||
stopPolling: () => void;
|
stopPolling: () => void;
|
||||||
pollJobStatus: (jobId: string) => void;
|
pollJobStatus: (jobId: string) => void;
|
||||||
selectionCount: number;
|
selectionCount: number;
|
||||||
sortedDumps: DumpFile[];
|
|
||||||
listFilters: Record<string, unknown>[];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.register('aeon-dump-manager-list', {
|
Component.register('aeon-dump-manager-list', {
|
||||||
template,
|
template,
|
||||||
|
|
||||||
mixins: [
|
// Provides createNotificationSuccess/createNotificationError, used below.
|
||||||
// Provides createNotificationSuccess/createNotificationError, used below.
|
mixins: [Mixin.getByName('notification')],
|
||||||
Mixin.getByName('notification'),
|
|
||||||
// Provides sortBy/sortDirection state, onSortColumn(), and route-query
|
|
||||||
// persistence for them (same mixin sw-product-list etc. use) — our own
|
|
||||||
// data() below overrides the defaults to keep "newest first".
|
|
||||||
Mixin.getByName('listing'),
|
|
||||||
],
|
|
||||||
|
|
||||||
inject: ['aeonDumpManagerApiService', 'acl'],
|
inject: ['aeonDumpManagerApiService', 'acl'],
|
||||||
|
|
||||||
@@ -67,56 +47,27 @@ Component.register('aeon-dump-manager-list', {
|
|||||||
deleteFilenames: null,
|
deleteFilenames: null,
|
||||||
selection: {},
|
selection: {},
|
||||||
pollTimer: null,
|
pollTimer: null,
|
||||||
dateFrom: null,
|
|
||||||
dateTo: null,
|
|
||||||
sortBy: 'datetime',
|
|
||||||
sortDirection: 'DESC',
|
|
||||||
storeKey: 'grid.filter.aeon-dump-manager',
|
|
||||||
defaultFilters: ['datetime'],
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
listFilters(this: ComponentInstance) {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
name: 'datetime',
|
|
||||||
type: 'date-filter',
|
|
||||||
property: 'datetime',
|
|
||||||
label: this.$tc('aeon-dump-manager.list.columnDatetime'),
|
|
||||||
dateType: 'date',
|
|
||||||
fromFieldLabel: this.$tc('aeon-dump-manager.list.filterFromLabel'),
|
|
||||||
toFieldLabel: this.$tc('aeon-dump-manager.list.filterToLabel'),
|
|
||||||
fromPlaceholder: this.$tc('aeon-dump-manager.list.filterFromPlaceholder'),
|
|
||||||
toPlaceholder: this.$tc('aeon-dump-manager.list.filterToPlaceholder'),
|
|
||||||
showTimeframe: false,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
},
|
|
||||||
|
|
||||||
columns() {
|
columns() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
property: 'datetime',
|
property: 'datetime',
|
||||||
dataIndex: 'datetime',
|
|
||||||
label: this.$tc('aeon-dump-manager.list.columnDatetime'),
|
label: this.$tc('aeon-dump-manager.list.columnDatetime'),
|
||||||
allowResize: true,
|
allowResize: true,
|
||||||
sortable: true,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
property: 'filename',
|
property: 'filename',
|
||||||
dataIndex: 'filename',
|
|
||||||
label: this.$tc('aeon-dump-manager.list.columnFilename'),
|
label: this.$tc('aeon-dump-manager.list.columnFilename'),
|
||||||
allowResize: true,
|
allowResize: true,
|
||||||
sortable: true,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
property: 'sizeBytes',
|
property: 'sizeBytes',
|
||||||
dataIndex: 'sizeBytes',
|
|
||||||
label: this.$tc('aeon-dump-manager.list.columnSize'),
|
label: this.$tc('aeon-dump-manager.list.columnSize'),
|
||||||
align: 'right',
|
align: 'right',
|
||||||
allowResize: true,
|
allowResize: true,
|
||||||
sortable: true,
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
@@ -124,27 +75,10 @@ Component.register('aeon-dump-manager-list', {
|
|||||||
selectionCount(this: ComponentInstance): number {
|
selectionCount(this: ComponentInstance): number {
|
||||||
return Object.keys(this.selection).length;
|
return Object.keys(this.selection).length;
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
|
||||||
sortedDumps(this: ComponentInstance): DumpFile[] {
|
created(this: ComponentInstance) {
|
||||||
const direction = this.sortDirection === 'ASC' ? 1 : -1;
|
this.loadList();
|
||||||
|
|
||||||
return [...this.dumps].sort((a, b) => {
|
|
||||||
let compareVal: number;
|
|
||||||
|
|
||||||
switch (this.sortBy) {
|
|
||||||
case 'sizeBytes':
|
|
||||||
compareVal = a.sizeBytes - b.sizeBytes;
|
|
||||||
break;
|
|
||||||
case 'datetime':
|
|
||||||
compareVal = new Date(a.datetime).getTime() - new Date(b.datetime).getTime();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
compareVal = a.filename.localeCompare(b.filename, undefined, { numeric: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
return compareVal * direction;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy(this: ComponentInstance) {
|
beforeDestroy(this: ComponentInstance) {
|
||||||
@@ -152,10 +86,10 @@ Component.register('aeon-dump-manager-list', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
getList(this: ComponentInstance): Promise<void> {
|
loadList(this: ComponentInstance): Promise<void> {
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
|
|
||||||
return this.aeonDumpManagerApiService.getList({ from: this.dateFrom, to: this.dateTo })
|
return this.aeonDumpManagerApiService.getList()
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
this.dumps = response.dumps;
|
this.dumps = response.dumps;
|
||||||
})
|
})
|
||||||
@@ -165,15 +99,7 @@ Component.register('aeon-dump-manager-list', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
formatDatetime(value: string): string {
|
formatDatetime(value: string): string {
|
||||||
return Shopware.Utils.format.date(value);
|
return new Date(value).toLocaleString();
|
||||||
},
|
|
||||||
|
|
||||||
onCriteriaChanged(this: ComponentInstance, criteria: DateRangeCriteria[]) {
|
|
||||||
const range = criteria.find((filter) => filter.type === 'range' && filter.field === 'datetime');
|
|
||||||
|
|
||||||
this.dateFrom = range?.parameters?.gte ?? null;
|
|
||||||
this.dateTo = range?.parameters?.lte ?? null;
|
|
||||||
this.getList();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
formatSize(bytes: number): string {
|
formatSize(bytes: number): string {
|
||||||
@@ -207,7 +133,7 @@ Component.register('aeon-dump-manager-list', {
|
|||||||
|
|
||||||
if (job.status === 'done') {
|
if (job.status === 'done') {
|
||||||
this.stopPolling();
|
this.stopPolling();
|
||||||
this.getList();
|
this.loadList();
|
||||||
window.setTimeout(() => {
|
window.setTimeout(() => {
|
||||||
this.pendingJob = null;
|
this.pendingJob = null;
|
||||||
}, CREATE_MODAL_AUTO_CLOSE_MS);
|
}, CREATE_MODAL_AUTO_CLOSE_MS);
|
||||||
@@ -270,19 +196,19 @@ Component.register('aeon-dump-manager-list', {
|
|||||||
|
|
||||||
// Optimistic UI update: pull the rows out immediately rather than
|
// Optimistic UI update: pull the rows out immediately rather than
|
||||||
// waiting on a full reload, so the grid never looks stale even if
|
// waiting on a full reload, so the grid never looks stale even if
|
||||||
// getList() is slow or a later delete in the batch fails.
|
// loadList() is slow or a later delete in the batch fails.
|
||||||
this.dumps = this.dumps.filter((dumpFile) => !filenames.includes(dumpFile.filename));
|
this.dumps = this.dumps.filter((dumpFile) => !filenames.includes(dumpFile.filename));
|
||||||
this.selection = {};
|
this.selection = {};
|
||||||
|
|
||||||
return Promise.all(filenames.map((filename) => this.aeonDumpManagerApiService.remove(filename)))
|
return Promise.all(filenames.map((filename) => this.aeonDumpManagerApiService.remove(filename)))
|
||||||
.then(() => this.getList())
|
.then(() => this.loadList())
|
||||||
.catch((error: Error) => {
|
.catch((error: Error) => {
|
||||||
this.createNotificationError({
|
this.createNotificationError({
|
||||||
message: this.$tc('aeon-dump-manager.list.deleteFailed', 0, { error: error.message }),
|
message: this.$tc('aeon-dump-manager.list.deleteFailed', 0, { error: error.message }),
|
||||||
});
|
});
|
||||||
// A delete failed after the optimistic removal — reload to
|
// A delete failed after the optimistic removal — reload to
|
||||||
// show the real state rather than leave a wrong guess on screen.
|
// show the real state rather than leave a wrong guess on screen.
|
||||||
return this.getList();
|
return this.loadList();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,10 +8,6 @@
|
|||||||
"columnFilename": "Name",
|
"columnFilename": "Name",
|
||||||
"columnDatetime": "Erstellt am",
|
"columnDatetime": "Erstellt am",
|
||||||
"columnSize": "Größe",
|
"columnSize": "Größe",
|
||||||
"filterFromLabel": "Von",
|
|
||||||
"filterFromPlaceholder": "Startdatum auswählen...",
|
|
||||||
"filterToLabel": "Bis",
|
|
||||||
"filterToPlaceholder": "Enddatum auswählen...",
|
|
||||||
"buttonCreate": "Dump erstellen",
|
"buttonCreate": "Dump erstellen",
|
||||||
"buttonDownload": "Herunterladen",
|
"buttonDownload": "Herunterladen",
|
||||||
"buttonDelete": "Löschen",
|
"buttonDelete": "Löschen",
|
||||||
|
|||||||
@@ -8,10 +8,6 @@
|
|||||||
"columnFilename": "Name",
|
"columnFilename": "Name",
|
||||||
"columnDatetime": "Created at",
|
"columnDatetime": "Created at",
|
||||||
"columnSize": "Size",
|
"columnSize": "Size",
|
||||||
"filterFromLabel": "From",
|
|
||||||
"filterFromPlaceholder": "Select start date...",
|
|
||||||
"filterToLabel": "To",
|
|
||||||
"filterToPlaceholder": "Select end date...",
|
|
||||||
"buttonCreate": "Create dump",
|
"buttonCreate": "Create dump",
|
||||||
"buttonDownload": "Download",
|
"buttonDownload": "Download",
|
||||||
"buttonDelete": "Delete",
|
"buttonDelete": "Delete",
|
||||||
|
|||||||
@@ -43,12 +43,9 @@ export default class DumpApiService extends ApiService {
|
|||||||
super(httpClient, loginService, apiEndpoint);
|
super(httpClient, loginService, apiEndpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
getList(filter: { from?: string | null; to?: string | null } = {}): Promise<DumpList> {
|
getList(): Promise<DumpList> {
|
||||||
return this.httpClient
|
return this.httpClient
|
||||||
.get('/_action/aeon-dump-manager/dumps', {
|
.get('/_action/aeon-dump-manager/dumps', { headers: this.getBasicHeaders() })
|
||||||
headers: this.getBasicHeaders(),
|
|
||||||
params: { from: filter.from ?? undefined, to: filter.to ?? undefined },
|
|
||||||
})
|
|
||||||
.then((response: unknown) => ApiService.handleResponse(response));
|
.then((response: unknown) => ApiService.handleResponse(response));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class DumpLister
|
|||||||
/**
|
/**
|
||||||
* @return DumpFile[] newest first
|
* @return DumpFile[] newest first
|
||||||
*/
|
*/
|
||||||
public function list(?\DateTimeImmutable $from = null, ?\DateTimeImmutable $to = null): array
|
public function list(): array
|
||||||
{
|
{
|
||||||
$dumps = [];
|
$dumps = [];
|
||||||
|
|
||||||
@@ -33,14 +33,6 @@ class DumpLister
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($from !== null && $datetime < $from) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($to !== null && $datetime > $to) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$dumps[] = new DumpFile($filename, $datetime, $item->fileSize());
|
$dumps[] = new DumpFile($filename, $datetime, $item->fileSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace AeonDumpManager\Tests\Service;
|
namespace AeonDumpManager\Tests\Service;
|
||||||
|
|
||||||
use AeonDumpManager\Service\DumpFilenameParser;
|
use AeonDumpManager\Service\DumpFilenameParser;
|
||||||
use PHPUnit\Framework\Attributes\DataProvider;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class DumpFilenameParserTest extends TestCase
|
class DumpFilenameParserTest extends TestCase
|
||||||
@@ -30,7 +29,9 @@ class DumpFilenameParserTest extends TestCase
|
|||||||
self::assertEquals($dateTime, $this->parser->parse($filename));
|
self::assertEquals($dateTime, $this->parser->parse($filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[DataProvider('invalidFilenameProvider')]
|
/**
|
||||||
|
* @dataProvider invalidFilenameProvider
|
||||||
|
*/
|
||||||
public function testParseRejectsInvalidFilenames(string $filename): void
|
public function testParseRejectsInvalidFilenames(string $filename): void
|
||||||
{
|
{
|
||||||
self::assertNull($this->parser->parse($filename));
|
self::assertNull($this->parser->parse($filename));
|
||||||
|
|||||||
@@ -3,12 +3,13 @@
|
|||||||
namespace AeonDumpManager\Tests\Service;
|
namespace AeonDumpManager\Tests\Service;
|
||||||
|
|
||||||
use AeonDumpManager\Service\MySqlVariant;
|
use AeonDumpManager\Service\MySqlVariant;
|
||||||
use PHPUnit\Framework\Attributes\DataProvider;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class MySqlVariantTest extends TestCase
|
class MySqlVariantTest extends TestCase
|
||||||
{
|
{
|
||||||
#[DataProvider('versionProvider')]
|
/**
|
||||||
|
* @dataProvider versionProvider
|
||||||
|
*/
|
||||||
public function testIsMariaDb(string $version, bool $expected): void
|
public function testIsMariaDb(string $version, bool $expected): void
|
||||||
{
|
{
|
||||||
self::assertSame($expected, MySqlVariant::isMariaDb($version));
|
self::assertSame($expected, MySqlVariant::isMariaDb($version));
|
||||||
|
|||||||
Reference in new issue
Block a user