Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 16.0.0

- #14400 - Removed the "Delete migration data" action from the migration history context menu
- #13898 - Fixed migration of orders with different tax rates on line items from SW5
- #11808 - Introduced Error Resolution to manage data inconsistencies and apply migration fixes directly in the SW6 administration, instead of fixing issues in the source system as it was needed previously.
- #11808 - Enriched migration logs with detailed data descriptions to improve error traceability.
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG_de-DE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 16.0.0

- #14400 - Die Aktion „Migrationsdaten löschen" wurde aus dem Kontextmenü der Migrationshistorie entfernt
- #13898 - Migration von Bestellungen mit unterschiedlichen Steuersätzen auf Positionen aus SW5 behoben
- #11808 - Einführung einer Benutzeroberfläche zur Fehlerbehebung, um Dateninkonsistenzen zu beheben und Migrationskorrekturen direkt in der SW6 Administration vorzunehmen, anstatt wie zuvor im Quellsystem.
- #11808 - Anreicherung der Migrations-Logs mit detaillierten Datenbeschreibungen zur besseren Nachvollziehbarkeit von Fehlern.
Expand Down
8 changes: 6 additions & 2 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# 16.0.0

- [BREAKING] [#115](https://github.com/shopware/SwagMigrationAssistant/pull/115) - refactor!: remove "Delete migration data" history action
- [BREAKING] Removed route `/api/_action/migration/clear-data-of-run` from `SwagMigrationAssistant\Controller\HistoryController`
- [BREAKING] Removed method `clearDataOfRun()` from `SwagMigrationAssistant\Migration\History\HistoryServiceInterface`
- [BREAKING] Removed route `/api/_action/migration/is-media-processing` from `SwagMigrationAssistant\Controller\HistoryController`
- [BREAKING] Removed method `isMediaProcessing()` from `SwagMigrationAssistant\Migration\History\HistoryServiceInterface`

- [BREAKING] [#114](https://github.com/shopware/SwagMigrationAssistant/pull/114) - fix: use item-specific tax in order conversion
- [BREAKING] Removed parameter `taxRules` from method `getLineItems` of `SwagMigrationAssistant\Profile\Shopware\Converter\OrderConverter`

Expand Down Expand Up @@ -49,8 +55,6 @@
- Added acl privilege mapping to `src/Resources/app/administration/src/module/swag-migration/acl/index.ts`
- [BREAKING] Added acl constraint for route `/migration/get-grouped-logs-of-run` from `SwagMigrationAssistant\Controller\HistoryController::getGroupedLogsOfRun()` requiring privilege `swag_migration.viewer`
- [BREAKING] Added acl constraint for route `/migration/download-logs-of-run` from `SwagMigrationAssistant\Controller\HistoryController::downloadLogsOfRun()` requiring privilege `swag_migration.viewer`
- [BREAKING] Added acl constraint for route `/migration/clear-data-of-run` from `SwagMigrationAssistant\Controller\HistoryController::clearDataOfRun()` requiring privilege `swag_migration.deleter`
- [BREAKING] Added acl constraint for route `/migration/is-media-processing` from `SwagMigrationAssistant\Controller\HistoryController::isMediaProcessing()` requiring privilege `swag_migration.viewer`
- [BREAKING] Added acl constraint for route `/migration/generate-premapping` from `SwagMigrationAssistant\Controller\PremappingController::generatePremapping()` requiring privilege `swag_migration.editor`
- [BREAKING] Added acl constraint for route `/migration/write-premapping` from `SwagMigrationAssistant\Controller\PremappingController::writePremapping()` requiring privilege `swag_migration.editor`
- [BREAKING] Added acl constraint for route `/migration/get-profile-information` from `SwagMigrationAssistant\Controller\StatusController::getProfileInformation()` requiring privilege `swag_migration.viewer`
Expand Down
28 changes: 0 additions & 28 deletions src/Controller/HistoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@
use Shopware\Core\Framework\Context;
use Shopware\Core\Framework\Log\Package;
use Shopware\Core\Framework\Routing\RoutingException;
use SwagMigrationAssistant\Exception\MigrationException;
use SwagMigrationAssistant\Migration\History\HistoryServiceInterface;
use SwagMigrationAssistant\Migration\History\LogGroupingService;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\HeaderUtils;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
Expand Down Expand Up @@ -86,32 +84,6 @@ public function downloadLogsOfRun(Request $request, Context $context): StreamedR
return $response;
}

#[Route(path: '/api/_action/migration/clear-data-of-run', name: 'api.admin.migration.clear-data-of-run', methods: ['POST'], defaults: ['_acl' => ['swag_migration.deleter']])]
public function clearDataOfRun(Request $request, Context $context): Response
{
$runUuid = $request->request->getAlnum('runUuid');

if ($runUuid === '') {
throw RoutingException::missingRequestParameter('runUuid');
}

if ($this->historyService->isMediaProcessing()) {
throw MigrationException::migrationProcessing();
}

$this->historyService->clearDataOfRun($runUuid, $context);

return new Response();
}

#[Route(path: '/api/_action/migration/is-media-processing', name: 'api.admin.migration.is-media-processing', methods: ['GET'], defaults: ['_acl' => ['swag_migration_history:read']])]
public function isMediaProcessing(): JsonResponse
{
$result = $this->historyService->isMediaProcessing();

return new JsonResponse($result);
}

#[Route(
path: '/api/_action/migration/get-log-groups',
name: 'api.admin.migration.get-log-groups',
Expand Down
1 change: 0 additions & 1 deletion src/DependencyInjection/migration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@
<service id="SwagMigrationAssistant\Migration\History\HistoryService">
<argument type="service" id="swag_migration_logging.repository"/>
<argument type="service" id="swag_migration_run.repository"/>
<argument type="service" id="Doctrine\DBAL\Connection"/>
</service>

<service id="SwagMigrationAssistant\Migration\Service\MigrationDataFetcher"
Expand Down
30 changes: 0 additions & 30 deletions src/Migration/History/HistoryService.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

namespace SwagMigrationAssistant\Migration\History;

use Doctrine\DBAL\Connection;
use Shopware\Core\Framework\Context;
use Shopware\Core\Framework\DataAbstractionLayer\EntityCollection;
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
Expand All @@ -20,7 +19,6 @@
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Sorting\FieldSorting;
use Shopware\Core\Framework\Log\Package;
use Shopware\Core\Framework\Uuid\Uuid;
use SwagMigrationAssistant\Exception\MigrationException;
use SwagMigrationAssistant\Migration\Logging\SwagMigrationLoggingCollection;
use SwagMigrationAssistant\Migration\Logging\SwagMigrationLoggingEntity;
Expand All @@ -41,7 +39,6 @@ class HistoryService implements HistoryServiceInterface
public function __construct(
private readonly EntityRepository $loggingRepo,
private readonly EntityRepository $runRepo,
private readonly Connection $connection,
) {
}

Expand Down Expand Up @@ -126,33 +123,6 @@ public function downloadLogsOfRun(string $runUuid, Context $context): \Closure
};
}

