From 70a01fae0193ca180ff27a5ac666667da43f4d29 Mon Sep 17 00:00:00 2001 From: scarqin <1054139596@qq.com> Date: Sat, 25 Feb 2023 18:16:34 +0800 Subject: [PATCH] feat: sync and save by one step --- src/workbench/browser/locale/messages.xlf | 84 +++++++---------- src/workbench/browser/locale/messages.zh.xlf | 90 +++++++------------ src/workbench/browser/src/app/app.module.ts | 7 +- .../app/core/services/errorHandle.service.ts | 12 +++ .../export-api/export-api.component.ts | 1 + .../import-api/import-api.component.ts | 12 +-- .../push-api/push-api.component.ts | 1 + .../sync-api/sync-api.component.ts | 62 ++++++------- .../group/tree/api-group-tree.component.ts | 25 +----- .../setting/project-setting.component.ts | 38 ++------ 10 files changed, 129 insertions(+), 203 deletions(-) create mode 100644 src/workbench/browser/src/app/core/services/errorHandle.service.ts diff --git a/src/workbench/browser/locale/messages.xlf b/src/workbench/browser/locale/messages.xlf index a1ed1ce47..d724da976 100644 --- a/src/workbench/browser/locale/messages.xlf +++ b/src/workbench/browser/locale/messages.xlf @@ -348,7 +348,7 @@ Extensions Hub src/app/layouts/navbar/navbar.component.ts - 44 + 43 @@ -594,7 +594,7 @@ src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 237 + 235 src/app/pages/workspace/project/api/websocket/websocket.component.ts @@ -973,11 +973,11 @@ src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 51 + 50 src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 73 + 72 @@ -1004,7 +1004,7 @@ src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 59 + 58 src/app/pages/workspace/project/api/components/history/eo-history.component.html @@ -1038,7 +1038,7 @@ Please import the file first src/app/modules/extension-select/import-api/import-api.component.ts - 103 + 106 @@ -1108,11 +1108,11 @@ 40 - - Sync API from URL Successfully + + Sync API from URL error: src/app/modules/extension-select/sync-api/sync-api.component.ts - 157 + 152 @@ -2273,7 +2273,7 @@ Copy src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 55 + 54 @Copy @@ -2281,46 +2281,46 @@ Add API src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 65 + 64 Add Subgroup src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 69 + 68 Delete src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 77 + 76 Import API src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 84 + 83 Import from file src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 85 + 84 Sync API from URL src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 90 + 89 src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 91 + 90 src/app/pages/workspace/project/setting/project-setting.component.ts @@ -2335,68 +2335,57 @@ Edit Group src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 180 + 178 Delete Group src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 189 + 187 Deletion Confirmation? src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 202 + 200 Are you sure you want to delete the data <strong title=""></strong> ? You cannot restore it once deleted! src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 203,205 + 201,203 Add Group src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 221 + 219 - - Sync Now + + Save and Sync src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 241 + 239 src/app/pages/workspace/project/setting/project-setting.component.ts 181 - - Save Config - - src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 250 - - - src/app/pages/workspace/project/setting/project-setting.component.ts - 190 - - Confirm src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 250 + 239 src/app/pages/workspace/project/setting/project-setting.component.ts - 190 + 181 src/app/shared/services/modal.service.ts @@ -2407,33 +2396,22 @@ Failed to ,Please upgrade extension or try again later src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 257 - - - src/app/pages/workspace/project/setting/project-setting.component.ts - 214 - - - - Save sync API config successfully - - src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 265 + 246 src/app/pages/workspace/project/setting/project-setting.component.ts - 202 + 188 successfully src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 270 + 254 src/app/pages/workspace/project/setting/project-setting.component.ts - 207 + 194 diff --git a/src/workbench/browser/locale/messages.zh.xlf b/src/workbench/browser/locale/messages.zh.xlf index f7fb28d2f..d0c860554 100644 --- a/src/workbench/browser/locale/messages.zh.xlf +++ b/src/workbench/browser/locale/messages.zh.xlf @@ -390,7 +390,7 @@ Extensions Hub src/app/layouts/navbar/navbar.component.ts - 44 + 43 插件广场 @@ -658,7 +658,7 @@ src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 237 + 235 src/app/pages/workspace/project/api/websocket/websocket.component.ts @@ -1078,11 +1078,11 @@ src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 51 + 50 src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 73 + 72 编辑 @@ -1110,7 +1110,7 @@ src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 59 + 58 src/app/pages/workspace/project/api/components/history/eo-history.component.html @@ -1146,7 +1146,7 @@ Please import the file first src/app/modules/extension-select/import-api/import-api.component.ts - 103 + 106 请先导入文件 @@ -1226,13 +1226,13 @@ 格式 - - Sync API from URL Successfully + + Sync API from URL error: src/app/modules/extension-select/sync-api/sync-api.component.ts - 157 + 152 - 从 URL 同步 API 成功 + 从 URL 同步 API 错误: Set Editor @@ -2528,7 +2528,7 @@ Copy src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 55 + 54 @Copy 复制 @@ -2537,7 +2537,7 @@ Add API src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 65 + 64 添加 API @@ -2545,7 +2545,7 @@ Add Subgroup src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 69 + 68 添加子分组 @@ -2553,7 +2553,7 @@ Delete src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 77 + 76 删除 @@ -2561,7 +2561,7 @@ Import API src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 84 + 83 导入 API @@ -2569,7 +2569,7 @@ Import from file src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 85 + 84 从文件导入 @@ -2577,11 +2577,11 @@ Sync API from URL src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 90 + 89 src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 91 + 90 src/app/pages/workspace/project/setting/project-setting.component.ts @@ -2597,7 +2597,7 @@ Edit Group src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 180 + 178 编辑分组 @@ -2605,7 +2605,7 @@ Delete Group src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 189 + 187 删除分组 @@ -2613,7 +2613,7 @@ Deletion Confirmation? src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 202 + 200 确认删除? @@ -2621,7 +2621,7 @@ Are you sure you want to delete the data <strong title=""></strong> ? You cannot restore it once deleted! src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 203,205 + 201,203 确认要删除数据 <strong title=""></strong> 吗?删除后不可恢复! @@ -2629,43 +2629,31 @@ Add Group src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 221 + 219 添加分组 - - Sync Now + + Save and Sync src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 241 + 239 src/app/pages/workspace/project/setting/project-setting.component.ts 181 - 立即同步 - - - Save Config - - src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 250 - - - src/app/pages/workspace/project/setting/project-setting.component.ts - 190 - - 保存设置 + 保存并同步 Confirm src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 250 + 239 src/app/pages/workspace/project/setting/project-setting.component.ts - 190 + 181 src/app/shared/services/modal.service.ts @@ -2677,35 +2665,23 @@ Failed to ,Please upgrade extension or try again later src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 257 + 246 src/app/pages/workspace/project/setting/project-setting.component.ts - 214 + 188 失败,请升级扩展或稍后再试 - - Save sync API config successfully - - src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 265 - - - src/app/pages/workspace/project/setting/project-setting.component.ts - 202 - - 保存同步 API 配置成功 - successfully src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts - 270 + 254 src/app/pages/workspace/project/setting/project-setting.component.ts - 207 + 194 成功 diff --git a/src/workbench/browser/src/app/app.module.ts b/src/workbench/browser/src/app/app.module.ts index 4d29f6f4c..b481c568e 100644 --- a/src/workbench/browser/src/app/app.module.ts +++ b/src/workbench/browser/src/app/app.module.ts @@ -1,11 +1,8 @@ -//Other module - -//I18n import { registerLocaleData } from '@angular/common'; import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; import en from '@angular/common/locales/en'; import zh from '@angular/common/locales/zh'; -import { NgModule, LOCALE_ID } from '@angular/core'; +import { NgModule, LOCALE_ID, ErrorHandler } from '@angular/core'; import { ReactiveFormsModule } from '@angular/forms'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { WarningFill } from '@ant-design/icons-angular/icons'; @@ -24,6 +21,7 @@ import { NzModalModule } from 'ng-zorro-antd/modal'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; +import { GlobalErrorHandler } from './core/services/errorHandle.service'; import { ThemeService } from './core/services/theme/theme.service'; import { TABLE_PRO_CONFIG } from './modules/eo-ui/table-pro/table-pro.token'; import { PcConsoleModule } from './modules/pc-console/pc-console.module'; @@ -50,6 +48,7 @@ registerLocaleData(zh); IndexedDBStorage, HttpStorage, ThemeService, + { provide: ErrorHandler, useClass: GlobalErrorHandler }, { provide: TABLE_PRO_CONFIG, useValue: { diff --git a/src/workbench/browser/src/app/core/services/errorHandle.service.ts b/src/workbench/browser/src/app/core/services/errorHandle.service.ts new file mode 100644 index 000000000..557df124f --- /dev/null +++ b/src/workbench/browser/src/app/core/services/errorHandle.service.ts @@ -0,0 +1,12 @@ +import { ErrorHandler, Injectable } from '@angular/core'; + +@Injectable() +export class GlobalErrorHandler implements ErrorHandler { + handleError(error: any): void { + const chunkFailedMessage = /Loading chunk [\d]+ failed/; + + if (chunkFailedMessage.test(error.message)) { + window.location.reload(); + } + } +} diff --git a/src/workbench/browser/src/app/modules/extension-select/export-api/export-api.component.ts b/src/workbench/browser/src/app/modules/extension-select/export-api/export-api.component.ts index 0590a16a9..56642adc8 100644 --- a/src/workbench/browser/src/app/modules/extension-select/export-api/export-api.component.ts +++ b/src/workbench/browser/src/app/modules/extension-select/export-api/export-api.component.ts @@ -20,6 +20,7 @@ import pkgInfo from '../../../../../../../../package.json'; export class ExportApiComponent implements OnInit { currentExtension = StorageUtil.get('export_api_modal'); supportList: any[] = []; + isValid = true; featureMap: Map; private destroy$: Subject = new Subject(); constructor( diff --git a/src/workbench/browser/src/app/modules/extension-select/import-api/import-api.component.ts b/src/workbench/browser/src/app/modules/extension-select/import-api/import-api.component.ts index 64658ee30..b0ff24c80 100644 --- a/src/workbench/browser/src/app/modules/extension-select/import-api/import-api.component.ts +++ b/src/workbench/browser/src/app/modules/extension-select/import-api/import-api.component.ts @@ -6,6 +6,7 @@ import { ExtensionService } from 'eo/workbench/browser/src/app/shared/services/e import { Message, MessageService } from 'eo/workbench/browser/src/app/shared/services/message'; import { ApiService } from 'eo/workbench/browser/src/app/shared/services/storage/api.service'; import { parseAndCheckCollections } from 'eo/workbench/browser/src/app/shared/services/storage/db/validate/validate'; +import { TraceService } from 'eo/workbench/browser/src/app/shared/services/trace.service'; import { StoreService } from 'eo/workbench/browser/src/app/shared/store/state.service'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; @@ -57,11 +58,13 @@ export class ImportApiComponent implements OnInit { supportList: any[] = []; currentExtension = StorageUtil.get('import_api_modal'); uploadData = null; + isValid = true; featureMap: Map; private destroy$: Subject = new Subject(); constructor( private router: Router, + private trace: TraceService, private eoMessage: EoNgFeedbackMessageService, private extensionService: ExtensionService, private store: StoreService, @@ -120,11 +123,6 @@ export class ImportApiComponent implements OnInit { try { console.log('content', content); - // TODO 兼容旧数据 - // if (Reflect.has(data, 'collections') && Reflect.has(data, 'environments')) { - // content = old2new(data, projectUuid, workSpaceUuid); - // console.log('new content', content); - // } const collections = parseAndCheckCollections(data.collections); const [result, err] = await this.apiService.api_projectImport({ ...{ @@ -140,6 +138,10 @@ export class ImportApiComponent implements OnInit { return; } callback(true); + // * For trace + const sync_platform = this.currentExtension; + const workspace_type = this.store.isLocal ? 'local' : 'remote'; + this.trace.report('import_project_success', { sync_platform, workspace_type }); this.router.navigate(['home/workspace/project/api']); } catch (error) { callback(false); diff --git a/src/workbench/browser/src/app/modules/extension-select/push-api/push-api.component.ts b/src/workbench/browser/src/app/modules/extension-select/push-api/push-api.component.ts index c6fbc0db9..08e314804 100644 --- a/src/workbench/browser/src/app/modules/extension-select/push-api/push-api.component.ts +++ b/src/workbench/browser/src/app/modules/extension-select/push-api/push-api.component.ts @@ -15,6 +15,7 @@ import packageJson from '../../../../../../../../package.json'; }) export class PushApiComponent implements OnInit { currentExtension = ''; + isValid = true; supportList: any[] = []; featureMap: Map; private destroy$: Subject = new Subject(); diff --git a/src/workbench/browser/src/app/modules/extension-select/sync-api/sync-api.component.ts b/src/workbench/browser/src/app/modules/extension-select/sync-api/sync-api.component.ts index 50441743a..f5fb0d887 100644 --- a/src/workbench/browser/src/app/modules/extension-select/sync-api/sync-api.component.ts +++ b/src/workbench/browser/src/app/modules/extension-select/sync-api/sync-api.component.ts @@ -131,10 +131,9 @@ export class SyncApiComponent implements OnInit, OnChanges { } }); } - console.log('featureMap', this.featureMap); }; - async syncNow(apiGroupTree) { + async syncNow(): Promise { if (!this.validateForm?.valid) { Object.values(this.validateForm.controls).forEach(control => { if (control.invalid) { @@ -142,48 +141,27 @@ export class SyncApiComponent implements OnInit, OnChanges { control.updateValueAndValidity({ onlySelf: true }); } }); - return Promise.reject(); + return false; } - const feature = this.featureMap.get(this.currentExtension); const module = await this.extensionService.getExtensionPackage(this.currentExtension); - if (typeof module[feature.action] === 'function') { - const [data, err] = await module[feature.action](this.validateForm?.value); - if (err) { - this.eoMessage.error(err); - return Promise.reject(err); - } - this.eoMessage.success($localize`Sync API from URL Successfully`); - this.trace.report('sync_api_from_url_success'); - apiGroupTree?.effect?.getGroupList(); + if (typeof module[feature.action] !== 'function') return false; + const [data, err] = await module[feature.action](this.validateForm?.value); + if (err) { + this.eoMessage.error($localize`Sync API from URL error: ${err}`); + return 'stayModal'; } + // this.eoMessage.success($localize`Sync API from URL Successfully`); + this.trace.report('sync_api_from_url_success'); + return true; } async submit(callback?, modal?) { if (!this.supportList.length) { return modal?.destroy?.(); } - if (this.validateForm?.valid) { - const { __formater, __crontab, ...rest } = this.validateForm.value; - console.log('submit', this.validateForm.value); - const params = { - id: this.currentFormater?.id, - pluginId: __formater, - crontab: __crontab, - pluginSettingJson: JSON.stringify(rest) - }; - const [data, err] = await this.apiService[params.id ? 'api_projectUpdateSyncSetting' : 'api_projectCreateSyncSetting'](params); - - if (err) { - console.error(err.msg); - callback?.('stayModal'); - return; - } - this.effectService.getSyncSettingList(); - - callback?.('stayModal'); - } else { + if (!this.validateForm?.valid) { Object.values(this.validateForm.controls).forEach(control => { if (control.invalid) { control.markAsDirty(); @@ -191,6 +169,24 @@ export class SyncApiComponent implements OnInit, OnChanges { } }); callback?.('stayModal'); + return; + } + const { __formater, __crontab, ...rest } = this.validateForm.value; + const params = { + id: this.currentFormater?.id, + pluginId: __formater, + crontab: __crontab, + pluginSettingJson: JSON.stringify(rest) + }; + const [data, err] = await this.apiService[params.id ? 'api_projectUpdateSyncSetting' : 'api_projectCreateSyncSetting'](params); + if (err) { + this.eoMessage.error(err.msg); + console.error(err.msg); + callback?.('stayModal'); + return; } + this.effectService.getSyncSettingList(); + const result = await this.syncNow(); + callback(result); } } diff --git a/src/workbench/browser/src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts b/src/workbench/browser/src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts index 5bb34340c..fb7077ee4 100644 --- a/src/workbench/browser/src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts +++ b/src/workbench/browser/src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts @@ -8,7 +8,6 @@ import { ApiTabService } from 'eo/workbench/browser/src/app/pages/workspace/proj import { ApiGroupEditComponent } from 'eo/workbench/browser/src/app/pages/workspace/project/api/components/group/edit/api-group-edit.component'; import { ModalService } from 'eo/workbench/browser/src/app/shared/services/modal.service'; import { GroupCreateDto, GroupUpdateDto } from 'eo/workbench/browser/src/app/shared/services/storage/db/dto/group.dto'; -import { TraceService } from 'eo/workbench/browser/src/app/shared/services/trace.service'; import { StoreService } from 'eo/workbench/browser/src/app/shared/store/state.service'; import { eoDeepCopy, waitNextTick } from 'eo/workbench/browser/src/app/utils/index.utils'; import { getExpandGroupByKey } from 'eo/workbench/browser/src/app/utils/tree/tree.utils'; @@ -104,7 +103,6 @@ export class ApiGroupTreeComponent implements OnInit { private router: Router, private route: ActivatedRoute, private tab: ApiTabService, - private trace: TraceService, private message: EoNgFeedbackMessageService ) {} @@ -238,21 +236,12 @@ export class ApiGroupTreeComponent implements OnInit { onClick: () => modal.destroy() }, { - label: $localize`Sync Now`, - show: () => actionComponent[type] === SyncApiComponent && modal.componentInstance?.supportList?.length, + label: actionComponent[type] === SyncApiComponent ? $localize`Save and Sync` : $localize`Confirm`, disabled: () => !modal.componentInstance?.isValid, - onClick: async () => { - await modal.componentInstance?.syncNow?.(this); - modal.destroy(); - } - }, - { - label: actionComponent[type] === SyncApiComponent ? $localize`Save Config` : $localize`Confirm`, type: 'primary', onClick: () => { return new Promise(resolve => { modal.componentInstance.submit(status => { - this.effect.getGroupList(); if (!status) { this.message.error($localize`Failed to ${title},Please upgrade extension or try again later`); return resolve(true); @@ -260,18 +249,10 @@ export class ApiGroupTreeComponent implements OnInit { if (status === 'stayModal') { return resolve(true); } - //Sync API - if (actionComponent[type] === SyncApiComponent) { - this.message.success($localize` Save sync API config successfully`); - return resolve(true); - } - // Import API + this.effect.getGroupList(); this.message.success($localize`${title} successfully`); - // * For trace - const sync_platform = modal.componentInstance.currentExtension; - const workspace_type = this.globalStore.isLocal ? 'local' : 'remote'; - this.trace.report('import_project_success', { sync_platform, workspace_type }); + resolve(true); modal.destroy(); }, modal); }); diff --git a/src/workbench/browser/src/app/pages/workspace/project/setting/project-setting.component.ts b/src/workbench/browser/src/app/pages/workspace/project/setting/project-setting.component.ts index c5db87c2b..4531105f2 100644 --- a/src/workbench/browser/src/app/pages/workspace/project/setting/project-setting.component.ts +++ b/src/workbench/browser/src/app/pages/workspace/project/setting/project-setting.component.ts @@ -178,42 +178,22 @@ export class ProjectSettingComponent implements OnInit { onClick: () => modal.destroy() }, { - label: $localize`Sync Now`, - show: () => actionComponent[type] === SyncApiComponent && modal.componentInstance?.supportList?.length, - disabled: () => !modal.componentInstance?.isValid, - onClick: async () => { - await modal.componentInstance?.syncNow?.(); - modal.destroy(); - } - }, - { - label: actionComponent[type] === SyncApiComponent ? $localize`Save Config` : $localize`Confirm`, + label: actionComponent[type] === SyncApiComponent ? $localize`Save and Sync` : $localize`Confirm`, type: 'primary', + disabled: () => !modal.componentInstance?.isValid, onClick: () => { return new Promise(resolve => { modal.componentInstance.submit(status => { - if (status) { - if (status === 'stayModal') { - resolve(true); - return; - } - //Sync API - if (actionComponent[type] === SyncApiComponent) { - this.message.success($localize` Save sync API config successfully`); - return resolve(true); - } - - // Import API - this.message.success($localize`${title} successfully`); - // * For trace - const sync_platform = modal.componentInstance.currentExtension; - const workspace_type = this.store.isLocal ? 'local' : 'remote'; - this.trace.report('import_project_success', { sync_platform, workspace_type }); - modal.destroy(); - } else { + if (!status) { this.message.error($localize`Failed to ${title},Please upgrade extension or try again later`); + return resolve(true); + } + if (status === 'stayModal') { + return resolve(true); } + this.message.success($localize`${title} successfully`); resolve(true); + modal.destroy(); }); }); }