This repository was archived by the owner on Sep 16, 2024. It is now read-only.
File tree 2 files changed +40
-22
lines changed
views/operation-hub/templates/pages
2 files changed +40
-22
lines changed Original file line number Diff line number Diff line change 50
50
const toRetry = ref (false );
51
51
const RECONNECT_MSG = ' --- press Y to reconnect! ---' ;
52
52
const appStore = useAppStore ();
53
+ const totalRetry = 5 ;
54
+ const retryCount = ref (5 );
55
+ let timer: any = null ;
53
56
54
57
const conReadyState = ref (0 );
55
58
278
281
actived .value = false ;
279
282
if (terminalSocket .value ) terminalSocket .value ?.close ?.();
280
283
};
284
+ const retryWs = () => {
285
+ if (retryCount .value > 0 ) {
286
+ retryCount .value -= 1 ;
287
+ term .value ?.write ?.(' ' );
288
+ setWssUrl ();
289
+ initWS ();
290
+ term .value .reset ();
291
+ }
292
+ };
281
293
watch (
282
294
() => props .url ,
283
295
() => {
286
298
terminalSocket .value ?.close ?.();
287
299
terminalSocket .value = {};
288
300
} else {
301
+ // reset retry count
302
+ retryCount .value = totalRetry ;
303
+ clearTimeout (timer );
304
+
289
305
term .value ?.reset ?.();
290
306
debounceCall ();
291
307
}
297
313
watch (
298
314
() => statusCode .value ,
299
315
(ov ) => {
300
- if (statusCode .value === 1003 ) {
301
- term . value ?. write ?.( ' ' );
302
- setWssUrl ();
303
- initWS ();
304
- term .value . reset ( );
316
+ if (statusCode .value === 1003 && retryCount . value > 0 ) {
317
+ clearTimeout ( timer );
318
+ timer = setTimeout (() => {
319
+ retryWs ();
320
+ }, 2 ** ( totalRetry - retryCount .value ) * 1000 );
305
321
}
306
322
},
307
323
{
Original file line number Diff line number Diff line change 110
110
}}
111
111
</div >
112
112
</template >
113
- <a-button
114
- ref =" correctionButton"
115
- :disabled =" loading"
116
- type =" outline"
117
- shape =" circle"
118
- class =" correction-btn"
119
- @click =" handleViewCorrection"
113
+ <a-tooltip
114
+ :content =" $t('operation.templates.detail.correctionview')"
115
+ position =" tr"
116
+ :arrow-style =" {
117
+ left: '95px'
118
+ }"
120
119
>
121
- <a-tooltip
122
- :content =" $t('operation.templates.detail.correctionview')"
120
+ <a-button
121
+ ref =" correctionButton"
122
+ :disabled =" loading"
123
+ type =" outline"
124
+ shape =" circle"
125
+ class =" correction-btn"
126
+ @click =" handleViewCorrection"
123
127
>
124
128
<template #content >
125
129
<div style =" width : max-content " >{{
126
130
$t('operation.templates.detail.correctionview')
127
131
}}</div >
128
132
</template >
129
- <span >
130
- <icon-font
131
- type =" icon-shoudongxiaoyan"
132
- class =" size-16"
133
- ></icon-font >
134
- </span >
135
- </a-tooltip >
136
- </a-button >
133
+ <icon-font
134
+ type =" icon-shoudongxiaoyan"
135
+ class =" size-16"
136
+ ></icon-font >
137
+ </a-button >
138
+ </a-tooltip >
137
139
</a-tooltip >
138
140
</a-space >
139
141
</div >
You can’t perform that action at this time.
0 commit comments