public function clearDataOfRun(string $runUuid, Context $context): void
{
$run = $this->runRepo->search(new Criteria([$runUuid]), $context)->getEntities()->first();

if ($run === null) {
throw MigrationException::entityNotExists(SwagMigrationRunEntity::class, $runUuid);
}

if ($run->getStep()->isRunning()) {
throw MigrationException::migrationProcessing();
}

$this->connection->executeStatement('DELETE FROM swag_migration_logging WHERE run_id = :runId', ['runId' => Uuid::fromHexToBytes($runUuid)]);
$this->connection->executeStatement('DELETE FROM swag_migration_data WHERE run_id = :runId', ['runId' => Uuid::fromHexToBytes($runUuid)]);
$this->connection->executeStatement('DELETE FROM swag_migration_media_file WHERE run_id = :runId', ['runId' => Uuid::fromHexToBytes($runUuid)]);
$this->connection->executeStatement('DELETE FROM swag_migration_run WHERE id = :runId', ['runId' => Uuid::fromHexToBytes($runUuid)]);
}

public function isMediaProcessing(): bool
{
$unprocessedCount = $this->connection->executeQuery(
'SELECT COUNT(id) FROM swag_migration_media_file WHERE processed = 0 and process_failure != 1'
)->fetchOne();

return (int) $unprocessedCount !== 0;
}

