Skip to content

Commit 9de1a8c

Browse files
feat: Admins can configure auto redirection after cloning from dashboard (#1212)
AB#118658 --------- Co-authored-by: Antoine Hurard <antoine@reliefapplications.org>
1 parent 69508e9 commit 9de1a8c

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

src/models/actionButton.model.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,42 @@ export const buttonSchema = new Schema<Button>(
9797
{
9898
template: String,
9999
autoReload: Boolean,
100+
onSave: {
101+
type: new Schema(
102+
{
103+
navigateTo: {
104+
type: new Schema(
105+
{
106+
targetUrl: {
107+
type: new Schema(
108+
{
109+
href: String,
110+
openInNewTab: { type: Boolean, default: true },
111+
},
112+
{ _id: false }
113+
),
114+
default: null,
115+
},
116+
targetPage: {
117+
type: new Schema(
118+
{
119+
pageUrl: { type: String },
120+
field: { type: String },
121+
},
122+
{ _id: false }
123+
),
124+
default: null,
125+
},
126+
},
127+
{ _id: false }
128+
),
129+
default: null,
130+
},
131+
},
132+
{ _id: false }
133+
),
134+
default: null,
135+
},
100136
},
101137
{ _id: false }
102138
),

src/schema/inputs/button-action.input.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,38 @@ const ActionButtonInputType = new GraphQLInputObjectType({
6262
fields: {
6363
template: { type: GraphQLString },
6464
autoReload: { type: GraphQLBoolean },
65+
onSave: {
66+
type: new GraphQLInputObjectType({
67+
name: 'CloneRecordOnSaveInputType',
68+
fields: {
69+
navigateTo: {
70+
type: new GraphQLInputObjectType({
71+
name: 'NavigateToOnSaveInputType',
72+
fields: {
73+
targetUrl: {
74+
type: new GraphQLInputObjectType({
75+
name: 'NavigateToTargetUrlOnSaveInputType',
76+
fields: {
77+
href: { type: GraphQLString },
78+
openInNewTab: { type: GraphQLBoolean },
79+
},
80+
}),
81+
},
82+
targetPage: {
83+
type: new GraphQLInputObjectType({
84+
name: 'NavigateToTargetPageOnSaveInputType',
85+
fields: {
86+
pageUrl: { type: GraphQLString },
87+
field: { type: GraphQLString },
88+
},
89+
}),
90+
},
91+
},
92+
}),
93+
},
94+
},
95+
}),
96+
},
6597
},
6698
}),
6799
},

0 commit comments

Comments
 (0)