File tree Expand file tree Collapse file tree
panel/backend/message-handlers
settings/backend/message-handlers
shared/actions/api/update Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import * as vscode from 'vscode'
2+ import { dictionary } from '@shared/constants/dictionary'
13import { PanelProvider } from '../panel-provider'
24import { update } from '@/views/shared/actions/web/update'
35
46export const handle_update_web_configuration = async (
57 provider : PanelProvider ,
68 message : any
79) : Promise < void > => {
10+ if ( message . is_new && message . origin === 'cancel' ) {
11+ const discard_button = 'Discard'
12+ const result = await vscode . window . showWarningMessage (
13+ dictionary . information_message . CONFIRM_DISCARD_UNSAVED_CHANGES (
14+ 'web configuration'
15+ ) ,
16+ {
17+ modal : true ,
18+ detail :
19+ dictionary . information_message . UNSAVED_CHANGES_TO_ITEM_WILL_BE_LOST (
20+ 'web configuration'
21+ )
22+ } ,
23+ discard_button
24+ )
25+
26+ if ( result != discard_button ) {
27+ return
28+ }
29+ }
30+
831 const result = await update ( {
932 updating_web_configuration : message . updating_web_configuration ,
1033 updated_web_configuration : message . updated_web_configuration ,
Original file line number Diff line number Diff line change 1+ import * as vscode from 'vscode'
2+ import { dictionary } from '@shared/constants/dictionary'
13import { SettingsProvider } from '@/views/settings/backend/settings-provider'
24import { UpdateWebConfigurationMessage } from '@/views/settings/types/messages'
35import { update } from '@/views/shared/actions/web/update'
@@ -6,6 +8,27 @@ export const handle_update_web_configuration = async (
68 settings_provider : SettingsProvider ,
79 message : UpdateWebConfigurationMessage
810) : Promise < void > => {
11+ if ( message . is_new && message . origin === 'cancel' ) {
12+ const discard_button = 'Discard'
13+ const result = await vscode . window . showWarningMessage (
14+ dictionary . information_message . CONFIRM_DISCARD_UNSAVED_CHANGES (
15+ 'web configuration'
16+ ) ,
17+ {
18+ modal : true ,
19+ detail :
20+ dictionary . information_message . UNSAVED_CHANGES_TO_ITEM_WILL_BE_LOST (
21+ 'web configuration'
22+ )
23+ } ,
24+ discard_button
25+ )
26+
27+ if ( result != discard_button ) {
28+ return
29+ }
30+ }
31+
932 const result = await update ( {
1033 updating_web_configuration : message . updating_web_configuration ,
1134 updated_web_configuration : message . updated_web_configuration ,
Original file line number Diff line number Diff line change @@ -18,10 +18,6 @@ export const update = async (params: {
1818} ) : Promise < { success : boolean ; has_changes : boolean ; new_id ?: string } > => {
1919 const providers_manager = new ModelProvidersManager ( params . context )
2020
21- if ( params . is_new && params . origin === 'cancel' ) {
22- return { success : true , has_changes : false }
23- }
24-
2521 const api_configurations = await providers_manager . get_api_configurations ( )
2622
2723 let api_configuration_index = - 1
You can’t perform that action at this time.
0 commit comments