6
6
:input-props =" inputProps"
7
7
remote
8
8
filterable
9
- :default-value =" activePanel?.connection?.name"
9
+ :default-value ="
10
+ ['ES_EDITOR', 'DYNAMO_EDITOR'].includes(props.type ?? '')
11
+ ? activePanel?.connection?.name
12
+ : connection?.name
13
+ "
10
14
:loading =" loadingRef.connection"
11
15
@update:show =" isOpen => handleOpen(isOpen, 'CONNECTION')"
12
16
@update:value =" value => handleUpdate(value, 'CONNECTION')"
@@ -114,6 +118,7 @@ const { loadDefaultSnippet, selectConnection } = tabStore;
114
118
const { activePanel, activeElasticsearchIndexOption } = storeToRefs (tabStore );
115
119
116
120
const clusterManageStore = useClusterManageStore ();
121
+ const { setConnection, refreshStates } = clusterManageStore ;
117
122
const { connection, hideSystemIndices } = storeToRefs (clusterManageStore );
118
123
119
124
const loadingRef = ref ({ connection: false , index: false });
@@ -128,10 +133,13 @@ const hideSystemIndicesRef = ref(true);
128
133
129
134
watch (
130
135
() => props .type ,
131
- newType => {
136
+ async newType => {
132
137
if (newType === ' ES_EDITOR' ) {
133
138
hideSystemIndicesRef .value = activePanel ?.value .hideSystemIndices ?? true ;
134
139
} else if (newType === ' MANAGE' ) {
140
+ if (! connection .value && activePanel .value .connection ) {
141
+ setConnection (activePanel .value .connection );
142
+ }
135
143
hideSystemIndicesRef .value = hideSystemIndices .value ;
136
144
}
137
145
},
@@ -198,9 +206,11 @@ const handleUpdate = async (value: string, type: 'CONNECTION' | 'INDEX') => {
198
206
return ;
199
207
}
200
208
try {
201
- [' ES_EDITOR' , ' DYNAMO_EDITOR' ].includes (props .type ?? ' ' )
202
- ? await selectConnection (con )
203
- : (connection .value = con );
209
+ if ([' ES_EDITOR' , ' DYNAMO_EDITOR' ].includes (props .type ?? ' ' )) {
210
+ await selectConnection (con );
211
+ } else {
212
+ setConnection (con );
213
+ }
204
214
} catch (err ) {
205
215
const error = err as CustomError ;
206
216
message .error (` status: ${error .status }, details: ${error .details } ` , {
@@ -237,12 +247,12 @@ const handleManageTabChange = (tabName: string) => {
237
247
emits (' switch-manage-tab' , tabName );
238
248
};
239
249
240
- const handleHiddenChange = (value : boolean ) => {
250
+ const handleHiddenChange = async (value : boolean ) => {
241
251
if (props .type === ' ES_EDITOR' && activePanel .value ) {
242
252
activePanel .value .hideSystemIndices = value ;
243
253
}
244
254
if (props .type === ' MANAGE' && connection .value ) {
245
- hideSystemIndices . value = value ;
255
+ await refreshStates ( value ) ;
246
256
}
247
257
};
248
258
</script >
0 commit comments