MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / onSaveClick

Function onSaveClick

web/pgadmin/misc/properties/ObjectNodeProperties.jsx:115–135  ·  view source on GitHub ↗
(isNew, data)

Source from the content-addressed store, hash-verified

113
114 /* on save button callback, promise required */
115 const onSaveClick = (isNew, data)=>new Promise((resolve, reject)=>{
116 return api({
117 url: url(isNew),
118 method: isNew ? 'POST' : 'PUT',
119 data: data,
120 }).then((res)=>{
121 /* Don't warn the user before closing dialog */
122 warnOnCloseFlag = false;
123 resolve(res.data);
124 onSave?.(res.data);
125 }).catch((err)=>{
126 pgAdmin.Browser.notifier.pgNotifier('error-noalert', err, '', function(msg) {
127 if (msg == 'CRYPTKEY_SET') {
128 return Promise.resolve(onSaveClick(isNew, data));
129 } else if (msg == 'CRYPTKEY_NOT_SET') {
130 reject(new Error(gettext('The master password is not set.')));
131 }
132 reject(err instanceof Error ? err : Error(gettext('Something went wrong')));
133 });
134 });
135 });
136
137 /* Called when switched to SQL tab, promise required */
138 const getSQLValue = (isNew, changedData)=>{

Callers

nothing calls this directly

Calls 4

gettextFunction · 0.85
pgNotifierMethod · 0.80
urlFunction · 0.70
onSaveFunction · 0.50

Tested by

no test coverage detected