File tree 2 files changed +28
-1
lines changed
2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 241
241
:maxReplica =" repoDetail.maxReplica"
242
242
:minReplica =" repoDetail.minReplica"
243
243
:clusterId =" repoDetail.clusterId"
244
- :variables =" repoDetail.engineArgs ? JSON.parse(repoDetail.engineArgs) : {}"
244
+ :variables =" safeJsonParse( repoDetail.engineArgs) ? JSON.parse(repoDetail.engineArgs) : {}"
245
245
/>
246
246
</template >
247
247
</tab-container >
277
277
import { ref , computed , onMounted } from ' vue'
278
278
import { ElMessage } from ' element-plus'
279
279
import { useI18n } from ' vue-i18n'
280
+ import { safeJsonParse } from ' ../../packs/utils'
280
281
281
282
const { t } = useI18n ()
282
283
Original file line number Diff line number Diff line change @@ -57,4 +57,30 @@ export const ToUnauthorizedPage = () => {
57
57
setTimeout ( ( ) => {
58
58
location . href = '/errors/unauthorized'
59
59
} , 300 )
60
+ }
61
+
62
+ export const randomUUID = ( ) => {
63
+ const hexDigits = '0123456789abcdef'
64
+ let uuid = ''
65
+
66
+ for ( let i = 0 ; i < 36 ; i ++ ) {
67
+ if ( i === 8 || i === 13 || i === 18 || i === 23 ) {
68
+ uuid += '-'
69
+ } else if ( i === 14 ) {
70
+ uuid += '4'
71
+ } else if ( i === 19 ) {
72
+ uuid += hexDigits [ Math . floor ( Math . random ( ) * 4 ) + 8 ]
73
+ } else {
74
+ uuid += hexDigits [ Math . floor ( Math . random ( ) * 16 ) ]
75
+ }
76
+ }
77
+ return uuid
78
+ }
79
+
80
+ export const safeJsonParse = ( str ) => {
81
+ try {
82
+ return JSON . parse ( str )
83
+ } catch ( e ) {
84
+ return null
85
+ }
60
86
}
You can’t perform that action at this time.
0 commit comments