Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add history of resent mails with state of mail delivery (#54)
--------- Co-authored-by: Felix von WIRDUZEN <felix@wirduzen.de> Co-authored-by: tinect <s.koenig@tinect.de>
- Loading branch information
1 parent
209e5b2
commit 1a8fd31
Showing
23 changed files
with
519 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Frosh\MailArchive\Migration; | ||
|
||
use Doctrine\DBAL\Connection; | ||
use Shopware\Core\Framework\Migration\MigrationStep; | ||
|
||
class Migration1694604822AddSourceMailId extends MigrationStep | ||
{ | ||
public function getCreationTimestamp(): int | ||
{ | ||
return 1694604822; | ||
} | ||
|
||
public function update(Connection $connection): void | ||
{ | ||
$connection->executeStatement("ALTER TABLE `frosh_mail_archive` ADD `source_mail_id` BINARY(16) NULL;"); | ||
} | ||
|
||
public function updateDestructive(Connection $connection): void | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Frosh\MailArchive\Migration; | ||
|
||
use Doctrine\DBAL\Connection; | ||
use Shopware\Core\Framework\Migration\MigrationStep; | ||
|
||
class Migration1694714751TransportInfo extends MigrationStep | ||
{ | ||
public function getCreationTimestamp(): int | ||
{ | ||
return 1694714751; | ||
} | ||
|
||
public function update(Connection $connection): void | ||
{ | ||
$connection->executeStatement("ALTER TABLE `frosh_mail_archive` ADD `transport_state` VARCHAR(255) NULL;"); | ||
} | ||
|
||
public function updateDestructive(Connection $connection): void | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import './init/api.init'; | ||
import './module/frosh-mail-archive'; | ||
import './component/notification-sw-admin'; | ||
|
59 changes: 59 additions & 0 deletions
59
...rosh-mail-archive/component/frosh-mail-resend-history/frosh-mail-resend-history.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<sw-card :title="$tc('frosh-mail-archive.detail.resend-grid.title')"> | ||
<template #grid> | ||
<sw-data-grid | ||
:isLoading="isLoading" | ||
:data-source="resentMails" | ||
:columns="columns" | ||
:allowInlineEdit="false" | ||
:allowColumnEdit="false" | ||
:showSettings="false" | ||
:showSelection="false" | ||
> | ||
<template #column-createdAt="{item}"> | ||
<template v-if="currentMailId === item.id"> | ||
{{ item.createdAt|date }} ({{ $tc('frosh-mail-archive.detail.resend-grid.currently-selected') }}) | ||
</template> | ||
<router-link v-else :to="{ name: 'frosh.mail.archive.detail', params: { id: item.id } }"> | ||
{{ item.createdAt|date }} | ||
</router-link> | ||
</template> | ||
<template #column-success="{item}"> | ||
<div v-if="item.transportState === 'sent'"> | ||
<sw-color-badge | ||
color="#37d046" | ||
rounded | ||
/> | ||
{{ $tc('frosh-mail-archive.detail.resend-grid.success-label') }} | ||
</div> | ||
<div v-else-if="item.transportState === 'failed'"> | ||
<sw-color-badge | ||
color="#de294c" | ||
rounded | ||
/> | ||
{{ $tc('frosh-mail-archive.detail.resend-grid.failed-label') }} | ||
</div> | ||
<div v-else-if="item.transportState === 'pending'"> | ||
<sw-color-badge | ||
color="#ffab22" | ||
rounded | ||
/> | ||
{{ $tc('frosh-mail-archive.detail.resend-grid.pending-label') }} | ||
</div> | ||
<div v-else> | ||
<sw-color-badge | ||
color="#94a6b8" | ||
rounded | ||
/> | ||
{{ $tc('frosh-mail-archive.detail.resend-grid.unknown-label') }} | ||
</div> | ||
</template> | ||
<template #actions="{ item }"> | ||
<sw-context-menu-item :disabled="currentMailId === item.id" | ||
@click="navigateToDetailPage(item.id)" | ||
> | ||
{{ $tc('frosh-mail-archive.detail.resend-grid.navigate') }} | ||
</sw-context-menu-item> | ||
</template> | ||
</sw-data-grid> | ||
</template> | ||
</sw-card> |
57 changes: 57 additions & 0 deletions
57
...administration/src/module/frosh-mail-archive/component/frosh-mail-resend-history/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
const {Criteria} = Shopware.Data; | ||
import template from './frosh-mail-resend-history.html.twig'; | ||
|
||
Shopware.Component.register('frosh-mail-resend-history', { | ||
props: { | ||
sourceMailId: { | ||
required: true, | ||
type: String | ||
}, | ||
currentMailId: { | ||
required: true, | ||
type: String | ||
} | ||
}, | ||
template, | ||
data() { | ||
return { | ||
resentMails: [], | ||
isLoading: false, | ||
columns: [{ | ||
property: 'createdAt', | ||
label: this.$tc('frosh-mail-archive.detail.resend-grid.column-created-at'), | ||
primary: true, | ||
}, { | ||
property: 'success', | ||
label: this.$tc('frosh-mail-archive.detail.resend-grid.column-state'), | ||
sortable: false, | ||
}] | ||
} | ||
}, | ||
inject: ['repositoryFactory'], | ||
computed: { | ||
mailArchiveRepository() { | ||
return this.repositoryFactory.create('frosh_mail_archive'); | ||
} | ||
}, | ||
async created() { | ||
this.isLoading = true; | ||
await this.loadMails(); | ||
this.isLoading = false; | ||
}, | ||
methods: { | ||
async loadMails() { | ||
const criteria = new Criteria(); | ||
criteria.addFilter(Criteria.multi('OR', [ | ||
Criteria.equals('id', this.sourceMailId), | ||
Criteria.equals('sourceMailId', this.sourceMailId) | ||
])); | ||
criteria.addSorting(Criteria.sort('createdAt', 'DESC')); | ||
|
||
this.resentMails = await this.mailArchiveRepository.search(criteria, Shopware.Context.api); | ||
}, | ||
navigateToDetailPage(id) { | ||
this.$router.push({name: 'frosh.mail.archive.detail', params: {id}}) | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,7 @@ | |
white-space: pre-line; | ||
} | ||
} | ||
|
||
.frosh-mail-archive__detail-alert { | ||
max-width: 960px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.