Skip to content

Commit

Permalink
Merge pull request #39 from EasyAbp/improve-clear-all
Browse files Browse the repository at this point in the history
Improve the clear-all action
  • Loading branch information
gdlcf88 authored Aug 12, 2024
2 parents 37fd2f5 + 393fc50 commit 8e54013
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 13 deletions.
2 changes: 1 addition & 1 deletion common.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Version>1.0.0</Version>
<Version>1.1.0-preview.1</Version>
<NoWarn>$(NoWarn);CS1591;CS0436</NoWarn>
<AbpProjectType>module</AbpProjectType>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,12 @@ public virtual async Task DismissAsync(DismissNotificationDto input)

foreach (var notificationId in input.NotificationIds)
{
var notification = await GetEntityByIdAsync(notificationId);
var notification = await Repository.FindAsync(notificationId);

if (notification is null)
{
continue;
}

if (notification.UserId != CurrentUser.GetId())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"ProcessUserName": "Username",
"TableFilter": "TableFilter",
"MoreProcesses": "More processes →",
"Process:InstantNotification": "Notification"
"Process:InstantNotification": "Notification",
"SureToClearAll": "Are you sure to clear all notifications? This action cannot be undone."
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"ProcessUserName": "用户名",
"TableFilter": "筛选器",
"MoreProcesses": "查看更多流程 →",
"Process:InstantNotification": "通知"
"Process:InstantNotification": "通知",
"SureToClearAll": "是否确认清空所有通知? 此操作不可撤销."
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"ProcessUserName": "使用者名",
"TableFilter": "篩選器",
"MoreProcesses": "查看更多流程 →",
"Process:InstantNotification": "通知"
"Process:InstantNotification": "通知",
"SureToClearAll": "是否確認清空所有通知? 此操作不可撤銷."
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
text-decoration: none;
color: var(--bs-offcanvas-color);
}
.clear-all-btn {
.clear-all-noti-btn {
float: right;
padding: 0;
text-decoration: none;
Expand Down Expand Up @@ -95,7 +95,7 @@
<button type="button" id="notification-offcanvas-more-processes-btn" class="more-processes-btn btn btn-link">
<small>@L["MoreProcesses"]</small>
</button>
<button type="button" id="notification-offcanvas-clear-all-btn" class="clear-all-btn btn btn-link">
<button type="button" id="notification-offcanvas-clear-all-btn" class="clear-all-noti-btn btn btn-link">
<small>@L["ClearAllNotifications"]</small>
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@

function init() {
var offcanvasElement = document.getElementById('notificationsOffcanvas');
var l = abp.localization.getResource('EasyAbpProcessManagement');

offcanvasElement.addEventListener('show.bs.offcanvas', function () {
fetchAndShowAlerts();
Expand Down Expand Up @@ -150,12 +151,16 @@
existingAlertIds.set(id, $(this));
});

easyAbp.processManagement.notifications.notification.dismiss({
notificationIds: existingAlertIds.keys().toArray()
}).then(function () {
existingAlertIds.forEach(function (alert, id) {
removeAlert(alert)
});
abp.message.confirm(l('SureToClearAll')).then(function (confirmed) {
if (confirmed) {
easyAbp.processManagement.notifications.notification.dismiss({
notificationIds: existingAlertIds.keys().toArray()
}).then(function () {
existingAlertIds.forEach(function (alert, id) {
removeAlert(alert)
});
});
}
}).always(function () {
tryCreateInterval();
});
Expand Down

0 comments on commit 8e54013

Please sign in to comment.