private function printLogEntry(SwagMigrationLoggingEntity $logEntry): void
{
\printf('----- Log Entry #%d -----%s', $logEntry->getAutoIncrement(), \PHP_EOL);
Expand Down
4 changes: 0 additions & 4 deletions src/Migration/History/HistoryServiceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,4 @@ public function getGroupedLogsOfRun(
* Use print / echo inside the Closure to write strings into the log file.
*/
public function downloadLogsOfRun(string $runUuid, Context $context): \Closure;

public function clearDataOfRun(string $runUuid, Context $context): void;

public function isMediaProcessing(): bool;
}
Original file line number Diff line number Diff line change
Expand Up @@ -380,28 +380,6 @@ export default class MigrationApiService extends ApiService {
);
}

async clearDataOfRun(runUuid: string): Promise<ApiResponse<unknown>> {
// @ts-ignore
const headers = this.getBasicHeaders();

// @ts-ignore
return this.httpClient
.post(
// @ts-ignore
`_action/${this.getApiBasePath()}/clear-data-of-run`,
{
runUuid,
},
{
...this.basicConfig,
headers,
},
)
.then((response: AxiosResponse) => {
return ApiService.handleResponse(response);
});
}

async resetChecksums(connectionId: string, additionalHeaders: AdditionalHeaders = {}): Promise<ApiResponse<unknown>> {
// @ts-ignore
const headers = this.getBasicHeaders(additionalHeaders);
Expand Down Expand Up @@ -440,17 +418,6 @@ export default class MigrationApiService extends ApiService {
);
}

async isMediaProcessing(additionalHeaders: AdditionalHeaders = {}): Promise<boolean> {
// @ts-ignore
const headers = this.getBasicHeaders(additionalHeaders);

// @ts-ignore
return this.httpClient.get(`_action/${this.getApiBasePath()}/is-media-processing`, {
...this.basicConfig,
headers,
});
}

