3
0

Add option to disable on record save notifications per record page

This commit is contained in:
Jože Fortun 2024-02-23 16:42:20 +01:00
parent e5f9fc2422
commit 06d362d244
6 changed files with 32 additions and 4 deletions

View File

@ -192,7 +192,9 @@ export default {
}
}
this.toastSuccess(this.$t(`notification:record.${isNew ? 'create' : 'update'}Success`))
if (this.page.meta.notifications.enabled) {
this.toastSuccess(this.$t(`notification:record.${isNew ? 'create' : 'update'}Success`))
}
})
.catch(e => {
// Since processing is set to false by the view record component, we need to set it to false here if we error out

View File

@ -225,6 +225,14 @@
>
{{ $t('showSubPages') }}
</b-form-checkbox>
<b-form-checkbox
v-if="isRecordPage"
v-model="page.meta.notifications.enabled"
data-test-id="checkbox-page-notifications-enabled"
>
{{ $t('edit.notifications.enabled') }}
</b-form-checkbox>
</b-form-group>
</b-col>

View File

@ -8,13 +8,19 @@ interface PartialPage extends Partial<Omit<Page, 'children' | 'meta' | 'blocks'
blocks?: PageBlock[];
meta?: object;
meta?: PageMeta;
createdAt?: string|number|Date;
updatedAt?: string|number|Date;
deletedAt?: string|number|Date;
}
interface PageMeta {
notifications: {
enabled: boolean;
};
}
interface PageConfig {
navItem: {
icon: {
@ -54,7 +60,11 @@ export class Page {
},
}
public meta: object = {};
public meta: PageMeta = {
notifications: {
enabled: true,
},
};
public createdAt?: Date = undefined;
public updatedAt?: Date = undefined;

View File

@ -84,9 +84,11 @@ createLabel: Create page
edit:
create: Create page
edit: Edit page
otherOptions: Other options
pageDescription: Page description
visible: Is page visible
otherOptions: Other options
notifications:
enabled: Show record save notifications
icon:
configure: Configure page icon
noIcon: No icon

View File

@ -624,6 +624,11 @@ func (svc page) handleUpdate(ctx context.Context, upd *types.Page) pageUpdateHan
changes |= pageChanged
}
if !reflect.DeepEqual(res.Meta.Notifications, upd.Meta.Notifications) {
res.Meta.Notifications = upd.Meta.Notifications
changes |= pageChanged
}
if res.Title != upd.Title {
res.Title = upd.Title
changes |= pageChanged

View File

@ -77,6 +77,7 @@ type (
PageMeta struct {
AllowPersonalLayouts bool `json:"allowPersonalLayouts"`
Notifications map[string]any `json:"notifications,omitempty"`
}
PageBlockStyle struct {