(url)
| 228 | } |
| 229 | |
| 230 | export function showChangeUserPassword(url) { |
| 231 | const title = gettext('Change pgAdmin User Password'); |
| 232 | pgAdmin.Browser.notifier.showModal(title, (onClose) => { |
| 233 | return <ChangePasswordContent |
| 234 | getInitData={()=>{ |
| 235 | const api = getApiInstance(); |
| 236 | return new Promise((resolve, reject)=>{ |
| 237 | api.get(url) |
| 238 | .then((res)=>{ |
| 239 | resolve(res.data); |
| 240 | }) |
| 241 | .catch((err)=>{ |
| 242 | reject(err instanceof Error ? err : Error(gettext('Something went wrong'))); |
| 243 | }); |
| 244 | }); |
| 245 | }} |
| 246 | onClose={()=>{ |
| 247 | onClose(); |
| 248 | }} |
| 249 | onSave={(_isNew, data)=>{ |
| 250 | const api = getApiInstance(); |
| 251 | return new Promise((resolve, reject)=>{ |
| 252 | const formData = { |
| 253 | 'password': data.password, |
| 254 | 'new_password': data.newPassword, |
| 255 | 'new_password_confirm': data.confirmPassword, |
| 256 | 'csrf_token': data.csrf_token |
| 257 | }; |
| 258 | |
| 259 | api({ |
| 260 | method: 'POST', |
| 261 | url: url, |
| 262 | data: formData, |
| 263 | }).then((res)=>{ |
| 264 | resolve(res.data.info); |
| 265 | onClose(); |
| 266 | pgAdmin.Browser.notifier.success(res.data.info); |
| 267 | }).catch((err)=>{ |
| 268 | reject(err instanceof Error ? err : Error(gettext('Something went wrong'))); |
| 269 | }); |
| 270 | }); |
| 271 | }} |
| 272 | hasCsrfToken={true} |
| 273 | showUser={false} |
| 274 | />; |
| 275 | }, |
| 276 | { isFullScreen: false, isResizeable: true, showFullScreen: false, isFullWidth: true, |
| 277 | dialogWidth: pgAdmin.Browser.stdW.md, dialogHeight: pgAdmin.Browser.stdH.md, id: 'id-change-password'}); |
| 278 | } |
| 279 | |
| 280 | export function showNamedRestorePoint() { |
| 281 | let title = arguments[0], |
no test coverage detected