async downloadLogsOfRun(runUuid: string, additionalHeaders: AdditionalHeaders = {}): Promise<Blob> {
// @ts-ignore
const headers = this.getBasicHeaders(additionalHeaders);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { AxiosResponse } from 'axios';
import template from './swag-migration-history.html.twig';
import './swag-migration-history.scss';
import type { TEntityCollection, TRepository } from '../../../../type/types';
Expand All @@ -25,8 +24,6 @@ export interface SwagMigrationHistoryData {
isLoading: boolean;
migrationRuns: TEntityCollection<'swag_migration_run'>;
sortDirection: string;
runIdForRunClear: string | null;
isMediaProcessing: boolean;
logDownloadEndpoint: string | null;
runIdForLogDownload: string | null;
oldParams: Record<
Expand All @@ -39,8 +36,6 @@ export interface SwagMigrationHistoryData {
naturalSorting?: boolean;
}
> | null;
showRunClearConfirmModal: boolean;
runClearConfirmModalIsLoading: boolean;
migrationDateOptions: {
hour: string;
minute: string;
Expand All @@ -58,7 +53,6 @@ export default Shopware.Component.wrapComponentConfig({
inject: [
MIGRATION_API_SERVICE,
'repositoryFactory',
'acl',
],

mixins: [
Expand All @@ -81,10 +75,6 @@ export default Shopware.Component.wrapComponentConfig({
context: Shopware.Context.api,
logDownloadEndpoint: '',
runIdForLogDownload: '',
runIdForRunClear: '',
showRunClearConfirmModal: false,
runClearConfirmModalIsLoading: false,
isMediaProcessing: true,
};
},

Expand All @@ -109,10 +99,6 @@ export default Shopware.Component.wrapComponentConfig({
},

created() {
this.migrationApiService.isMediaProcessing().then((response: AxiosResponse<boolean>) => {
this.isMediaProcessing = response.data;
});

this.logDownloadEndpoint = `/api/_action/${this.migrationApiService.getApiBasePath()}/download-logs-of-run`;
},

Expand Down Expand Up @@ -221,34 +207,5 @@ export default Shopware.Component.wrapComponentConfig({
this.$refs.downloadLogsOfRunForm.submit();
});
},

clearDataOfRun(runId: string) {
this.runClearConfirmModalIsLoading = true;

return this.migrationApiService
.clearDataOfRun(runId)
.then(() => {
this.showRunClearConfirmModal = false;
this.runClearConfirmModalIsLoading = false;
window.location.reload();
})
.catch(() => {
this.createNotificationError({
message: this.$t(
'swag-migration.index.shopInfoCard.resetMigrationConfirmDialog.errorNotification.message',
),
growl: true,
});
});
},

onContextClearRunClicked(runId: string) {
this.runIdForRunClear = runId;
this.showRunClearConfirmModal = true;
},

onClearRunConfirmed() {
this.clearDataOfRun(this.runIdForRunClear);
},
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,6 @@
<sw-context-menu-item @click="onContextDownloadLogFile(item.id)">
{{ $tc('swag-migration.history.contextMenu.downloadLogs') }}
</sw-context-menu-item>

<sw-context-menu-item
variant="danger"
:disabled="isMediaProcessing || !acl.can('swag_migration.deleter')"
@click="onContextClearRunClicked(item.id)"
>
{{ $tc('swag-migration.history.contextMenu.clearLogs') }}
</sw-context-menu-item>
</template>
{% endblock %}

Expand Down Expand Up @@ -108,54 +100,6 @@
</form>
{% endblock %}

{% block swag_migration_history_run_clear_confirm_modal %}
<sw-modal
v-if="showRunClearConfirmModal"
class="swag-migration-history__run-clear-confirm-modal"
:title="$tc('swag-migration.history.clearRunDialog.title')"
:is-loading="runClearConfirmModalIsLoading"
variant="small"
@modal-close="showRunClearConfirmModal = false"
>
{% block swag_migration_history_run_clear_confirm_modal_content_hint %}
<p class="swag-migration-history__run-clear-confirm-modal-content-hint">
{{ $tc('swag-migration.history.clearRunDialog.contentHint') }}
</p>
{% endblock %}

{% block swag_migration_history_run_clear_confirm_modal_content %}
<p class="swag-migration-history__run-clear-confirm-modal-content">
{{ $tc('swag-migration.history.clearRunDialog.content') }}
</p>
{% endblock %}

{% block swag_migration_history_run_clear_confirm_modal_footer %}
<template #modal-footer>
{% block swag_migration_history_run_clear_confirm_modal_abort %}
<mt-button
size="small"
variant="secondary"
:disabled="runClearConfirmModalIsLoading"
@click="showRunClearConfirmModal = false"
>
{{ $tc('global.default.cancel') }}
</mt-button>
{% endblock %}

{% block swag_migration_history_run_clear_confirm_modal_confirm %}
<mt-button
size="small"
variant="critical"
:disabled="runClearConfirmModalIsLoading || !acl.can('swag_migration.deleter')"
@click="onClearRunConfirmed"
>
{{ $tc('global.default.delete') }}
</mt-button>
{% endblock %}
</template>
{% endblock %}
</sw-modal>
{% endblock %}
</template>
</mt-card>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -775,13 +775,7 @@
"selectedData": "Daten",
"contextMenu": {
"details": "Details anzeigen",
"downloadLogs": "Protokoll herunterladen",
"clearLogs": "Migrationsdaten löschen"
},
"clearRunDialog": {
"title": "Migrationsdaten löschen",
"content": "Beim Löschen der Migrationsdaten werden Log-Einträge, Mediendateien-Einträge, temporäre Migrationsdatensätze und der Migrationslauf selbst entfernt. Nach dem Löschen ist die Migration in der Historie nicht mehr einsehbar.",
"contentHint": "Willst Du die Daten wirklich löschen?"
"downloadLogs": "Protokoll herunterladen"
},
"detailPage": {
"title": "Details zur Migration",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -787,13 +787,7 @@
"selectedData": "Data",
"contextMenu": {
"details": "Show details",
"downloadLogs": "Download log",
"clearLogs": "Delete migration data"
},
"clearRunDialog": {
"title": "Delete migration data",
"content": "Deleting migration data will remove log entries, media file entries, temporary migration data records and the migration run, which then will no longer be available in the migration history.",
"contentHint": "Do you really want to delete the data?"
"downloadLogs": "Download log"
},
"detailPage": {
"title": "Migration details",
Expand Down
Loading
Loading